sisc.ser
Class LibraryAE

java.lang.Object
  extended by sisc.util.Util
      extended by sisc.data.Expression
          extended by sisc.data.Value
              extended by sisc.env.MemorySymEnv
                  extended by sisc.ser.LibraryAE
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, Immediate, NamedValue, SymbolicEnvironment, ExpressionVisitee, Version

public class LibraryAE
extends MemorySymEnv

An SymEnv backed by a random-access library. It can operate in two modes: 1) "observe" - keep track of bindings from which to later create a library 2) "retrieve" - access bindings in a library

See Also:
Serialized Form

Field Summary
protected  java.util.Map addressMap
           
protected  Library base
           
protected  java.util.Set bindWatch
           
protected  LibraryBuilder lb
           
protected  int parentIdx
           
 
Fields inherited from class sisc.env.MemorySymEnv
env, EXPFACT, nextFree, parent, sidecars, symbolMap
 
Fields inherited from class sisc.data.Expression
annotations, EMPTYSET
 
Fields inherited from class sisc.util.Util
BACKQUOTE, BEGIN, bundles, caseSensitive, EMPTYLIST, EMPTYVEC, EOF, ERRORK, EVAL, EXPSC, EXPTOP, FALSE, FCONT, FIVE, JEXCEPTION, LAMBDA, LOCATION, maxFloatPrecision, MESSAGE, minFloatPrecision, NAME, OTHER, PARENT, permitInterrupts, QUOTE, QUOTESYM, REPORT, SETBANG, SISC, SISC_SPECIFIC, SISCB, SOURCE_COLUMN, SOURCE_FILE, SOURCE_LINE, SYMENV, THIS, TOPLEVEL, TRUE, UNQUOTE, UNQUOTE_SPLICING, VOID, ZV
 
Fields inherited from interface sisc.util.Version
VERSION
 
Constructor Summary
LibraryAE()
           
LibraryAE(Library base)
          Operate in "retrieve" mode.
LibraryAE(SymbolicEnvironment parent, LibraryBuilder lb)
          Operate in "observe" mode.
LibraryAE(Symbol name, LibraryBuilder lb)
          Operate in "observe" mode.
 
Method Summary
 void addBinding(Library lib, Symbol sym, int ep)
           
 void addSymbolicBindings(Library lib, Pair s)
           
 void deserialize(Deserializer d)
          All Expressions must implement a default (no-argument) constructor.
 int getLoc(Symbol s)
           
 SymbolicEnvironment getParent()
           
 void serialize(Serializer s)
          All Expressions must implement a default (no-argument) constructor.
 int store(Symbol s, Value v)
          Catch all occurences of sets and note them for when we serialize
 void undefine(Symbol s)
           
 boolean visit(ExpressionVisitor v)
           
 
Methods inherited from class sisc.env.MemorySymEnv
asValue, define, deserializeSidecar, display, expand, getSidecarEnvironment, lookup, lookup, serializeSidecar, set, setParent, trim, visitSidecar
 
Methods inherited from class sisc.data.Value
apply, displayNamedOpaque, equals, eqv, eval, express, getValue, synopsis, synopsis, toString, valueEqual, valueHashCode, write, writeReplace
 
Methods inherited from class sisc.data.Expression
deserializeAnnotations, getAnnotation, getAnnotation, getAnnotationKeys, getAnnotations, getName, readExternal, readResolve, serializeAnnotations, setAnnotation, setAnnotation, setName, visitAnnotations, writeExternal
 
Methods inherited from class sisc.util.Util
annotated, annotatedAppEval, append, argCheck, argsToSymbols, assq, bininport, bininstream, binoutport, binoutstream, box, character, charinport, charinreader, charoutport, charoutwriter, charsetFromString, chr, cont, currentClassLoader, env, error, error, error, error, error, error, error, expr, getDefaultCharacterSet, immutablePair, immutableVector, inport, javaExceptionToString, javaWrap, justify, length, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, liMessage, list, list, list, list, list, makeURL, mapcar, memq, nlib, num, outport, pair, pairToExpressions, pairToExpVect, pairToValues, proc, read, registerBundle, reverse, reverseInPlace, simpleErrorToString, sourceAnnotations, str, string, sym, symbol, symval, truePair, truth, truth, typeError, typeError, updateName, url, url, url, valArrayToList, valArrayToList, valArrayToVec, vec, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface sisc.env.SymbolicEnvironment
getName, setName
 
Methods inherited from interface sisc.data.NamedValue
getName, setName
 

Field Detail

lb

protected LibraryBuilder lb

base

protected Library base

addressMap

protected java.util.Map addressMap

bindWatch

protected java.util.Set bindWatch

parentIdx

protected int parentIdx
Constructor Detail

LibraryAE

public LibraryAE(Symbol name,
                 LibraryBuilder lb)
Operate in "observe" mode.

Parameters:
name - the name of the SymEnv
lb - the library serializer

LibraryAE

public LibraryAE(SymbolicEnvironment parent,
                 LibraryBuilder lb)
Operate in "observe" mode.

Parameters:
parent - the name of the parent SymEnv
lb - the library serializer

LibraryAE

public LibraryAE(Library base)
Operate in "retrieve" mode.

Parameters:
base - the library from which to retrieve bindings

LibraryAE

public LibraryAE()
Method Detail

getParent

public SymbolicEnvironment getParent()
Specified by:
getParent in interface SymbolicEnvironment
Overrides:
getParent in class MemorySymEnv

addSymbolicBindings

public void addSymbolicBindings(Library lib,
                                Pair s)

addBinding

public void addBinding(Library lib,
                       Symbol sym,
                       int ep)

undefine

public void undefine(Symbol s)
Specified by:
undefine in interface SymbolicEnvironment
Overrides:
undefine in class MemorySymEnv

getLoc

public int getLoc(Symbol s)
Specified by:
getLoc in interface SymbolicEnvironment
Overrides:
getLoc in class MemorySymEnv

store

public int store(Symbol s,
                 Value v)
Catch all occurences of sets and note them for when we serialize

Overrides:
store in class MemorySymEnv
Parameters:
s - the key being set
v - the value associated with the key
Returns:
index of binding

deserialize

public void deserialize(Deserializer d)
                 throws java.io.IOException
Description copied from class: Expression
All Expressions must implement a default (no-argument) constructor. Those that wish to b serialized to a heap must implement both this and the serialize method. The Expression may use any method of the DataInput stream and the Deserializer serialization context to read its state.

Specified by:
deserialize in interface SymbolicEnvironment
Overrides:
deserialize in class MemorySymEnv
Parameters:
d - the Deserializer
Throws:
java.io.IOException

serialize

public void serialize(Serializer s)
               throws java.io.IOException
Description copied from class: Expression
All Expressions must implement a default (no-argument) constructor. Those that wish to be serialized to a heap must implement both this and the deserialize method. The Expression may use any method of the Serializer, which implements java.io.DataOutput to write its state.

Specified by:
serialize in interface SymbolicEnvironment
Overrides:
serialize in class MemorySymEnv
Parameters:
s - the Serializer
Throws:
java.io.IOException

visit

public boolean visit(ExpressionVisitor v)
Specified by:
visit in interface ExpressionVisitee
Overrides:
visit in class MemorySymEnv