/** * Get a {@link Set} containing all of the source vertices in this * AdjacencyMap. * * @return an immutable set containing the source vertices */ public Set<Object> getAllSources() { return Collections.unmodifiableSet(edgeGraph.rowKeySet()); }
/** * Determines whether this AdjacencyMap contains the specified source * vertex. * * @param source the source vertex to query for * * @return {@code true} if the adjacency map contains the source, otherwise * {@code false} */ public boolean containsSource(final Object source) { return edgeGraph.rowKeySet().contains(source); }
@Override public String toString() { return edgeGraph.rowKeySet().stream() .map(s -> s.toString() + "->" + getDestinations(s)) .collect(Collectors.joining(", ", "{", "}")); } }
emptyServers.clear(); emptyServerGroups.clear(); nextGroup: for (String group : extraSurplus.rowKeySet()) { if (!extras.containsKey(group)) { Iterator<TserverGroupInfo> iter = extraSurplus.row(group).values().iterator();
serversToRemove.clear(); serversGroupsToRemove.clear(); for (String group : surplusExtra.rowKeySet()) { if (!extras.containsKey(group)) { TserverGroupInfo srcTgi = surplusExtra.row(group).values().iterator().next();
/** * Get a {@link Set} containing all of the source vertices in this * AdjacencyMap. * * @return an immutable set containing the source vertices */ public Set<Object> getAllSources() { return Collections.unmodifiableSet(edgeGraph.rowKeySet()); }
/** * Determines whether this AdjacencyMap contains the specified source * vertex. * * @param source the source vertex to query for * * @return {@code true} if the adjacency map contains the source, otherwise * {@code false} */ public boolean containsSource(final Object source) { return edgeGraph.rowKeySet().contains(source); }
@Override public Iterable<V> vertices() { return Sets.union(Sets.union(graphTable.rowKeySet(), graphTable.columnKeySet()), disconnected); }
@Override public String toString() { return edgeGraph.rowKeySet().stream() .map(s -> s.toString() + "->" + getDestinations(s)) .collect(Collectors.joining(", ", "{", "}")); } }
/** * Execute a routine on all of the usernames known to this service. * * @param consumer */ public void forEachUser(Consumer<ByteBuffer> consumer) { accounts.rowKeySet().forEach(id -> { ByteBuffer username = ByteBuffers.decodeFromHex( (String) accounts.get(id, AccountAttribute.USERNAME.key())); consumer.accept(username); }); }
/** * Construct a new instance. * * @param backingStore * @param accessTokenTtl * @param accessTokenTtlUnit */ @SuppressWarnings("unchecked") private UserService(String backingStore, int accessTokenTtl, TimeUnit accessTokenTtlUnit) { this.backingStore = backingStore; this.tokens = new AccessTokenManager(accessTokenTtl, accessTokenTtlUnit); if(FileSystem.getFileSize(backingStore) > 0) { ByteBuffer bytes = FileSystem.readBytes(backingStore); accounts = Serializables.read(bytes, HashBasedTable.class); counter = new AtomicInteger( (int) Collections.max(accounts.rowKeySet())); } else { counter = new AtomicInteger(0); accounts = HashBasedTable.create(); // If there are no credentials (which implies this is a new server) // add the default admin username/password create(ByteBuffers.decodeFromHex(DEFAULT_ADMIN_USERNAME), ByteBuffers.decodeFromHex(DEFAULT_ADMIN_PASSWORD), Role.ADMIN); } }