opale.tools
Class OpaleObject

java.lang.Object
  |
  +--opale.tools.OpaleObject
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
MarkType, Object2D, ObjectODE, OIJ

public abstract class OpaleObject
extends java.lang.Object
implements java.lang.Cloneable

Many classes of Opale extend this abstract class. It makes it possible to read/write in a stream with an user language.

Since:
Opale-tools 0.14 (OpaleV1b5)

Constructor Summary
protected OpaleObject()
           
 
Method Summary
 java.lang.Object clone()
          Return a "clone object" but with an id set at null pointer.
 java.lang.String getId()
          Return the string identifcator of this object.
 void read(java.io.StreamTokenizer f, OpaleSet session)
          This method read the data in a file at format '.opa' .
abstract  int readKeyWord(java.lang.String s, java.io.StreamTokenizer f, OpaleSet session)
          Abstract method to read a key word in a file '*.ode'.
 int setId(java.lang.String i)
          Set the id of this object.
abstract  void write(java.io.PrintWriter f, OpaleSet session)
          Abstrcat method to write the current object in a stream.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpaleObject

protected OpaleObject()
Method Detail

getId

public final java.lang.String getId()
Return the string identifcator of this object.
Returns:
String, the id.

setId

public final int setId(java.lang.String i)
Set the id of this object. It's not possible to set an id if the object has already an id : in this case this method return -1. Moreover if the id exists, an instance of opale.tools.InvalidIdException is thrown. In other case it returns a positive integer.
Returns:
String, the id.

read

public void read(java.io.StreamTokenizer f,
                 OpaleSet session)
          throws java.io.IOException,
                 InvalidFormatException
This method read the data in a file at format '.opa' . It calls the abstract method readKeyword implemented in the derivated classes.
Parameters:
StreamTokenizer - f, stream to read.
OpaleSet - session, the group of object that are read in the stream.

readKeyWord

public abstract int readKeyWord(java.lang.String s,
                                java.io.StreamTokenizer f,
                                OpaleSet session)
                         throws java.io.IOException,
                                InvalidFormatException
Abstract method to read a key word in a file '*.ode'.
Parameters:
String - s, key word to read.
StreamTokenizer - f, stream to read.
OpaleSet - session, the group of 'Opale' object
Returns:
int, 0 if the key word is correct, -1 otherwise.

write

public abstract void write(java.io.PrintWriter f,
                           OpaleSet session)
                    throws InvalidFormatException
Abstrcat method to write the current object in a stream.
Parameters:
printWriter - f, a stream.
OpaleSet - session, the set of 'Opale' object.

clone

public java.lang.Object clone()
Return a "clone object" but with an id set at null pointer.
Overrides:
clone in class java.lang.Object
Returns:
Object