|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.util.Pair<T,T> de.hpi.fgis.dude.util.OrderedPair<T>
T
- The type of both elements.
has to implement Comparable
.public class OrderedPair<T extends Comparable<T>>
OrderedPair
extends Pair
in this way that both elements has to have the same type. Additionally both elements should be
Comparable
in order to set the smaller element at position 1.
Constructor Summary | |
---|---|
OrderedPair()
Initializes an empty pair. |
|
OrderedPair(T elem1,
T elem2)
Creates a OrderedPair instance with the passed objects. |
Method Summary | |
---|---|
void |
copyPropertiesFrom(OrderedPair<T> pair)
Copies the properties from the passed pair into the current instance. |
Object |
getProperty(String key)
Returns the value of the passed property. |
boolean |
hasProperty(String key)
Checks whether the passed property is set. |
void |
setElements(T elem1,
T elem2)
Resets the pair's elements. |
void |
setFirstElement(T elem)
Sets the first element. |
Object |
setProperty(String key,
Object value)
Sets the passed property. |
void |
setSecondElement(T elem)
Sets the second element. |
Methods inherited from class de.hpi.fgis.dude.util.Pair |
---|
equals, getFirstElement, getSecondElement, hashCode, isReflexive, isSymmetricTo, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OrderedPair()
public OrderedPair(T elem1, T elem2)
OrderedPair
instance with the passed objects. The order of the elements does not matter since they are stored depending
on which of the elements is the smaller one.
elem1
- The first element.elem2
- The second element.Method Detail |
---|
public boolean hasProperty(String key)
key
- The name of the property.
true
, if the property is set; otherwise false
.public Object getProperty(String key)
key
- The name of the property.
null
, if the property is not set.public Object setProperty(String key, Object value)
key
- The name of the property.value
- The value of the property.
null
, if it was not set, yet.public void copyPropertiesFrom(OrderedPair<T> pair)
pair
- The DuDeObjectPair
whose properties shall be copied.public void setElements(T elem1, T elem2)
elem1
- The new element no #1.elem2
- The new element no #2.public void setFirstElement(T elem)
Pair
setFirstElement
in class Pair<T extends Comparable<T>,T extends Comparable<T>>
elem
- The new first element.public void setSecondElement(T elem)
Pair
setSecondElement
in class Pair<T extends Comparable<T>,T extends Comparable<T>>
elem
- The new second element.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |