sk.uniba.euromath.editor.textEditor
Class Interval

java.lang.Object
  extended by sk.uniba.euromath.editor.textEditor.Interval

public class Interval
extends Object

Range of this interval is positive (not zero)

Author:
Tomáš Studva 7.2.2006 Martin Kollar

Constructor Summary
Interval(int start, int end)
          Contructor.
 
Method Summary
 boolean contains(int value)
           
 boolean contains(Interval interval)
           
 int getEnd()
           
 int getStart()
           
 boolean intersects(Interval interval)
           
static Interval ORIntervals(Interval interval1, Interval interval2)
          Intervals have to intersect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Interval

public Interval(int start,
                int end)
Contructor.

Parameters:
start - of interval, must be non-negative
end - of interval
Method Detail

getStart

public int getStart()
Returns:
starting point

getEnd

public int getEnd()
Returns:
ending point

contains

public boolean contains(int value)
Parameters:
value -
Returns:
true if value is inside of this interval

contains

public boolean contains(Interval interval)
Parameters:
interval - Interval to check
Returns:
true if interval is inside this interval

intersects

public boolean intersects(Interval interval)
Parameters:
interval - Interval to check fror inersection
Returns:
true if their intersection is not empty or they are adjacent

ORIntervals

public static Interval ORIntervals(Interval interval1,
                                   Interval interval2)
Intervals have to intersect

Parameters:
interval1 -
interval2 -
Returns:
logical OR of this intersecting intervals


Copyright © 2003-2006 null. All Rights Reserved.