Search in sources :

Example 1 with MonitorableVariableStore

use of pcgen.cdom.formula.MonitorableVariableStore in project pcgen by PCGen.

the class PlayerCharacter method doFormulaSetup.

private void doFormulaSetup(LoadContext context) {
    SplitFormulaSetup formulaSetup = formulaSetupFacet.get(id.getDatasetID());
    MonitorableVariableStore varStore = new MonitorableVariableStore();
    IndividualSetup mySetup = new IndividualSetup(formulaSetup, "Global", varStore);
    scopeFacet.set(id, mySetup.getInstanceFactory());
    variableStoreFacet.set(id, varStore);
    SolverFactory solverFactory = solverFactoryFacet.get(id.getDatasetID());
    solverManagerFacet.set(id, new DynamicSolverManager(mySetup.getFormulaManager(), context.getVariableContext().getManagerFactory(), solverFactory, varStore));
}
Also used : SplitFormulaSetup(pcgen.base.solver.SplitFormulaSetup) DynamicSolverManager(pcgen.base.solver.DynamicSolverManager) IndividualSetup(pcgen.base.solver.IndividualSetup) SolverFactory(pcgen.base.solver.SolverFactory) MonitorableVariableStore(pcgen.cdom.formula.MonitorableVariableStore)

Example 2 with MonitorableVariableStore

use of pcgen.cdom.formula.MonitorableVariableStore 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 "";
        }
    });
}
Also used : SplitFormulaSetup(pcgen.base.solver.SplitFormulaSetup) IndividualSetup(pcgen.base.solver.IndividualSetup) DependencyManager(pcgen.base.formula.base.DependencyManager) EvaluationManager(pcgen.base.formula.base.EvaluationManager) MonitorableVariableStore(pcgen.cdom.formula.MonitorableVariableStore) Modifier(pcgen.base.solver.Modifier)

Example 3 with MonitorableVariableStore

use of pcgen.cdom.formula.MonitorableVariableStore in project pcgen by PCGen.

the class AbstractFormulaTestCase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
    setup = context.getVariableContext().getFormulaSetup();
    setup.getSolverFactory().addSolverFormat(Number.class, getDMod(0));
    setup.getSolverFactory().addSolverFormat(String.class, getDMod(""));
    localSetup = new IndividualSetup(setup, "Global", new MonitorableVariableStore());
}
Also used : IndividualSetup(pcgen.base.solver.IndividualSetup) ConsolidatedListCommitStrategy(pcgen.rules.context.ConsolidatedListCommitStrategy) RuntimeReferenceContext(pcgen.rules.context.RuntimeReferenceContext) MonitorableVariableStore(pcgen.cdom.formula.MonitorableVariableStore) RuntimeLoadContext(pcgen.rules.context.RuntimeLoadContext)

Aggregations

IndividualSetup (pcgen.base.solver.IndividualSetup)3 MonitorableVariableStore (pcgen.cdom.formula.MonitorableVariableStore)3 SplitFormulaSetup (pcgen.base.solver.SplitFormulaSetup)2 DependencyManager (pcgen.base.formula.base.DependencyManager)1 EvaluationManager (pcgen.base.formula.base.EvaluationManager)1 DynamicSolverManager (pcgen.base.solver.DynamicSolverManager)1 Modifier (pcgen.base.solver.Modifier)1 SolverFactory (pcgen.base.solver.SolverFactory)1 ConsolidatedListCommitStrategy (pcgen.rules.context.ConsolidatedListCommitStrategy)1 RuntimeLoadContext (pcgen.rules.context.RuntimeLoadContext)1 RuntimeReferenceContext (pcgen.rules.context.RuntimeReferenceContext)1