Ejemplo n.º 1
0
        /// <summary>
        /// allows reuse of builder instance by starting a new empty ReplacementRule
        /// </summary>
        /// <returns>builder instance</returns>
        public ReplacementRuleBuilder Reset()
        {
            // already good to go!
            if (currentState == State.Start)
            {
                return(this);
            }

            if (currentState != State.End)
            {
                throw new InvalidOperationException("Reset() should only be called on a Builder in [End] State! (did you forget to GetResult()?)");
            }

            result = new ReplacementRule();
            currentPatternVertex     = null;
            currentReplacementVertex = null;
            currentReplacementEdge   = null;
            currentPatternEdge       = null;
            taggedPatternVertices.Clear();
            taggedReplacementVertices.Clear();
            freezeState    = false;
            lastValidState = State.Start;
            currentState   = State.Start;
            return(this);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// basic constructor - initializes attributes and state
 /// </summary>
 public ReplacementRuleBuilder()
 {
     currentState              = State.Start;
     result                    = new ReplacementRule();
     taggedPatternVertices     = new Dictionary <string, Vertex>();
     taggedReplacementVertices = new Dictionary <string, Vertex>();
 }