Release Planner v1.0

rp.util.dom
Class DOMRelation.Endpoint

java.lang.Object
  |
  +--rp.util.TwoList
        |
        +--rp.util.dom.DOMRelation.Endpoint
Direct Known Subclasses:
DOMRelation.Left, DOMRelation.Right
Enclosing class:
DOMRelation

public abstract static class DOMRelation.Endpoint
extends TwoList

The end-point (left or right) of a relationship. Each object wishing to participate in a relationship must own an endpoint object.


Nested Class Summary
static interface DOMRelation.Endpoint.Iterator
          Used to iterate across the endpoints of a relationship.
 
Nested classes inherited from class rp.util.TwoList
TwoList.IteratorA, TwoList.IteratorB
 
Field Summary
 
Fields inherited from class rp.util.TwoList
headA, headB, nextA, nextB, numsA, numsB, prevA, prevB
 
Constructor Summary
protected DOMRelation.Endpoint(DOMObject o)
          Initializes an endpoint held by the specified object.
 
Method Summary
abstract  int count()
          Returns a count of the number of relationships attached to this endpoint.
 DOMObject getObject()
          Returns the object that owns this endpoint.
abstract  DOMObject getOther()
          Returns the (first) object on the other side of the relationship or null if none.
abstract  DOMRelation getRelation()
          Returns the meta-infomration about the relationship that this endpoint is part of.
 boolean isLeft()
          Indicates if this is a left endpoint.
 boolean isRight()
          Indicates if this is a right endpoint.
abstract  DOMObject.Iterator iterator()
          Returns an iterator over all objects on the other side of the relationship.
abstract  DOMRelation.Instance.Iterator relationIterator()
          Returns an iterator over all relationship instances attached to this endpoint.
 
Methods inherited from class rp.util.TwoList
addA, addB, countA, countB, decommissionAsHeadA, decommissionAsHeadB, firstA, firstB, headA, headB, initAsHeadA, initAsHeadB, isElementA, isElementB, isHeadA, isHeadB, rmA, rmB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMRelation.Endpoint

protected DOMRelation.Endpoint(DOMObject o)
Initializes an endpoint held by the specified object.

Parameters:
o - the object that wishes to participate in relationships that holds this endpoint
Method Detail

isLeft

public boolean isLeft()
Indicates if this is a left endpoint.

Returns:
true when this is a left endpoint

isRight

public boolean isRight()
Indicates if this is a right endpoint.

Returns:
true when this is a right endpoint

relationIterator

public abstract DOMRelation.Instance.Iterator relationIterator()
Returns an iterator over all relationship instances attached to this endpoint.

Returns:
a new iterator initialized to the start of the list of relationship instances attached to this endpoint

iterator

public abstract DOMObject.Iterator iterator()
Returns an iterator over all objects on the other side of the relationship.

Returns:
a new iterator initialized to the start of the list of objects on the other side from this endpoint

getOther

public abstract DOMObject getOther()
Returns the (first) object on the other side of the relationship or null if none.


count

public abstract int count()
Returns a count of the number of relationships attached to this endpoint. Runs in O(1) time.

Returns:
the number of relationship instances attached to this endpoint.

getObject

public DOMObject getObject()
Returns the object that owns this endpoint.

Returns:
the object that owns this endpoint

getRelation

public abstract DOMRelation getRelation()
Returns the meta-infomration about the relationship that this endpoint is part of. Users of the DOMRelation framework must declare and initialize a (typically) static DOMRelation meta-object and then derive from the appropriate Left/Right Endpoint subclasses and implement this method to return the meta-relation object.


Release Planner v1.0