public Node(string newName, StateOfNode newState, UInt32 newID ,int newLevel) { this.name = newName; this.state = newState; this.Level = newLevel; this.ID = newID; }
public void ChangeStateOfAllSubNodes(UInt32 headID, StateOfNode fromState, StateOfNode toState) { int currentLevel = GetLevel (headID); long remPositoin = reader.BaseStream.Position; reader.DiscardBufferedData(); SetReaderOn (headID); string line; List<UInt32> lista = new List<uint>(); while ((line = reader.ReadLine()) != null) { if(ParseLevel(line) > currentLevel) { if(ParseState(line) == fromState) lista.Add(ParseID(line)); } else break; } foreach(UInt32 currID in lista) { Node nod = GetNode(currID); nod.state = toState; Save(nod); } reader.BaseStream.Position = remPositoin; }
private void SetColor(StateOfNode state) { switch(state) { case StateOfNode.completed: Console.ForegroundColor = ConsoleColor.DarkGreen; break; case StateOfNode.dontcare: Console.ForegroundColor = ConsoleColor.Cyan; break; default: Console.ForegroundColor = ConsoleColor.White; break; } }
public Node(string newName) { this.name = newName; this.state = StateOfNode.uncompleted; }
public Node(string newName, StateOfNode newState) { this.name = newName; this.state = newState; }
public Node(string newName, StateOfNode newState, int newLevel) { this.name = newName; this.state = newState; this.Level = newLevel; }
public Node() { this.name = null; this.state = StateOfNode.uncompleted; }
private int CountSubTreeElements(UInt32 headID, StateOfNode state) { int currentlevel = GetLevel (headID); long remPosition = reader.BaseStream.Position; reader.DiscardBufferedData(); SetReaderOn (headID); string line; int count=0; while ((line=reader.ReadLine()) != null) { if(ParseLevel(line) > currentlevel) { if(ParseState(line) == state) count++; } else break; } reader.BaseStream.Position = remPosition; return count; }