Add a transition to the state. If a transition with the provided character already
exists, it will be replaced.

@param c The transition character.
@param s The to-state.
515099
public void addTransition(Character c, State s) {
        transitions.put(c, s);
        d_recomputeHash = true;
    }
111992
boolean addToBuffer(char c) throws IOException {
	int len = sb.length();
	if (len == 0 && c != CHAR_LT) return false; // buffer must starts with '<'

	sb.append(c); // if we reached this point then we will return true
	if (++len >= minTagLen) { // increment len as it was sampled before we appended c
	    boolean isClosingTag = (len >= 2 && sb.charAt(1) == CHAR_SL);
	    String substr;
	    if (isClosingTag) substr = sb.substring(2); // we know that the 1st two chars are "</"
	    else substr = sb.substring(1); // we know that the 1st char is "<"
	    for (int i = 0; i < EXCLUDE_TAGS.length; i++) { // loop thru list of WS-preserving tags
		if (substr.equalsIgnoreCase(EXCLUDE_TAGS[i])) { // we have a match
		    if (isClosingTag) {
			depthDec(i); // decrement the depth at i and calc depthSum
			printBuffer();
			lastChar = 0; // needed to allow WS after buffer was printed
		    }
		    else {
			depthInc(i); // increment the depth at i and calc depthSum
		    }
		}
	    }
	}
	return true;
    }
435580
public Set<Transition<NFAState<T>>> getSingleTransitionTo(NFAState<T> state)
    {
        Set<Transition<NFAState<T>>> set = new HashSet<>();
        if  (transitions.size() != 1)
        {
            return null;
        }
        for (CharRange range : transitions.keySet())
        {
            Set<Transition<NFAState<T>>> s = transitions.get(range);
            for (Transition<NFAState<T>> tr : s)
            {
                if (state.equals(tr.getTo()))
                {
                    set.add(tr);
                }
                else
                {
                    return null;    // to somewhere else
                }
            }
        }
        if (set.isEmpty())
        {
            return null;
        }
        else
        {
            return set;
        }
    }
1128915
public void transition(CopycatServer.State state) {
    checkThread();

    if (this.state != null && state == this.state.type()) {
      return;
    }

    LOGGER.info("{} - Transitioning to {}", cluster.member().address(), state);

    // Close the old state.
    try {
      this.state.close().get();
    } catch (InterruptedException | ExecutionException e) {
      throw new IllegalStateException("failed to close Raft state", e);
    }

    // Force state transitions to occur synchronously in order to prevent race conditions.
    try {
      this.state = createState(state);
      this.state.open().get();
    } catch (InterruptedException | ExecutionException e) {
      throw new IllegalStateException("failed to initialize Raft state", e);
    }

    stateChangeListeners.forEach(l -> l.accept(this.state.type()));
  }
905090
public void addTransition(RangeSet rs, NFAState<T> to)
    {
        for (CharRange c : rs)
        {
            addTransition(c, to);
        }
        edges.add(to);
        to.inStates.add(this);
    }
77168
private void dataBufferAppend(char c) {
        // Expand buffer if necessary.
        if (dataBufferPos >= dataBuffer.length) {
            dataBuffer = (char[]) extendArray(dataBuffer, dataBuffer.length,
                    dataBufferPos);
        }
        dataBuffer[dataBufferPos++] = c;
    }
118588
public int transition(char c, int from)
    {
        int b = from;
        int p;

        p = b + (int) (c) + 1;
        if (b == check[p])
            b = base[p];
        else
            return -1;

        return b;
    }
667940
public static String removeChar(String s, char c)
  {
    int pos = s.indexOf(c);
    if (pos < 0) {
      return s;
    }
    StringBuilder sb = new StringBuilder(s.length() - 1);
    int prevPos = 0;
    do {
      sb.append(s, prevPos, pos);
      prevPos = pos + 1;
      pos = s.indexOf(c, pos + 1);
    } while (pos > 0);
    sb.append(s, prevPos, s.length());
    return sb.toString();
  }
253595
private void incrementIndexes(int c) {
        if(c > 0) {
            this.index++;
            if(c=='\r') {
                this.line++;
                this.characterPreviousLine = this.character;
                this.character=0;
            }else if (c=='\n') {
                if(this.previous != '\r') {
                    this.line++;
                    this.characterPreviousLine = this.character;
                }
                this.character=0;
            } else {
                this.character++;
            }
        }
    }
525358
public void append(char c) {
        if (this.length + 1 > this.ch.length) {
                    int newLength = this.ch.length*2;
                    if (newLength < this.ch.length + DEFAULT_SIZE)
                        newLength = this.ch.length + DEFAULT_SIZE;
                    char[] newch = new char[newLength];
                    System.arraycopy(this.ch, 0, newch, 0, this.length);
                    this.ch = newch;
        }
        this.ch[this.length] = c;
        this.length++;
    }
120608
public final UnicodeSet addAll(CharSequence s) {
        checkFrozen();
        int cp;
        for (int i = 0; i < s.length(); i += UTF16.getCharCount(cp)) {
            cp = UTF16.charAt(s, i);
            add_unchecked(cp, cp);
        }
        return this;
    }
636685
public void addAction(M element, char value)
    {
        actions.put(element, Character.valueOf(value));
    }
1130352
public void add(byte b, String s) {
		if (s != null) {
			String s2 = get(b);
			if (s2 == null)
				s2 = s;
			else
				s2 += lineSeparator + s;
			set(b, s2);
		}
	}
737735
protected int transition(int current, char c)
    {
        int b = current;
        int p;

        p = b + c + 1;
        if (b == check[p])
            b = base[p];
        else
            return -1;

        p = b;
        return p;
    }
1120198
public boolean addToSignature(TransitionLabel<S, L> letter) {
        boolean first = signature.isEmpty();
        signature.add(letter);
        return first;
    }
1066170
public void setTransitions(int state,
                               int inputIdx,
                               Collection<? extends Integer> successors) { // TODO: replace by primitive specialization
        int transIdx = toMemoryIndex(state, inputIdx);
        //TIntSet succs = transitions[transIdx];
        Set<Integer> succs = transitions[transIdx]; // TODO: replace by primitive specialization
        if (succs == null) {
            //succs = new TIntHashSet(successors);
            succs = Sets.newHashSetWithExpectedSize(successors.size()); // TODO: replace by primitive specialization
            transitions[transIdx] = succs;
        } else {
            succs.clear();
        }
        succs.addAll(successors);
    }
1261352
public void addState(String name, S state)
    {
        AbstractState old = states.put(name, new StateWrapper(name, state));
        if (old != null)
        {
            throw new IllegalArgumentException("state "+name+" exists already");
        }
    }