示例#1
0
文件: F.java 项目: gspandy/utils
 public <X> Either<A, B> fold(Action<A> fa, Action<B> fb) {
   if (isLeft()) {
     fa.apply(left.get());
     return new Either<A, B>(left.get(), null);
   } else if (isRight()) {
     fb.apply(right.get());
     return new Either<A, B>(null, right.get());
   } else {
     return new Either<A, B>(null, null);
   }
 }
 @Override
 protected void apply(
     final ResolutionRule originalRule, final Collection<ResolutionRule> output) {
   for (Action adjust : _adjusts) {
     adjust.apply(originalRule, output);
   }
 }
示例#3
0
文件: F.java 项目: gspandy/utils
 @Override
 public Option<T> map(Action<T> function) {
   if (isDefined()) {
     function.apply(get());
     return Option.maybe(get());
   }
   return Option.none();
 }
示例#4
0
 public void withConnection(Action<Connection> f) {
   Connection c = connection();
   try {
     f.apply(c);
     c.commit();
   } catch (Exception e) {
     rollback(c);
     throw new DatabaseException(e);
   } finally {
     close(c);
   }
 }
  private void checkWhen(
      Action[] actions, @Nullable String[] pathsToCompile, @Nullable String[] pathsToDelete) {
    for (Action action : actions) {
      action.apply();
    }

    makeAll().assertSuccessful();

    if (pathsToCompile != null) {
      assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, pathsToCompile);
    }

    if (pathsToDelete != null) {
      assertDeleted(pathsToDelete);
    }
  }
 @Override
 public Collection<ResolutionRule> transform(final Collection<ResolutionRule> rules) {
   final Collection<ResolutionRule> result = new ArrayList<ResolutionRule>(rules.size());
   for (ResolutionRule rule : rules) {
     final String function =
         rule.getFunction().getFunction().getFunctionDefinition().getShortName();
     final Action action = _functionTransformations.get(function);
     if (action == null) {
       s_logger.debug("Function {} has no transformation rules", function);
       result.add(rule);
     } else {
       s_logger.debug("Applying transformation rules for function {}", function);
       action.apply(rule, result);
     }
   }
   return result;
 }
示例#7
0
 public void doAction() throws VehicleClashException {
   if (this.resAction != null) resAction.apply(board);
 }
示例#8
0
 public void applyAction(Personnage perso, Personnage target, int objID, short cellid) {
   for (Action a : onUseActions) a.apply(perso, target, objID, cellid);
 }