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
A bounded number object whose bounds values cannot be modified
- Author:
- Pasteur
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.
Module: work-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-api</artifactId> </dependency>
-
Constructor Summary
ConstructorDescriptionAbstractBounded
(N lower, N initValue, N upper, boolean lowerStrict, boolean upperStrict) Creates a new Bounded object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(BoundedChangeListener<N> changeListener) Adds a listener that will listen for changes to this objectabstract N
Clamps the value of theBounded
object.Returns the list of listeners that will listen for changes to this objectReturns the lower limit of the object.Returns the upper limit of the object.getValue()
Returns the value.boolean
Does the value have to be strictly greater than the lower bound?boolean
Does the value have to be strictly lower than the upper bound?void
removeListener
(BoundedChangeListener<N> changeListener) Removes a listener from the list that will listen for changes to this objectvoid
Set the upper bound (upper
) and lower bound (lower
) of the Bounded Object.void
setLowerBoundStrict
(boolean lowerStrict) Set the lower bound strict policy tolowerStrict
.void
setUpperBoundStrict
(boolean upperStrict) Set the upper bound strict policy toupperStrict
.abstract void
Sets the value of theBounded
object.void
Set the valuev
as the value of the Bounded Object.
-
Constructor Details
-
AbstractBounded
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 Details
-
getUpperBound
Returns the upper limit of the object.- Returns:
- the upper bound.
-
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
Returns the value.- Returns:
- the current value of the
Bounded
object.
-
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
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
Set the valuev
as the value of the Bounded Object.- Parameters:
v
- the value to be set.
-
setValue
Sets the value of theBounded
object.- Parameters:
s
- will be converted to the value type of theBounded
object.
-
clamp
Clamps the value of theBounded
object. -
addListener
Adds a listener that will listen for changes to this object- Parameters:
changeListener
- listener object
-
removeListener
Removes a listener from the list that will listen for changes to this object- Parameters:
changeListener
- listener object
-
getListeners
Returns the list of listeners that will listen for changes to this object- Returns:
- the list of listeners
-