|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--noope.input.BlockReader
This is an abstract class used for reading in the law and entity definitions. This might be from a file, but is abstract, so it could be from anything, for example, a GUI editor program. This is a generic class, could be used for anything using this block format. (This is the syntax accepted by StringBlockReader.)
#any whitespace seperates tokens #string values can use double quote marks to delimit #use \" to put a quote mark inside a string #comments start with a # symbol and extend until end of line #[] denotes optional header [parameter] { key1 value1 # this is an entry key2 value2 key3 value3 ... keyN valueN subheader1 [subparameter1] # this is a block { subkey1 subvalue1 ... subsubheader1 [subsubparameter1] { ... } } header2 [subparameter2] { ... } }The format used for reading in a Physics object is as follows.
# this file is case sensitive # comments start with hash physics { laws { lawHere is an example of using the file format:{ [name "string"] constant1 constant2 ... } } entities { entity [ ] { [name "string"] position velocity inertialMass } Law1 { ... } Law2 { ... } } }
physics { laws { law Gravity { name "Gravity" G 6.67e-23 } } entities { entity { # defaults to Entity class name "Electron" position (0.5,54.5,45.1) velocity 0 # promotes to (0,0,0) inertialMass 9.1e-31 Gravity { mass 9.1e-31 } Electric { charge -1.6e-19 } } } }
Constructor Summary | |
BlockReader()
|
Method Summary | |
void |
assertEmpty()
Throws exception unless BlockReader is empty. |
abstract BlockReaderLocation |
getBlockLocation()
Similar to getEntryLocation |
abstract BlockReaderContext |
getContext(BlockReaderLocation loc)
Converts a Location into a fully-qualified Context object. |
abstract BlockReaderLocation |
getEntryLocation()
Returns a BlockReaderLocation object describing the current Entry location. |
abstract java.lang.String |
getHeader()
Returns the header of this block. |
abstract BlockReader |
getNextBlock()
Returns the next subblock, which is an instance of BlockReader. |
abstract java.lang.String[] |
getNextEntry()
Returns the next Entry, as a string array. |
abstract java.lang.String |
getParameter()
Returns the parameter of this block. |
abstract boolean |
hasMoreBlocks()
Returns TRUE if this block has more Blocks after the one that was last returned |
abstract boolean |
hasMoreEntries()
Returns TRUE if this block has more Entries after the one that was last returned |
abstract BlockReader |
peekNextBlock()
This method acts as getNextBlock() but does not advance position |
abstract java.lang.String[] |
peekNextEntry()
This method acts as getNextEntry() but does not advance position |
abstract void |
seekFirstBlock()
Resets the subblock position to the beginning, so that the next call to getNextBlock() will return the first subblock (unless there are no subblocks, in which case an exception is thrown, of course. |
abstract void |
seekFirstEntry()
Moves the "entry pointer" back to the first Entry, so that the next call to getNextEntry() will return the first one in the block |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BlockReader()
Method Detail |
public abstract java.lang.String getHeader() throws BlockReaderException
public abstract java.lang.String getParameter() throws BlockReaderException
public abstract boolean hasMoreEntries() throws BlockReaderException
public abstract java.lang.String[] getNextEntry() throws BlockReaderException
public abstract java.lang.String[] peekNextEntry() throws BlockReaderException
public abstract void seekFirstEntry() throws BlockReaderException
public abstract BlockReaderLocation getEntryLocation() throws BlockReaderException
public abstract boolean hasMoreBlocks() throws BlockReaderException
public abstract BlockReader getNextBlock() throws BlockReaderException
public abstract BlockReader peekNextBlock() throws BlockReaderException
public abstract void seekFirstBlock() throws BlockReaderException
public abstract BlockReaderLocation getBlockLocation() throws BlockReaderException
public abstract BlockReaderContext getContext(BlockReaderLocation loc) throws BlockReaderException
public void assertEmpty() throws BRLoadingException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |