Example #1
0
 @Override
 public Map<SkyKey, NodeEntry> createIfAbsentBatch(Iterable<SkyKey> keys) {
   for (SkyKey key : keys) {
     notifyingHelper.graphListener.accept(key, EventType.CREATE_IF_ABSENT, Order.BEFORE, null);
   }
   return Maps.transformEntries(delegate.createIfAbsentBatch(keys), notifyingHelper.wrapEntry);
 }
 @Override
 public Map<String, Object> getAttributes() {
   return Maps.transformEntries(
       configuration.getSource(),
       new Maps.EntryTransformer<String, Object, Object>() {
         @Override
         public Object transformEntry(String key, Object value) {
           if (SENSITIVE_CONFIGURATION_KEYS.contains(key)) {
             return "****";
           }
           return value;
         }
       });
 }
Example #3
0
  /**
   * Creates a new vocabulary backed by the given {@link Enum} class and with properties having the
   * common URI stem <code>base</code> and prefix <code>prefix</code>
   *
   * @param clazz the enumeration backing this vocabulary.
   * @param base the common stem URI of properties in this vocabulary.
   * @param prefix the common prefix of properties in this vocabulary.
   */
  public <T extends Enum<T>> EnumVocab(
      final Class<T> clazz, final String base, final String prefix) {
    this.index =
        ImmutableMap.copyOf(
            Maps.transformEntries(
                Maps.uniqueIndex(EnumSet.allOf(clazz), ENUM_TO_NAME),
                new EntryTransformer<String, T, Property>() {

                  @Override
                  public Property transformEntry(String name, T enumee) {
                    return Property.newFrom(name, base, prefix, enumee);
                  }
                }));
  }
Example #4
0
    LongPositions(Iterable<? extends Object> elements, final int bitPerLong) {
      this.elements = ImmutableList.copyOf(elements);
      checkArgument(bitPerLong <= BITS_IN_LONG, bitPerLong);

      for (int i = 0; i < this.elements.size(); i++) {
        positions.put(this.elements.get(i), new BitPosition(i / bitPerLong, i % bitPerLong));
      }

      this.longPositions =
          ImmutableSortedMap.copyOf(
              Maps.transformEntries(
                  Multimaps.index(positions.values(), ToLongIndex.FUNCTION).asMap(),
                  new Maps.EntryTransformer<Integer, Collection<BitPosition>, LongSet>() {
                    @Override
                    public LongSet transformEntry(Integer key, Collection<BitPosition> position) {
                      return new LongSet(key, position);
                    }
                  }));
    }
Example #5
0
 @Override
 public Map<SkyKey, NodeEntry> getBatch(Iterable<SkyKey> keys) {
   return Maps.transformEntries(delegate.getBatch(keys), notifyingHelper.wrapEntry);
 }
Example #6
0
 @Override
 public Map<SkyKey, NodeEntry> getBatchWithFieldHints(
     Iterable<SkyKey> keys, EnumSet<NodeEntryField> fields) {
   return Maps.transformEntries(
       delegate.getBatchWithFieldHints(keys, fields), notifyingHelper.wrapEntry);
 }