Here you can find the source of getDirectColRefExpr(Node refNode, boolean mode)
Parameter | Description |
---|---|
refNode | a parameter |
private static boolean getDirectColRefExpr(Node refNode, boolean mode)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004, 2005 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:// w w w . j a v a 2 s . c o m * Actuate Corporation - initial API and implementation *******************************************************************************/ import org.mozilla.javascript.Node; import org.mozilla.javascript.Token; public class Main { private final static String STRING_ROW = "row"; private final static String STRING_DATASET_ROW = "dataSetRow"; /** * if the Node is row Node, return true * * @param refNode * @return */ private static boolean getDirectColRefExpr(Node refNode, boolean mode) { assert (refNode.getType() == Token.GETPROP || refNode.getType() == Token.GETELEM); Node rowName = refNode.getFirstChild(); assert (rowName != null); if (rowName.getType() != Token.NAME) return false; String str = rowName.getString(); assert (str != null); if (mode && !str.equals(STRING_ROW)) return false; else if (!mode && !str.equals(STRING_DATASET_ROW)) return false; Node rowColumn = rowName.getNext(); assert (rowColumn != null); if (refNode.getType() == Token.GETPROP && rowColumn.getType() == Token.STRING) { return true; } else if (refNode.getType() == Token.GETELEM) { if (rowColumn.getType() == Token.NUMBER || rowColumn.getType() == Token.STRING) return true; } return false; } }