Пример #1
0
  @NotNull
  public ValueContainerImpl<Value> copy() {
    ValueContainerImpl<Value> container = new ValueContainerImpl<Value>();

    if (myInputIdMapping instanceof THashMap) {
      final THashMap<Value, Object> mapping = (THashMap<Value, Object>) myInputIdMapping;
      final THashMap<Value, Object> newMapping = new THashMap<Value, Object>(mapping.size());
      container.myInputIdMapping = newMapping;

      mapping.forEachEntry(
          new TObjectObjectProcedure<Value, Object>() {
            @Override
            public boolean execute(Value key, Object val) {
              if (val instanceof ChangeBufferingList) {
                newMapping.put(key, ((ChangeBufferingList) val).clone());
              } else {
                newMapping.put(key, val);
              }
              return true;
            }
          });
    } else {
      container.myInputIdMapping = myInputIdMapping;
      container.myInputIdMappingValue =
          myInputIdMappingValue instanceof ChangeBufferingList
              ? ((ChangeBufferingList) myInputIdMappingValue).clone()
              : myInputIdMappingValue;
    }
    return container;
  }
Пример #2
0
 private void fixUnresolvedClassReferences() {
   openClassDescriptorToQualifiedLabel.forEachEntry(
       new TObjectObjectProcedure<ClassDescriptor, JsNameRef>() {
         @Override
         public boolean execute(ClassDescriptor descriptor, JsNameRef ref) {
           if (ref.getName() == null) {
             // from library
             ref.resolve(context().getNameForDescriptor(descriptor));
             ref.setQualifier(context().getQualifierForDescriptor(descriptor));
           }
           return true;
         }
       });
 }
Пример #3
0
  private THashMap<Value, Object> mapCopy(final THashMap<Value, Object> map) {
    if (map == null) {
      return null;
    }
    final THashMap<Value, Object> cloned = map.clone();
    cloned.forEachEntry(
        new TObjectObjectProcedure<Value, Object>() {
          @Override
          public boolean execute(Value key, Object val) {
            if (val instanceof ChangeBufferingList) {
              cloned.put(key, ((ChangeBufferingList) val).clone());
            }
            return true;
          }
        });

    return cloned;
  }
 public void process(@NotNull TObjectObjectProcedure<T, T> procedure) {
   modifiedToOriginal.forEachEntry(procedure);
 }