Documentation of 'com.jstatcom.model.JSCDRange' Java class
JSCDRange
com.jstatcom.model

Class JSCDRange

  • All Implemented Interfaces:
    JSCData


    public final class JSCDRange
    extends AbstractJSCData
    Adapter to TSDateRange objects that conforms to the JSCData interface. Everytime something changes, a new TSDateRange object is created, because range objects are immutable.

    Whenever the value of this data object changes, registered JSCDataListeners are notified via a JSCDataEvent. If not otherwise stated, the event objects always contain the values before the change and after the change.

    This class is thread-safe. All access to mutable data is synchronized. All events are fired outside the synchronized blocks.

    See Also:
    TSDateRange
    • Field Detail

      • JSCDRange_XML

        public static final XmlFormat<JSCDRange> JSCDRange_XML
        XML format field for (de)serialization.
    • Constructor Detail

      • JSCDRange

        public JSCDRange(java.lang.String name)
        Creates an empty JSCDRange.
        Parameters:
        name - the identifier of that object
        Throws:
        java.lang.IllegalArgumentException - if name is not valid or if (name == null)
        See Also:
        JSCConstants.isValidName(java.lang.String)
      • JSCDRange

        public JSCDRange(java.lang.String name,
                         TSDateRange tsRange)
        Creates a JSCDRange for a given TSDateRange.
        Parameters:
        name - the identifier of that object
        tsRange - the date value
        Throws:
        java.lang.IllegalArgumentException - if name is not valid or if (name == null)
        See Also:
        JSCConstants.isValidName(java.lang.String)
    • Method Detail

      • clear

        public void clear()
        Clears this data object. Fires:
        • JSCDataEventTypes.EMPTY_STATE event
        • JSCDataEventTypes.VALUE_CHANGED event
        if it was not empty before. After calling this method isEmpty returns true.
      • copy

        public JSCDRange copy()
        Description copied from interface: JSCData
        Gets a copy of the current object. Implementations of this method must fulfil the two conditions:
        • a.isEqual(a.copy())- compares values
        • a.getName().equals(a.copy().getName())- compares name
        JSCDataListeners attached to the original object should not be copied.
        Returns:
        a clonelike copy of the original object
        See Also:
        JSCData
      • encloses

        public boolean encloses(JSCDate date)
        Gets whether date is enclosed by this range.
        Parameters:
        date - the JSCDate to be checked
        Returns:
        true if date ist enclosed by this
        Throws:
        java.lang.IllegalArgumentException - if (date == null) or if (date.isEmpty()) or if (isEmpty())
      • encloses

        public boolean encloses(JSCDRange dRange)
        Gets whether dRange is enclosed by this range.
        Parameters:
        dRange - the JSCDRange to be checked
        Returns:
        true if dRange ist enclosed by this
        Throws:
        java.lang.IllegalArgumentException - if (dRange == null) or if (dRange.isEmpty()) or if (isEmpty())
      • getTSDateRange

        public TSDateRange getTSDateRange()
        Gets the stored date object.
        Returns:
        the used TSDateRange or null if empty
      • isEmpty

        public boolean isEmpty()
        Gets whether this is empty. This method returns true, if value returns null.
        Returns:
        true if empty
      • isEqual

        public boolean isEqual(JSCData o)
        Description copied from interface: JSCData
        Gets whether the values of this data object and other are logically equal.
        Returns:
        true if considered equal according to the logic of the representation
        See Also:
        JSCData
      • name

        public java.lang.String name()
        Description copied from interface: JSCData
        Gets the name of the data object. It must fulfil the requirements for variable names defined in JSCConstants.
        Returns:
        the name
        See Also:
        JSCData
      • setVal

        public void setVal(TSDateRange newRange)
        Sets a new value to this date adapter. Fires a JSCDataEvent of type:
        • JSCDataEventTypes.VALUE_CHANGED if !newRange.equals(getTSDateRange())
        • JSCDataEventTypes.EMPTY_STATE if newRange != null and this was empty before
        • JSCDataEventTypes.EMPTY_STATE if newRange == null and this was not empty before
        Parameters:
        newRange - the new range, if null it is similar to clear
      • type

        public JSCTypes type()
        Gets the type of this JSCData object.
        Returns:
        JSCTypes.DRANGE
        See Also:
        JSCTypes
      • value

        public java.lang.Object value()
        Gets the underlying value, which is stored as a TSDateRange.
        Returns:
        the value object or null if this is empty

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.