|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jutil.structure.StructureSet
A class of "components" for inplementing a 1-n binding. This class is the 1 side of the binding (the side where the "n" is in a UML diagram).
This is actually a lightweight version of the APSet-APElement combination of the Beedra framework of Jan Dockx.
This class is typically using in the following way. See class StructureElement for class B.
public class A {
public A() {
$b= new StructureSet(this);
}
public Set getBs() {
return $b.getOtherEnds();
}
public void addB(B b) {
$b.add(b.getALink());
}
public void removeB(B b) {
$b.remove(b.getALink());
}
private StructureSet $b;
}
Field Summary | |
static java.lang.String |
CVS_REVISION
|
Constructor Summary | |
StructureSet(java.lang.Object object)
public invariant (\forall StructureElement e; contains(e); e.getStructureSet() == this); public behavior pre object != null; post getObject() == object; post (\forall StructuredElement s;; !contains(s)); Initialize an empty StructureSet for the given object. |
Method Summary | |
void |
add(StructureElement element)
public behavior pre element != null; post element.getStructuredSet() == this; post \old(element.getStructuredSet()) != null && \old(element.getStructuredSet()) != this ==> ! \old(element.getStructuredSet()).contains(element); post contains(element); Remove the given StructureElement from this StructureSet. |
boolean |
contains(StructureElement element)
Check whether or not the given element is connected to this StructureSet. |
java.lang.Object |
getObject()
Return the object at the 1 side of the 1-n binding. |
java.util.Set |
getOtherEnds()
public behavior post (\forall Object o;; \result.contains(o) <=> (\exists StructureElement s; contains(s); s.getObject().equals(o))); post \result != null; Return a set containing the objects at the n side of the 1-n binding. |
java.util.Set |
getStructureElements()
public behavior post (\forall StructuredElement s;; contains(s) <=> \result.contains(s)); post \result != null; Return a set containing the StructureElements at the n side of the 1-n binding. |
void |
remove(StructureElement element)
public behavior post contains(element) ==> element.getStructuredSet() == null; post contains(element) ==> ! contains(element); Add the given StructureElement to this StructureSet. |
int |
size()
public behavior post \reulst == (\num_of StructureElement e; contains(e); 1); Return the size of the StructureSet |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CVS_REVISION
Constructor Detail |
public StructureSet(java.lang.Object object)
object
- The 1 side of the 1-n bindingMethod Detail |
public java.lang.Object getObject()
public void remove(StructureElement element)
element
- The StructureElement to be added.public void add(StructureElement element)
element
- The StructureElement to be removed.public java.util.Set getOtherEnds()
public java.util.Set getStructureElements()
public int size()
public boolean contains(StructureElement element)
element
- The element of which one wants to know if it is in
this StructureSet.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |