Class VectorInt<T extends MguiNumber>

java.lang.Object
All Implemented Interfaces:
AttributeObject, InterfaceObject, NamedObject, TreeObject, CleanableObject, XMLObject, IconObject

public class VectorInt<T extends MguiNumber>
extends VariableInt<T>
Represents an array of numeric values.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

    • elements

      protected java.util.ArrayList<T extends MguiNumber> elements
  • Constructor Details

    • VectorInt

      public VectorInt​(java.lang.String name, int n)
    • VectorInt

      public VectorInt​(java.util.List<T> values)
    • VectorInt

      public VectorInt​(java.lang.String name, java.util.List<T> values)
  • Method Details

    • setValues

      public void setValues​(java.util.List<T> values)
      Sets the values for this vector.
      Parameters:
      values -
    • getAsList

      public java.util.ArrayList<T> getAsList()
      Description copied from class: VariableInt
      Returns this variable as a single list of values.
      Specified by:
      getAsList in class VariableInt<T extends MguiNumber>
      Returns:
    • getSize

      public int getSize()
      Description copied from class: VariableInt
      Returns the total size (number of elements) of this variable.
      Specified by:
      getSize in class VariableInt<T extends MguiNumber>
      Returns:
    • getPart

      public VectorInt<T> getPart​(int start, int end)
      Returns a part of this vector, between and including indices start and end.
      Parameters:
      name -
      start -
      end -
      Returns:
    • getPart

      public VectorInt<T> getPart​(java.lang.String name, int start, int end)
      Returns a part of this vector, between and including indices start and end.
      Parameters:
      name -
      start -
      end -
      Returns:
    • getPart

      public VectorInt<T> getPart​(java.lang.String name, java.lang.String part)
      Description copied from class: VariableInt
      Parses part to return a part of this variable. Syntax for n dimensions is: "x_start,y_start,..,n_start:x_start,y_start,..,n_start". E.g., "1,2:20,2". Use asterisk, "*" to indicate last element in a dimension. E.g,, "1,2:*,*".
      Specified by:
      getPart in class VariableInt<T extends MguiNumber>
      Returns:
    • setValue

      public boolean setValue​(java.util.List<java.lang.Integer> indices, T value) throws VariableException
      Description copied from class: VariableInt
      Sets the value at the given indices; throws an exception if they are out of bounds, this variable is not editable, or value is an inappropriate value.
      Specified by:
      setValue in class VariableInt<T extends MguiNumber>
      Returns:
      object at the given indices
      Throws:
      VariableException
    • setStringValue

      public boolean setStringValue​(java.util.List<java.lang.Integer> indices, java.lang.String value) throws VariableException
      Description copied from class: VariableInt
      Sets the value at the given indices as a String; throws an exception if they are out of bounds, this variable is not editable, or value is an inappropriate value.
      Specified by:
      setStringValue in class VariableInt<T extends MguiNumber>
      Returns:
      object at the given indices
      Throws:
      VariableException
    • getDimensions

      public java.util.ArrayList<java.lang.Integer> getDimensions()
      Specified by:
      getDimensions in class VariableInt<T extends MguiNumber>
    • getValue

      protected T getValue​(java.util.List<java.lang.Integer> indices) throws VariableException
      Description copied from class: VariableInt
      Returns the value at the given indices; throws an exception if they are out of bounds. If the indices are of a lower dimension than the variable dimension, the returned object is handled by the subclass method. As a general policy, this object should represent the remaining dimensions in some way.
      Specified by:
      getValue in class VariableInt<T extends MguiNumber>
      Returns:
      object at the given indices
      Throws:
      VariableException
    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Description copied from interface: IconObject
      Returns the Icon associated with this object.
      Specified by:
      getObjectIcon in interface IconObject
      Overrides:
      getObjectIcon in class VariableInt<T extends MguiNumber>
      Returns:
    • getValue

      public T getValue​(int i) throws VariableException
      Throws:
      VariableException
    • getN

      public int getN()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class VariableInt<T extends MguiNumber>