コード例 #1
0
  /* (non-Javadoc)
   * @see org.xmlrobot.hyperspace.Recurrence#mass(org.xmlrobot.genesis.MassListener, org.xmlrobot.horizon.Tachyon)
   */
  @Override
  public void mass(MassListener sender, Tachyon<?, ?> event) {
    super.mass(sender, event);

    switch (event.getCommand()) {
      case GENESIS:
        if (event.getSource() instanceof Columbia) {
          // start supergalaxy
          event.start(getContext());
        }
        break;
      case INTERRUPTED:
      case TRANSFER:
        if (event.getSource() instanceof Columbia) {
          // stop supergalaxy
          event.stop(getContext());
        } else if (event.getSource() instanceof Capricornus) {
          // cast source
          Capricornus pair = (Capricornus) event.getSource();
          // supercluster reincarnation
          getValue().put(pair.getValue(), pair.getKey());
        }
        break;
      default:
        break;
    }
  }
コード例 #2
0
 /* (non-Javadoc)
  * @see org.xmlrobot.inheritance.Parent#run()
  */
 @Override
 public void run() {
   // avoid concurrent calls to run
   if (!message.compareAndSet(RUNNER, null, Thread.currentThread())) {
     // because is already running
     return;
   } else {
     // life starts here
     super.run();
     // life ends here
     push(Command.TRANSFER);
   }
 }