Beispiel #1
0
  public void resetTypist(CharacterSource newTypist) {
    CharacterSource oldTypist;

    if (newTypist != null) newTypist.addCharacterListener(this);

    oldTypist = typist.getAndSet(newTypist);
    if (oldTypist != null) oldTypist.removeCharacterListener(this);
  }
Beispiel #2
0
  public void resetGenerator(CharacterSource newGenerator) {
    /** 注意这个方法的算法更改逻辑 */
    CharacterSource oldGenerator;

    if (newGenerator != null) newGenerator.addCharacterListener(this);

    oldGenerator = generator.getAndSet(newGenerator);
    if (oldGenerator != null) oldGenerator.removeCharacterListener(this);
  }