Пример #1
0
 public void resetGenerator(CharacterSource newGenerator) {
   try {
     scoreLock.lock();
     if (generator != null) generator.removeCharacterListener(this);
     generator = newGenerator;
     if (generator != null) generator.addCharacterListener(this);
   } finally {
     scoreLock.unlock();
   }
 }
Пример #2
0
 public void resetTypist(CharacterSource newTypist) {
   try {
     scoreLock.lock();
     if (typist != null) typist.removeCharacterListener(this);
     typist = newTypist;
     if (typist != null) typist.addCharacterListener(this);
   } finally {
     scoreLock.unlock();
   }
 }
Пример #3
0
 public ScoreLabel(CharacterSource generator, CharacterSource typist) {
   this.generator = generator;
   this.typist = typist;
   if (generator != null) generator.addCharacterListener(this);
   if (typist != null) typist.addCharacterListener(this);
 }