edu.uky.rch.ept.xmlSegmentTree.element
Interface Element

All Known Implementing Classes:
AbstractElement

public interface Element

An interface representing an element in XML. An Element may be either:

Each element has a start and a length. An element's length may be zero, indicating an empty element.


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?
 List getAttributes()
          Get a list of attribute keys.
 String getAttributeValue(String attr)
          Get the value of an attribute.
 Position getEnd()
          Get the endpoint of this element.
 int getLength()
          Get the length of this element.
 Position getStart()
          Get the beginning of this element.
 String getString()
          Get the string of a string element.
 String getTag()
          Get the tag of this element.
 boolean isEmpty()
          Is this element empty?
 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?
 

Method Detail

getStart

public Position getStart()
Get the beginning of this element.

Returns:
the beginning point as a Position.

getEnd

public Position getEnd()
Get the endpoint of this element.

Returns:
the endpoint as a Position.

getLength

public int getLength()
Get the length of this element. Should be consistent with getStart(), getEnd(), and pos().

Returns:
the length as an integer.

isEmpty

public boolean isEmpty()
Is this element empty?

Returns:
true if this is an empty element.

getTag

public String getTag()
Get the tag of this element.

Returns:
the tag, or null if this element is not a tagged element.

getAttributes

public List getAttributes()
Get a list of attribute keys.

Returns:
a list of the attribute keys for this element.

getAttributeValue

public String getAttributeValue(String attr)
Get the value of an attribute.

Parameters:
attr - the attribute key.
Returns:
the value of the specified attribute, or null if the attribute is not present.

isString

public boolean isString()
Returns true if this element is a string element.

Returns:
true if this element is a string element, false if it is a tagged element.

getString

public String getString()
Get the string of a string element.

Returns:
the string, or null if this element is a tagged element.

startsBefore

public boolean startsBefore(Element e)
Does this element start before another element?

Parameters:
e - the element to test against.
Returns:
true if this element starts before e.

startsAfter

public boolean startsAfter(Element e)
Does this element start after another element?

Parameters:
e - the element to test against.
Returns:
true if this element starts after e.

startsWithin

public boolean startsWithin(Element e)
Does this element start within another element?

Parameters:
e - the element to test against.
Returns:
true if this element starts within e.

endsBefore

public boolean endsBefore(Element e)
Does this element end before another element?

Parameters:
e - the element to test against.
Returns:
true if this element ends before e.

endsAfter

public boolean endsAfter(Element e)
Does this element end after another element?

Parameters:
e - the element to test against.
Returns:
true if this element ends after e.

endsWithin

public boolean endsWithin(Element e)
Does this element end within another element?

Parameters:
e - the element to test against.
Returns:
true if this element ends within e.

within

public boolean within(Element e)
Does this element lie within another element?

Parameters:
e - the element to test against.
Returns:
true if this element lies within e.

overlaps

public boolean overlaps(Element e)
Does this element overlap with another element?

Parameters:
e - the element to test against.
Returns:
true if this element and e overlap.

disjoint

public boolean disjoint(Element e)
Are this element and another element disjoint?

Parameters:
e - the element to test against.
Returns:
true if this element and e are disjoint.