Package org.waveprotocol.wave.model.document.operation.impl

Examples of org.waveprotocol.wave.model.document.operation.impl.AttributesUpdateImpl


              c.getUpdateAttributes().getAttributeUpdate(i);
            triplets[j++] = kvu.getKey();
            triplets[j++] = kvu.hasOldValue() ? kvu.getOldValue() : null;
            triplets[j++] = kvu.hasNewValue() ? kvu.getNewValue() : null;
          }
          output.updateAttributes(new AttributesUpdateImpl(triplets));
        }
      } else {
        //throw new IllegalArgumentException("Unsupported operation component: " + c);
      }
    }
View Full Code Here


      currentLocation++;
      currentContainer = currentContainer.getNextContainer();
      currentParent = node;
      annotations.skip(1);

      AttributesUpdateImpl attrUpdate = new AttributesUpdateImpl(triples);
      builder.updateAttributes(attrUpdate);
      onModifyAttributes(currentParent, attrUpdate);
    }
View Full Code Here

    b.replaceAttributes(new AttributesImpl(), Attributes.EMPTY_MAP);
    // Now we add similar cases for annotation boundaries.  Since consecutive annotation
    // boundaries would make the operation ill-formed, we interleave them with further
    // updateAttributes tests.
    b.annotationBoundary(AnnotationBoundaryMapImpl.builder().build());
    b.updateAttributes(new AttributesUpdateImpl());
    b.annotationBoundary(AnnotationBoundaryMapImpl.builder()
        .updateValues("b", "XZ", "yz", "f-", null, null,
            "g-", "a", null, "k-", "b", "", "r", "", "2")
        .build());
    b.updateAttributes(new AttributesUpdateImpl("a", null, "1"));
    b.annotationBoundary(AnnotationBoundaryMapImpl.builder()
        .initializationEnd("b", "g-", "k-", "r")
        .updateValues("e", "166", null, "f-", null, null)
        .build());
    b.updateAttributes(new AttributesUpdateImpl("P", null, "", ":wq", "ZZ", null));
    b.annotationBoundary(AnnotationBoundaryMapImpl.builder()
        .initializationEnd("e", "f-")
        .build());

    return b.finish();
View Full Code Here

   */
  public static DocOp setAttribute(int size, int location, String name, String oldValue,
      String newValue) {
    return new SimplifyingDocOpBuilder()
        .retain(location)
        .updateAttributes(new AttributesUpdateImpl(name, oldValue, newValue))
        .retain(size - location - 1)
        .build();
  }
View Full Code Here

            return pickRandomNonNullMappedElement(r, p.getAttributeValues(),
                new Mapper<String, Pair<String, String>>() {
              @Override
              public Pair<String, String> map(String value) {
                Attributes b = finalAttrAccu.updateWith(
                    new AttributesUpdateImpl(name, null, value));
                assert b != finalAttrAccu; // assert non-destructiveness
                ValidationResult v = checker.check(b);
                if (valid && !v.isValid() || !valid && v.isIllFormed()) {
                  return null;
                } else {
                  return Pair.of(name, value);
                }
              }
            });
          }
        });
        if (newAttr == null) {
          return attrAccu;
        }
        attrAccu = attrAccu.updateWith(
            new AttributesUpdateImpl(newAttr.getFirst(), null, newAttr.getSecond()));
      }
      return attrAccu;
    }
View Full Code Here

        syncAnnotations();
        Map<String, String> updated = new HashMap<String, String>();
        for (int i = 0; i < update.changeSize(); ++i) {
          updated.put(update.getChangeKey(i), update.getNewValue(i));
        }
        AttributesUpdate newUpdate = new AttributesUpdateImpl();
        // TODO: This is a little silly. We should do this a better way.
        for (int i = 0; i < this.update.changeSize(); ++i) {
          String key = this.update.getChangeKey(i);
          String newOldValue = updated.containsKey(key) ? updated.get(key)
              : this.update.getOldValue(i);
          newUpdate = newUpdate.composeWith(new AttributesUpdateImpl(key,
              newOldValue, this.update.getNewValue(i)));
        }
        targetDocument.updateAttributes(newUpdate);
        Set<String> keySet = new HashSet<String>();
        for (int i = 0; i < this.update.changeSize(); ++i) {
View Full Code Here

    preAnnotationQueue.flush();
    postAnnotationQueue.flush();
  }

  private static AttributesUpdate invertUpdate(AttributesUpdate attrUpdate) {
    AttributesUpdate inverseUpdate = new AttributesUpdateImpl();
    // TODO: This is a little silly. We should do this a better way.
    for (int i = 0; i < attrUpdate.changeSize(); ++i) {
      inverseUpdate = inverseUpdate.composeWith(new AttributesUpdateImpl(
          attrUpdate.getChangeKey(i), attrUpdate.getNewValue(i), attrUpdate.getOldValue(i)));
    }
    return inverseUpdate;
  }
View Full Code Here

    target.replaceAttributes(newAttrs, oldAttrs);
  }

  @Override
  public void updateAttributes(AttributesUpdate attrUpdate) {
    AttributesUpdate update = new AttributesUpdateImpl();
    // TODO: This is a little silly. We should do this a better way.
    for (int i = 0; i < attrUpdate.changeSize(); ++i) {
      update = update.composeWith(new AttributesUpdateImpl(attrUpdate.getChangeKey(i),
          attrUpdate.getNewValue(i), attrUpdate.getOldValue(i)));
    }
    target.updateAttributes(update);
  }
View Full Code Here

          for (KeyValueUpdate kvu : u.getAttributeUpdate()) {
            triplets[i++] = kvu.getKey();
            triplets[i++] = kvu.hasOldValue() ? kvu.getOldValue() : null;
            triplets[i++] = kvu.hasNewValue() ? kvu.getNewValue() : null;
          }
          output.updateAttributes(new AttributesUpdateImpl(triplets));
        }
      } else {
        // throw new
        // IllegalArgumentException("Unsupported operation component: " + c);
      }
View Full Code Here

              c.getUpdateAttributes().getAttributeUpdate(i);
            triplets[j++] = kvu.getKey();
            triplets[j++] = kvu.hasOldValue() ? kvu.getOldValue() : null;
            triplets[j++] = kvu.hasNewValue() ? kvu.getNewValue() : null;
          }
          output.updateAttributes(new AttributesUpdateImpl(triplets));
        }
      } else {
        //throw new IllegalArgumentException("Unsupported operation component: " + c);
      }
    }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.impl.AttributesUpdateImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.