Class AbstractBounded<N extends Comparable<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-api

    To 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 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 Bounded object.
      • setUpperBoundStrict

        public void setUpperBoundStrict​(boolean upperStrict)
        Set the upper bound strict policy to upperStrict.
        Parameters:
        upperStrict - the upper bound strict policy to be set
      • setLowerBoundStrict

        public void setLowerBoundStrict​(boolean lowerStrict)
        Set the lower bound strict policy to lowerStrict.
        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 value v as the value of the Bounded Object.
        Parameters:
        v - the value to be set.
      • setValue

        public abstract void setValue​(String s)
        Sets the value of the Bounded object.
        Parameters:
        s - will be converted to the value type of the Bounded object.
      • clamp

        public abstract N clamp​(N value)
        Clamps the value of the Bounded object.
      • 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