Search in sources :

Example 1 with DynamicDependency

use of pcgen.base.formula.base.DynamicDependency in project pcgen by PCGen.

the class DropIntoContext method getDependencies.

@Override
public void getDependencies(DependencyVisitor visitor, DependencyManager fdm, Node[] args) {
    String legalScopeName = ((ASTQuotString) args[0]).getText();
    TrainingStrategy ts = new TrainingStrategy();
    DependencyManager trainer = fdm.getWith(DependencyManager.VARSTRATEGY, ts);
    if (args[1] instanceof ASTQuotString) {
    //Direct,  no dependencies
    } else if (args[1] instanceof ASTPCGenSingleWord) {
        //Variable
        args[1].jjtAccept(visitor, trainer);
    } else {
    //Error
    }
    DynamicDependency dd = new DynamicDependency(ts.getControlVar(), legalScopeName);
    fdm.get(DependencyManager.DYNAMIC).addDependency(dd);
    DependencyManager dynamic = fdm.getWith(DependencyManager.VARSTRATEGY, dd);
    //Rest of Equation
    args[2].jjtAccept(visitor, dynamic);
}
Also used : DynamicDependency(pcgen.base.formula.base.DynamicDependency) TrainingStrategy(pcgen.base.formula.base.TrainingStrategy) ASTQuotString(pcgen.base.formula.parse.ASTQuotString) DependencyManager(pcgen.base.formula.base.DependencyManager) ASTQuotString(pcgen.base.formula.parse.ASTQuotString) ASTPCGenSingleWord(pcgen.base.formula.parse.ASTPCGenSingleWord)

Aggregations

DependencyManager (pcgen.base.formula.base.DependencyManager)1 DynamicDependency (pcgen.base.formula.base.DynamicDependency)1 TrainingStrategy (pcgen.base.formula.base.TrainingStrategy)1 ASTPCGenSingleWord (pcgen.base.formula.parse.ASTPCGenSingleWord)1 ASTQuotString (pcgen.base.formula.parse.ASTQuotString)1