edu.uky.rch.ept.xmlSegmentTree.element.position
Class PairPosition

java.lang.Object
  extended byedu.uky.rch.ept.xmlSegmentTree.element.position.PairPosition
All Implemented Interfaces:
Comparable, Position

public class PairPosition
extends Object
implements Position


Field Summary
static int MAX_SUB
           
 
Constructor Summary
PairPosition(int position)
           
PairPosition(int position, int subPosition)
           
 
Method Summary
 Element begin(Element e)
          Transform an element of which this is the beginning position.
 int compareTo(Object o)
          Compare this position to another Position.
 Element end(Element e)
          Transform an element of which this is the ending position.
 boolean equals(Object o)
           
 Position extend(Position p)
          Find the Position the same distance from this position as another position, but on the other side.
 Position midpoint(Position p)
          Find the Position midway between this position and another one.
 Position next()
          Return the position immediately following this one.
 int pos()
          Return the integer value of this position.
 Position previous()
          Return the position immediately preceding this one.
 int subPos()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SUB

public static int MAX_SUB
Constructor Detail

PairPosition

public PairPosition(int position,
                    int subPosition)

PairPosition

public PairPosition(int position)
Method Detail

pos

public int pos()
Description copied from interface: Position
Return the integer value of this position. pos() should be nondecreasing with respect to the ordering imposed by Position.compareTo(java.lang.Object), but need not be strictly increasing.

Specified by:
pos in interface Position
Returns:
the integer value of this position.

subPos

public int subPos()

next

public Position next()
Description copied from interface: Position
Return the position immediately following this one.

Specified by:
next in interface Position
Returns:
the next position.

previous

public Position previous()
Description copied from interface: Position
Return the position immediately preceding this one.

Specified by:
previous in interface Position
Returns:
the previous position.

midpoint

public Position midpoint(Position p)
Description copied from interface: Position
Find the Position midway between this position and another one.

Specified by:
midpoint in interface Position
Parameters:
p - the other endpoint.
Returns:
the Position lying midway between this position and p.

extend

public Position extend(Position p)
Description copied from interface: Position
Find the Position the same distance from this position as another position, but on the other side.

Specified by:
extend in interface Position
Parameters:
p - the other endpoint.
Returns:
the Position lying midway between this position and p.

begin

public Element begin(Element e)
Description copied from interface: Position
Transform an element of which this is the beginning position.

Specified by:
begin in interface Position
Parameters:
e - the Element to transform.
Returns:
a transformed version of e, possibly e itself.

end

public Element end(Element e)
Description copied from interface: Position
Transform an element of which this is the ending position.

Specified by:
end in interface Position
Parameters:
e - the Element to transform.
Returns:
a transformed version of e, possibly e itself.

compareTo

public int compareTo(Object o)
Description copied from interface: Position
Compare this position to another Position. As is always the case with Comparables, implementors must ensure that compareTo is transitive, antisymmetric, and irreflexive regardless of the particular classes of the arguments. In practice, this means that compareTo may treat objects of the same class specially, but should use Position.pos() to compare Elements which are not related in an implementation heirarchy.

Specified by:
compareTo in interface Position
Parameters:
o - the object against which to compare.
Returns:
-1 if this position precedes o, 1 if this position follows o, or 0 if this position equals o.

equals

public boolean equals(Object o)

toString

public String toString()