use of pcgen.base.formula.base.DependencyManager 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);
}
use of pcgen.base.formula.base.DependencyManager in project pcgen by PCGen.
the class AbstractFormulaTestCase method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
setup = new SplitFormulaSetup();
LegalScopeUtilities.loadLegalScopeLibrary(setup.getLegalScopeLibrary());
localSetup = new IndividualSetup(setup, "Global", new MonitorableVariableStore());
setup.getSolverFactory().addSolverFormat(Number.class, new Modifier() {
@Override
public Object process(EvaluationManager manager) {
return 0;
}
@Override
public void getDependencies(DependencyManager fdm) {
}
@Override
public long getPriority() {
return 0;
}
@Override
public Class getVariableFormat() {
return Number.class;
}
@Override
public String getIdentification() {
return "SET";
}
@Override
public String getInstructions() {
return "0";
}
});
setup.getSolverFactory().addSolverFormat(String.class, new Modifier() {
@Override
public Object process(EvaluationManager manager) {
return "";
}
@Override
public void getDependencies(DependencyManager fdm) {
}
@Override
public long getPriority() {
return 0;
}
@Override
public Class getVariableFormat() {
return String.class;
}
@Override
public String getIdentification() {
return "SET";
}
@Override
public String getInstructions() {
return "";
}
});
}
use of pcgen.base.formula.base.DependencyManager in project pcgen by PCGen.
the class AbstractFormulaTestCase method getVariables.
protected List<VariableID<?>> getVariables(SimpleNode node) {
DependencyManager fdm = generateDependencyManager(getFormulaManager(), getGlobalScopeInst(), null);
new DependencyVisitor().visit(node, fdm);
return fdm.getVariables();
}
use of pcgen.base.formula.base.DependencyManager in project pcgen by PCGen.
the class AbstractFormulaTestCase method getVariables.
protected List<VariableID<?>> getVariables(SimpleNode node) {
DependencyManager fdm = managerFactory.generateDependencyManager(getFormulaManager(), getGlobalScopeInst(), null);
new DependencyVisitor().visit(node, fdm);
return fdm.getVariables();
}
Aggregations