Class symantec.itools.awt.Matrix
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class symantec.itools.awt.Matrix
Object
   |
   +----symantec.itools.awt.Matrix
  -  public final class Matrix
  
-  extends Object
  
-  implements Serializable
   
This class implements a sparse matrix of objects.
  -  Version:
  
 -  1.0, Nov 26, 1996
  
 -  Author:
  
 -  Symantec
 
  
  -  
	errors
   -   Error strings.
 
  
  -  
	symantec.itools.awt.Matrix()
   -   Constructs an empty matrix.
 
  
  -  
	addElement(int, int, Object)
   -   Adds the given element to this matrix at the specified row and column.
  
 -  
	elementAt(int, int)
   -   Returns the element at the specified row and column.
  
 -  
	elements()
   -   Returns an enumeration of all the elements.
  
 -  
	insertRow(int)
   -   Inserts a new row at the given location.
  
 -  
	printRow(int)
   -   Prints the specified row to System.out.
  
 -  
	removeAllElements()
   -   Removes all elements of the matrix.
  
 -  
	removeElementAt(int, int)
   -   Deletes the element at the specified row and column.
  
 -  
	removeRow(int)
   -   Deletes all elements on the specified row.
  
 -  
	rows()
   -   Returns the number of rows in the matrix.
  
 -  
	sort(CompareFunc, int)
   -   Sorts all rows into ascending order.
  
 -  
	toString()
   -   Returns a string representation of this component.
  
 -  
	updateElement(int, int, Object)
   -   Adds or updates the element at the specified row and column, as needed.
 
  
errors
protected transient java.util.ResourceBundle errors
  -  Error strings.
 
  
Matrix
public Matrix()
  -  Constructs an empty matrix.
  
 
 
  
addElement
public synchronized void addElement(int r,
                                    int c,
                                    Object o) throws IllegalArgumentException
  -  Adds the given element to this matrix at the specified row and column.
  
 
 
    -  Parameters:
    
 -  r - the row of the element to be added
    
-  c - the column of the element to added
    
-  o - the element to be added
    
   -  Throws: IllegalArgumentException
    
 -  if an element is already allocated
 at [r,c]
    
 -  See Also:
    
 -  updateElement, removeElementAt
  
 
 
 
elementAt
public synchronized java.lang.Object elementAt(int r,
                                               int c) throws ArrayIndexOutOfBoundsException
  -  Returns the element at the specified row and column.
  
 
 
    -  Parameters:
    
 -  r - the row of the element to return
    
-  c - the column of the element to return
    
  -  Returns:
    
 -  the element at [r,c]
    
 -  Throws: ArrayIndexOutOfBoundsException
    
 -  if an invalid
 row and/or column was given
  
 
 
 
elements
public synchronized symantec.itools.awt.MatrixEnumeration elements()
  -  Returns an enumeration of all the elements. Use the enumeration methods
 of the returned object to fetch the elements sequentially.
  
 
 
insertRow
public synchronized void insertRow(int r)
  -  Inserts a new row at the given location.
 It does this by incrementing the row number of all elements with
 row indexes >= given row number.
  
 
 
    -  Parameters:
    
 -  r - the number of the row to insert
    
 -  See Also:
    
 -  removeRow
  
 
 
 
printRow
public synchronized void printRow(int r)
  -  Prints the specified row to System.out.
 This can be handy for debugging purposes.
  
 
 
    -  Parameters:
    
 -  r - the row to print
  
 
 
 
removeAllElements
public synchronized void removeAllElements()
  -  Removes all elements of the matrix. The matrix becomes empty.
  
 
 
    -  See Also:
    
 -  addElement, removeElementAt
  
 
 
 
removeElementAt
public synchronized void removeElementAt(int r,
                                         int c) throws ArrayIndexOutOfBoundsException
  -  Deletes the element at the specified row and column.
  
 
 
    -  Parameters:
    
 -  r - the row of the element to remove
    
-  c - the column of the element to remove
    
  -  Throws: ArrayIndexOutOfBoundsException
    
 -  if an invalid
 row and/or column was given
  
 
 
 
removeRow
public synchronized void removeRow(int r)
  -  Deletes all elements on the specified row.
  
 
 
    -  Parameters:
    
 -  r - the row of the elements to remove
    
 -  See Also:
    
 -  insertRow, removeElementAt
  
 
 
 
rows
public synchronized int rows()
  -  Returns the number of rows in the matrix.
  
 
 
sort
public synchronized void sort(CompareFunc f,
                              int c)
  -  Sorts all rows into ascending order.
 It does this by comparing elements at the given
 column number using the provided CompareFunc.
  
 
 
    -  Parameters:
    
 -  f - compares two objects and determines which one is less than the other
    
-  c - the column number of elements to compare
  
  
 
 
toString
public synchronized java.lang.String toString()
  -  Returns a string representation of this component.
 This is a standard Java AWT method which gets called to generate
 a string that represents this component.
  
 
 
    -  Returns:
    
 -  a meaningful string about this object
    
 -  Overrides:
    
 -  toString in class Object
  
 
 
 
updateElement
public synchronized void updateElement(int r,
                                       int c,
                                       Object obj)
  -  Adds or updates the element at the specified row and column, as needed.
  
 
 
    -  Parameters:
    
 -  r - the row of the element to be updated
    
-  c - the column of the element to updated
    
-  o - the new element
    
   -  See Also:
    
 -  addElement, removeElementAt
  
 
 
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index