Ejemplo n.º 1
0
 public Node(string newName, StateOfNode newState, UInt32 newID ,int newLevel)
 {
     this.name = newName;
     this.state = newState;
     this.Level = newLevel;
     this.ID = newID;
 }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
 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;
         }
 }
Ejemplo n.º 4
0
 public Node(string newName)
 {
     this.name = newName;
     this.state = StateOfNode.uncompleted;
 }
Ejemplo n.º 5
0
 public Node(string newName, StateOfNode newState)
 {
     this.name = newName;
     this.state = newState;
 }
Ejemplo n.º 6
0
 public Node(string newName, StateOfNode newState, int newLevel)
 {
     this.name = newName;
     this.state = newState;
     this.Level = newLevel;
 }
Ejemplo n.º 7
0
 public Node()
 {
     this.name = null;
     this.state = StateOfNode.uncompleted;
 }
Ejemplo n.º 8
0
        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;
        }