/** * Updates the properties of all elements at the matched positions with * computed properties maps. * * @param functions an array of function to compute new properties maps. * @return an instance of this blip references, for chaining. */ public BlipContentRefs updateElement(MapFunction... functions) { return execute(ModifyHow.UPDATE_ELEMENT, null, (Object[]) functions); }
/** * Inserts the given arguments at the matched positions. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param arguments the new contents to be inserted. * @return an instance of this blip references, for chaining. */ public BlipContentRefs insert( List<BundledAnnotation> bundledAnnotations, BlipContent... arguments) { return execute(ModifyHow.INSERT, bundledAnnotations, ((Object[]) arguments)); }
/** * Replaces the matched positions with the given arguments. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param arguments the new contents to replace the original contents. * @return an instance of this blip references, for chaining. */ public BlipContentRefs replace( List<BundledAnnotation> bundledAnnotations, BlipContent... arguments) { return execute(ModifyHow.REPLACE, bundledAnnotations, (Object[]) arguments); }
/** * Replaces the matched positions with computed contents. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param functions the functions to compute the new contents. * @return an instance of this blip references, for chaining. */ public BlipContentRefs replace( List<BundledAnnotation> bundledAnnotations, BlipContentFunction... functions) { return execute(ModifyHow.REPLACE, bundledAnnotations, (Object[]) functions); }
/** * Updates the properties of all elements at the matched positions with the * given properties maps. * * @param newProperties an array of new properties map. * @return an instance of this blip references, for chaining. */ @SuppressWarnings("unchecked") public BlipContentRefs updateElement(Map<String, String>... newProperties) { return execute(ModifyHow.UPDATE_ELEMENT, null, (Object[]) newProperties); }
/** * Inserts the given arguments just after the matched positions. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param arguments the new contents to be inserted. * @return an instance of this blip references, for chaining. */ public BlipContentRefs insertAfter( List<BundledAnnotation> bundledAnnotations, BlipContent... arguments) { return execute(ModifyHow.INSERT_AFTER, bundledAnnotations, (Object[]) arguments); }
/** * Deletes the contents at the matched positions. * * @return an instance of this blip references, for chaining. */ public BlipContentRefs delete() { return execute(ModifyHow.DELETE, null); }
/** * Clears the annotations at the matched positions. * * @param key the annotation key to be cleared. * @return an instance of this blip references, for chaining. */ public BlipContentRefs clearAnnotation(String key) { return execute(ModifyHow.CLEAR_ANNOTATION, null, key); }
/** * Inserts computed contents at the matched positions. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param functions the functions to compute the new contents based on the * matched contents. * @return an instance of this blip references, for chaining. */ public BlipContentRefs insert( List<BundledAnnotation> bundledAnnotations, BlipContentFunction... functions) { return execute(ModifyHow.INSERT, bundledAnnotations, ((Object[]) functions)); }
/** * Inserts computed contents just after the matched positions. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param functions the functions to compute the new contents based on the * matched contents. * @return an instance of this blip references, for chaining. */ public BlipContentRefs insertAfter( List<BundledAnnotation> bundledAnnotations, BlipContentFunction... functions) { return execute(ModifyHow.INSERT_AFTER, bundledAnnotations, (Object[]) functions); }
/** * Updates the properties of all elements at the matched positions with * computed properties map. * * Note: The purpose of this overloaded version is because the version that * takes a var-args generates compiler warning due to the way generics and * var-args are implemented in Java. Most of the time, robot only needs to * update one gadget at at time, and it can use this version to avoid the * compiler warning. * * @param function the function to compute the new properties map. * @return an instance of this blip references, for chaining. */ public BlipContentRefs updateElement(MapFunction function) { return execute(ModifyHow.UPDATE_ELEMENT, null, new Object[] {function}); }
/** * Updates the properties of all elements at the matched positions with the * given properties map. * * Note: The purpose of this overloaded version is because the version that * takes a var-args generates compiler warning due to the way generics and * var-args are implemented in Java. Most of the time, robot only needs to * update one gadget at at time, and it can use this version to avoid the * compiler warning. * * @param newProperties the new properties map. * @return an instance of this blip references, for chaining. */ public BlipContentRefs updateElement(Map<String, String> newProperties) { return execute(ModifyHow.UPDATE_ELEMENT, null, new Object[] {newProperties}); }
/** * Replaces the matched positions with the given strings. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param arguments the new strings to replace the original contents. * @return an instance of this blip references, for chaining. */ public BlipContentRefs replace(List<BundledAnnotation> bundledAnnotations, String... arguments) { Object[] array = new Plaintext[arguments.length]; for (int i = 0; i < arguments.length; ++i) { array[i] = Plaintext.of(arguments[i]); } return execute(ModifyHow.REPLACE, bundledAnnotations, array); }
/** * Inserts the given strings at the matched positions. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param arguments the new strings to be inserted. * @return an instance of this blip references, for chaining. */ public BlipContentRefs insert(List<BundledAnnotation> bundledAnnotations, String... arguments) { Object[] array = new Plaintext[arguments.length]; for (int i = 0; i < arguments.length; ++i) { array[i] = Plaintext.of(arguments[i]); } return execute(ModifyHow.INSERT, bundledAnnotations, array); }
/** * Annotates the contents at the matched positions. * * @param key the annotation key. * @param values the annotation values. * @return an instance of this blip references, for chaining. */ public BlipContentRefs annotate(String key, String... values) { if (values.length == 0) { values = new String[]{key}; } Annotation[] annotations = new Annotation[values.length]; for (int i = 0; i < values.length; ++i) { annotations[i] = new Annotation(key, values[i], 0, 1); } return execute(ModifyHow.ANNOTATE, null, (Object[]) annotations); }
/** * Inserts the given strings just after the matched positions. * * @param bundledAnnotations annotations to immediately apply to the inserted * text. * @param arguments the new strings to be inserted. * @return an instance of this blip references, for chaining. */ public BlipContentRefs insertAfter( List<BundledAnnotation> bundledAnnotations, String... arguments) { Object[] array = new Plaintext[arguments.length]; for (int i = 0; i < arguments.length; ++i) { array[i] = Plaintext.of(arguments[i]); } return execute(ModifyHow.INSERT_AFTER, bundledAnnotations, array); }