org.scilab.modules.types
Class ScilabPolynomial

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

public class ScilabPolynomial
extends java.lang.Object
implements ScilabType

This class provides a representation on the Scilab Polynomial datatype

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

TODO Sly: faire de la doc

See Also:
Scilab, Serialized Form

Constructor Summary
ScilabPolynomial()
          Default constructor
ScilabPolynomial(double[] data)
          Constructor with a unique polynomial.
ScilabPolynomial(double[][][] data)
          Constructor with a matrix of real polynomials.
ScilabPolynomial(double[][][] realData, double[][][] imagData)
          Constructor with a matrix of complex polynomials
ScilabPolynomial(double[][][] realData, double[][][] imagData, java.lang.String polyVarName)
          Constructor with a matrix of complex polynomials
ScilabPolynomial(double[][][] data, java.lang.String polyVarName)
          Constructor with a matrix of real polynomials.
ScilabPolynomial(double[] realData, double[] imagData)
          Constructor with a unique complex polynomial.
ScilabPolynomial(double[] realData, double[] imagData, java.lang.String polyVarName)
          Constructor with a unique complex polynomial.
ScilabPolynomial(double[] data, java.lang.String polyVarName)
          Constructor with a unique polynomial.
ScilabPolynomial(java.lang.String varName, java.lang.String polyVarName, double[][][] realData, double[][][] imagData, boolean swaped)
          Constructor with a matrix of complex polynomials
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare if obj is the same object or not
 int getHeight()
          Return the height (number of elements) of the stored data
 double[][][] getImaginaryPart()
          Get the imaginary part of the data.
 java.lang.String getPolyVarName()
          Get the polynomila variable name
 double[][][] getRealPart()
          Get the real part of the data.
 double[][] getSerializedComplexPolynomial()
          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 isReal()
          Check if the current data doesn't have an imaginary part.
 boolean isReference()
          
 boolean isSwaped()
          Get the how the matrix is stored
 void readExternal(java.io.ObjectInput in)
           
 void setImaginaryPart(double[][][] imaginaryPart)
          Set the imaginary part of the data.
 void setPolyVarName(java.lang.String polyVarName)
           
 void setRealPart(double[][][] realPart)
          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

ScilabPolynomial

public ScilabPolynomial()
Default constructor


ScilabPolynomial

public ScilabPolynomial(double[] data)
Constructor with a unique polynomial.

Parameters:
data - the unique polynomial

ScilabPolynomial

public ScilabPolynomial(double[] data,
                        java.lang.String polyVarName)
Constructor with a unique polynomial.

Parameters:
data - the unique polynomial

ScilabPolynomial

public ScilabPolynomial(double[] realData,
                        double[] imagData)
Constructor with a unique complex polynomial.

Parameters:
realData - the real part
imagData - the complex part

ScilabPolynomial

public ScilabPolynomial(double[] realData,
                        double[] imagData,
                        java.lang.String polyVarName)
Constructor with a unique complex polynomial.

Parameters:
realData - the real part
imagData - the complex part

ScilabPolynomial

public ScilabPolynomial(double[][][] data)
Constructor with a matrix of real polynomials.

Parameters:
data - the data

ScilabPolynomial

public ScilabPolynomial(double[][][] data,
                        java.lang.String polyVarName)
Constructor with a matrix of real polynomials.

Parameters:
data - the data

ScilabPolynomial

public ScilabPolynomial(double[][][] realData,
                        double[][][] imagData)
Constructor with a matrix of complex polynomials

Parameters:
realData - the real part of the data
imagData - the imaginary part of the data

ScilabPolynomial

public ScilabPolynomial(double[][][] realData,
                        double[][][] imagData,
                        java.lang.String polyVarName)
Constructor with a matrix of complex polynomials

Parameters:
realData - the real part of the data
imagData - the imaginary part of the data

ScilabPolynomial

public ScilabPolynomial(java.lang.String varName,
                        java.lang.String polyVarName,
                        double[][][] realData,
                        double[][][] imagData,
                        boolean swaped)
Constructor with a matrix of complex polynomials

Parameters:
varName - the variable name
polyVarName - the polynomial variable name
realData - the real part of the data
imagData - the imaginary part of the data
swaped - if true the matrix is stored row by row
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.

isReal

public boolean isReal()
Check if the current data doesn't have an imaginary part.

Returns:
true, if the data are real only.

getRealPart

public double[][][] getRealPart()
Get the real part of the data.

Returns:
the real part.

setRealPart

public void setRealPart(double[][][] realPart)
Set the real part of the data.

Parameters:
realPart - the real part.

getImaginaryPart

public double[][][] getImaginaryPart()
Get the imaginary part of the data.

Returns:
the imaginary part.

setImaginaryPart

public void setImaginaryPart(double[][][] imaginaryPart)
Set the imaginary part of the data.

Parameters:
imaginaryPart - the imaginary part.

getPolyVarName

public java.lang.String getPolyVarName()
Get the polynomila variable name

Returns:
the name

setPolyVarName

public void setPolyVarName(java.lang.String polyVarName)

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

getSerializedComplexPolynomial

public double[][] getSerializedComplexPolynomial()
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()