Select Git revision
Util.jadd 1.07 KiB
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.*;
import java.util.stream.Collectors;
aspect Logging {
static Logger ASTNode.logger = LogManager.getLogger(ASTNode.class);
}
aspect JastAddAPIExtension {
/**
* removes the object from the AST, i.e. removes the reference from its parent to the object
*
* Please note that any intrinsic non-containment relations to the object are not removed.
* @return true, if the object had a parent.
*/
public boolean ASTNode.removeSelf() {
if (getParent() == null) {
return false;
} else {
for (int childIndex = 0; childIndex < getParent().numChildren(); childIndex++) {
if (getParent().getChild(childIndex) == this) {
getParent().removeChild(childIndex);
return true;
}
}
}
throw new RuntimeException("unable to remove child, because it was not contained in its parent!");
}
public String Element.customID() {
return getLabel();
}
public String Element.toString() {
return getLabel();
}
}