/// <summary>
        /// Creates a copy of an instance with reversed edges.
        /// </summary>
        public ParsedPatternNode CloneReverse()
        {
            ParsedPatternNode clone = ParsedPatternNode.ParsedPatternNodeFactoryReverse(this.GetType());

            clone.Name        = this.Name;
            clone.Table       = this.Table;
            clone.IsAnonymous = this.IsAnonymous;
            return(clone);
        }
 /// <summary>
 /// Tries to find a table based on the indentifier node value and assign it to the parsed node.
 /// </summary>
 /// <param name="node"> An identifier node from Visiting indetifier node.</param>
 /// <param name="d"> A Dictionary of tables from edges/vertices. </param>
 /// <param name="n"> A ParsedPatternNode from within Visiting identifier node.</param>
 private void ProcessType(IdentifierNode node, Dictionary <string, Table> d, ParsedPatternNode n)
 {
     //Try find the table of the variable, it has to be always valid table name.
     if (!d.TryGetValue(node.value, out Table table))
     {
         throw new ArgumentException($"{this.GetType()}, could not parse Table name.");
     }
     else
     {
         n.Table = table;
     }
 }
Exemple #3
0
        /// <summary>
        /// Constructor for each DFS Match object.
        /// </summary>
        /// <param name="node"> A node containing data of the match object. </param>
        /// <param name="indexInMap"> An index in the map of variables. (-1 if the the variable is anonymous.) </param>
        /// <param name="isFirst"> Indicates whether its first appearance of the variable. </param>
        /// <param name="matchingType"> A type of matching graph element. </param>
        protected DFSBaseMatch(ParsedPatternNode node, int indexInMap, bool isFirst, Type matchingType)
        {
            this.matchingType = matchingType;
            if (indexInMap != -1)
            {
                this.isAnonnymous = false;
            }
            else
            {
                this.isAnonnymous = true;
            }

            this.isFirstAppereance       = isFirst;
            this.positionOfRepeatedField = indexInMap;
            this.table = node.Table;
        }
        /// <summary>
        /// Either assigns a name of a variable to the last ParsedPatternNode or there is a table pertaining to the node.
        /// It returns from here because there is no other node to visit.
        /// </summary>
        public void Visit(IdentifierNode node)
        {
            ParsedPatternNode n = currentPattern.GetLastParsedPatternNode();

            if (readingName)
            {
                n.IsAnonymous = false;
                n.Name        = node.value;
            }
            else
            {
                if (readingVertex)
                {
                    ProcessType(node, vTables, n);
                }
                else
                {
                    ProcessType(node, eTables, n);
                }
            }
        }
 public DFSAnyEdgeMatch(ParsedPatternNode node, int indexInMap, bool isFirst) : base(node, indexInMap, isFirst, typeof(Edge))
 {
 }
 public DFSVertexMatch(ParsedPatternNode node, int indexInMap, bool isFirst) : base(node, indexInMap, isFirst, typeof(Vertex))
 {
 }
Exemple #7
0
 public void AddParsedPatternNode(ParsedPatternNode node)
 {
     this.pattern.Add(node);
 }