public class RevisionAnalysis extends Pass
SemanticAnalysis
, this pass determines which
CodeGenerator
s need to have their code generated and which classifiers need to be
trained based on the revisions made to the LBJava source file.
A hard coded classifier, a constraint, or an inference named foo
needs its code
regenerated iff at least one of the following is true:
foo.java
does not exist.
foo.java
, it is determined that the code specifying
foo
has been revised.
foo.java
do not exist, or if they don't have the
expected form, the file will not be overwritten and an error will be generated.
All CodeGenerator
s are also labeled as either "affected" (by a revision) or
"unaffected". An CodeGenerator
named foo
is labeled "affected" iff at
least one of the following is true:
foo
is a hard coded classifier, a constraint, or an inference and either:
CodeGenerator
.
foo
is a learning classifier and at least one of its label or extractor classifiers
is "affected".
A learning classifier named foo
needs to have its code regenerated and retrained iff
at least one of the following is true:
foo.java
does not exist.
foo.java
, it is determined that the code specifying
foo
has been revised.
SemanticAnalysis
Modifier and Type | Field and Description |
---|---|
static Integer |
AFFECTED
Constant representing the "affected" revision status.
|
static boolean |
noChanges
Set to
true iff no code has changed since the compiler was last run. |
static Integer |
REVISED
Constant representing the "revised" revision status.
|
static HashMap |
revisionStatus
Keeps track of the names of classifiers whose revision status has been resolved.
|
static String[] |
statusNames
The names of the three revision states.
|
static Integer |
UNAFFECTED
Constant representing the "unaffected" revision status.
|
ast, canAddErrorsAndWarnings, fatalError, root
Constructor and Description |
---|
RevisionAnalysis(AST ast)
Instantiates a pass that runs on an entire
AST . |
Modifier and Type | Method and Description |
---|---|
static void |
printRevisionStatus()
Prints the contents of
revisionStatus to STDOUT . |
void |
run(ClassifierName cn)
Runs this pass on all nodes of the indicated type.
|
void |
run(CodedClassifier cc)
Runs this pass on all nodes of the indicated type.
|
void |
run(CompositeGenerator cg)
Runs this pass on all nodes of the indicated type.
|
void |
run(Conjunction c)
Runs this pass on all nodes of the indicated type.
|
void |
run(ConstraintDeclaration cd)
Runs this pass on all nodes of the indicated type.
|
void |
run(DeclarationList list)
Runs this pass on all nodes of the indicated type.
|
void |
run(InferenceDeclaration id)
Runs this pass on all nodes of the indicated type.
|
void |
run(InferenceInvocation i)
Runs this pass on all nodes of the indicated type.
|
void |
run(LearningClassifierExpression lce)
Runs this pass on all nodes of the indicated type.
|
static String |
statusToString(Integer status)
Returns the name of a revision status, or
"no status" if the status is
null . |
printErrorsAndWarnings, reportError, reportWarning, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, runOnChildren, setRoot
public static final Integer UNAFFECTED
public static final Integer AFFECTED
public static final Integer REVISED
public static final String[] statusNames
public static HashMap revisionStatus
public static boolean noChanges
true
iff no code has changed since the compiler was last run.public RevisionAnalysis(AST ast)
AST
.ast
- The program to run this pass on.public static void printRevisionStatus()
revisionStatus
to STDOUT
.public static String statusToString(Integer status)
"no status"
if the status is
null
.public void run(DeclarationList list)
public void run(LearningClassifierExpression lce)
public void run(ClassifierName cn)
public void run(CodedClassifier cc)
public void run(CompositeGenerator cg)
public void run(Conjunction c)
public void run(InferenceInvocation i)
public void run(ConstraintDeclaration cd)
public void run(InferenceDeclaration id)
Copyright © 2016. All rights reserved.