diff options
Diffstat (limited to 'bundles/runtime/org.eclipse.fx.core/src')
-rw-r--r-- | bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/Range.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/Range.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/Range.java new file mode 100644 index 000000000..5de1cc84c --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/Range.java @@ -0,0 +1,19 @@ +package org.eclipse.fx.core; + +public class Range { + public final int start; + public final int end; + + public Range(int start, int end) { + this.start = start; + this.end = end; + } + + public static boolean intersects(int start1, int end1, int start2, int end2) { + return between(start1, end1, start2) || between(start1, end1, end2); + } + + public static boolean between(int start, int end, int value) { + return start <= value && end >= value; + } +} |