edu.uky.rch.ept.xmlSegmentTree.element
Class AbstractElement

java.lang.Object
  extended byedu.uky.rch.ept.xmlSegmentTree.element.AbstractElement
All Implemented Interfaces:
Element
Direct Known Subclasses:
SimpleElement, StringElement

public abstract class AbstractElement
extends Object
implements Element

An abstract implementation of Element, defining the binary predicates as well as getLength().


Constructor Summary
AbstractElement()
           
 
Method Summary
 boolean disjoint(Element e)
          Are this element and another element disjoint?
 boolean endsAfter(Element e)
          Does this element end after another element?
 boolean endsBefore(Element e)
          Does this element end before another element?
 boolean endsWithin(Element e)
          Does this element end within another element?
abstract  List getAttributes()
          Get a list of attribute keys.
abstract  String getAttributeValue(String attr)
          Get the value of an attribute.
abstract  Position getEnd()
          Get the endpoint of this element.
 int getLength()
          Get the length of this element.
abstract  Position getStart()
          Get the beginning of this element.
abstract  String getString()
          Get the string of a string element.
abstract  String getTag()
          Get the tag of this element.
abstract  boolean isEmpty()
          Is this element empty?
abstract  boolean isString()
          Returns true if this element is a string element.
 boolean overlaps(Element e)
          Does this element overlap with another element?
 boolean startsAfter(Element e)
          Does this element start after another element?
 boolean startsBefore(Element e)
          Does this element start before another element?
 boolean startsWithin(Element e)
          Does this element start within another element?
 boolean within(Element e)
          Does this element lie within another element?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractElement

public AbstractElement()
Method Detail

getStart

public abstract Position getStart()
Description copied from interface: Element
Get the beginning of this element.

Specified by:
getStart in interface Element
Returns:
the beginning point as a Position.

getEnd

public abstract Position getEnd()
Description copied from interface: Element
Get the endpoint of this element.

Specified by:
getEnd in interface Element
Returns:
the endpoint as a Position.

isEmpty

public abstract boolean isEmpty()
Description copied from interface: Element
Is this element empty?

Specified by:
isEmpty in interface Element
Returns:
true if this is an empty element.

getTag

public abstract String getTag()
Description copied from interface: Element
Get the tag of this element.

Specified by:
getTag in interface Element
Returns:
the tag, or null if this element is not a tagged element.

getAttributes

public abstract List getAttributes()
Description copied from interface: Element
Get a list of attribute keys.

Specified by:
getAttributes in interface Element
Returns:
a list of the attribute keys for this element.

getAttributeValue

public abstract String getAttributeValue(String attr)
Description copied from interface: Element
Get the value of an attribute.

Specified by:
getAttributeValue in interface Element
Parameters:
attr - the attribute key.
Returns:
the value of the specified attribute, or null if the attribute is not present.

isString

public abstract boolean isString()
Description copied from interface: Element
Returns true if this element is a string element.

Specified by:
isString in interface Element
Returns:
true if this element is a string element, false if it is a tagged element.

getString

public abstract String getString()
Description copied from interface: Element
Get the string of a string element.

Specified by:
getString in interface Element
Returns:
the string, or null if this element is a tagged element.

getLength

public int getLength()
Description copied from interface: Element
Get the length of this element. Should be consistent with getStart(), getEnd(), and pos().

Specified by:
getLength in interface Element
Returns:
the length as an integer.

startsBefore

public boolean startsBefore(Element e)
Description copied from interface: Element
Does this element start before another element?

Specified by:
startsBefore in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element starts before e.

startsAfter

public boolean startsAfter(Element e)
Description copied from interface: Element
Does this element start after another element?

Specified by:
startsAfter in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element starts after e.

startsWithin

public boolean startsWithin(Element e)
Description copied from interface: Element
Does this element start within another element?

Specified by:
startsWithin in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element starts within e.

endsBefore

public boolean endsBefore(Element e)
Description copied from interface: Element
Does this element end before another element?

Specified by:
endsBefore in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element ends before e.

endsAfter

public boolean endsAfter(Element e)
Description copied from interface: Element
Does this element end after another element?

Specified by:
endsAfter in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element ends after e.

endsWithin

public boolean endsWithin(Element e)
Description copied from interface: Element
Does this element end within another element?

Specified by:
endsWithin in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element ends within e.

within

public boolean within(Element e)
Description copied from interface: Element
Does this element lie within another element?

Specified by:
within in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element lies within e.

overlaps

public boolean overlaps(Element e)
Description copied from interface: Element
Does this element overlap with another element?

Specified by:
overlaps in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element and e overlap.

disjoint

public boolean disjoint(Element e)
Description copied from interface: Element
Are this element and another element disjoint?

Specified by:
disjoint in interface Element
Parameters:
e - the element to test against.
Returns:
true if this element and e are disjoint.