Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.pqt.autorib.instr
Class InstrWReader  view InstrWReader download InstrWReader.java

java.lang.Object
  extended byorg.pqt.autorib.instr.InstrWReader

public class InstrWReader
extends java.lang.Object

This class provides routines for reading and writing Instr (instrutions) files, for storing their contents, and for applying them to RIB.

The writing routines are used for debugging only.


Field Summary
 java.util.Vector addedLights
          this stores any lights added by FrameRIB (or, indeed, globalRIB)
private  java.util.Vector content
          this holds the contents of the instructions file
 boolean globalOrFrameRIB
          this records whether we need to process any RIB added by GlobalRIB or FrameRIB
 boolean inForBlock
          true if we are reading instructions from within a for block
 boolean inLightBlock
          true if we are currently reading instructions from within a lights block
 boolean inObjectBlock
          true if we are reading instructions inside an Objects block
 org.pqt.autorib.util.NameGroupManager nameGroupManager
          this is used to manage the numbering of groups of individual primitives by name
 org.pqt.autorib.util.NameNumberManager nameNumberManager
          this manages name / number lookups
private  boolean pushedBack
          true if rq holds a token that has been pushed back
 int requestsRead
          the number of requests read in this and archived files
 org.pqt.autorib.rib.RIBWReader rib
          used to hold the rib stream being processed
private  InstrRequest rq
          used to hold the current instruction being read in
 InstrState state
          the current state, by which we mean map dimensions, filtering etc.
private  java.util.Stack stateStack
          used for saving and restoring the state within blocks
 java.util.Hashtable storedPrefs
          this stores saved Pref values from objects
 InstrTokenizer tokenizer
          a tokenizer for the instructions file
 
Constructor Summary
InstrWReader(java.lang.String name)
          Open the named Instr file
 
Method Summary
private  int findID(java.lang.String name)
          find the id of a given instruction request
 void process(org.pqt.autorib.rib.RIBWReader ribp, org.pqt.autorib.rib.RIBLight light)
          process an individual light - go through the instructions file calling the process functions of all instuctions
 void process(org.pqt.autorib.rib.RIBWReader ribp, org.pqt.autorib.rib.RIBObjectGroup object)
          Process an object,
 void process(org.pqt.autorib.rib.RIBWReader ribp, java.util.Vector header, org.pqt.autorib.rib.RIBOptionRec option, int instr)
          process the rib file and add rib.
 void processMisc(org.pqt.autorib.rib.RIBWReader ribp, org.pqt.autorib.rib.RIBOptionRec option)
           
 void pushBack()
          Push back the most recently read instruction, so that it will be returned in response to the next read
 void read()
          Read in the whole instuctions file
 InstrRequest readRequest()
          Read in a single request
 void readToEndBlock(java.util.Vector content, int[] valid)
          read a block assuming the opening brace '{' has already been read
 void restoreState()
          restore the state from the top of the stack
 void saveState()
          push the current state onto a stack to be retrieved later
 void write(java.io.Writer outStream)
          write out the entire contents of the stored instructions file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stateStack

private java.util.Stack stateStack
used for saving and restoring the state within blocks


state

public InstrState state
the current state, by which we mean map dimensions, filtering etc.


tokenizer

public InstrTokenizer tokenizer
a tokenizer for the instructions file


rq

private InstrRequest rq
used to hold the current instruction being read in


requestsRead

public int requestsRead
the number of requests read in this and archived files


pushedBack

private boolean pushedBack
true if rq holds a token that has been pushed back


content

private java.util.Vector content
this holds the contents of the instructions file


inLightBlock

public boolean inLightBlock
true if we are currently reading instructions from within a lights block


inForBlock

public boolean inForBlock
true if we are reading instructions from within a for block


inObjectBlock

public boolean inObjectBlock
true if we are reading instructions inside an Objects block


rib

public org.pqt.autorib.rib.RIBWReader rib
used to hold the rib stream being processed


globalOrFrameRIB

public boolean globalOrFrameRIB
this records whether we need to process any RIB added by GlobalRIB or FrameRIB


addedLights

public java.util.Vector addedLights
this stores any lights added by FrameRIB (or, indeed, globalRIB)


nameGroupManager

public org.pqt.autorib.util.NameGroupManager nameGroupManager
this is used to manage the numbering of groups of individual primitives by name


nameNumberManager

public org.pqt.autorib.util.NameNumberManager nameNumberManager
this manages name / number lookups


storedPrefs

public java.util.Hashtable storedPrefs
this stores saved Pref values from objects

Constructor Detail

InstrWReader

public InstrWReader(java.lang.String name)
             throws org.pqt.autorib.tokenizer.FormatException,
                    java.io.FileNotFoundException
Open the named Instr file

Method Detail

readRequest

public InstrRequest readRequest()
                         throws org.pqt.autorib.tokenizer.FormatException,
                                java.io.IOException
Read in a single request


readToEndBlock

public void readToEndBlock(java.util.Vector content,
                           int[] valid)
                    throws org.pqt.autorib.tokenizer.FormatException,
                           java.io.IOException
read a block assuming the opening brace '{' has already been read


read

public void read()
          throws org.pqt.autorib.tokenizer.FormatException,
                 java.io.IOException
Read in the whole instuctions file


write

public void write(java.io.Writer outStream)
           throws java.io.IOException
write out the entire contents of the stored instructions file


pushBack

public void pushBack()
Push back the most recently read instruction, so that it will be returned in response to the next read


saveState

public void saveState()
push the current state onto a stack to be retrieved later


restoreState

public void restoreState()
restore the state from the top of the stack


process

public void process(org.pqt.autorib.rib.RIBWReader ribp,
                    org.pqt.autorib.rib.RIBLight light)
             throws java.io.IOException,
                    org.pqt.autorib.tokenizer.FormatException
process an individual light - go through the instructions file calling the process functions of all instuctions


process

public void process(org.pqt.autorib.rib.RIBWReader ribp,
                    org.pqt.autorib.rib.RIBObjectGroup object)
             throws java.io.IOException,
                    org.pqt.autorib.tokenizer.FormatException
Process an object,


process

public void process(org.pqt.autorib.rib.RIBWReader ribp,
                    java.util.Vector header,
                    org.pqt.autorib.rib.RIBOptionRec option,
                    int instr)
             throws java.io.IOException,
                    org.pqt.autorib.tokenizer.FormatException
process the rib file and add rib. This function is used to add the rib specified in the GlobalRIB and FrameRIB instructions cf the AddRIB instruction which works on a per object/light basis


processMisc

public void processMisc(org.pqt.autorib.rib.RIBWReader ribp,
                        org.pqt.autorib.rib.RIBOptionRec option)
                 throws java.io.IOException,
                        org.pqt.autorib.tokenizer.FormatException

findID

private int findID(java.lang.String name)
            throws org.pqt.autorib.tokenizer.FormatException
find the id of a given instruction request