Guess from a parent node what are the parameter type of its child node, should one of its child node
contain parameter.
@param db catalog
@param elm node under inspection
@return string representation of the type of its child node.
495494
private static String guessParameterType(Database db, VoltXMLElement elm) {
        if (! isParameterized(elm) || ! elm.name.equals("operation")) {
            return "";
        } else {
            final ExpressionType op = mapOfVoltXMLOpType.get(elm.attributes.get("optype"));
            assert op != null;
            switch (op) {
                case CONJUNCTION_OR:
                case CONJUNCTION_AND:
                case OPERATOR_NOT:
                    return "boolean";
                case COMPARE_GREATERTHAN: // For these 2 operator-ops, the type is what the non-parameterized part gets set to.
                case COMPARE_LESSTHAN:
                case COMPARE_EQUAL:
                case COMPARE_NOTEQUAL:
                case COMPARE_GREATERTHANOREQUALTO:
                case COMPARE_LESSTHANOREQUALTO:
                case OPERATOR_PLUS:
                case OPERATOR_MINUS:
                case OPERATOR_MULTIPLY:
                case OPERATOR_DIVIDE:
                case OPERATOR_CONCAT:
                case OPERATOR_MOD:
                case COMPARE_IN:
                    final VoltXMLElement left = elm.children.get(0), right = elm.children.get(1);
                    return isParameterized(left) ? getType(db, right) : getType(db, left);
                case OPERATOR_UNARY_MINUS:
                    return "integer";
                case OPERATOR_IS_NULL:
                case OPERATOR_EXISTS:
                    return "";
                default:
                    assert false;
                    return "";
            }
        }
    }
1207316
private final LeafNode<K, V> findLeafNode(final K key, final boolean tracePath) {
		Node<K, V> node = getNode(rootIdx);
		if (tracePath) {
			stackNodes.clear();
			stackSlots.clear();
		}
		while (!node.isLeaf()) {
			final InternalNode<K, V> nodeInternal = (InternalNode<K, V>) node;
			int slot = node.findSlotByKey(key);
			slot = ((slot < 0) ? (-slot) - 1 : slot + 1);
			if (tracePath) {
				stackNodes.push(nodeInternal);
				stackSlots.push(slot);
			}
			node = getNode(nodeInternal.childs[slot]);
			if (node == null) {
				log.error("ERROR childs[" + slot + "] in node=" + nodeInternal);
				return null;
			}
		}
		return (node.isLeaf() ? (LeafNode<K, V>) node : null);
	}
958960
function (elm) {
        var ctrl, lookup = this.getRoot().controlIdLookup;

        while (elm && lookup) {
          ctrl = lookup[elm.id];
          if (ctrl) {
            break;
          }

          elm = elm.parentNode;
        }

        return ctrl;
      }
1326288
function(db) {
    if (!db.type) {
      return defaultDbType;
    }

    return dbTypes.find(function(dbType) {
      return dbType.name === db.type;
    }) || null;
  }
1317667
public final TreeModelFilter<SQLPPTriplesMap> type() throws RecognitionException {
        TreeModelFilter<SQLPPTriplesMap> value = null;


        try {
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:69:3: ( ID | TEXT | TARGET | SOURCE | FUNCT | PRED )
            int alt4=6;
            switch ( input.LA(1) ) {
            case ID:
                {
                alt4=1;
                }
                break;
            case TEXT:
                {
                alt4=2;
                }
                break;
            case TARGET:
                {
                alt4=3;
                }
                break;
            case SOURCE:
                {
                alt4=4;
                }
                break;
            case FUNCT:
                {
                alt4=5;
                }
                break;
            case PRED:
                {
                alt4=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 4, 0, input);

                throw nvae;

            }

            switch (alt4) {
                case 1 :
                    // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:69:5: ID
                    {
                    match(input,ID,FOLLOW_ID_in_type120); 

                     value = new MappingIDTreeModelFilter();

                    }
                    break;
                case 2 :
                    // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:70:5: TEXT
                    {
                    match(input,TEXT,FOLLOW_TEXT_in_type133); 

                     value = new MappingStringTreeModelFilter(); 

                    }
                    break;
                case 3 :
                    // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:71:5: TARGET
                    {
                    match(input,TARGET,FOLLOW_TARGET_in_type144); 

                     value = new MappingHeadVariableTreeModelFilter();

                    }
                    break;
                case 4 :
                    // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:72:5: SOURCE
                    {
                    match(input,SOURCE,FOLLOW_SOURCE_in_type153); 

                     value = new MappingSQLStringTreeModelFilter();

                    }
                    break;
                case 5 :
                    // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:73:5: FUNCT
                    {
                    match(input,FUNCT,FOLLOW_FUNCT_in_type162); 

                     value = new MappingFunctorTreeModelFilter();

                    }
                    break;
                case 6 :
                    // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:74:5: PRED
                    {
                    match(input,PRED,FOLLOW_PRED_in_type172); 

                     value = new MappingPredicateTreeModelFilter();

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return value;
    }
805545
@Nullable
  private static Node nameOfParam(Node param) {
    switch (param.getToken()) {
      case NAME:
        return param;
      case DEFAULT_VALUE:
        return nameOfParam(param.getFirstChild());
      case REST:
        return nameOfParam(param.getOnlyChild());
      case ARRAY_PATTERN:
      case OBJECT_PATTERN:
        return null;
      default:
        throw new IllegalStateException("Unexpected child of PARAM_LIST: " + param.toStringTree());
    }
  }
1034386
public static String parent(String node) {
        final int index = node.lastIndexOf('/');
        if (index < 0)
            return null;
        return node.substring(0, index);
    }
433570
public static String child(String node) {
        final int index = node.lastIndexOf('/');
        if (index < 0 || index == node.length() - 1)
            return null;
        return node.substring(index + 1, node.length());
    }
552944
@Override
    public Node getParentNode(String parentNodeId)
    {
        NodeLink link = new NodeLink(parentNodeId, getNodeId());

        if (this.parents == null)
        {
            return null;
        }
        else
        {
            return this.parents.get(link);
        }
    }
636250
public T visitTernaryExpression(TernaryExpression elm, C context) {
        for (Expression element : elm.getOperand()) {
            visitElement(element, context);
        }
        return null;
    }
952339
public T visitParameterDef(ParameterDef elm, C context) {
        if (elm.getParameterTypeSpecifier() != null) {
            visitElement(elm.getParameterTypeSpecifier(), context);
        }

        if (elm.getDefault() != null) {
            visitElement(elm.getDefault(), context);
        }

        return null;
    }
76602
protected String getStringFromNode(Object inNode)
  {
    if (tc.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(cclass, "getStringFromNode", inNode);
    
    String strValue = null;
    if (inNode instanceof Node)
    {
      Node theNode = (Node)inNode;
      // Check the type of the node
      int nodeType = theNode.getNodeType();
      if(nodeType == Node.ATTRIBUTE_NODE)
      {
        strValue = theNode.getNodeValue();
      }
//TODO: More special casing needed here dependent on node type? text etc?        
      else
      {
        // Note this gets the text associated with the first child element only.
        Node firstChild = theNode.getFirstChild();
        if(firstChild != null)
          strValue = firstChild.getNodeValue();
      }
    }  // eof is inNode instanceof Node
    
    if (tc.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(cclass, "getStringFromNode", strValue);    
    return strValue;
  }
530000
function getParentNode(node) {
  return genericPropertyGet(
      Methods.PARENT_NODE_GETTER, node, 'parentNode', function(parentNode) {
        // We need to ensure that parentNode is returning the actual parent node
        // and not a child node that happens to have a name of "parentNode".
        // We check that the node returned by parentNode is itself not named
        // "parentNode" - this could happen legitimately but on IE we have no
        // better means of avoiding the pitfall.
        return !(
            parentNode && typeof parentNode.name == 'string' &&
            parentNode.name && parentNode.name.toLowerCase() == 'parentnode');
      });
}
928083
private SoyType getElementType(SoyType collectionType, ForNonemptyNode node) {
    Preconditions.checkNotNull(collectionType);
    switch (collectionType.getKind()) {
      case UNKNOWN:
        // If we don't know anything about the base type, then make no assumptions
        // about the field type.
        return UnknownType.getInstance();

      case LIST:
        if (collectionType == ListType.EMPTY_LIST) {
          errorReporter.report(node.getParent().getSourceLocation(), EMPTY_LIST_FOREACH);
          return ErrorType.getInstance();
        }
        return ((ListType) collectionType).getElementType();

      case UNION:
        {
          // If it's a union, then do the field type calculation for each member of
          // the union and combine the result.
          UnionType unionType = (UnionType) collectionType;
          List<SoyType> fieldTypes = new ArrayList<>(unionType.getMembers().size());
          for (SoyType unionMember : unionType.getMembers()) {
            SoyType elementType = getElementType(unionMember, node);
            if (elementType.getKind() == SoyType.Kind.ERROR) {
              return ErrorType.getInstance();
            }
            fieldTypes.add(elementType);
          }
          return SoyTypes.computeLowestCommonType(typeRegistry, fieldTypes);
        }

      default:
        errorReporter.report(
            node.getParent().getSourceLocation(),
            BAD_FOREACH_TYPE,
            node.getExpr().toSourceString(),
            node.getExpr().getType()); // Report the outermost union type in the error.
        return ErrorType.getInstance();
    }
  }
582844
public NodeType getNodeType() {
        String value = getFieldValue(ConfigureNodeFields.node_type);

        if (value == null)
            return null;
        else
            return NodeType.valueOf(value);
    }
1107079
void calcNullable(RBBINode n) {
           if (n == null) {
               return;
           }
           if (n.fType == RBBINode.setRef ||
               n.fType == RBBINode.endMark ) {
               // These are non-empty leaf node types.
               n.fNullable = false;
               return;
           }

           if (n.fType == RBBINode.lookAhead || n.fType == RBBINode.tag) {
               // Lookahead marker node.  It's a leaf, so no recursion on children.
               // It's nullable because it does not match any literal text from the input stream.
               n.fNullable = true;
               return;
           }


           // The node is not a leaf.
           //  Calculate nullable on its children.
           calcNullable(n.fLeftChild);
           calcNullable(n.fRightChild);

           // Apply functions from table 3.40 in Aho
           if (n.fType == RBBINode.opOr) {
               n.fNullable = n.fLeftChild.fNullable || n.fRightChild.fNullable;
           }
           else if (n.fType == RBBINode.opCat) {
               n.fNullable = n.fLeftChild.fNullable && n.fRightChild.fNullable;
           }
           else if (n.fType == RBBINode.opStar || n.fType == RBBINode.opQuestion) {
               n.fNullable = true;
           }
           else {
               n.fNullable = false;
           }
       }
699093
protected void parse(Node node) {
		NamedNodeMap attributes = node.getAttributes();
		type = getValueRecursive(attributes.getNamedItem("type"));

		NodeList childNodes = node.getChildNodes();
		for (int i = 0; i < childNodes.getLength(); i++) {
			Node child = childNodes.item(i);
			String nodeName = child.getNodeName();
			if ("Format".equalsIgnoreCase(nodeName)) {
				format = getValueRecursive(child);
			} else if ("OnlineResource".equalsIgnoreCase(nodeName)) {
				onlineResource = createOnlineResource(child);
			}
		}
	}