org.scilab.modules.types
Class ScilabBoolean

java.lang.Object
  extended by org.scilab.modules.types.ScilabBoolean
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, ScilabType
Direct Known Subclasses:
ScilabBooleanReference

public class ScilabBoolean
extends java.lang.Object
implements ScilabType

This class provides a representation on the Scilab boolean datatype

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

Example:
boolean [][]a={{true,false,true}, {true,true,true}};
ScilabBoolean aMatrix = new ScilabBoolean(a);

See Also:
Scilab, Serialized Form

Field Summary
protected  boolean byref
           
protected  boolean[][] data
           
protected  boolean swaped
           
protected  java.lang.String varName
           
 
Constructor Summary
ScilabBoolean()
          Create an empty object
ScilabBoolean(boolean value)
          Create a scalar boolean from a boolean
ScilabBoolean(boolean[][] data)
          Create an object from an array of array of boolean
ScilabBoolean(java.lang.String varName, boolean[][] data, boolean swaped)
          Create an object from an array of array of boolean
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare if obj is the same object or not
 boolean[][] getData()
          Return the data
 boolean getElement(int i, int j)
          Get the element at position (i, j)
 int getHeight()
          Return the height (number of element) of the stored data
 java.lang.Object getRawData()
           
 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 element) of the stored data
 boolean isEmpty()
          If it is empty / uninitialized
 boolean isReference()
          
 boolean isSwaped()
          Get the how the matrix is stored
 void readExternal(java.io.ObjectInput in)
           
 void setData(boolean[][] data)
          Change the value with the provided data
 void setElement(int i, int j, boolean x)
          Set the element at position (i, j)
 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
 

Field Detail

data

protected boolean[][] data

varName

protected java.lang.String varName

swaped

protected boolean swaped

byref

protected transient boolean byref
Constructor Detail

ScilabBoolean

public ScilabBoolean()
Create an empty object


ScilabBoolean

public ScilabBoolean(boolean[][] data)
Create an object from an array of array of boolean

Parameters:
data - the array of boolean

ScilabBoolean

public ScilabBoolean(java.lang.String varName,
                     boolean[][] data,
                     boolean swaped)
Create an object from an array of array of boolean

Parameters:
data - the array of boolean

ScilabBoolean

public ScilabBoolean(boolean value)
Create a scalar boolean from a boolean

Parameters:
value - the boolean
Method Detail

isReference

public boolean isReference()

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

setData

public void setData(boolean[][] data)
Change the value with the provided data

Parameters:
data - array of boolean

getData

public boolean[][] getData()
Return the data

Returns:
the array of array of boolean

getRawData

public java.lang.Object getRawData()
Returns:
the data

getElement

public boolean getElement(int i,
                          int j)
Get the element at position (i, j)

Parameters:
i - the first coordinate
j - the second coordinate
Returns:
the corresponding boolean

setElement

public void setElement(int i,
                       int j,
                       boolean x)
Set the element at position (i, j)

Parameters:
i - the first coordinate
j - the second coordinate
x - the new value

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

getType

public ScilabTypeEnum getType()
Return the type of Scilab

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

getHeight

public int getHeight()
Return the height (number of element) of the stored data

Specified by:
getHeight in interface ScilabType
Returns:
the height

getWidth

public int getWidth()
Return the width (number of element) of the stored data

Specified by:
getWidth in interface ScilabType
Returns:
the width

isEmpty

public boolean isEmpty()
If it is empty / uninitialized

Specified by:
isEmpty in interface ScilabType
Returns:
true if empty

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:
the pretty print