Package org.waveprotocol.wave.model.util.ReadableStringSet

Examples of org.waveprotocol.wave.model.util.ReadableStringSet.Proc


   * Behaviour is undefined if this builder is used after calling this method.
   */
  public AnnotationBoundaryMap build() {
    final String[] ends = new String[endKeys.countEntries()];
    final Triplet[] changes = new Triplet[this.changes.countEntries()];
    endKeys.each(new Proc() {
      int i = 0;
      @Override
      public void apply(String key) {
        ends[i] = key;
        i++;
View Full Code Here


          public AnnotationMap updateWithNoCompatibilityCheck(AnnotationsUpdate mutation) {
            return new AnnotationMapImpl(this).updateWithNoCompatibilityCheck(mutation);
          }
        }
        final AnnoMap annotations = new AnnoMap();
        doc.knownKeys().each(new Proc() {
          @Override
          public void apply(String key) {
            String value = doc.getAnnotation(pos, key);
            if (value != null) {
              annotations.put(key, value);
View Full Code Here

      DomOperationUtil.buildDomInitializationFromSubtree(doc, at, domOp);
    }

    // step 3: form the annotatinos
    AnnotationInterval<String> last = null;
    doc.knownKeys().each(new Proc() { // start all the keys
        @Override public void apply(String key) {
          annotOp.startAnnotation(key, null, doc.getAnnotation(removeStart, key));
        }
      });
    for (AnnotationInterval<String> interval : // update along the way
        doc.annotationIntervals(removeStart, removeEnd, null)) {
      interval.diffFromLeft().each(new ProcV<Object>() {
        @Override public void apply(String key, Object value) {
          assert value == null || value instanceof String;
          if (value != null) {
            annotOp.startAnnotation(key, null, (String) value);
          } else {
            annotOp.endAnnotation(key);
          }
        }
      });
      annotOp.retain(interval.length());
      last = interval;
    }
    doc.knownKeys().each(new Proc() { // close all the keys
      @Override public void apply(String key) {
        annotOp.endAnnotation(key);
      }
    });
View Full Code Here

  }

  public void refresh() {
    final EditorUpdateEventImpl updates = editor.debugGetUpdateEventImpl();
    updateEventsPanel.clear();
    updates.debugGetAllUpdateEventNames().each(new Proc() {
      @Override
      public void apply(final String element) {
        addCheckBox(updateEventsPanel, element,
            !updates.debugGetSuppressedUpdateEventNames().contains(element),
            new ValueChangeHandler<Boolean>() {
View Full Code Here

    // Likewise, with cursorBias = RIGHT, as all that's used & tested so far is cursorBias = LEFT

    // calculate annotation maps before and after
    final StringMap<Object> before = CollectionUtils.createStringMap();
    final StringMap<Object> after = CollectionUtils.createStringMap();
    annotationSet.knownKeys().each(new Proc() {
      @Override
      public void apply(String key) {
        if (position > 0) {
          Object beforeV = annotationSet.getAnnotation(position - 1, key);
          if (beforeV != null) {
            before.put(key, beforeV);
          }
        }
        if (position< annotationSet.size()) {
          Object afterV = annotationSet.getAnnotation(position, key);
          if (afterV != null) {
            after.put(key, afterV);
          }
        }
      }
    });

    // assign them to inside/outside the cursor based on bias:
    final StringMap<Object> inside = (cursorBias == BiasDirection.RIGHT ? after : before);
    final StringMap<Object> outside = (cursorBias == BiasDirection.RIGHT ? before : after);

    final StringMap<String> changedAnnotations = CollectionUtils.createStringMap();
    annotationSet.knownKeys().each(new Proc() {
      @Override
      public void apply(String key) {
        interpretReplace(key, type, builder, inside, outside, before, changedAnnotations);
      }
    });
View Full Code Here

  /** Mirror of stripKeys, called at the end of mutation to close annotations. */
  public void unstripKeys(final Builder builder, final ReadableStringSet stripKeys,
      final ReadableStringSet ignoreSet) {
    // NOTE(patcoleman) - maybe worth adding a set minus here. stripKeys.subtract(ignoreSet).each(
    stripKeys.each(new Proc() {
      @Override
      public void apply(String element) {
        if (!ignoreSet.contains(element)) {
          builder.endAnnotation(element);
        }
View Full Code Here

   *
   * @param known
   */
  private ReadableStringSet filterContentAnnotations(ReadableStringSet known) {
    final StringSet interested = CollectionUtils.createStringSet();
    known.each(new Proc() {
      @Override
      public void apply(final String key) {
        AnnotationBehaviour behaviour = annotationLogic.getClosestBehaviour(key);
        if (behaviour != null && behaviour.getAnnotationFamily() == AnnotationFamily.CONTENT) {
          interested.add(key);
View Full Code Here

        }
      });
    }

    // fill in values that change
    keysToCheck.each(new Proc() {
      public void apply(String key) {
        String left = leftValues.get(key);
        String right = rightValues.get(key);
        if (ValueUtils.notEqual(left, right)) {
          leftSide.put(key, left);
View Full Code Here

    if (leftAlign) {
      return;
    }

    // supplement anything that's missing and different:
    keys.each(new Proc() {
      @Override
      public void apply(String key) {
        if (!caret.hasAnnotation(key)) {
          String newValue = Annotations.getAlignedAnnotation(doc, location, key, leftAlign);
          String oldValue = doc.getAnnotation(location - 1, key);
View Full Code Here

      // TODO(danilatos): More efficient, too much hashmap munging.
      boundaryBefore = new HashMap<String, Object>();
      boundaryAfter = new HashMap<String, Object>();

      nextChangingKeys.each(new Proc() {
        @Override
        public void apply(String key) {
          Object newValue = localAnnotations.getAnnotation(start, key);

          boundaryBefore.put(key, currentValues.get(key));
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.util.ReadableStringSet.Proc

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.