@Override public IExpressionNode[] getConditionalExpressionNodes() { int childCount = conditionsStatementsNode.getChildCount(); ArrayList<IExpressionNode> retVal = new ArrayList<IExpressionNode>(3); for (int i = 0; i < childCount; i++) { IASNode child = conditionsStatementsNode.getChild(i); if (child instanceof IExpressionNode) retVal.add((IExpressionNode)child); } return retVal.toArray(new IExpressionNode[0]); }
@Override public IExpressionNode[] getConditionalExpressionNodes() { int childCount = conditionsStatementsNode.getChildCount(); ArrayList<IExpressionNode> retVal = new ArrayList<IExpressionNode>(3); for (int i = 0; i < childCount; i++) { IASNode child = conditionsStatementsNode.getChild(i); if (child instanceof IExpressionNode) retVal.add((IExpressionNode)child); } return retVal.toArray(new IExpressionNode[0]); }
@Override public IExpressionNode[] getArgumentNodes() { ArrayList<IExpressionNode> retVal = new ArrayList<IExpressionNode>(); if (argumentsNode != null) { int childCount = argumentsNode.getChildCount(); for (int i = 0; i < childCount; i++) { IASNode child = argumentsNode.getChild(i); if (child instanceof IExpressionNode) { retVal.add((IExpressionNode)child); } } } return retVal.toArray(new IExpressionNode[0]); }
@Override public IExpressionNode[] getArgumentNodes() { ArrayList<IExpressionNode> retVal = new ArrayList<IExpressionNode>(); if (argumentsNode != null) { int childCount = argumentsNode.getChildCount(); for (int i = 0; i < childCount; i++) { IASNode child = argumentsNode.getChild(i); if (child instanceof IExpressionNode) { retVal.add((IExpressionNode)child); } } } return retVal.toArray(new IExpressionNode[0]); }
@Override public IParameterNode[] getParameterNodes() { IParameterNode[] variables = {}; ContainerNode arguments = contentsPart.getParametersNode(); if (arguments != null) { int argumentscount = arguments.getChildCount(); variables = new IParameterNode[argumentscount]; for (int i = 0; i < argumentscount; i++) { IASNode argument = arguments.getChild(i); if (argument instanceof IParameterNode) variables[i] = (IParameterNode)argument; } } return variables; }
@Override public String getValue(boolean rawValue) { StringBuilder builder = new StringBuilder(); int length = getContentsNode().getChildCount(); for (int i = 0; i < length; i++) { IASNode child = getContentsNode().getChild(i); if (child instanceof ILiteralNode) { builder.append(((ILiteralNode) child).getValue(rawValue)); } } return builder.toString(); }
@Override public String getValue(boolean rawValue) { StringBuilder builder = new StringBuilder(); int length = getContentsNode().getChildCount(); for (int i = 0; i < length; i++) { IASNode child = getContentsNode().getChild(i); if (child instanceof ILiteralNode) { builder.append(((ILiteralNode) child).getValue(rawValue)); } } return builder.toString(); }
@Override public String getValue(boolean rawValue) { StringBuilder builder = new StringBuilder(); ContainerNode contents = getContentsNode(); int childcount = contents.getChildCount(); for (int i = 0; i < childcount; i++) { IASNode child = contents.getChild(i); if (child instanceof ILiteralNode) builder.append(((ILiteralNode)child).getValue(rawValue)); else if (child instanceof IIdentifierNode) builder.append(((IIdentifierNode)child).getName()); if (i + 1 < (childcount)) builder.append(","); } return "[" + builder.toString() + "]"; } }
/** * This method is for debugging and testing purposes only. * * @return XML literal text. */ public final String getText() { final StringBuilder result = new StringBuilder(); final ContainerNode contents = getContentsNode(); for (int i = 0; i < contents.getChildCount(); i++) { final IASNode element = contents.getChild(i); if (element instanceof LiteralNode) result.append(((LiteralNode)element).getValue()); else if (element instanceof IIdentifierNode) result.append("{").append(((IIdentifierNode)element).getName()).append("}"); else if (element instanceof IMemberAccessExpressionNode) result.append("{").append(((IMemberAccessExpressionNode)element).getDisplayString()).append("}"); } return result.toString(); } }
/** * This method is for debugging and testing purposes only. * * @return XML literal text. */ public final String getText() { final StringBuilder result = new StringBuilder(); final ContainerNode contents = getContentsNode(); for (int i = 0; i < contents.getChildCount(); i++) { final IASNode element = contents.getChild(i); if (element instanceof LiteralNode) result.append(((LiteralNode)element).getValue()); else if (element instanceof IIdentifierNode) result.append("{").append(((IIdentifierNode)element).getName()).append("}"); else if (element instanceof IMemberAccessExpressionNode) result.append("{").append(((IMemberAccessExpressionNode)element).getDisplayString()).append("}"); } return result.toString(); } }
@Override public String getValue(boolean rawValue) { StringBuilder builder = new StringBuilder(); ContainerNode contents = getContentsNode(); int childcount = contents.getChildCount(); for (int i = 0; i < childcount; i++) { IASNode child = contents.getChild(i); if (child instanceof ILiteralNode) builder.append(((ILiteralNode)child).getValue(rawValue)); else if (child instanceof IIdentifierNode) builder.append(((IIdentifierNode)child).getName()); if (i + 1 < (childcount)) builder.append(","); } return "[" + builder.toString() + "]"; } }
@Override public IParameterNode[] getParameterNodes() { IParameterNode[] variables = {}; ContainerNode arguments = contentsPart.getParametersNode(); if (arguments != null) { int argumentscount = arguments.getChildCount(); variables = new IParameterNode[argumentscount]; for (int i = 0; i < argumentscount; i++) { IASNode argument = arguments.getChild(i); if (argument instanceof IParameterNode) variables[i] = (IParameterNode)argument; } } return variables; }
/** * Check if the next attribute definition is gated with a configuration * condition variable. If it is, then return the evaluated result of the * condition. * * @param containerNode parent node * @return True if the attributed definition is enabled. */ protected final boolean isDefinitionEnabled(final ContainerNode containerNode) { assert containerNode != null : "Container node can't be null."; final int childCount = containerNode.getChildCount(); if (childCount > 0) { final IASNode lastChild = containerNode.getChild(childCount - 1); if (lastChild.getNodeID() == ASTNodeID.LiteralBooleanID) { // evaluate final boolean eval = Boolean.parseBoolean(((LiteralNode)lastChild).getValue()); // remove the configuration condition node containerNode.removeItem((NodeBase)lastChild); containerNode.setRemovedConditionalCompileNode(true); return eval; } } return true; }
/** * Check if the next attribute definition is gated with a configuration * condition variable. If it is, then return the evaluated result of the * condition. * * @param containerNode parent node * @return True if the attributed definition is enabled. */ protected final boolean isDefinitionEnabled(final ContainerNode containerNode) { assert containerNode != null : "Container node can't be null."; final int childCount = containerNode.getChildCount(); if (childCount > 0) { final IASNode lastChild = containerNode.getChild(childCount - 1); if (lastChild.getNodeID() == ASTNodeID.LiteralBooleanID) { // evaluate final boolean eval = Boolean.parseBoolean(((LiteralNode)lastChild).getValue()); // remove the configuration condition node containerNode.removeItem((NodeBase)lastChild); containerNode.setRemovedConditionalCompileNode(true); return eval; } } return true; }
public static void findQualifiedNamesInXMLLiteral(XMLLiteralNode node, ICompilerProject project, List<String> qualifiedNames) { int childCount = node.getContentsNode().getChildCount(); for (int i = 0; i < childCount; i++) { IASNode child = node.getContentsNode().getChild(i); if (child instanceof ILiteralNode) { ILiteralNode literalChild = (ILiteralNode) child; if (literalChild.getLiteralType() == ILiteralNode.LiteralType.XML) { findQualifiedNamesInXMLLiteralChild(literalChild, project, qualifiedNames); } } } }
public static void findQualifiedNamesInXMLLiteral(XMLLiteralNode node, ICompilerProject project, List<String> qualifiedNames) { int childCount = node.getContentsNode().getChildCount(); for (int i = 0; i < childCount; i++) { IASNode child = node.getContentsNode().getChild(i); if (child instanceof ILiteralNode) { ILiteralNode literalChild = (ILiteralNode) child; if (literalChild.getLiteralType() == ILiteralNode.LiteralType.XML) { findQualifiedNamesInXMLLiteralChild(literalChild, project, qualifiedNames); } } } }
/** * Copy constructor. * * @param other The node to copy. */ protected FunctionCallNode(FunctionCallNode other) { super(other); this.newKeywordNode = other.newKeywordNode != null ? new KeywordNode(other.newKeywordNode) : null; this.nameNode = other.nameNode != null ? other.nameNode.copy() : null; this.argumentsNode = new ContainerNode(other.argumentsNode.getChildCount()); for (IExpressionNode arg : other.getArgumentNodes()) { argumentsNode.addItem(((ExpressionNodeBase)arg).copy()); } }
/** * Copy constructor. * * @param other The node to copy. */ protected FunctionCallNode(FunctionCallNode other) { super(other); this.newKeywordNode = other.newKeywordNode != null ? new KeywordNode(other.newKeywordNode) : null; this.nameNode = other.nameNode != null ? other.nameNode.copy() : null; this.argumentsNode = new ContainerNode(other.argumentsNode.getChildCount()); for (IExpressionNode arg : other.getArgumentNodes()) { argumentsNode.addItem(((ExpressionNodeBase)arg).copy()); } }
final int size = contents.getChildCount();
final int size = contents.getChildCount();