Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had written some sample code fast. Hope it makes sense:</p> <pre><code>enum SygnType { More, Less, Equal } public class Representation { public SignType sign; public int value; } public class Range { public bool infinityNegative; public bool infinityPositive; public int minValue; public int maxValue; public Range(List&lt;Representation&gt; values) { infinityNegative=true; infinityPositive=true; foreach(var value in values) { if (value.sign==SignType.More) { infinityNegative=false; if (value&gt;minValue) minValue=value; } else if (value.sign==SignType.Less) { infinityPositive=false; if (value&lt;maxValue) maxValue=value; } else if (value.sign==SignType.Equal) { infinityPositive=infinityNegative=false; minValue=maxValue=value; break; } } } public bool Overlaps(Range checkRange) { if (checkRange.infinityPositive) return CompareUpperLevelValue(checkRange); //this method should compare upper value overlapping else if (checkRange.infinityNegative) return CompareLowerLevelValue(checkRange); //this method should compare lower value overlapping else return CompareInterval(checkRange); //this method should compare interval } public bool CompareUpperLevelValue(Range checkRange) { if (checkRange.maxValue&lt;maxValue) return true; else return false } public bool CompareLowerLevelValue(Range checkRange) { if (checkRange.minValue&gt;minValue) return true; else return false } public bool CompareInterval(Range checkRange) { if ((checkRange.minValue&gt;minValue)&amp;&amp;(checkRange.maxValue&lt;maxValue)) return true; else return false; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload