Search in sources :

Example 6 with ScopeInstance

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

the class SolverManagerFacet method removeModifier.

public <T> void removeModifier(CharID id, VarModifier<T> vm, VarScoped target, ScopeInstance source) {
    ScopeInstance scope = scopeFacet.get(id, vm.getLegalScope().getName(), target);
    VariableID<T> varID = (VariableID<T>) variableLibraryFacet.getVariableID(id.getDatasetID(), scope, vm.getVarName());
    get(id).removeModifier(varID, vm.getModifier(), source);
}
Also used : ScopeInstance(pcgen.base.formula.base.ScopeInstance) VariableID(pcgen.base.formula.base.VariableID)

Example 7 with ScopeInstance

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

the class PlayerCharacter method addModifier.

public <T> void addModifier(VarModifier<T> modifier, VarScoped vs, VarScoped source) {
    ScopeInstance inst = scopeFacet.get(id, source.getLocalScopeName(), source);
    solverManagerFacet.addModifier(id, modifier, vs, inst);
}
Also used : ScopeInstance(pcgen.base.formula.base.ScopeInstance)

Example 8 with ScopeInstance

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

the class GlobalVarModel method get.

/**
	 * Gets the global variable (new formula system) represented by the given
	 * key.
	 * 
	 * @see freemarker.template.TemplateHashModel#get(java.lang.String)
	 */
@Override
public TemplateModel get(String varName) throws TemplateModelException {
    ScopeInstance varScope = scopeFacet.getGlobalScope(id);
    VariableID<?> varID = variableLibraryFacet.getVariableID(id.getDatasetID(), varScope, varName);
    Object value = variableStoreFacet.getValue(id, varID);
    return wrapperFacet.wrap(id, value);
}
Also used : ScopeInstance(pcgen.base.formula.base.ScopeInstance)

Example 9 with ScopeInstance

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

the class VariableActor method process.

@Override
public TemplateModel process(CharID id, CDOMObject obj) throws TemplateModelException {
    ScopeInstance varScope = scopeFacet.getGlobalScope(id);
    VariableID<?> varID = variableLibraryFacet.getVariableID(id.getDatasetID(), varScope, varName);
    Object value = variableStoreFacet.getValue(id, varID);
    return wrapperFacet.wrap(id, value);
}
Also used : ScopeInstance(pcgen.base.formula.base.ScopeInstance) CDOMObject(pcgen.cdom.base.CDOMObject)

Example 10 with ScopeInstance

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

the class SolverViewFrame method update.

private void update() {
    updateObjects();
    ScopeInstance scope = scopeFacet.get(activeIdentifier, selectedScope.getName(), activeObject);
    if (variableLibraryFacet.isLegalVariableName(activeIdentifier.getDatasetID(), scope.getLegalScope(), varNameText)) {
        displayInfo(scope);
    } else {
        //TODO Update a status bar
        System.err.println(selectedScope.getName() + " does not have a variable: " + varNameText);
    }
}
Also used : ScopeInstance(pcgen.base.formula.base.ScopeInstance)

Aggregations

ScopeInstance (pcgen.base.formula.base.ScopeInstance)24 LegalScope (pcgen.base.formula.base.LegalScope)8 Equipment (pcgen.core.Equipment)7 VariableID (pcgen.base.formula.base.VariableID)6 CDOMObject (pcgen.cdom.base.CDOMObject)6 VarModifier (pcgen.cdom.content.VarModifier)6 Test (org.junit.Test)5 ParseResult (pcgen.rules.persistence.token.ParseResult)5 CharID (pcgen.cdom.enumeration.CharID)4 EquipmentHead (pcgen.cdom.inst.EquipmentHead)4 VarScoped (pcgen.base.formula.base.VarScoped)3 VariableLibrary (pcgen.base.formula.base.VariableLibrary)3 ScopeInstanceFactory (pcgen.base.formula.inst.ScopeInstanceFactory)3 SimpleNode (pcgen.base.formula.parse.SimpleNode)3 ReconstructionVisitor (pcgen.base.formula.visitor.ReconstructionVisitor)3 RemoteModifier (pcgen.cdom.content.RemoteModifier)3 PCGenModifier (pcgen.base.calculation.PCGenModifier)2 FormulaSemantics (pcgen.base.formula.base.FormulaSemantics)2 ManagerFactory (pcgen.base.formula.base.ManagerFactory)2 SemanticsVisitor (pcgen.base.formula.visitor.SemanticsVisitor)2