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();
  }
 static {
   final SortedSet<String> ecmds = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
   ecmds.addAll(Arrays.asList("exit", "done", "quit", "end", "fino"));
   EXIT_COMMANDS = Collections.unmodifiableSortedSet(ecmds);
   final SortedSet<String> hcmds = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
   hcmds.addAll(Arrays.asList("help", "helpi", "?"));
   HELP_COMMANDS = Collections.unmodifiableSet(hcmds);
   DATE_PATTERN =
       Pattern.compile("\\d{4}([-\\/])\\d{2}\\1\\d{2}"); // http://regex101.com/r/xB8dR3/1
   HELP_MESSAGE =
       format(
           "Please enter some data or enter one of the following commands to exit %s",
           EXIT_COMMANDS);
 }
Example #8
0
 public EmpUser(
     Long userId,
     String name,
     String email,
     String pass,
     String deptId,
     String deptName,
     Date createDate,
     Integer enable,
     String userAccount,
     Set<Roles> roleSet,
     String password,
     String username,
     Set<GrantedAuthority> authorities,
     boolean accountNonExpired,
     boolean accountNonLocked,
     boolean credentialsNonExpired,
     boolean enabled) {
   super();
   if (((userAccount == null) || "".equals(userAccount)) || (pass == null)) {
     throw new IllegalArgumentException(
         "userAccount and pass cannot be null or empty values to constructor");
   }
   this.userId = userId;
   this.name = name;
   this.email = email;
   this.pass = pass;
   this.deptId = deptId;
   this.deptName = deptName;
   this.createDate = createDate;
   this.enable = enable;
   this.userAccount = userAccount;
   this.roleSet = roleSet;
   this.password = password;
   this.username = username;
   this.authorities = Collections.unmodifiableSortedSet(sortAuthorities(authorities));
   this.accountNonExpired = accountNonExpired;
   this.accountNonLocked = accountNonLocked;
   this.credentialsNonExpired = credentialsNonExpired;
   this.enabled = enabled;
 }
Example #9
0
    SortedSet<MMObjectNode> getByDestinationSourceRole(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 sourceMin = source <= 0 ? 0 : source;
      int destinationMin = destination <= 0 ? 0 : destination;

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

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

      final SortedSet allowed = subSet(fromTypeRelNode, toTypeRelNode);
      return Collections.unmodifiableSortedSet(allowed);
    }
  /**
   * Constructs a nullable set for the given grammar.
   *
   * @param g
   */
  public NullableNonterminals(CFG g) {
    super();

    // Construct Nullable Nonterminals
    List<Production> productions = g.productions();
    boolean changing = true;
    while (changing) {
      changing = false;
      for (Production p : productions) {
        Token left = p.leftHandSide();
        if (!nullable.contains(left)) {
          if (p.goesToEpsilon()) {
            nullable.add(left);
            changing = true;
          } else {
            List<Token> rhs = p.rightHandSide();
            boolean all_nullable = true;
            for (Token right : rhs) {
              if (!nullable.contains(right)) {
                all_nullable = false;
                break;
              }
            }

            if (all_nullable) {
              nullable.add(left);
              changing = true;
            }
          }
        }
      }
    }

    // ---------------------------------------------------------------------
    /*
     * Stores an immutable version of the non-terminal set to avoid
     * accidentally mutating it later.
     */
    this.nullable = Collections.unmodifiableSortedSet(nullable);
  }
 public SortedSet<MavenVersion> getVersions() {
   return Collections.unmodifiableSortedSet(versions);
 }
 public SortedSet<AnalyzedInstruction> getPredecessors() {
   return Collections.unmodifiableSortedSet(predecessors);
 }
 private AttributeSet(final SortedSet<Attribute> attributes) {
   this.attributes = Collections.unmodifiableSortedSet(attributes);
 }
 public SortedSet<SLeak> getLeaks() {
   return Collections.unmodifiableSortedSet(leaks);
 }
 protected SortedSet<String> getObject() {
   SortedSet<String> set = new TreeSet<String>();
   set.add("string");
   return Collections.unmodifiableSortedSet(set);
 }
 private StripCapabilitiesResult(
     SortedSet<String> requiredCapabilities, SortedSet<String> obsoleteCapabilities) {
   this.requiredCapabilities = Collections.unmodifiableSortedSet(requiredCapabilities);
   this.obsoleteCapabilities = Collections.unmodifiableSortedSet(obsoleteCapabilities);
 }
Example #17
0
 /** @see SPNode */
 public SortedSet<SPVertex<T>> getConnections() {
   return (Collections.unmodifiableSortedSet(links));
 }
 public SortedSet<Abbreviation> getAbbreviations() {
   return Collections.unmodifiableSortedSet(abbreviations);
 }
Example #19
0
 private void aqH() {
   List localList = Arrays.asList(bPR.h(this.cig));
   this.cXs = Collections.unmodifiableSortedSet(new TreeSet(localList));
 }
Example #20
0
 /**
  * staticインポート名のソートされたセットを取得する。
  *
  * @return staticインポート名のソートされたセット
  */
 public SortedSet<String> getStaticImportNameSet() {
   return Collections.unmodifiableSortedSet(staticImportNameSet);
 }
 public SortedSet<SPos> getChop() {
   return Collections.unmodifiableSortedSet(chop);
 }
 public DependencyEntry(String uid, SortedSet<DefDescriptor<?>> dependencies, long lastModTime) {
   this.uid = uid;
   this.dependencies = Collections.unmodifiableSortedSet(dependencies);
   this.lastModTime = lastModTime;
   this.qfe = null;
 }
Example #23
0
 @Override
 public Iterator<PriceStep> iterator() {
   return Collections.unmodifiableSortedSet(priceSteps).iterator();
 }
 public SortedSet<OwsOperation> getOperations() {
   return Collections.unmodifiableSortedSet(operations);
 }
 protected SortedSet<String> getAnotherObject() {
   SortedSet<String> set = new TreeSet<String>();
   return Collections.unmodifiableSortedSet(set);
 }
  /** Tracks the state of resolving a single client object. */
  private static class Resolution {
    /** There's no Collections shortcut for this. */
    private static final SortedSet<String> EMPTY =
        Collections.unmodifiableSortedSet(new TreeSet<String>());

    /** The client object. */
    private final Object clientObject;

    /**
     * A one-shot flag for {@link #hasWork()} to ensure that simple properties will be resolved,
     * even when there's no requested property set.
     */
    private boolean needsSimpleValues;

    private SortedSet<String> toResolve = EMPTY;
    private final SortedSet<String> resolved = new TreeSet<String>();
    private final ResolutionKey key;

    public Resolution(Object simpleValue) {
      assert !(simpleValue instanceof Resolution);
      this.clientObject = simpleValue;
      this.key = null;
    }

    public Resolution(ResolutionKey key, BaseProxy clientObject) {
      this.clientObject = clientObject;
      this.key = key;
      needsSimpleValues = true;
    }

    /**
     * Removes the prefix from each requested path and enqueues paths that have not been previously
     * resolved for the next batch of work.
     */
    public void addPaths(String prefix, Collection<String> requestedPaths) {
      if (clientObject == null) {
        // No point trying to follow paths past a null value
        return;
      }

      // Identity comparison intentional
      if (toResolve == EMPTY) {
        toResolve = new TreeSet<String>();
      }
      prefix = prefix.isEmpty() ? prefix : (prefix + ".");
      int prefixLength = prefix.length();
      for (String path : requestedPaths) {
        if (path.startsWith(prefix)) {
          toResolve.add(path.substring(prefixLength));
        } else if (path.startsWith("*.")) {
          toResolve.add(path.substring("*.".length()));
        }
      }
      toResolve.removeAll(resolved);
      if (toResolve.isEmpty()) {
        toResolve = EMPTY;
      }
    }

    public Object getClientObject() {
      return clientObject;
    }

    public ResolutionKey getResolutionKey() {
      return key;
    }

    public boolean hasWork() {
      return needsSimpleValues || !toResolve.isEmpty();
    }

    public boolean needsSimpleValues() {
      return needsSimpleValues;
    }

    /** Returns client-object-relative reference paths that should be further resolved. */
    public SortedSet<String> takeWork() {
      needsSimpleValues = false;
      SortedSet<String> toReturn = toResolve;
      resolved.addAll(toReturn);
      toResolve = EMPTY;
      return toReturn;
    }
  }
 @Override
 public SortedSet<V> getVersions() {
   return Collections.unmodifiableSortedSet(versions);
 }
 public SortedSet<File> getResult() {
   return Collections.unmodifiableSortedSet(myResult);
 }
 /**
  * Returns the parameters set by {@link #setParam(String, String)}. If no parameters are set, an
  * empty set will be returned
  */
 @DatabaseChangeProperty(isChangeProperty = false)
 public SortedSet<String> getParams() {
   return Collections.unmodifiableSortedSet(params);
 }
Example #30
0
 private Depth(DbEntity dbEntity, Symbol symbol, SortedSet<Offer> asks, SortedSet<Offer> bids) {
   super(dbEntity);
   this.symbol = symbol;
   this.asks = Collections.unmodifiableSortedSet(asks);
   this.bids = Collections.unmodifiableSortedSet(bids);
 }