Exemplo n.º 1
0
 /* (non-Javadoc)
  * @see org.xmlrobot.hyperspace.Recurrence#mass(org.xmlrobot.genesis.MassListener, org.xmlrobot.horizon.Takion)
  */
 @Override
 public void mass(MassListener sender, Tachyon<?, ?> event) {
   super.mass(sender, event);
   switch (event.getCommand()) {
     case ORDER:
       if (event.getSource() instanceof HyperbosonW) {
         // declare stem
         Mass<Sun, AlphaCentauri> future;
         // cast source
         HyperbosonW pair = (HyperbosonW) event.getSource();
         // check if empty and chained
         if ((future = get()) != null
             ? !future.isEmpty() ? !future.contains(pair) : true
             : false) {
           // release child
           future.order(pair);
         }
       }
       break;
     case SEND:
       if (event.getSource() instanceof HyperbosonW) {
         // declare stem
         Mass<Sun, AlphaCentauri> future;
         // cast source
         HyperbosonW pair = (HyperbosonW) event.getSource();
         // check if empty and chained
         if ((future = get()) != null
             ? !future.isEmpty() ? !future.contains(pair) : true
             : false) {
           // push child
           future.add(pair);
         }
       }
       break;
     case RELEASE:
       if (event.getSource() instanceof HyperbosonW) {
         // declare stem
         Mass<Sun, AlphaCentauri> future;
         // cast source
         HyperbosonW pair = (HyperbosonW) event.getSource();
         // check if empty and chained
         if ((future = get()) != null
             ? !future.isEmpty() ? future.contains(pair) : false
             : false) {
           // release child
           future.remove(pair);
         }
       }
       break;
     case SUBMIT:
       if (event.getSource() instanceof HyperbosonW) {
         // declare stem
         Mass<Sun, AlphaCentauri> future;
         // cast source
         HyperbosonW pair = (HyperbosonW) event.getSource();
         // check if empty and chained
         if ((future = get()) != null
             ? !future.isEmpty() ? !future.contains(pair) : true
             : false) {
           // push child
           future.submit(pair);
         }
       }
       break;
     default:
       break;
   }
 }
Exemplo n.º 2
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) {
          // cast child
          Columbia entity = (Columbia) event.getSource();
          // push supercluster into hyperspace
          put(entity, (Fornax) entity.get());
        }
        break;
      case ORDER:
        if (event.getSource() instanceof Cluster) {
          // declare stem
          Mass<Fornax, Columbia> future;
          // cast source
          Cluster pair = (Cluster) event.getSource();
          // check if empty and chained
          if ((future = get()) != null
              ? !future.isEmpty() ? !future.contains(pair) : true
              : false) {
            // release child
            future.order(pair);
          }
        }
        break;
      case SEND:
        if (event.getSource() instanceof Cluster) {
          // get antimatter
          Mass<Fornax, Columbia> future;
          // cast source
          Cluster pair = (Cluster) event.getSource();
          // check if empty and chained
          if ((future = get()) != null
              ? !future.isEmpty() ? !future.contains(pair) : true
              : false) {
            // submit child to the inheritance cycle
            future.add(pair);
          }
        }
        break;
      case PUSH:
        if (event.getSource() instanceof Columbia) {
          // check emptiness
          if (!isEmpty()) {
            // cast source
            Columbia key = (Columbia) event.getSource();
            // send pulse to child's value
            getValue().pulse(this, new Expansion(key));
          }
        } else if (event.getSource() instanceof Cluster) {
          // call child
          if (!isEmpty()) {
            // cast source
            Cluster pair = (Cluster) event.getSource();
            // emit mass to the future
            getChild().pulse(this, new Dilatation(pair));
          }
        }
        break;
      case RELEASE:
        if (event.getSource() instanceof Cluster) {
          // declare stem
          Mass<Fornax, Columbia> future;
          // cast source
          Cluster pair = (Cluster) event.getSource();
          // check if empty and chained
          if ((future = get()) != null
              ? !future.isEmpty() ? future.contains(pair) : false
              : false) {
            // release child
            future.remove(pair);
          }
        }
        break;
      case SUBMIT:
        if (event.getSource() instanceof Cluster) {
          // declare stem
          Mass<Fornax, Columbia> future;
          // cast source
          Cluster pair = (Cluster) event.getSource();
          // check if empty and chained
          if ((future = get()) != null
              ? !future.isEmpty() ? !future.contains(pair) : true
              : false) {
            // push child
            future.submit(pair);
          }
        }
        break;
      case TRANSFER:
        if (event.getSource() instanceof Capricornus) {
          // cast source
          Capricornus pair = (Capricornus) event.getSource();
          // make pair free
          pair.remove();
        } else if (event.getSource() instanceof Cluster) {
          // the funeral of cluster
          event.stop(getContext());
        }
        break;
      default:
        break;
    }
  }
Exemplo n.º 3
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 Ecosystem) {
          // cast source
          Ecosystem entity = (Ecosystem) event.getSource();
          // create key-value pair
          put(entity, (Biosphere) entity.get());
        }
        break;
      case ORDER:
        if (event.getSource() instanceof Earth) {
          // declare stem
          Mass<Biosphere, Ecosystem> future;
          // cast source
          Earth pair = (Earth) event.getSource();
          // check if empty and chained
          if ((future = get()) != null
              ? !future.isEmpty() ? !future.contains(pair) : true
              : false) {
            // release child
            future.order(pair);
          }
        }
        break;
      case SEND:
        if (event.getSource() instanceof Earth) {
          // get matter
          Mass<Biosphere, Ecosystem> future;
          // cast source
          Earth pair = (Earth) event.getSource();
          // check if empty and chained
          if ((future = get()) != null
              ? !future.isEmpty() ? !future.contains(pair) : true
              : false) {
            // submit child to the inheritance cycle
            future.add(pair);
          }
        }
        break;
      case PUSH:
        if (event.getSource() instanceof Ecosystem) {
          // check emptiness
          if (!isEmpty()) {
            // cast source
            Ecosystem key = (Ecosystem) event.getSource();
            // send pulse to child's value
            getValue().pulse(this, new Homogenization(key));
          }
        } else if (event.getSource() instanceof Earth) {
          // check emptiness
          if (!isEmpty()) {
            // cast source
            Earth earth = (Earth) event.getSource();
            // send him a little asteroid
            getChild().pulse(this, new Impact(earth));
          }
        }
        break;
      case RELEASE:
        if (event.getSource() instanceof Earth) {
          // declare stem
          Mass<Biosphere, Ecosystem> future;
          // cast source
          Earth pair = (Earth) event.getSource();
          // check if empty and chained
          if ((future = get()) != null
              ? !future.isEmpty() ? future.contains(pair) : false
              : false) {
            // release child
            future.remove(pair);
          }
        }
        break;
      case SUBMIT:
        if (event.getSource() instanceof Earth) {
          // declare stem
          Mass<Biosphere, Ecosystem> future;
          // cast source
          Earth pair = (Earth) event.getSource();
          // check if empty and chained
          if ((future = get()) != null
              ? !future.isEmpty() ? !future.contains(pair) : true
              : false) {
            // push child
            future.submit(pair);
          }
        }
        break;
      case TRANSFER:
        if (event.getSource() instanceof Being) {
          // cast source
          Being pair = (Being) event.getSource();
          // free from inheritance
          pair.remove();
        } else if (event.getSource() instanceof Earth) {
          // the funeral
          event.stop(getContext());
        }
        break;
      default:
        break;
    }
  }