{"id":438,"date":"2009-08-10T03:42:22","date_gmt":"2009-08-10T01:42:22","guid":{"rendered":"http:\/\/raftaman.net\/?p=438"},"modified":"2021-05-15T11:46:41","modified_gmt":"2021-05-15T09:46:41","slug":"does-an-interval-intersect-with-another-one","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=438","title":{"rendered":"Does an interval intersect with another one?"},"content":{"rendered":"<p>Simple question, simple answer:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\/\/ does this interval a intersect b?\r\n    public boolean intersects(Interval b) {\r\n        Interval a = this;\r\n        if (b.left &lt;= a.right &amp;&amp; b.left &gt;= a.left) { return true; }\r\n        if (a.left &lt;= b.right &amp;&amp; a.left &gt;= b.left) { return true; }\r\n        return false;\r\n    }\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Simple question, simple answer: \/\/ does this interval a intersect b? public boolean intersects(Interval b) { Interval a = this; if (b.left &lt;= a.right &amp;&amp; b.left &gt;= a.left) { return true; } if (a.left &lt;= b.right &amp;&amp; a.left &gt;= b.left) { return true; } return false; }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4],"class_list":["post-438","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/438","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=438"}],"version-history":[{"count":4,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/438\/revisions"}],"predecessor-version":[{"id":2694,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/438\/revisions\/2694"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}