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>
compositums
private java.lang.String
key
private java.lang.String
value
-
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 void
addHierarchy(CompositeContainer container)
Adds a branch/leave to the composite.boolean
equals(java.lang.Object obj)
java.util.ArrayList<CompositeContainer>
getCompositums()
Returns a list of all branches/leaves from this composite.java.lang.String
getKey()
Returns the key.java.lang.String
getValue()
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:
equals
in classjava.lang.Object
-