Eidola home

org.eidola.kernel
Class Container.Compilation

java.lang.Object
  |
  +--org.eidola.kernel.Container.Compilation
Direct Known Subclasses:
Element.Compilation, Namespace.Compilation
Enclosing class:
Container

public abstract class Container.Compilation
extends Object

Generates and holds potentially computationally expensive derived structures, and checks the lazy rules of the semantics. To access this derived information, call Container.getCompilation().

See Compiler for information about the compile process.

This class is not synchronized, but is concurrent read safe.


Field Summary
protected  Set contents
           
 
Constructor Summary
Container.Compilation()
          Creates an empty compilation.
 
Method Summary
protected  void addError(LazySemanticViolation error)
          Adds an error to the ones which cropped up during this compilation.
protected abstract  void calculateDerived()
          Calculates any potentially computation-intensive derived structures.
protected  void checkLazy()
          Checks the structure of this container against the lazy rules of the semantics.
 long getCompileVersion()
          Returns the compile version of the container which this compilation corresponds to.
 Set getContents()
          Returns the contents of this container.
 List getErrors()
          Returns the LazySemanticViolations from this compilation, or an empty list if the compilation was sucessful.
 boolean hasErrors()
          Determines whether this compilation was successful.
 boolean isCurrent()
          Determines whether this compilation reflects the most recent version of its associated container.
 void run()
          Performs the compilation.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

contents

protected Set contents
Constructor Detail

Container.Compilation

public Container.Compilation()
Creates an empty compilation.
Method Detail

getCompileVersion

public long getCompileVersion()
Returns the compile version of the container which this compilation corresponds to.

isCurrent

public boolean isCurrent()
Determines whether this compilation reflects the most recent version of its associated container. Note that this does not nececssarily mean that the Compilation is completely up-to-date; under certain circumstances, dependencies between the derived structures of two different containers can take multiple compilations to resolve.

hasErrors

public boolean hasErrors()
Determines whether this compilation was successful. This is the same as asking whether the list of errors is empty.

getErrors

public List getErrors()
Returns the LazySemanticViolations from this compilation, or an empty list if the compilation was sucessful.

getContents

public Set getContents()
Returns the contents of this container.

toString

public String toString()
Overrides:
toString in class Object

run

public void run()
Performs the compilation. This calls calculateDerived() and checkLazy(), in that order. Subclasses can add additional steps.

addError

protected void addError(LazySemanticViolation error)
Adds an error to the ones which cropped up during this compilation.

calculateDerived

protected abstract void calculateDerived()
Calculates any potentially computation-intensive derived structures. For all containers, this should include the set of contents.

checkLazy

protected void checkLazy()
Checks the structure of this container against the lazy rules of the semantics.

For all containers, this method checks that named contents have unique names. Subclasses should override this to do additional checks.


Eidola home