示例#1
0
        //
        // Acquires the hypergraph index value of the given nodes using structural equality
        //
        public static List <int> CollectGraphIndices(Hypergraph.Hypergraph <ConcreteAST.GroundedClause, Hypergraph.EdgeAnnotation> graph, List <ConcreteAST.GroundedClause> clauses)
        {
            List <int> indices = new List <int>();

            foreach (ConcreteAST.GroundedClause gc in clauses)
            {
                int index = Utilities.StructuralIndex(graph, gc);
                if (index != -1)
                {
                    indices.Add(index);
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("We expect to find the given node (we did not): " + gc.ToString());
                }
            }

            return(indices);
        }
        //
        // Acquires the hypergraph index value of the given nodes using structural equality
        //
        private List <int> CollectGraphIndices(List <ConcreteAST.GroundedClause> clauses)
        {
            List <int> indices = new List <int>();

            foreach (ConcreteAST.GroundedClause gc in clauses)
            {
                int index = Utilities.StructuralIndex(graph, gc);
                if (index != -1)
                {
                    indices.Add(index);
                }
                else
                {
                    Debug.WriteLine("We expect to find the given node (we did not): " + gc.ToString());
                }
            }

            return(indices);
        }
示例#3
0
 //
 // Given a list of grounded clauses, add a new value which is structurally unique.
 //
 public static bool HasStructurally <T>(List <T> list, T t) where T : ConcreteAST.GroundedClause
 {
     return(Utilities.StructuralIndex <T>(list, t) != -1);
 }