public override StateDescriptionNode GetAvailableStates(string themeRoleName) { StateDescriptionNode node = new StateDescriptionNode(themeRoleName); this.rootState.AddAvailableStates((ICollection <StateDescriptionNode>) new LinkedList <StateDescriptionNode>(), node); return(node); }
private bool MatchDescriptionNodeToState(StateDescriptionNode rootState, string[] stateNames, int stateNamesIndex) { if (stateNamesIndex >= stateNames.Length) { return(true); } string stateName = stateNames[stateNamesIndex]; StateDescriptionNode matchedNode = null; foreach (StateDescriptionNode descrNode in rootState.Nodes) { if (descrNode.StateName == stateName) { matchedNode = descrNode; break; } } if (matchedNode == null) { return(false); } return(MatchDescriptionNodeToState(matchedNode, stateNames, stateNamesIndex + 1)); }
public override void AddAvailableStates( ICollection <StateDescriptionNode> newNodes, StateDescriptionNode node) { for (LinkedListNode <StateNodeBase> linkedListNode = this.states.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { LinkedList <StateDescriptionNode> linkedList1 = new LinkedList <StateDescriptionNode>(); linkedListNode.Value.AddAvailableStates((ICollection <StateDescriptionNode>)linkedList1, node); LinkedListNode <StateNodeBase> next = linkedListNode.Next; foreach (StateDescriptionNode stateDescriptionNode in linkedList1) { newNodes.Add(stateDescriptionNode); } for (; next != null; next = next.Next) { LinkedList <StateDescriptionNode> linkedList2 = new LinkedList <StateDescriptionNode>(); foreach (StateDescriptionNode node1 in linkedList1) { next.Value.AddAvailableStates((ICollection <StateDescriptionNode>)linkedList2, node1); } foreach (StateDescriptionNode stateDescriptionNode in linkedList2) { newNodes.Add(stateDescriptionNode); linkedList1.AddFirst(stateDescriptionNode); } } } }
public StateDescriptionNode AddNode(string stateName) { StateDescriptionNode stateDescriptionNode = new StateDescriptionNode(stateName); this.nodes.Add(stateDescriptionNode); return(stateDescriptionNode); }
private bool MatchDescriptionNodeToState( StateDescriptionNode rootState, string[] stateNames, int stateNamesIndex) { if (stateNamesIndex >= stateNames.Length) { return(true); } string stateName = stateNames[stateNamesIndex]; StateDescriptionNode rootState1 = (StateDescriptionNode)null; foreach (StateDescriptionNode node in rootState.Nodes) { if (node.StateName == stateName) { rootState1 = node; break; } } if (rootState1 == null) { return(false); } return(this.MatchDescriptionNodeToState(rootState1, stateNames, stateNamesIndex + 1)); }
public override StateDescriptionNode GetAvailableStates(string themeRoleName) { StateDescriptionNode rootNode = new StateDescriptionNode(themeRoleName); this.rootState.AddAvailableStates(new LinkedList <StateDescriptionNode>(), rootNode); return(rootNode); }
public virtual bool VerifyState(string themeRoleName, string key) { string[] stateNames = key.Split('.'); StateDescriptionNode availableStates = this.GetAvailableStates(themeRoleName); if (stateNames.Length == 0 || availableStates.StateName != stateNames[0]) { return(false); } return(this.MatchDescriptionNodeToState(availableStates, stateNames, 1)); }
public override void AddAvailableStates( ICollection <StateDescriptionNode> newNodes, StateDescriptionNode node) { if (this.TrueStateLink != null) { this.TrueStateLink.AddAvailableStates(newNodes, node); } else { newNodes.Add(node.AddNode(this.Name)); } if (this.FalseStateLink == null) { return; } this.FalseStateLink.AddAvailableStates(newNodes, node); }
public bool VerifyState(string themeRoleName, string key) { Debug.Assert(!string.IsNullOrEmpty(key)); string[] stateNames = key.Split(ItemStateManager.stateDelimiter); StateDescriptionNode rootState = this.GetAvailableStates(themeRoleName); if (stateNames.Length == 0) { return(false); } if (rootState.StateName != stateNames[0]) { return(false); } return(this.MatchDescriptionNodeToState(rootState, stateNames, 1)); }
public override void AddAvailableStates(ICollection <StateDescriptionNode> newNodes, StateDescriptionNode node) { newNodes.Add(node.AddNode(this.Name)); }
public override void AddAvailableStates( ICollection <StateDescriptionNode> newNodes, StateDescriptionNode node) { }
public abstract void AddAvailableStates(ICollection <StateDescriptionNode> newNodes, StateDescriptionNode node);
public override void AddAvailableStates(ICollection <StateDescriptionNode> newNodes, StateDescriptionNode node) { //Permutate all available group states LinkedListNode <StateNodeBase> stateLink = this.states.First; while (stateLink != null) { LinkedList <StateDescriptionNode> addedNodes = new LinkedList <StateDescriptionNode>(); stateLink.Value.AddAvailableStates(addedNodes, node); LinkedListNode <StateNodeBase> nextLink = stateLink.Next; foreach (StateDescriptionNode newStateNode in addedNodes) { newNodes.Add(newStateNode); } while (nextLink != null) { LinkedList <StateDescriptionNode> innerNodes = new LinkedList <StateDescriptionNode>(); foreach (StateDescriptionNode newStateNode in addedNodes) { //add inner nodes nextLink.Value.AddAvailableStates(innerNodes, newStateNode); } foreach (StateDescriptionNode innerNode in innerNodes) { newNodes.Add(innerNode); addedNodes.AddFirst(innerNode); } nextLink = nextLink.Next; } stateLink = stateLink.Next; } }