edu.stanford.nlp.linalg
Class Entry

java.lang.Object
  |
  +--edu.stanford.nlp.linalg.Entry
All Implemented Interfaces:
Comparable

public class Entry
extends Object
implements Comparable

Stores and allows access to single entry in a vector or matrix. Note: this is not to be confused with inner class java.util.Map.Entry which stores an (Object)key-(Object)value pair. This stores a (int i, int j, Number val) triplet.


Constructor Summary
Entry(int i, double val)
          constructor for a column vector entry A(i).
Entry(int i, int val)
          constructor for a column vector entry A(i).
Entry(int row, int column, double val)
          constructor for a Matrix entry M(i,j)
Entry(int row, int column, int val)
          constructor for a Matrix entry M(i,j)
Entry(int row, int column, Number val)
          constructor for a Matrix entry M(i,j)
Entry(int i, Number val)
          constructor for a column vector entry A(i).
 
Method Summary
 int columnIndex()
          returns column index of Entry
 int compareTo(Object o)
          Compares entries first by value, then by row index, then by column index.
 boolean equals(Object o)
           
 int index()
          returns row index of Entry.
 int rowIndex()
          returns row index of Entry
 int setColumnIndex(int i)
          If the entry is a column vector entry, sets the Column index to i.
 String toString()
           
 double value()
          returns M(i,j)
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Entry

public Entry(int row,
             int column,
             Number val)
constructor for a Matrix entry M(i,j)


Entry

public Entry(int row,
             int column,
             double val)
constructor for a Matrix entry M(i,j)


Entry

public Entry(int row,
             int column,
             int val)
constructor for a Matrix entry M(i,j)


Entry

public Entry(int i,
             Number val)
constructor for a column vector entry A(i). Sets the column index to -1 to denote that it is an Array entry and not a Matrix entry.


Entry

public Entry(int i,
             double val)
constructor for a column vector entry A(i). Sets the column index to -1 to denote that it is an Array entry and not a Matrix entry.


Entry

public Entry(int i,
             int val)
constructor for a column vector entry A(i). Sets the column index to -1 to denote that it is an Array entry and not a Matrix entry.

Method Detail

rowIndex

public int rowIndex()
returns row index of Entry


columnIndex

public int columnIndex()
returns column index of Entry


index

public int index()
returns row index of Entry. convenient for Array Entries, where the column index is meaningless


setColumnIndex

public int setColumnIndex(int i)
If the entry is a column vector entry, sets the Column index to i. This is useful when inserting a column vector into a matrix. Does not allow client to set the column index if the column index has already been set (such as in a Matrix Entry).


value

public double value()
returns M(i,j)


compareTo

public int compareTo(Object o)
Compares entries first by value, then by row index, then by column index. If all three are the same, then the entry If the object to which we are comparing this Entry to is not an Entry, a ClassCastException will be thrown.

Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Stanford NLP Group