/** * <copyright> * </copyright> * * */ package org.dresdenocl.language.ocl.resource.ocl.mopp; import java.util.ArrayList; import java.util.List; public class OclSyntaxElementDecorator { /** * the syntax element to be decorated */ private org.dresdenocl.language.ocl.resource.ocl.grammar.OclSyntaxElement decoratedElement; /** * an array of child decorators (one decorator per child of the decorated syntax * element */ private OclSyntaxElementDecorator[] childDecorators; /** * a list of the indices that must be printed */ private List<Integer> indicesToPrint = new ArrayList<Integer>(); public OclSyntaxElementDecorator(org.dresdenocl.language.ocl.resource.ocl.grammar.OclSyntaxElement decoratedElement, OclSyntaxElementDecorator[] childDecorators) { super(); this.decoratedElement = decoratedElement; this.childDecorators = childDecorators; } public void addIndexToPrint(Integer index) { indicesToPrint.add(index); } public org.dresdenocl.language.ocl.resource.ocl.grammar.OclSyntaxElement getDecoratedElement() { return decoratedElement; } public OclSyntaxElementDecorator[] getChildDecorators() { return childDecorators; } public Integer getNextIndexToPrint() { if (indicesToPrint.size() == 0) { return null; } return indicesToPrint.remove(0); } public String toString() { return "" + getDecoratedElement(); } }