Пример #1
0
        protected bool CheckNode(out double leftVal, out double rightVal)
        {
            leftVal  = 0.0;
            rightVal = 0.0;

            if (FilsGauche == null)
            {
                logger.Info("Missing left child on node " + Content);
                return(false);
            }
            if (FilsDroit == null)
            {
                logger.Info("Missing right child on node " + Content);
                return(false);
            }

            double?valeurGauche = FilsGauche.EvalNode();
            double?valeurDroit  = FilsDroit.EvalNode();

            if (valeurGauche == null)
            {
                logger.Info("Can't evaluate left child of node : " + Content);
                return(false);
            }
            if (valeurDroit == null)
            {
                logger.Info("Can't evaluate right child of node : " + Content);
                return(false);
            }

            leftVal  = valeurGauche.Value;
            rightVal = valeurDroit.Value;
            return(true);
        }
Пример #2
0
 public string encode(char Lettre)
 {
     if (FilsGauche.getMot() == Lettre)
     {
         return("0");
     }
     else
     {
         return("1" + FilsDroit.encode(Lettre));
     }
 }
Пример #3
0
        public override bool ToSubTree(LinkedList <AnodeAst> list, LinkedListNode <AnodeAst> currentNode)
        {
            bool hadError;
            LinkedListNode <AnodeAst> previousNode = currentNode.Previous;
            LinkedListNode <AnodeAst> nextNode     = currentNode.Next;

            if ((previousNode == null) || (nextNode == null))
            {
                logger.Warn("Chaine opération non valide");
                hadError = true;
            }
            else
            {
                // création de l'arbre
                FilsGauche = previousNode.Value;
                FilsDroit  = nextNode.Value;

                // Delete childNodes from the list
                list.Remove(previousNode);
                list.Remove(nextNode);

                // dé-marquage du noeud : il doit maintenant être considéré comme un sous-arbre.
                IsTree = true;

                hadError = false;
            }
            if (!hadError)
            {
                logger.Info("Node to Tree {0} {1} {2}", FilsGauche.EvalNode(), Content, FilsDroit.EvalNode());
            }

            return(hadError);
        }