Class StateCollection

    • Method Detail

      • getIsReadOnly

        public boolean getIsReadOnly()
        Gets a value indicating whether or not the collection is read-only. This will be true for continuous variables.
      • getVariable

        public Variable getVariable()
        Gets the Variable this collection belongs to. This is null if this is a child state collection.
        Returns:
        The variable that owns this collection.
      • get

        public State get​(String name)
        Performs a case sensitive lookup.
        Parameters:
        name - The name of the State to find.
        Returns:
        A State with the specified name if found; otherwise null.
      • get

        public State get​(String name,
                         boolean throwIfNotFound)
        Performs a case sensitive lookup.
        Parameters:
        name - The name of the State to find.
        throwIfNotFound - When true throws an exception if the name is not found.
        Returns:
        The State with the specified name; otherwise null.
      • findByValue

        public State findByValue​(Object value)
        Finds the state whose value/> matches the given [value], or null if a match is not found. For discretized variables, each State.getValue() is an Interval, and this method returns the state whose interval contains the given [value].
        Parameters:
        value - The value to match to a State.getValue().
        Returns:
        The matching State or null if a match is not found.
      • indexOf

        public int indexOf​(Object o)
        Determines the index of a specific State in the collection. This operation is O(1).
        Specified by:
        indexOf in interface List<State>
        Overrides:
        indexOf in class AbstractList<State>
        Parameters:
        o - The state to find. The value can be null.
        Returns:
        The index of the state in the collection, or -1 if not found.
      • add

        public void add​(int index,
                        State item)
        Inserts an element into the collection at the specified index.
        Specified by:
        add in interface List<State>
        Overrides:
        add in class AbstractList<State>
        Parameters:
        index - The zero based index at which to add the element.
        item - The item to insert. Cannot be null.
        Throws:
        NullPointerException - Raised when [item] is null.
        IllegalStateException - Raised if the state already belongs to a network.
        IllegalArgumentException - index is less than 0.-or-index is equal to or greater than the collection count.
      • remove

        public State remove​(int index)
        Removes an element from the collection at the specified index.
        Specified by:
        remove in interface List<State>
        Overrides:
        remove in class AbstractList<State>
        Parameters:
        index - The zero based index at which to remove the element.
        Throws:
        IllegalArgumentException - index is less than 0.-or-index is equal to or greater than the collection count.