Java 类it.unimi.dsi.fastutil.ints.IntLists 实例源码

项目:RinLog    文件:Schedule.java   
static <C, T> Schedule<C, T> create(C context,
    ImmutableList<ImmutableList<T>> routes,
    IntList startIndices,
    RouteEvaluator<C, T> routeEvaluator) {
  final DoubleList costs = new DoubleArrayList(routes.size());
  double sumCost = 0;
  for (int i = 0; i < routes.size(); i++) {
    final double cost = routeEvaluator.computeCost(context, i, routes.get(i));
    costs.add(cost);
    sumCost += cost;
  }

  return new Schedule<C, T>(
    context,
    routes,
    IntLists.unmodifiable(new IntArrayList(startIndices)),
    DoubleLists.unmodifiable(costs),
    sumCost,
    routeEvaluator);
}
项目:RinLog    文件:Insertions.java   
@Override
public IntList next() {
  if (!hasNext()) {
    throw new NoSuchElementException();
  }
  if (index > 0) {
    for (int i = 0; i < insertionPositions.length; i++) {
      if (insertionPositions[i] == originalListSize) {
        insertionPositions[i - 1]++;
        for (int j = i; j < insertionPositions.length; j++) {
          insertionPositions[j] = insertionPositions[i - 1];
        }
        break;
      } else if (i == insertionPositions.length - 1) {
        insertionPositions[i]++;
      }
    }
  }
  index++;
  return IntLists.unmodifiable(new IntArrayList(insertionPositions));
}
项目:RinLog    文件:Schedule.java   
static <C, T> Schedule<C, T> create(C context,
    ImmutableList<ImmutableList<T>> routes,
    IntList startIndices,
    DoubleList objectiveValues,
    double globalObjectiveValue,
    RouteEvaluator<C, T> routeEvaluator) {

  return new Schedule<C, T>(
    context,
    routes,
    IntLists.unmodifiable(new IntArrayList(startIndices)),
    DoubleLists.unmodifiable(new DoubleArrayList(objectiveValues)),
    globalObjectiveValue,
    routeEvaluator);
}
项目:RinLog    文件:Swaps.java   
/**
 * Removes all items from list and returns the indices of the removed items.
 * @param list The list to remove items from.
 * @param item The item to remove from the list.
 * @return The indices of the removed items, or an empty list if the item was
 *         not found in list.
 */
static <T> IntList removeAll(List<T> list, T item) {
  final Iterator<T> it = list.iterator();
  final IntArrayList indices = new IntArrayList();
  int i = 0;
  while (it.hasNext()) {
    if (it.next().equals(item)) {
      it.remove();
      indices.add(i);
    }
    i++;
  }
  return IntLists.unmodifiable(indices);
}
项目:iChunUtil    文件:ConditionalIngredient.java   
@Override
@Nonnull
public IntList getValidItemStacksPacked() {
    boolean normal = isConditionMet.getAsBoolean();
    IntList validStacks = normal ? packedConditionMet : packedConditionNotMet;
    if (validStacks == null)
    {
        validStacks = IntLists.singleton(RecipeItemHelper.pack(normal ? stackConditionMet : stackConditionNotMet));
        if (normal)
            packedConditionMet = validStacks;
        else
            packedConditionNotMet = validStacks;
    }
    return validStacks;
}
项目:LanternServer    文件:MessagePlayOutUnlockRecipes.java   
private MessagePlayOutUnlockRecipes(boolean openRecipeBook, boolean craftingFilter, IntList recipeIds) {
    this.recipeIds = IntLists.unmodifiable(recipeIds);
    this.openRecipeBook = openRecipeBook;
    this.craftingFilter = craftingFilter;
}
项目:LanternServer    文件:MessagePlayOutUnlockRecipes.java   
public Init(boolean openRecipeBook, boolean craftingFilter, IntList recipeIds, IntList recipeIdsToBeDisplayed) {
    super(openRecipeBook, craftingFilter, recipeIds);
    this.recipeIdsToBeDisplayed = IntLists.unmodifiable(recipeIdsToBeDisplayed);
}
项目:RinLog    文件:Swaps.java   
static IntList asIntList(final int... values) {
  return IntLists.unmodifiable(new IntArrayList(values));
}