Package org.cytoscape.work.util
Class AbstractBounded<N extends Comparable<N>>
- java.lang.Object
-
- org.cytoscape.work.util.AbstractBounded<N>
-
- Type Parameters:
N- Any type of Number.
- Direct Known Subclasses:
BoundedDouble,BoundedFloat,BoundedInteger,BoundedLong
public abstract class AbstractBounded<N extends Comparable<N>> extends Object
A bounded number object whose bounds values cannot be modified- Author:
- Pasteur
Module:
work-apiTo use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (Abstract Class): This class is abstract and meant to be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
-
-
Constructor Summary
Constructors Constructor Description AbstractBounded(N lower, N initValue, N upper, boolean lowerStrict, boolean upperStrict)Creates a new Bounded object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddListener(BoundedChangeListener<N> changeListener)Adds a listener that will listen for changes to this objectabstract Nclamp(N value)Clamps the value of theBoundedobject.List<BoundedChangeListener<N>>getListeners()Returns the list of listeners that will listen for changes to this objectNgetLowerBound()Returns the lower limit of the object.NgetUpperBound()Returns the upper limit of the object.NgetValue()Returns the value.booleanisLowerBoundStrict()Does the value have to be strictly greater than the lower bound?booleanisUpperBoundStrict()Does the value have to be strictly lower than the upper bound?voidremoveListener(BoundedChangeListener<N> changeListener)Removes a listener from the list that will listen for changes to this objectvoidsetBounds(N lower, N upper)Set the upper bound (upper) and lower bound (lower) of the Bounded Object.voidsetLowerBoundStrict(boolean lowerStrict)Set the lower bound strict policy tolowerStrict.voidsetUpperBoundStrict(boolean upperStrict)Set the upper bound strict policy toupperStrict.abstract voidsetValue(String s)Sets the value of theBoundedobject.voidsetValue(N v)Set the valuevas the value of the Bounded Object.
-
-
-
Constructor Detail
-
AbstractBounded
public AbstractBounded(N lower, N initValue, N upper, boolean lowerStrict, boolean upperStrict)
Creates a new Bounded object.- Parameters:
lower- The lower bound value.initValue- The initial value.upper- The upper bound value.lowerStrict- True means that the value cannot be equal to the lower bound.upperStrict- True means that the value cannot be equal to the upper bound.
-
-
Method Detail
-
getUpperBound
public N getUpperBound()
Returns the upper limit of the object.- Returns:
- the upper bound.
-
getLowerBound
public N getLowerBound()
Returns the lower limit of the object.- Returns:
- the lower bound.
-
isUpperBoundStrict
public boolean isUpperBoundStrict()
Does the value have to be strictly lower than the upper bound?- Returns:
- true if the upper bound is strict, otherwise false.
-
isLowerBoundStrict
public boolean isLowerBoundStrict()
Does the value have to be strictly greater than the lower bound?- Returns:
- true if the lower bound is strict, otherwise false.
-
getValue
public N getValue()
Returns the value.- Returns:
- the current value of the
Boundedobject.
-
setUpperBoundStrict
public void setUpperBoundStrict(boolean upperStrict)
Set the upper bound strict policy toupperStrict.- Parameters:
upperStrict- the upper bound strict policy to be set
-
setLowerBoundStrict
public void setLowerBoundStrict(boolean lowerStrict)
Set the lower bound strict policy tolowerStrict.- Parameters:
lowerStrict- the lower bound strict policy to be set
-
setBounds
public void setBounds(N lower, N upper)
Set the upper bound (upper) and lower bound (lower) of the Bounded Object.- Parameters:
lower- the lower bound to be set.upper- the upper bound to be set.
-
setValue
public void setValue(N v)
Set the valuevas the value of the Bounded Object.- Parameters:
v- the value to be set.
-
setValue
public abstract void setValue(String s)
Sets the value of theBoundedobject.- Parameters:
s- will be converted to the value type of theBoundedobject.
-
addListener
public void addListener(BoundedChangeListener<N> changeListener)
Adds a listener that will listen for changes to this object- Parameters:
changeListener- listener object
-
removeListener
public void removeListener(BoundedChangeListener<N> changeListener)
Removes a listener from the list that will listen for changes to this object- Parameters:
changeListener- listener object
-
getListeners
public List<BoundedChangeListener<N>> getListeners()
Returns the list of listeners that will listen for changes to this object- Returns:
- the list of listeners
-
-