Skip to content

Commit

Permalink
[*] Rename GlobalScope to GlobalPCScope (#5452)
Browse files Browse the repository at this point in the history
We should do this because it is true. Also, because we are soon going to
introduce a new "EQ" scope that differs from the PC scope.
  • Loading branch information
grimreaper authored and thpr committed May 5, 2019
1 parent 7cf643e commit d05b7fb
Show file tree
Hide file tree
Showing 26 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion code/src/java/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@
<!-- END Facet Definitions -->

<!-- Scope Definitions -->
<bean id="globalLegalScope" class="pcgen.cdom.formula.scope.GlobalScope"/>
<bean id="globalLegalScope" class="pcgen.cdom.formula.scope.GlobalPCScope"/>
<bean id="saveLegalScope" class="pcgen.cdom.formula.scope.SaveScope">
<property name="parent" ref="globalLegalScope"/>
</bean>
Expand Down
4 changes: 2 additions & 2 deletions code/src/java/pcgen/cdom/facet/ScopeFacet.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import pcgen.base.formula.base.VarScoped;
import pcgen.cdom.enumeration.CharID;
import pcgen.cdom.facet.base.AbstractItemFacet;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;

/**
* ScopeFacet stores the relationship from a Character, LegalScope, and
Expand All @@ -44,7 +44,7 @@ public class ScopeFacet extends AbstractItemFacet<CharID, ScopeInstanceFactory>
*/
public ScopeInstance getGlobalScope(CharID id)
{
return get(id).getGlobalInstance(GlobalScope.GLOBAL_SCOPE_NAME);
return get(id).getGlobalInstance(GlobalPCScope.GLOBAL_SCOPE_NAME);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions code/src/java/pcgen/cdom/formula/scope/DynamicScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
public class DynamicScope implements PCGenScope
{
/**
* The parent PCGenScope for all DynamicScope objects is the GlobalScope.
* The parent PCGenScope for all DynamicScope objects is the GlobalPCScope.
*/
private static final Optional<PCGenScope> PARENT_SCOPE = Optional.of(SpringHelper.getBean(GlobalScope.class));
private static final Optional<PCGenScope> PARENT_SCOPE = Optional.of(SpringHelper.getBean(GlobalPCScope.class));

/**
* The DynamicCategory indicating the objects contained by this DynamicScope.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* Copyright 2015 (C) Tom Parker <[email protected]>
*
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Expand All @@ -25,7 +25,7 @@
/**
* This is the global variable scope
*/
public class GlobalScope implements PCGenScope
public class GlobalPCScope implements PCGenScope
{
/**
* The name of the Global Scope for PCGen characters, publicly available for reuse...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private LegalScopeUtilities()

public static void loadLegalScopeLibrary(ScopeManagerInst library)
{
library.registerScope(SpringHelper.getBean(GlobalScope.class));
library.registerScope(SpringHelper.getBean(GlobalPCScope.class));
library.registerScope(SpringHelper.getBean(EquipmentScope.class));
library.registerScope(SpringHelper.getBean(EquipmentPartScope.class));
library.registerScope(SpringHelper.getBean(SaveScope.class));
Expand Down
4 changes: 2 additions & 2 deletions code/src/java/pcgen/persistence/SourceFileLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import pcgen.cdom.enumeration.StringKey;
import pcgen.cdom.enumeration.Type;
import pcgen.cdom.formula.scope.EquipmentPartScope;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.inst.GlobalModifiers;
import pcgen.cdom.util.CControl;
import pcgen.cdom.util.ControlUtilities;
Expand Down Expand Up @@ -711,7 +711,7 @@ private static void enableBuiltInControl(LoadContext context,

private static void defineVariable(VariableContext varContext, FormatManager<?> formatManager, String varName)
{
LegalScope varScope = varContext.getScope(GlobalScope.GLOBAL_SCOPE_NAME);
LegalScope varScope = varContext.getScope(GlobalPCScope.GLOBAL_SCOPE_NAME);
varContext.assertLegalVariableID(varName, varScope, formatManager);
}

Expand Down
4 changes: 2 additions & 2 deletions code/src/java/pcgen/rules/context/LoadContextInst.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import pcgen.cdom.facet.DataSetInitializationFacet;
import pcgen.cdom.facet.FacetInitialization;
import pcgen.cdom.facet.FacetLibrary;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;
import pcgen.cdom.grouping.GroupingCollection;
import pcgen.cdom.grouping.GroupingInfo;
Expand Down Expand Up @@ -530,7 +530,7 @@ public PCGenScope getActiveScope()
{
if (legalScope == null)
{
legalScope = var.getScope(GlobalScope.GLOBAL_SCOPE_NAME);
legalScope = var.getScope(GlobalPCScope.GLOBAL_SCOPE_NAME);
}
return legalScope;
}
Expand Down
4 changes: 2 additions & 2 deletions code/src/java/plugin/lsttokens/variable/GlobalToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import pcgen.base.formula.exception.LegalVariableException;
import pcgen.base.util.FormatManager;
import pcgen.cdom.content.DatasetVariable;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;
import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.token.AbstractNonEmptyToken;
Expand Down Expand Up @@ -94,7 +94,7 @@ protected ParseResult parseNonEmptyToken(LoadContext context, DatasetVariable dv
public String[] unparse(LoadContext context, DatasetVariable dv)
{
PCGenScope scope = dv.getScope();
if (scope != null && !scope.getName().equals(GlobalScope.GLOBAL_SCOPE_NAME))
if (scope != null && !scope.getName().equals(GlobalPCScope.GLOBAL_SCOPE_NAME))
{
//is a local variable
return null;
Expand Down
4 changes: 2 additions & 2 deletions code/src/java/plugin/lsttokens/variable/LocalToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import pcgen.base.util.FormatManager;
import pcgen.cdom.base.Constants;
import pcgen.cdom.content.DatasetVariable;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;
import pcgen.rules.context.LoadContext;
import pcgen.rules.context.VariableContext;
Expand Down Expand Up @@ -117,7 +117,7 @@ protected ParseResult parseNonEmptyToken(LoadContext context, DatasetVariable dv
public String[] unparse(LoadContext context, DatasetVariable dv)
{
PCGenScope scope = dv.getScope();
if (scope == null || scope.getName().equals(GlobalScope.GLOBAL_SCOPE_NAME))
if (scope == null || scope.getName().equals(GlobalPCScope.GLOBAL_SCOPE_NAME))
{
//Global variable
return null;
Expand Down
6 changes: 3 additions & 3 deletions code/src/utest/pcgen/base/solver/SetSolverManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import pcgen.cdom.formula.ManagerKey;
import pcgen.cdom.formula.local.ModifierDecoration;
import pcgen.cdom.formula.scope.EquipmentScope;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;
import pcgen.cdom.formula.scope.SkillScope;
import pcgen.core.Skill;
Expand All @@ -72,7 +72,7 @@
class SetSolverManagerTest
{

private final PCGenScope globalScope = new GlobalScope();
private final PCGenScope globalScope = new GlobalPCScope();
private TrackingVariableCache vc;
private ScopeManagerInst vsLib;
private VariableManager sl;
Expand Down Expand Up @@ -190,7 +190,7 @@ public void testProcessDynamicSet()
manager.createChannel(varIDa);
vc.put(varIDa, 3);
ScopeInstance globalInst =
siFactory.getGlobalInstance(GlobalScope.GLOBAL_SCOPE_NAME);
siFactory.getGlobalInstance(GlobalPCScope.GLOBAL_SCOPE_NAME);
VariableID varIDq = sl.getVariableID(globalInst, "SkillVar");
manager.createChannel(varIDq);
VariableID varIDr = sl.getVariableID(globalInst, "ResultVar");
Expand Down
4 changes: 2 additions & 2 deletions code/src/utest/pcgen/cdom/base/FormulaFactoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pcgen.base.formula.inst.NEPFormula;
import pcgen.base.formula.inst.ScopeManagerInst;
import pcgen.base.solver.FormulaSetupFactory;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;

import org.junit.jupiter.api.AfterEach;
Expand All @@ -28,7 +28,7 @@ void setUp() throws Exception
{
arrayManager = new ArrayFormatManager<>(FormatUtilities.NUMBER_MANAGER,
'\n', ',');
varScope = new GlobalScope();
varScope = new GlobalPCScope();
FormulaSetupFactory formulaSetupFactory = new FormulaSetupFactory();
ScopeManagerInst legalScopeManager = new ScopeManagerInst();
formulaSetupFactory
Expand Down
4 changes: 2 additions & 2 deletions code/src/utest/pcgen/cdom/formula/VariableChannelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import pcgen.base.solver.SolverManager;
import pcgen.cdom.enumeration.CharID;
import pcgen.cdom.enumeration.DataSetID;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;
import pcgen.cdom.formula.testsupport.AbstractModifier;
import pcgen.facade.util.event.ReferenceEvent;
Expand All @@ -58,7 +58,7 @@ public void setUp() throws Exception
FormulaUtilities.loadBuiltInOperators(getOperatorLibrary());

manager = context.getVariableContext().generateSolverManager(getVariableStore());
globalScope = context.getVariableContext().getScope(GlobalScope.GLOBAL_SCOPE_NAME);
globalScope = context.getVariableContext().getScope(GlobalPCScope.GLOBAL_SCOPE_NAME);
ScopeInstanceFactory sif = getFormulaManager().getScopeInstanceFactory();
globalInstance = sif.getGlobalInstance(globalScope.getName());
}
Expand Down
6 changes: 3 additions & 3 deletions code/src/utest/pcgen/cdom/helper/BridgeListenerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import pcgen.cdom.facet.base.AbstractSourcedListFacet;
import pcgen.cdom.formula.PCGenScoped;
import pcgen.cdom.formula.VariableChangeEvent;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.core.PCTemplate;
import pcgen.core.Race;
import pcgen.facade.util.event.ReferenceEvent;
Expand Down Expand Up @@ -95,7 +95,7 @@ void testVariableBasic()
CharID id = CharID.getID(dsID);
AbstractSourcedListFacet<CharID, PCGenScoped> target = new Target();
BridgeListener bridge = new BridgeListener(id, target);
GlobalScope scope = new GlobalScope();
GlobalPCScope scope = new GlobalPCScope();
ScopeInstance instance =
new SimpleScopeInstance(Optional.empty(), scope, owner);
TransparentFormatManager<PCTemplate> formatManager =
Expand Down Expand Up @@ -128,7 +128,7 @@ void testVariableArray()
CharID id = CharID.getID(dsID);
AbstractSourcedListFacet<CharID, PCGenScoped> target = new Target();
BridgeListener bridge = new BridgeListener(id, target);
GlobalScope scope = new GlobalScope();
GlobalPCScope scope = new GlobalPCScope();
ScopeInstance instance =
new SimpleScopeInstance(Optional.empty(), scope, owner);
TransparentFormatManager<PCTemplate[]> formatManager =
Expand Down
6 changes: 3 additions & 3 deletions code/src/utest/plugin/function/GetFactFunctionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import pcgen.cdom.content.fact.FactDefinition;
import pcgen.cdom.enumeration.FactKey;
import pcgen.cdom.formula.ManagerKey;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.core.Skill;
import pcgen.rules.context.AbstractReferenceContext;
import pcgen.util.enumeration.Visibility;
Expand Down Expand Up @@ -160,7 +160,7 @@ public void testDynamic()
{
VariableLibrary vl = getVariableLibrary();
LegalScope globalScope =
context.getVariableContext().getScope(GlobalScope.GLOBAL_SCOPE_NAME);
context.getVariableContext().getScope(GlobalPCScope.GLOBAL_SCOPE_NAME);
vl.assertLegalVariableID("SkillVar", globalScope,
context.getManufacturer("SKILL"));

Expand All @@ -184,7 +184,7 @@ public void testDynamic()
Skill skillalt = new Skill();
skillalt.setName("SkillAlt");
ScopeInstance globalInst = getFormulaManager().getScopeInstanceFactory()
.getGlobalInstance(GlobalScope.GLOBAL_SCOPE_NAME);
.getGlobalInstance(GlobalPCScope.GLOBAL_SCOPE_NAME);
VariableID varIDq = vl.getVariableID(globalInst, "SkillVar");
getVariableStore().put(varIDq, skill);
context.getReferenceContext().importObject(skill);
Expand Down
6 changes: 3 additions & 3 deletions code/src/utest/plugin/function/GetOtherFunctionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import pcgen.base.formula.visitor.ReconstructionVisitor;
import pcgen.base.formula.visitor.SemanticsVisitor;
import pcgen.cdom.formula.ManagerKey;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.core.Skill;
import pcgen.rules.context.AbstractReferenceContext;
import pcgen.rules.context.VariableContext;
Expand Down Expand Up @@ -147,7 +147,7 @@ public void testDynamic()
VariableLibrary vl = getVariableLibrary();
VariableContext variableContext = context.getVariableContext();
LegalScope skillScope = variableContext.getScope("PC.SKILL");
LegalScope globalScope = variableContext.getScope(GlobalScope.GLOBAL_SCOPE_NAME);
LegalScope globalScope = variableContext.getScope(GlobalPCScope.GLOBAL_SCOPE_NAME);
vl.assertLegalVariableID("LocalVar", skillScope, numberManager);
vl.assertLegalVariableID("SkillVar", globalScope, context.getManufacturer("SKILL"));

Expand All @@ -171,7 +171,7 @@ public void testDynamic()
VariableID varIDa = vl.getVariableID(scopeInsta, "LocalVar");
getVariableStore().put(varIDa, 3);
ScopeInstance globalInst =
scopeInstanceFactory.getGlobalInstance(GlobalScope.GLOBAL_SCOPE_NAME);
scopeInstanceFactory.getGlobalInstance(GlobalPCScope.GLOBAL_SCOPE_NAME);
VariableID varIDq = vl.getVariableID(globalInst, "SkillVar");
getVariableStore().put(varIDq, skill);
context.getReferenceContext().importObject(skill);
Expand Down
4 changes: 2 additions & 2 deletions code/src/utest/plugin/function/InputFunctionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import pcgen.cdom.facet.SolverManagerFacet;
import pcgen.cdom.facet.VariableStoreFacet;
import pcgen.cdom.formula.VariableChannel;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.output.channel.ChannelUtilities;
import plugin.function.testsupport.AbstractFormulaTestCase;
import plugin.function.testsupport.TestUtilities;
Expand Down Expand Up @@ -100,7 +100,7 @@ public void testGlobalChannelStrength()
{
ScopeInstanceFactory instFactory = scopeFacet.get(id);
ScopeInstance globalInstance =
instFactory.getGlobalInstance(GlobalScope.GLOBAL_SCOPE_NAME);
instFactory.getGlobalInstance(GlobalPCScope.GLOBAL_SCOPE_NAME);
context.getVariableContext().assertLegalVariableID(ChannelUtilities.createVarName("STR"),
globalInstance.getLegalScope(), numberManager);
VariableChannel<Number> strChannel = (VariableChannel<Number>) context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import pcgen.cdom.facet.LoadContextFacet;
import pcgen.cdom.formula.ManagerKey;
import pcgen.cdom.formula.MonitorableVariableStore;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.rules.context.ConsolidatedListCommitStrategy;
import pcgen.rules.context.LoadContext;
import pcgen.rules.context.RuntimeLoadContext;
Expand Down Expand Up @@ -177,7 +177,7 @@ protected LegalScope getGlobalScope()
protected ScopeInstance getGlobalScopeInst()
{
return getFormulaManager().getScopeInstanceFactory()
.getGlobalInstance(GlobalScope.GLOBAL_SCOPE_NAME);
.getGlobalInstance(GlobalPCScope.GLOBAL_SCOPE_NAME);
}

protected FormulaManager getFormulaManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import pcgen.base.format.BooleanManager;
import pcgen.base.formula.base.ManagerFactory;
import pcgen.base.util.FormatManager;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;
import pcgen.rules.persistence.token.ModifierFactory;
import plugin.modifier.testsupport.EvalManagerUtilities;
Expand All @@ -34,7 +34,7 @@
public class SetBooleanModifierTest
{

private final PCGenScope varScope = new GlobalScope();
private final PCGenScope varScope = new GlobalPCScope();
private FormatManager<Boolean> booleanManager = new BooleanManager();

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import pcgen.base.format.NumberManager;
import pcgen.base.formula.base.ManagerFactory;
import pcgen.base.util.FormatManager;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;
import pcgen.rules.persistence.token.ModifierFactory;
import plugin.modifier.testsupport.EvalManagerUtilities;
Expand All @@ -35,7 +35,7 @@

class AddNumberModifierTest
{
private final PCGenScope varScope = new GlobalScope();
private final PCGenScope varScope = new GlobalPCScope();
private FormatManager<Number> numManager = new NumberManager();

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import pcgen.base.format.NumberManager;
import pcgen.base.formula.base.ManagerFactory;
import pcgen.base.util.FormatManager;
import pcgen.cdom.formula.scope.GlobalScope;
import pcgen.cdom.formula.scope.GlobalPCScope;
import pcgen.cdom.formula.scope.PCGenScope;
import plugin.modifier.testsupport.EvalManagerUtilities;

Expand All @@ -35,7 +35,7 @@
public class DivideNumberModifierTest
{

private final PCGenScope varScope = new GlobalScope();
private final PCGenScope varScope = new GlobalPCScope();
private final FormatManager<Number> numManager = new NumberManager();

@Test
Expand Down
Loading

0 comments on commit d05b7fb

Please sign in to comment.