public RecursiveVariableFinder(InstanceSave instanceSave, List <ElementWithState> elementStack) { if (instanceSave == null) { throw new ArgumentException("InstanceSave must not be null", "instanceSave"); } ContainerType = VariableContainerType.InstanceSave; mInstanceSave = instanceSave; ElementStack = elementStack; }
public InstanceSave PopInstance() { var toReturn = mInstanceSave; if (ContainerType != VariableContainerType.InstanceSave) { throw new Exception(); } ContainerType = VariableContainerType.StateSave; mInstanceSave = null; return(toReturn); }
public void PushInstance(InstanceSave instanceSave) { if (ContainerType == VariableContainerType.InstanceSave) { throw new Exception(); } if (mElementStack.Count == 0) { throw new Exception(); } ContainerType = VariableContainerType.InstanceSave; mInstanceSave = instanceSave; }
public RecursiveVariableFinder(InstanceSave instanceSave, ElementSave container) { if (instanceSave == null) { throw new ArgumentException("InstanceSave must not be null", "instanceSave"); } ContainerType = VariableContainerType.InstanceSave; mInstanceSave = instanceSave; mElementStack = new List <ElementWithState>() { new ElementWithState(container) }; }
public RecursiveVariableFinder(StateSave stateSave) { ContainerType = VariableContainerType.StateSave; mStateSave = stateSave; ElementStack = new List <ElementWithState>(); #if DEBUG if (stateSave.ParentContainer == null) { throw new NullReferenceException("The state passed in to the RecursiveVariableFinder has a null ParentContainer and it shouldn't"); } #endif ElementStack.Add(new ElementWithState(stateSave.ParentContainer) { StateName = stateSave.Name }); }