Beispiel #1
0
  public ActMood mostSpecificGeneralization(CD that) {
    if (this == that || this.equals(that)) return this;
    if (!(that instanceof ActMood))
      throw new UnsupportedOperationException("cannot handle argument of class " + that.getClass());
    final ActMood thatActMood = (ActMood) that;

    // First build the intersection of the implied concepts
    // the remainder is a single path of which we have to
    // find the most specific concept, i.e., the one who
    // has all others as parents, i.e., the one with the
    // largest set of implied concepts.
    EnumSet<ActMood> intersection = EnumSet.copyOf(getImpliedConcepts());
    intersection.removeAll(EnumSet.complementOf(thatActMood.getImpliedConcepts()));
    intersection.remove(root);

    // XXX: this iterative search is likely to be least optimal because
    // we probably have to search the path from the root here.
    // I don't know of any better way to do it right now though.

    ActMood mostSpecificKnownGeneralization = root;
    int maxKnownSpecificity = 1;

    for (ActMood candidate : intersection) {
      int specificity = candidate.getImpliedConcepts().size();
      if (specificity > maxKnownSpecificity) {
        maxKnownSpecificity = specificity;
        mostSpecificKnownGeneralization = candidate;
      }
    }

    return mostSpecificKnownGeneralization;
  }
 @Override
 public TextGraphics putString(
     int column, int row, String string, SGR extraModifier, SGR... optionalExtraModifiers) {
   clearModifiers();
   EnumSet<SGR> extraModifiers = EnumSet.of(extraModifier, optionalExtraModifiers);
   extraModifiers.removeAll(activeModifiers);
   enableModifiers(extraModifiers);
   putString(column, row, string);
   disableModifiers(extraModifiers);
   return this;
 }
 public void tickStart(EnumSet<TickType> ticks, Object... data) {
   sidedDelegate.profileStart("modTickStart$" + ticks);
   for (ITickHandler ticker : tickHandlers) {
     EnumSet<TickType> ticksToRun = EnumSet.copyOf(ticker.ticks());
     ticksToRun.removeAll(EnumSet.complementOf(ticks));
     if (!ticksToRun.isEmpty()) {
       sidedDelegate.profileStart(ticker.getLabel());
       ticker.tickStart(ticksToRun, data);
       sidedDelegate.profileEnd();
     }
   }
   sidedDelegate.profileEnd();
 }
Beispiel #4
0
  public void tickStart(EnumSet<TickType> ticks, Side side, Object... data) {
    List<IScheduledTickHandler> scheduledTicks =
        side.isClient() ? scheduledClientTicks : scheduledServerTicks;

    if (scheduledTicks.size() == 0) {
      return;
    }
    for (IScheduledTickHandler ticker : scheduledTicks) {
      EnumSet<TickType> ticksToRun =
          EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
      ticksToRun.removeAll(EnumSet.complementOf(ticks));
      if (!ticksToRun.isEmpty()) {
        ticker.tickStart(ticksToRun, data);
      }
    }
  }
 /** Return the set of unsupported JVM features that improve the estimation. */
 public static EnumSet<JvmFeature> getUnsupportedFeatures() {
   EnumSet<JvmFeature> unsupported = EnumSet.allOf(JvmFeature.class);
   unsupported.removeAll(supportedFeatures);
   return unsupported;
 }