org.scilab.modules.types
Class ScilabString

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

public class ScilabString
extends java.lang.Object
implements ScilabType

This class provides a representation on the Scilab String datatype

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

Example:
String [][]a={{"This","is","my","string"},{"and","I want to", "compare"," them"}};
ScilabString aMatrix = new ScilabString(a);

See Also:
Scilab, Serialized Form

Constructor Summary
ScilabString()
          Default constructor
ScilabString(java.lang.String string)
          Constructor with a unique value
ScilabString(java.lang.String[] data)
          Constructor with vector data.
ScilabString(java.lang.String[][] data)
          Constructor with data.
ScilabString(java.lang.String varName, java.lang.String[][] data, boolean swaped)
          Constructor with data.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare if obj is the same object or not
 java.lang.String[][] getData()
           
 int getHeight()
          Return the height (number of elements) of the stored data
 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 setData(java.lang.String[][] data)
          Set the values.
 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

ScilabString

public ScilabString()
Default constructor


ScilabString

public ScilabString(java.lang.String[][] data)
Constructor with data.

Parameters:
data - the associated data.

ScilabString

public ScilabString(java.lang.String varName,
                    java.lang.String[][] data,
                    boolean swaped)
Constructor with data.

Parameters:
data - the associated data.

ScilabString

public ScilabString(java.lang.String[] data)
Constructor with vector data.

Parameters:
data - the column vector data

ScilabString

public ScilabString(java.lang.String string)
Constructor with a unique value

Parameters:
string - the value
Method Detail

setData

public void setData(java.lang.String[][] data)
Set the values.

Parameters:
data - the values

getType

public ScilabTypeEnum getType()
Return the type of Scilab

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

getData

public java.lang.String[][] getData()
Returns:
the associated values

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

isReference

public boolean isReference()

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

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()

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.

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()