/** @return the wrapped node's toString(). */ public String toString() { return m_node.toString(); } /** @return the current best cost to reach a goal state. */
/** @return the wrapped node's toString(). */ public String toString() { return m_node.toString(); } /** @return the current best cost to reach a goal state. */
public Scope(Scope containingScope, AST node) { scope = new ArrayList<>(containingScope.scope); if (node != null) { scope.add(node.toString()); } parent = containingScope; this.setPrefix(parent.getPrefix()); }
public static boolean accept(AST node) { boolean result = false; AST sizeNode = node.getFirstChild(); if (sizeNode != null) { // check that node has a fixed_array_size child node result = true; while (sizeNode != null && result) { // check that all fixed_array_size nodes encode // positive integers String s = sizeNode.toString(); for (int j = 0; j < s.length(); j++) { if (!Character.isDigit(s.charAt(j))) { result = false; } } sizeNode = sizeNode.getNextSibling(); } } return result; }
/** * @return the first child of the parent AST with the specified node type. */ private AST getASTByType(AST parent, int node_type) { for ( AST current = parent.getFirstChild(); current != null; current = current.getNextSibling() ) { if ( current.getType() == node_type ) return current; } throw new IllegalStateException ( "AST " + parent.toString() + " has no child of node type " + node_type + "." ); }
private void generateGetter(AST typeNode, AST nameNode) { // generate wrapped doc element in parameter XmlSchemaElement inParameters = generateWrappedDocElement(null, GETTER_PREFIX + nameNode.toString(), PARAM_NAME); // generate wrapped doc element out parameter XmlSchemaElement outParameters = generateWrappedDocElement(typeNode, GETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX, RETURN_PARAM_NAME); // generate input message Message inMsg = generateMessage(inParameters, GETTER_PREFIX + nameNode.toString()); // generate output message Message outMsg = generateMessage(outParameters, GETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX); // generate operation String name = GETTER_PREFIX + nameNode.toString(); Operation op = generateOperation(name, inMsg, outMsg); // generate corba return param ArgType corbaReturn = generateCorbaReturnParam(typeNode); // generate corba operation OperationType corbaOp = generateCorbaOperation(op, null, corbaReturn); // generate binding generateCorbaBindingOperation(binding, op, corbaOp); }
void describeNode ( JBurgAnnotation node, java.io.PrintWriter debugOutput ) { if ( node == null ) return; String self_description; try { self_description = java.net.URLEncoder.encode(node.getNode().toString(),"UTF-8"); } catch ( Exception cant_encode ) {self_description = node.getNode().toString(); } debugOutput.print ( "<node operator=\"" + node.getNode().getType() + "\" selfDescription=\"" + self_description + "\">"); for (int i = 0; i <= nStates ; i++ ) { if ( node.getRule(i) != 0 ) { debugOutput.print ( "<goal"); debugOutput.print ( " name=\"" + stateName[i] + "\""); debugOutput.print ( " rule=\"" + node.getRule(i) + "\""); debugOutput.print ( " cost=\"" + node.getCost(i) + "\""); debugOutput.println ( "/>" ); } } for (int i = 0; i < node.getArity(); i++ ) describeNode ( node.getNthChild(i), debugOutput ); debugOutput.println ( "</node>" ); }
private void removeRecursiveScopedName(AST identifierNode) { String structName = identifierNode.toString(); Scope structScope = new Scope(getScope(), structName); ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames(); scopedNames.remove(structScope); }
private void removeRecursiveScopedName(AST identifierNode) { String structName = identifierNode.toString(); Scope structScope = new Scope(getScope(), structName); ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames(); scopedNames.remove(structScope); }
private void createCase(AST caseNode, Unionbranch unionBranch) { AST node = caseNode.getFirstChild(); if (node != null) { if (node.getType() == IDLTokenTypes.LITERAL_case) { // corba:case CaseType caseType = new CaseType(); caseType.setLabel(node.getNextSibling().toString()); unionBranch.getCase().add(caseType); // recursive call createCase(node, unionBranch); } else { // corba:case CaseType caseType = new CaseType(); caseType.setLabel(node.toString()); unionBranch.getCase().add(caseType); } } }
private void visitForwardDeclaredStruct(AST identifierNode) { String structName = identifierNode.toString(); Scope structScope = new Scope(getScope(), structName); ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames(); if (scopedNames.getScope(structScope) == null) { scopedNames.add(structScope); } }
private void visitForwardDeclaredInterface(AST identifierNode) { String interfaceName = identifierNode.toString(); Scope interfaceScope = new Scope(getScope(), interfaceName); ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames(); if (scopedNames.getScope(interfaceScope) == null) { scopedNames.add(interfaceScope); } }
private boolean addRecursiveScopedName(AST identifierNode) { String structName = identifierNode.toString(); Scope structScope = new Scope(getScope(), structName); ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames(); if (scopedNames.getScope(structScope) == null) { scopedNames.add(structScope); return true; } return false; }
private boolean addRecursiveScopedName(AST identifierNode) { String structName = identifierNode.toString(); Scope structScope = new Scope(getScope(), structName); ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames(); if (scopedNames.getScope(structScope) == null) { scopedNames.add(structScope); return true; } return false; }
private void visitForwardDeclaredUnion(AST identifierNode) { String unionName = identifierNode.toString(); Scope unionScope = new Scope(getScope(), unionName); ScopeNameCollection scopedNames = wsdlVisitor.getScopedNames(); if (scopedNames.getScope(unionScope) == null) { scopedNames.add(unionScope); } }
private MemberType createMemberType(AST memberNode, CorbaType ctype, Scope fqName) { // corba:member MemberType memberType = new MemberType(); memberType.setName(memberNode.toString()); if (ctype != null) { memberType.setIdltype(ctype.getQName()); } else { wsdlVisitor.getDeferredActions(). add(fqName, new ExceptionDeferredAction(memberType)); } return memberType; }
private MemberType createMemberType(AST memberNode, CorbaType corbaType, Scope fqName) { // corba:member String memberName = memberNode.toString(); MemberType memberType = new MemberType(); memberType.setName(memberName); if (corbaType != null) { memberType.setIdltype(corbaType.getQName()); } else { wsdlVisitor.getDeferredActions(). add(fqName, new StructDeferredAction(memberType)); } return memberType; }
private XmlSchemaElement createXmlSchemaElement(AST memberNode, XmlSchemaType schemaType, Scope fqName) { // xmlschema:member XmlSchemaElement member = new XmlSchemaElement(schema, false); String memberName = memberNode.toString(); member.setName(memberName); member.setSchemaType(schemaType); if (schemaType != null) { member.setSchemaTypeName(schemaType.getQName()); if (schemaType.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) { member.setNillable(true); } } else { wsdlVisitor.getDeferredActions(). add(fqName, new StructDeferredAction(member)); } return member; }
private XmlSchemaElement createElementType(AST memberNode, XmlSchemaType stype, Scope fqName) { // xmlschema:member XmlSchemaElement member = new XmlSchemaElement(schema, false); String memberName = memberNode.toString(); member.setName(memberName); if (stype != null) { member.setSchemaType(stype); member.setSchemaTypeName(stype.getQName()); if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) { member.setNillable(true); } } else { wsdlVisitor.getDeferredActions(). add(fqName, new ExceptionDeferredAction(member)); } return member; }
private void generateStringAlias(AST typeDeclaratorNode, AST identifierNode, XmlSchemaType schemaType, CorbaType corbaType, Scope fqName) { Scope typedefScope = new Scope(getScope(), identifierNode); Alias corbaString = new Alias(); if (typeDeclaratorNode.getType() == IDLTokenTypes.LITERAL_string) { corbaString.setBasetype(CorbaConstants.NT_CORBA_STRING); } else if (typeDeclaratorNode.getType() == IDLTokenTypes.LITERAL_wstring) { corbaString.setBasetype(CorbaConstants.NT_CORBA_WSTRING); } else { // should never get here throw new RuntimeException("[TypedefVisitor] Attempted to visit an invalid node: " + typeDeclaratorNode.toString()); } Scope newScope = new Scope(typedefScope.getParent(), identifierNode); corbaString.setQName(new QName(typeMap.getTargetNamespace(), newScope.toString())); corbaString.setType(Constants.XSD_STRING); corbaString.setRepositoryID(newScope.toIDLRepositoryID()); typeMap.getStructOrExceptionOrUnion().add(corbaString); }