Package model.container
Class CompositeContainer
java.lang.Object
model.container.CompositeContainer
public class CompositeContainer
extends java.lang.Object
CompositeContainer class to represent a hierarchical structure of any depth.
Consists of an optional key, and value that describes it.
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<CompositeContainer>compositumsprivate java.lang.Stringkeyprivate java.lang.Stringvalue -
Constructor Summary
Constructors Constructor Description CompositeContainer()Constructor of CompositContainer, which takes nor key or value to represent the rootCompositeContainer(java.lang.String key, java.lang.String value)Constructor of CompositContainer, which takes a key and a value and safes them. -
Method Summary
Modifier and Type Method Description voidaddHierarchy(CompositeContainer container)Adds a branch/leave to the composite.booleanequals(java.lang.Object obj)java.util.ArrayList<CompositeContainer>getCompositums()Returns a list of all branches/leaves from this composite.java.lang.StringgetKey()Returns the key.java.lang.StringgetValue()Returns the value.Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
key
private java.lang.String key -
value
private java.lang.String value -
compositums
-
-
Constructor Details
-
CompositeContainer
public CompositeContainer(java.lang.String key, java.lang.String value)Constructor of CompositContainer, which takes a key and a value and safes them.- Parameters:
key- Key of the composite that describes the valuevalue- value of the composite
-
CompositeContainer
public CompositeContainer()Constructor of CompositContainer, which takes nor key or value to represent the root
-
-
Method Details
-
addHierarchy
Adds a branch/leave to the composite.- Parameters:
container- CompositeContainer
-
getCompositums
Returns a list of all branches/leaves from this composite.- Returns:
- List of all branches/leaves from this composite.
-
getValue
public java.lang.String getValue()Returns the value.- Returns:
- value
-
getKey
public java.lang.String getKey()Returns the key.- Returns:
- key
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-