com.multicorebsp.util
Class MatrixData<T extends MatrixData<?>>

java.lang.Object
  extended by com.multicorebsp.util.MatrixData<T>
All Implemented Interfaces:
com.multicorebsp.core.CompulsaryCloneable<T>, java.lang.Cloneable
Direct Known Subclasses:
ComplexData, DoubleData, IntegerData, NoData

public abstract class MatrixData<T extends MatrixData<?>>
extends java.lang.Object
implements com.multicorebsp.core.CompulsaryCloneable<T>

Class storing nonzero values of sparse matrices. Also subs as a factory of the different storage classes.


Constructor Summary
MatrixData()
           
 
Method Summary
abstract  void add(int i, int j)
          Adds the values of two nonzeroes and saves it at the last index available.
 java.lang.Object clone()
           
abstract  void parseAndWrite(int i, java.util.Scanner s)
          Parses an input stream and writes the contect to the i'th index.
abstract  void removeDuplicates(int nr)
          Removes duplicates from the data structure.
abstract  T safeClone(int i, int j)
          Clones only a subset of the data.
abstract  void swap(int i, int j)
          Swaps data elements.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.multicorebsp.core.CompulsaryCloneable
safeClone
 

Constructor Detail

MatrixData

public MatrixData()
Method Detail

add

public abstract void add(int i,
                         int j)
Adds the values of two nonzeroes and saves it at the last index available.

Parameters:
i - First nonzero index (will remain unchanged).
j - Second nonzero index (will be replaced by sum).

removeDuplicates

public abstract void removeDuplicates(int nr)
Removes duplicates from the data structure. Assumed is all duplicates reside at the last part of the data structure.

Parameters:
nr - Number of elements to remove.

swap

public abstract void swap(int i,
                          int j)
Swaps data elements.

Parameters:
i - First index
j - Second index

clone

public java.lang.Object clone()
Specified by:
clone in interface com.multicorebsp.core.CompulsaryCloneable<T extends MatrixData<?>>
Overrides:
clone in class java.lang.Object

safeClone

public abstract T safeClone(int i,
                            int j)
Clones only a subset of the data.

Parameters:
i - Lower bound of the index to copy.
j - Upper bound on the index to copy.
Returns:
Partial clone of the current object.

parseAndWrite

public abstract void parseAndWrite(int i,
                                   java.util.Scanner s)
Parses an input stream and writes the contect to the i'th index.

Parameters:
i - At what index to save input.
s - Where to get the input from.