LBJ2.infer
Class XpressMPHook.Vector2D

java.lang.Object
  extended by LBJ2.infer.XpressMPHook.Vector2D
Direct Known Subclasses:
XpressMPHook.Vector2DDouble, XpressMPHook.Vector2DInt
Enclosing class:
XpressMPHook

protected static class XpressMPHook.Vector2D
extends java.lang.Object

A two dimensional vector representation implemented here because we are not assuming Java 5. The term sub-vector appearing below refers to the Vector objects which are elements of data.


Field Summary
protected  java.util.Vector data
          The vector of vectors.
protected  int size
          The total number of elements in all vectors.
 
Constructor Summary
XpressMPHook.Vector2D()
          Default constructor.
 
Method Summary
 void add(java.lang.Object element, int index)
          Adds the specified element to the specified vector.
 java.lang.Object get(int v, int i)
          Returns the element at the specified position in the 2D vector.
 int[] indexMap()
          The array returned by this method contains indexes into the arrays returned by XpressMPHook.Vector2DInt.flatten() and XpressMPHook.Vector2DDouble.flatten() indicating where each vector began and ended before they were flattened.
 int size()
          Returns the total number of elements in all vectors.
 int size(int v)
          Returns the size of the specified sub-vector.
 int subVectors()
          Returns the number of vectors contained in data.
 java.lang.String toString()
          Returns a string representation of this two dimensional vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected java.util.Vector data
The vector of vectors.


size

protected int size
The total number of elements in all vectors.

Constructor Detail

XpressMPHook.Vector2D

public XpressMPHook.Vector2D()
Default constructor.

Method Detail

subVectors

public int subVectors()
Returns the number of vectors contained in data.


size

public int size()
Returns the total number of elements in all vectors.


size

public int size(int v)
Returns the size of the specified sub-vector.

Parameters:
v - The index of a sub-vector.
Returns:
The number of elements in sub-vector v.

add

public void add(java.lang.Object element,
                int index)
Adds the specified element to the specified vector. If the specified vector does not exist, new vectors are added until it does.

Parameters:
element - The element to add.
index - The index of the vector to which element should be added.

get

public java.lang.Object get(int v,
                            int i)
Returns the element at the specified position in the 2D vector.

Parameters:
v - The index of the sub-vector in which to look.
i - The index of the element in vector v.
Returns:
The element at the specified position.

indexMap

public int[] indexMap()
The array returned by this method contains indexes into the arrays returned by XpressMPHook.Vector2DInt.flatten() and XpressMPHook.Vector2DDouble.flatten() indicating where each vector began and ended before they were flattened.


toString

public java.lang.String toString()
Returns a string representation of this two dimensional vector.

Overrides:
toString in class java.lang.Object