iicm.vrml.pw
Class Field

java.lang.Object
  extended by iicm.vrml.pw.Field
Direct Known Subclasses:
MultiField, SFBool, SFColor, SFFloat, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f

public abstract class Field
extends java.lang.Object

Field - Field base class Copyright (c) 1996,97 IICM

Version:
0.5, latest change: 31 Jan 97
Author:
Michael Pichler, Karin Roschker, Andreas Pesendorfer

Field Summary
protected  boolean changed
           
protected  int class_
           
private  boolean enableRoutes_
           
static int F_EVENTIN
           
static int F_EVENTOUT
           
static int F_EXPOSEDFIELD
           
static int F_FIELD
           
(package private) static java.lang.String[] fieldClassName
           
private  java.util.Vector goteventcb_
           
(package private) static java.lang.String IS_KEYWORD
           
(package private)  boolean protoIS
           
 java.lang.String protoIScontent
           
 Field protoISfield
           
(package private)  java.lang.String protoISname
           
protected  boolean readerror
           
(package private)  java.util.Vector receiver_
           
static java.lang.String STR_EVENTIN
           
static java.lang.String STR_EVENTOUT
           
static java.lang.String STR_EXPOSEDFIELD
           
(package private) static java.lang.String STR_FALSE
           
static java.lang.String STR_FIELD
           
(package private) static java.lang.String STR_NULL
           
(package private) static java.lang.String STR_TRUE
           
static java.lang.String STR_X3d_EVENTIN
           
static java.lang.String STR_X3d_EVENTOUT
           
static java.lang.String STR_X3d_EXPOSEDFIELD
           
static java.lang.String STR_X3d_FIELD
           
(package private)  double timeOfChange_
           
 
Constructor Summary
Field()
           
 
Method Summary
(package private)  void addReceiver(Field eventIn)
          add eventIn to receiver-list.
(package private) abstract  void copyValue(Field source)
          copy field's value(s) to this field (of same type, non-null)
(package private)  void disableRoutes()
          avoid sending eventOuts.
(package private)  void enableRoutes()
          allow sending eventOuts.
abstract  java.lang.String fieldName()
          the field's type name
static java.lang.String fieldNameToX3d(java.lang.String name)
           
 int getFieldClass()
          get field class
 java.lang.String getFieldClassName()
          get field class name
(package private)  java.lang.String getIScontent()
           
(package private) abstract  Field newFieldInstance()
          create a new instance of the prototyped field changed flags etc. will be virgin (not taken from proto field)
(package private)  boolean readBoolValue(StrTokenizer st)
          read a boolean field
 boolean readError()
           
(package private)  void readFieldValue(VRMLparser parser)
          read field's value(s), which may be a prototyped field (IS).
(package private)  double readFloatValue(StrTokenizer st)
          read a float/double field
(package private)  int readIntValue(StrTokenizer st)
          read an integer field (32 bit)
(package private)  boolean readISdeclaration(VRMLparser parser)
          check for occurance of an IS clause (inside PROTO).
(package private)  boolean readISdeclaration(VRMLparser parser, java.lang.String content)
           
(package private)  java.lang.String readStringValue(StrTokenizer st)
          read a String field, must be enclosed in quotes ("").
(package private) abstract  void readValue(VRMLparser parser)
          read field's value(s); sets changed and/or readerror flags accordingly
private  void receiveEvent(double timestamp, Field sender)
          receive an event and send it to all receiver of the sender
(package private)  boolean removeReceiver(Field eventIn)
          remove eventIn from receiver-liat.
(package private)  boolean routeExists(Field target)
          check whether a route exists to a reciever
 void sendEvent(double timestamp)
          send an event. actual value to be set before with setValue
 void setEventCallback(GotEventCallback cb)
           
(package private)  void setFieldClass(int fclass)
          set field class
(package private)  void setIScontent(java.lang.String content)
           
 boolean wasChanged()
           
(package private)  void writeFieldValue(java.io.PrintStream os, java.util.Hashtable writtenrefs)
          write field's value(s), which may be a prototyped field (IS)
(package private) abstract  void writeValue(java.io.PrintStream os, java.util.Hashtable writtenrefs)
          write field's value(s) to an output stream
(package private)  void writeX3dFieldValue(java.io.PrintStream os, java.util.Hashtable writtenrefs)
           
(package private) abstract  void writeX3dValue(java.io.PrintStream os, java.util.Hashtable writtenrefs)
          write field's value(s) to an x3d output stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STR_TRUE

static final java.lang.String STR_TRUE
See Also:
Constant Field Values

STR_FALSE

static final java.lang.String STR_FALSE
See Also:
Constant Field Values

STR_NULL

static final java.lang.String STR_NULL
See Also:
Constant Field Values

IS_KEYWORD

static final java.lang.String IS_KEYWORD
See Also:
Constant Field Values

F_FIELD

public static final int F_FIELD
See Also:
Constant Field Values

F_EVENTIN

public static final int F_EVENTIN
See Also:
Constant Field Values

F_EVENTOUT

public static final int F_EVENTOUT
See Also:
Constant Field Values

F_EXPOSEDFIELD

public static final int F_EXPOSEDFIELD
See Also:
Constant Field Values

STR_FIELD

public static final java.lang.String STR_FIELD
See Also:
Constant Field Values

STR_EXPOSEDFIELD

public static final java.lang.String STR_EXPOSEDFIELD
See Also:
Constant Field Values

STR_EVENTIN

public static final java.lang.String STR_EVENTIN
See Also:
Constant Field Values

STR_EVENTOUT

public static final java.lang.String STR_EVENTOUT
See Also:
Constant Field Values

STR_X3d_FIELD

public static final java.lang.String STR_X3d_FIELD
See Also:
Constant Field Values

STR_X3d_EXPOSEDFIELD

public static final java.lang.String STR_X3d_EXPOSEDFIELD
See Also:
Constant Field Values

STR_X3d_EVENTIN

public static final java.lang.String STR_X3d_EVENTIN
See Also:
Constant Field Values

STR_X3d_EVENTOUT

public static final java.lang.String STR_X3d_EVENTOUT
See Also:
Constant Field Values

fieldClassName

static final java.lang.String[] fieldClassName

class_

protected int class_

changed

protected boolean changed

readerror

protected boolean readerror

protoISfield

public Field protoISfield

protoISname

java.lang.String protoISname

protoIScontent

public java.lang.String protoIScontent

protoIS

boolean protoIS

receiver_

java.util.Vector receiver_

enableRoutes_

private boolean enableRoutes_

goteventcb_

private java.util.Vector goteventcb_

timeOfChange_

double timeOfChange_
Constructor Detail

Field

public Field()
Method Detail

setEventCallback

public void setEventCallback(GotEventCallback cb)

setFieldClass

void setFieldClass(int fclass)
set field class


getFieldClass

public int getFieldClass()
get field class


getFieldClassName

public java.lang.String getFieldClassName()
get field class name


fieldName

public abstract java.lang.String fieldName()
the field's type name


newFieldInstance

abstract Field newFieldInstance()
create a new instance of the prototyped field changed flags etc. will be virgin (not taken from proto field)


readFieldValue

void readFieldValue(VRMLparser parser)
              throws java.io.IOException
read field's value(s), which may be a prototyped field (IS).

Throws:
java.io.IOException
See Also:
readISdeclaration(iicm.vrml.pw.VRMLparser), readValue(iicm.vrml.pw.VRMLparser)

readISdeclaration

boolean readISdeclaration(VRMLparser parser)
                    throws java.io.IOException
check for occurance of an IS clause (inside PROTO). on nested protos only the innermost may provide fields to use

Returns:
flag wheter an IS clause was actually found and read
Throws:
java.io.IOException

readISdeclaration

boolean readISdeclaration(VRMLparser parser,
                          java.lang.String content)
                    throws java.io.IOException
Throws:
java.io.IOException

setIScontent

void setIScontent(java.lang.String content)

getIScontent

java.lang.String getIScontent()

routeExists

boolean routeExists(Field target)
check whether a route exists to a reciever


addReceiver

void addReceiver(Field eventIn)
add eventIn to receiver-list. caller should check whether routeExists first, to avoid identical routes


removeReceiver

boolean removeReceiver(Field eventIn)
remove eventIn from receiver-liat.


enableRoutes

void enableRoutes()
allow sending eventOuts.


disableRoutes

void disableRoutes()
avoid sending eventOuts.


sendEvent

public void sendEvent(double timestamp)
send an event. actual value to be set before with setValue


receiveEvent

private void receiveEvent(double timestamp,
                          Field sender)
receive an event and send it to all receiver of the sender


copyValue

abstract void copyValue(Field source)
copy field's value(s) to this field (of same type, non-null)


readValue

abstract void readValue(VRMLparser parser)
                 throws java.io.IOException
read field's value(s); sets changed and/or readerror flags accordingly

Throws:
java.io.IOException

writeFieldValue

void writeFieldValue(java.io.PrintStream os,
                     java.util.Hashtable writtenrefs)
write field's value(s), which may be a prototyped field (IS)


writeX3dFieldValue

void writeX3dFieldValue(java.io.PrintStream os,
                        java.util.Hashtable writtenrefs)

writeValue

abstract void writeValue(java.io.PrintStream os,
                         java.util.Hashtable writtenrefs)
write field's value(s) to an output stream


writeX3dValue

abstract void writeX3dValue(java.io.PrintStream os,
                            java.util.Hashtable writtenrefs)
write field's value(s) to an x3d output stream


wasChanged

public final boolean wasChanged()
Returns:
flag whether field value was changed after construction

readError

public final boolean readError()
Returns:
flag whether an error occured on reading value

readBoolValue

final boolean readBoolValue(StrTokenizer st)
                     throws java.io.IOException
read a boolean field

Throws:
java.io.IOException

readStringValue

final java.lang.String readStringValue(StrTokenizer st)
                                throws java.io.IOException
read a String field, must be enclosed in quotes (""). quotes themselves are not part of the string

Throws:
java.io.IOException

readIntValue

final int readIntValue(StrTokenizer st)
                throws java.io.IOException
read an integer field (32 bit)

Throws:
java.io.IOException

readFloatValue

final double readFloatValue(StrTokenizer st)
                     throws java.io.IOException
read a float/double field

Throws:
java.io.IOException

fieldNameToX3d

public static java.lang.String fieldNameToX3d(java.lang.String name)