org.scilab.modules.types
Class ScilabBooleanSparse

java.lang.Object
  extended by org.scilab.modules.types.ScilabBooleanSparse
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, ScilabType

public class ScilabBooleanSparse
extends java.lang.Object
implements ScilabType

This class provides a representation on the Scilab Boolean Sparse datatype

This class is Serializable and any modification could impact load and store of data (Xcos files, Javasci saved data, etc...).

//TODO Sly : ajouter de la doc

See Also:
Scilab, Serialized Form

Constructor Summary
ScilabBooleanSparse()
          Default constructor
ScilabBooleanSparse(boolean data)
          Constructor with a unique value.
ScilabBooleanSparse(boolean[][] data)
          Constructor with a matrix of real data.
ScilabBooleanSparse(int rows, int cols, int nbItem, int[] nbItemRow, int[] colPos)
          Constructor
ScilabBooleanSparse(int rows, int cols, int nbItem, int[] nbItemRow, int[] colPos, boolean check)
          Constructor
ScilabBooleanSparse(java.lang.String varName, int rows, int cols, int nbItem, int[] nbItemRow, int[] colPos)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare if obj is the same object or not
 int[] getColPos()
          Get the real part of the data.
 boolean[][] getFullMatrix()
          Get the real part of the full sparse matrix
 int getHeight()
          Return the height (number of elements) of the stored data
 int[] getNbItemRow()
          Get the real part of the data.
 int getNbNonNullItems()
          Get the real part of the data.
 int[] getScilabColPos()
          Get the column positions of the non null items.
 boolean[] getSerializedBooleanSparseMatrix()
          Get complex matrix as a serialized form
 java.lang.Object getSerializedObject()
          Get a single object used to easily rebuild a Scilab variable from the Java ScilabType
 ScilabTypeEnum getType()
          Return the type of Scilab
 java.lang.String getVarName()
          Get the variable name or null if it has not a name
 int getWidth()
          Return the width (number of elements) of the stored data
 boolean isEmpty()
          Check the emptiness of the associated data.
 boolean isReference()
          
 boolean isSwaped()
          Get the how the matrix is stored
 void readExternal(java.io.ObjectInput in)
           
 void setColPos(int[] colPos)
          Set the real part of the data.
 void setNbItemRow(int[] nbItemRow)
          Set the real part of the data.
 void setNbNonNullItems(int nbItem)
          Set the real part of the data.
 java.lang.String toString()
          Display the representation in the Scilab language of the type
Note that the representation can be copied/pasted straight into Scilab
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScilabBooleanSparse

public ScilabBooleanSparse()
Default constructor


ScilabBooleanSparse

public ScilabBooleanSparse(boolean data)
Constructor with a unique value.

Parameters:
data - the unique value

ScilabBooleanSparse

public ScilabBooleanSparse(int rows,
                           int cols,
                           int nbItem,
                           int[] nbItemRow,
                           int[] colPos,
                           boolean check)
                    throws ScilabSparseException
Constructor

Parameters:
rows - the number of rows
cols - the number of cols
nbItem - the number of true items
nbItemRow - contains the number of true in each rows
colPos - the column position of each true
check - if true the parameters validity is checked
Throws:
ScilabSparseException

ScilabBooleanSparse

public ScilabBooleanSparse(int rows,
                           int cols,
                           int nbItem,
                           int[] nbItemRow,
                           int[] colPos)
Constructor

Parameters:
rows - the number of rows
cols - the number of cols
nbItem - the number of true items
nbItemRow - contains the number of true in each rows
colPos - the column position of each true

ScilabBooleanSparse

public ScilabBooleanSparse(boolean[][] data)
Constructor with a matrix of real data.

Parameters:
data - the data

ScilabBooleanSparse

public ScilabBooleanSparse(java.lang.String varName,
                           int rows,
                           int cols,
                           int nbItem,
                           int[] nbItemRow,
                           int[] colPos)
Constructor

Parameters:
varName - the variable name
rows - the number of rows
cols - the number of cols
nbItem - the number of true items
nbItemRow - contains the number of true in each rows
colPos - the column position of each true
Method Detail

isReference

public boolean isReference()

Specified by:
isReference in interface ScilabType
Returns:
true if data are backed in a java.nio.Buffer

getType

public ScilabTypeEnum getType()
Return the type of Scilab

Specified by:
getType in interface ScilabType
Returns:
the type of Scilab
Since:
5.4.0

isEmpty

public boolean isEmpty()
Check the emptiness of the associated data.

Specified by:
isEmpty in interface ScilabType
Returns:
true, if the associated data array is empty.

getNbNonNullItems

public int getNbNonNullItems()
Get the real part of the data.

Returns:
the real part.

setNbNonNullItems

public void setNbNonNullItems(int nbItem)
Set the real part of the data.

Parameters:
nbItem - the real part.

getNbItemRow

public int[] getNbItemRow()
Get the real part of the data.

Returns:
the real part.

setNbItemRow

public void setNbItemRow(int[] nbItemRow)
Set the real part of the data.

Parameters:
nbItemRow - the real part.

getScilabColPos

public int[] getScilabColPos()
Get the column positions of the non null items.

Returns:
an integer array.

getColPos

public int[] getColPos()
Get the real part of the data.

Returns:
the real part.

setColPos

public void setColPos(int[] colPos)
Set the real part of the data.

Parameters:
colPos - the real part.

getVarName

public java.lang.String getVarName()
Get the variable name or null if it has not a name

Specified by:
getVarName in interface ScilabType
Returns:
the name

isSwaped

public boolean isSwaped()
Get the how the matrix is stored

Specified by:
isSwaped in interface ScilabType
Returns:
true if the matrix is stored row by row

getFullMatrix

public boolean[][] getFullMatrix()
Get the real part of the full sparse matrix

Returns:
the full real matrix

getSerializedBooleanSparseMatrix

public boolean[] getSerializedBooleanSparseMatrix()
Get complex matrix as a serialized form

Returns:
the serialized matrix with complex values

getHeight

public int getHeight()
Description copied from interface: ScilabType
Return the height (number of elements) of the stored data

Specified by:
getHeight in interface ScilabType
Returns:
the height of the data matrix
See Also:
ScilabType.getHeight()

getWidth

public int getWidth()
Description copied from interface: ScilabType
Return the width (number of elements) of the stored data

Specified by:
getWidth in interface ScilabType
Returns:
the width of the data matrix
See Also:
ScilabType.getWidth()

equals

public boolean equals(java.lang.Object obj)
Description copied from interface: ScilabType
Compare if obj is the same object or not

Specified by:
equals in interface ScilabType
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object we want to compare
Returns:
true if the two objects are equals, false otherwise
See Also:
ScilabType.equals(Object)

getSerializedObject

public java.lang.Object getSerializedObject()
Get a single object used to easily rebuild a Scilab variable from the Java ScilabType

Specified by:
getSerializedObject in interface ScilabType
Returns:
an very simple object reflecting this ScilabType.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

toString

public java.lang.String toString()
Display the representation in the Scilab language of the type
Note that the representation can be copied/pasted straight into Scilab

Specified by:
toString in interface ScilabType
Overrides:
toString in class java.lang.Object
Returns:
a Scilab-like String representation of the data.
See Also:
Object.toString()