private static void addDecoration(final Node container, final AnnotationDecoration decoration) { container.astSetDecoration(ANNOTATION_DECORATION_NAME, decoration); }
public static void setDebugDecoration(final Node node, final String[] value) { if (!(node instanceof Task) && !(node instanceof Instruction)) { throw new IllegalArgumentException( "node must be either a Task or an Instruction"); } node.astSetDecoration(DEBUG_DECORATION, value); }
/** * Add the given set of input resources to the "input resources" decoration * associated to the given node. * * @param node a node. * @param resources the resources to add. May be <code>null</code>. */ public static void addInputResources(final Node node, final Set<InputResource> resources) { if (resources == null) return; final Set<InputResource> previousResources = getInputResources(node); if (previousResources == null) { node.astSetDecoration(INPUT_RESOURCES_DECORATION, new HashSet<InputResource>(resources)); } else { previousResources.addAll(resources); } }
/** * Add the given resource to the "input resources" decoration associated to * the given node. * * @param node a node. * @param resource a resource (ADL name, IDL file name, etc...). * @return <code>true</code> if the given resource has been actually added to * the set of input resources (i.e. if the set of input resources did * not contain the given resource). */ public static boolean addInputResource(final Node node, final InputResource resource) { Set<InputResource> resources = getInputResources(node); if (resources == null) { resources = new HashSet<InputResource>(); node.astSetDecoration(INPUT_RESOURCES_DECORATION, resources); } return resources.add(resource); }
/** * Attach the given comment to the given node. * * @param node a node. * @param comment the comment to attach. * @throws IllegalArgumentException if the given node already has a decoration * called {@link #COMMENT_DECORATION_NAME}. */ public static void setComment(final Node node, final String comment) { final Object o = node.astGetDecoration(COMMENT_DECORATION_NAME); if (o != null) throw new IllegalArgumentException("Given node already contains a \"" + COMMENT_DECORATION_NAME + "\" decoration."); node.astSetDecoration(COMMENT_DECORATION_NAME, new CommentDecoration( comment, node)); }