de.cau.cs.kieler.core.properties
Class Property<T>

java.lang.Object
  extended by de.cau.cs.kieler.core.properties.Property<T>
Type Parameters:
T - type of the property
All Implemented Interfaces:
IProperty<T>, Comparable<IProperty<?>>
Direct Known Subclasses:
ExporterOption, ImporterOption

public class Property<T>
extends Object
implements IProperty<T>, Comparable<IProperty<?>>

A property that uses a string for identification.

Rating yellow
(2011-01-17) reviewed by haf, cmot, soh

Field Summary
static Comparable<?> NEGATIVE_INFINITY
          the default lower bound, which is smaller than everything else.
static Comparable<?> POSITIVE_INFINITY
          the default upper bound, which is greater than everything else.
 
Constructor Summary
Property(IProperty<T> other, T thedefaultValue)
          Creates a property using another property as identifier, but changing the default value.
Property(IProperty<T> other, T thedefaultValue, Comparable<T> thelowerBound)
          Creates a property using another property as identifier, but changing the default value and lower bound.
Property(IProperty<T> other, T thedefaultValue, Comparable<T> thelowerBound, Comparable<T> theupperBound)
          Creates a property using another property as identifier, but changing the default value, lower bound, and upper bound.
Property(String theid)
          Creates a property with given identifier and null as default value.
Property(String theid, T thedefaultValue)
          Creates a property with given identifier and default value.
Property(String theid, T thedefaultValue, Comparable<T> thelowerBound)
          Creates a property with given identifier, default value, and lower bound.
Property(String theid, T thedefaultValue, Comparable<T> thelowerBound, Comparable<T> theupperBound)
          Creates a property with given identifier, default value, and lower and upper bound.
 
Method Summary
 int compareTo(IProperty<?> other)
          Compares this with another Object.
 boolean equals(Object obj)
          
 T getDefault()
          Returns the default value of this property.
 String getId()
          Returns an identifier string for this property.
 Comparable<T> getLowerBound()
          Returns the lower bound of this property.
 Comparable<T> getUpperBound()
          Returns the upper bound of this property.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NEGATIVE_INFINITY

public static final Comparable<?> NEGATIVE_INFINITY
the default lower bound, which is smaller than everything else.


POSITIVE_INFINITY

public static final Comparable<?> POSITIVE_INFINITY
the default upper bound, which is greater than everything else.

Constructor Detail

Property

public Property(String theid)
Creates a property with given identifier and null as default value.

Parameters:
theid - the identifier

Property

public Property(String theid,
                T thedefaultValue)
Creates a property with given identifier and default value.

Parameters:
theid - the identifier
thedefaultValue - the default value

Property

public Property(String theid,
                T thedefaultValue,
                Comparable<T> thelowerBound)
Creates a property with given identifier, default value, and lower bound.

Parameters:
theid - the identifier
thedefaultValue - the default value
thelowerBound - the lower bound

Property

public Property(String theid,
                T thedefaultValue,
                Comparable<T> thelowerBound,
                Comparable<T> theupperBound)
Creates a property with given identifier, default value, and lower and upper bound.

Parameters:
theid - the identifier
thedefaultValue - the default value
thelowerBound - the lower bound, or null if the default lower bound shall be taken
theupperBound - the upper bound

Property

public Property(IProperty<T> other,
                T thedefaultValue)
Creates a property using another property as identifier, but changing the default value.

Parameters:
other - another property
thedefaultValue - the new default value

Property

public Property(IProperty<T> other,
                T thedefaultValue,
                Comparable<T> thelowerBound)
Creates a property using another property as identifier, but changing the default value and lower bound.

Parameters:
other - another property
thedefaultValue - the new default value
thelowerBound - the new lower bound

Property

public Property(IProperty<T> other,
                T thedefaultValue,
                Comparable<T> thelowerBound,
                Comparable<T> theupperBound)
Creates a property using another property as identifier, but changing the default value, lower bound, and upper bound.

Parameters:
other - another property
thedefaultValue - the new default value
thelowerBound - the new lower bound
theupperBound - the new upper bound
Method Detail

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

getDefault

public T getDefault()
Returns the default value of this property.

Specified by:
getDefault in interface IProperty<T>
Returns:
the default value

getLowerBound

public Comparable<T> getLowerBound()
Returns the lower bound of this property. If there is no lower bound, a comparable is returned that is smaller than everything else.

Specified by:
getLowerBound in interface IProperty<T>
Returns:
the lower bound

getUpperBound

public Comparable<T> getUpperBound()
Returns the upper bound of this property. If there is no upper bound, a comparable is returned that is greater than everything else.

Specified by:
getUpperBound in interface IProperty<T>
Returns:
the upper bound

getId

public String getId()
Returns an identifier string for this property.

Specified by:
getId in interface IProperty<T>
Returns:
an identifier

compareTo

public int compareTo(IProperty<?> other)
Compares this with another Object. Returns -1 if this object is smaller, 0 if both objects are equal and 1 if this object is bigger.

Specified by:
compareTo in interface Comparable<IProperty<?>>
Parameters:
other - the object to compare with
Returns:
one of the values -1, 0, 1