Java Collections.unmodifiableSortedSet Examples

Java Collections.unmodifiableSortedSet - 30 examples found. These are the top rated real world Java examples of java.util.Collections.unmodifiableSortedSet extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 State(String name, String stateCode, int index, State[] ambiguities) {
   this.name = name;
   this.stateCode = stateCode;
   this.ambiguities =
       Collections.unmodifiableSortedSet(new TreeSet<State>(Arrays.asList(ambiguities)));
   this.index = index;
 }
Example #2
0
    SortedSet<MMObjectNode> getBySourceDestinationRole(int source, int destination, int role) {
      // determine minimum value - corrects in case '-1' (common MMBase value for N.A.) is passed
      int roleMin = role <= 0 ? 0 : role;
      int destinationMin = destination <= 0 ? 0 : destination;
      int sourceMin = source <= 0 ? 0 : source;

      // determine maximum value
      int roleMax = role <= 0 ? 0 : role + 1; // i.e. source, destination, role
      int destinationMax =
          role <= 0 ? destinationMin + 1 : destinationMin; // i.e. source, destination, 0
      int sourceMax =
          (destination <= 0 && role <= 0)
              ? (sourceMin <= 0 ? 0 : sourceMin + 1)
              : sourceMin; // i.e. source, 0, 0

      VirtualTypeRelNode fromTypeRelNode =
          new VirtualTypeRelNode(sourceMin, destinationMin, roleMin);
      VirtualTypeRelNode toTypeRelNode = new VirtualTypeRelNode(sourceMax, destinationMax, roleMax);

      if (log.isDebugEnabled()) {
        log.debug(" " + fromTypeRelNode + " " + toTypeRelNode);
      }
      SortedSet<MMObjectNode> allowed = subSet(fromTypeRelNode, toTypeRelNode);
      return Collections.unmodifiableSortedSet(allowed);
    }
  public static SortedSet<Integer> findAll(List<?> list, Object elem) {
    if (list == null) throw new IllegalArgumentException("list cannot be null.");
    SortedSet<Integer> result = new TreeSet<Integer>();
    for (int i = 0, n = list.size(); i < n; i++) {
      if (list.get(i).equals(elem)) {
        result.add(i);
      }
    }

    return Collections.unmodifiableSortedSet(result);
  }
  public PossibleTypesServiceData(final Collection<ElementType> types) {
    final SortedSet<ElementType> clean = new TreeSet<ElementType>(COMPARATOR);

    for (ElementType type : types) {
      if (type != null) {
        clean.add(type);
      }
    }

    this.types = Collections.unmodifiableSortedSet(clean);
  }
 /**
  * Get the sorted selected positions in a byte with the right most position as zero.
  *
  * @param input Byte to be evaluated
  * @return Array of integer positions.
  */
 public static SortedSet<Integer> getSelectedPCR(byte input) {
   ArrayList<Integer> arrayList = new ArrayList<Integer>();
   byte mask = 0x01;
   for (int i = 0; i <= 7; i++) {
     int value = (input >>> i) & mask;
     if (value == 1) {
       arrayList.add(i);
     }
   }
   Collections.sort(arrayList);
   return Collections.unmodifiableSortedSet(new TreeSet<Integer>(arrayList));
 }
  public FileReader(File file, Charset charset, int splitCount, ForkJoinPool pool)
      throws IOException {
    this.raf = new BufferedAccessFile(file, READ_MODE);
    this.charset = charset;

    long threshold = Math.max(MIN_FORK_THRESHOLD, file.length() / splitCount);
    this.index =
        Collections.unmodifiableSortedSet(
            pool.invoke(new IndexingTask(file, 0, file.length(), threshold)));

    this.lock = new ReentrantLock();
  }