@Override public boolean check(ValidationContext ctx, ASTNode node) { // Lambda only allowed as first child of FunctionDefinitions if (node.isLambda()) { TreeNode p = node.getParent(); return p instanceof FunctionDefinition; } return true; } };
TreeNode parent = getParent(); if ((parent != null) && (parent instanceof ASTNode)) { ASTNode parentNode = (ASTNode) parent;
@Override public ASTNodeValue lt(ASTNode left, ASTNode right) throws SBMLException { if (left != null && left.getParent().getChildCount() > 2 || left != null && left.getParent().getChildCount() < 2) { return function("lt", ((ASTNode) left.getParent()).getListOfNodes()); } return new ASTNodeValue(relation(left, "<", right), this); }
@Override public ASTNodeValue geq(ASTNode left, ASTNode right) throws SBMLException { if (left != null && left.getParent().getChildCount() > 2 || left != null && left.getParent().getChildCount() < 2) { return function("geq", ((ASTNode) left.getParent()).getListOfNodes()); // TODO - still use ">=" when there are more than 2 children } return new ASTNodeValue(relation(left, ">=", right), this); }
@Override public ASTNodeValue eq(ASTNode left, ASTNode right) throws SBMLException { if (left != null && left.getParent().getChildCount() > 2 || left != null && left.getParent().getChildCount() < 2) { return function("eq", ((ASTNode) left.getParent()).getListOfNodes()); } return new ASTNodeValue(relation(left, "==", right), this); }
@Override public ASTNodeValue gt(ASTNode left, ASTNode right) throws SBMLException { if (left != null && left.getParent().getChildCount() > 2 || left != null && left.getParent().getChildCount() < 2) { return function("gt", ((ASTNode) left.getParent()).getListOfNodes()); } return new ASTNodeValue(relation(left, ">", right), this); }
@Override public ASTNodeValue leq(ASTNode left, ASTNode right) throws SBMLException { if (left != null && left.getParent().getChildCount() > 2 || left != null && left.getParent().getChildCount() < 2) { return function("leq", ((ASTNode) left.getParent()).getListOfNodes()); } return new ASTNodeValue(relation(left, "<=", right), this); }
@Override public boolean accepts(Object o) { if (o instanceof ASTNode) { ASTNode current = (ASTNode) o; if (current.equals(bvar)) { ASTNode parent = (ASTNode) current.getParent(); int index = parent.getIndex(current); if (index != -1) { parent.replaceChild(index, expandedBVar); } } } return false; } });
if (getParent() == null) { buffer.append(", no parent defined");
TreeNode parent = current.getParent();