Class SequenceAttribute

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, ValueListener
    Direct Known Subclasses:
    ProcessAttribute

    public class SequenceAttribute
    extends Parameter
    implements java.lang.Comparable
    The sequence number for actor in the sequence domain. This parameter stores an integer value that is required to be unique within the portion of the model under the control of a single SequenceDirector. Duplicate sequence numbers will trigger an exception. FIXME: Shouldn't these numbers be forced to be unique, like by their position in the XML file?
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Elizabeth Latronico (Bosch)
    Pt.AcceptedRating:
    Red (beth)
    Pt.ProposedRating:
    Red (beth)
    • Constructor Detail

      • SequenceAttribute

        public SequenceAttribute()
        Construct an attribute in the default workspace with an empty string as its name. The object is added to the directory of the workspace. Increment the version number of the workspace.
      • SequenceAttribute

        public SequenceAttribute​(Workspace workspace)
        Construct an attribute in the specified workspace with an empty string as a name. The object is added to the directory of the workspace. Increment the version number of the workspace.
        Parameters:
        workspace - The workspace that will list the attribute.
      • SequenceAttribute

        public SequenceAttribute​(NamedObj container,
                                 java.lang.String name)
                          throws IllegalActionException,
                                 NameDuplicationException
        Construct an attribute with the given name contained by the specified container. The container argument must not be null, or a NullPointerException will be thrown. This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. The object is added to the directory of the workspace if the container is null. Increment the version of the workspace.
        Parameters:
        container - The container.
        name - The name of this attribute.
        Throws:
        IllegalActionException - If the attribute is not of an acceptable class for the container, or if the name contains a period.
        NameDuplicationException - If the name coincides with an attribute already in the container. type is set to Integer for sequence number
    • Method Detail

      • compareTo

        public int compareTo​(java.lang.Object object)
        Implement compareTo method to compare sequence numbers Only the sequence numbers are compared (independent of any process name). Object may be a SequenceAttribute or a SequenceAttribute
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        object - The SequenceAttribute object.
        Returns:
        0 if the sequence numbers are the same.
      • equals

        public boolean equals​(java.lang.Object sequenceAttribute)
        Return true if this SequenceAttribute has the same sequence number as the given SequenceAttribute.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        sequenceAttribute - The SequenceAttribute object that this SequenceAttribute object is compared to.
        Returns:
        True if the two SequenceAttribute objects have the same sequence number, name and workspace
      • getSequenceNumber

        public int getSequenceNumber()
                              throws IllegalActionException
        Construct an attribute with the given name contained by the specified /** Returns the sequence number as an int, or 0 if there is none.
        Returns:
        int sequence number
        Throws:
        IllegalActionException - If there is a problem getting the token value.
      • validate

        public java.util.Collection validate()
                                      throws IllegalActionException
        Implement validate method to validate the SequenceAttribute and ProcessAttributes.
        Specified by:
        validate in interface Settable
        Overrides:
        validate in class Variable
        Returns:
        The current list of value listeners, which are evaluated as a consequence of this call to validate().
        Throws:
        IllegalActionException - If thrown by the parent class.
      • hashCode

        public int hashCode()
        Return the hash code for this SequenceAttribute object. If two SequenceAttribute objects contain the same processName, methodName and have the same sequence number, then they will have the same hashCode.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hash code for this TimedEvent object.