Class MultiplicitiesVector

All Implemented Interfaces:
Serializable, Cloneable, Comparable<EnhancedVector>, Iterable<Integer>, Collection<Integer>, List<Integer>, RandomAccess, SequencedCollection<Integer>

public class MultiplicitiesVector extends EnhancedVector
This class implements the MultiplicitiesVector object, which is used to store a multiplicities vector. It extends an EnhancedVector object.
Author:
Michail Makaronidis, 2010
See Also:
  • Constructor Details

    • MultiplicitiesVector

      public MultiplicitiesVector()
      Creates an empty MultiplicitiesVector object.
    • MultiplicitiesVector

      public MultiplicitiesVector(Integer[] M)
      Creates an MultiplicitiesVector with content equal to the given matrix.
      Parameters:
      M - The matrix containing the vector elements
    • MultiplicitiesVector

      public MultiplicitiesVector(int k, int length)
      Creates a new MultiplicitiesVector of specific lenth, where all elements are equal to a specific value.
      Parameters:
      k - The value of all elements
      length - The length of the MultiplicitiesVector
  • Method Details

    • copy

      public MultiplicitiesVector copy()
      This method returns a copy of the current MultiplicitiesVector object. Position and delta stacks are disregarded.
      Overrides:
      copy in class EnhancedVector
      Returns:
      Copy of the initial MultiplicitiesVector object.
    • addVec

      Description copied from class: EnhancedVector
      Adds two vectors. The vectors must be of the same size.
      Overrides:
      addVec in class EnhancedVector
      Parameters:
      b - Vector to add
      Returns:
      The result of the addition
    • whichSingleQueueAdded

      public int whichSingleQueueAdded() throws InternalErrorException
      Added by Jack Bradshaw.
      Returns:
      The position of the entry that contains at 1
      Throws:
      InternalErrorException - if more or less than one queue added.
    • isNearlyAllOneElements

      public int isNearlyAllOneElements()
      Added by Haixiao Su
      Returns:
      The position of the element that is not 1 if that's the only element that is not 1, otherwise return -1.