Examples of FunctionDefinition


Examples of com.icona.tree.nodes.FunctionDefinition


    // $ANTLR start "function_definition"
    // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:290:1: function_definition returns [FunctionDefinition functionDefinition] : ds= declaration_specifiers declarator c= compound_statement ;
    public final FunctionDefinition function_definition() throws RecognitionException {
        FunctionDefinition functionDefinition = null;


        ObjectiveCParser.declaration_specifiers_return ds =null;

        Statement.CompoundStatement c =null;

        ObjectiveCParser.declarator_return declarator1 =null;



          functionDefinition =new FunctionDefinition(null,-1);

        try {
            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:297:2: (ds= declaration_specifiers declarator c= compound_statement )
            // C:\\Users\\line47\\workspace\\ObjCFYPA\\src\\com\\icona\\antlr\\main\\ObjectiveC.g:298:2: ds= declaration_specifiers declarator c= compound_statement
            {
            pushFollow(FOLLOW_declaration_specifiers_in_function_definition853);
            ds=declaration_specifiers();

            state._fsp--;
            if (state.failed) return functionDefinition;

            if ( state.backtracking==0 ) {
                functionDefinition.setModifier((ds!=null?ds.modifier:null));
                functionDefinition.setDataType((ds!=null?ds.dataType:null));
                functionDefinition.setSpecifier((ds!=null?ds.specifier:null));
              }

            pushFollow(FOLLOW_declarator_in_function_definition857);
            declarator1=declarator();

            state._fsp--;
            if (state.failed) return functionDefinition;

            if ( state.backtracking==0 ) {
                functionDefinition.setIdentifier((declarator1!=null?declarator1.identifier:null));
                functionDefinition.setArrayType((declarator1!=null?declarator1.arrayType:null));
              }

            pushFollow(FOLLOW_compound_statement_in_function_definition865);
            c=compound_statement();

            state._fsp--;
            if (state.failed) return functionDefinition;

            if ( state.backtracking==0 ) {
                functionDefinition.setCompoundStatement(c);
              }

            }

        }
View Full Code Here

Examples of com.opengamma.engine.function.FunctionDefinition

    final InMemoryFunctionRepository repo = FunctionRepositoryFactory.constructRepository(configuration);
    assertNotNull(repo);
    final Collection<FunctionDefinition> definitions = repo.getAllFunctions();
    assertNotNull(definitions);
    assertEquals(FunctionRepositoryFactory.INTRINSIC_FUNCTION_COUNT + 1, definitions.size());
    FunctionDefinition definition = null;
    for (final FunctionDefinition d : definitions) {
      if (d instanceof MockEmptyFunction) {
        assertNotNull(d.getUniqueId());
        definition = d;
      }
    }
    assertNotNull(definition);
    final FunctionCompilationContext context = new FunctionCompilationContext();
    context.setRawComputationTargetResolver(new DefaultComputationTargetResolver());
    final CompiledFunctionService cfs = new CompiledFunctionService(repo, new CachingFunctionRepositoryCompiler(), context);
    cfs.initialize();
    final CompiledFunctionRepository compiledRepo = cfs.compileFunctionRepository(System.currentTimeMillis());
    assertNotNull(compiledRepo.getDefinition(definition.getUniqueId()));
    final FunctionInvoker invoker = compiledRepo.getInvoker(definition.getUniqueId());
    assertNotNull(invoker);
    assertTrue(invoker instanceof MockEmptyFunction);
    assertSame(definition, invoker);
  }
View Full Code Here

Examples of org.apache.flex.compiler.internal.definitions.FunctionDefinition

        loop_prologue_common(iNode, ((IForLoopNode)iNode).getStatementContentsNode());
    }

    void prologue_function(IASNode n)
    {
        FunctionDefinition func = null;

        IFunctionNode funcNode = null;
       
        if ( n instanceof IFunctionNode )
            funcNode = (IFunctionNode)n;
        else if( n instanceof FunctionObjectNode )
            funcNode = ((FunctionObjectNode)n).getFunctionNode();

        // Add any parse problems which might have been encountered while lazily parsing the function
        if( funcNode instanceof FunctionNode )
        {
            Collection<ICompilerProblem> parseProblems = ((FunctionNode) funcNode).getParsingProblems();
            for( ICompilerProblem problem : parseProblems )
                currentScope.addProblem(problem);
        }

        assert funcNode != null : n + " has no FunctionNode child";
        func = (FunctionDefinition)funcNode.getDefinition();
        assert(func != null): n + " has no definition.";

        currentScope.setLocalASScope(func.getContainedScope());
        currentScope.resetDebugInfo();

        // Set the current file name - the function body will always start with an OP_debugfile
        // so we never need emit another one unless the method body spans multiple files
        currentScope.setDebugFile(SemanticUtils.getFileName(n));
View Full Code Here

Examples of org.sbml.jsbml.FunctionDefinition

   
    /*
     * Function Definitions
     */
    logger.debug("==== FunctionDefinitions ====");
    FunctionDefinition f1 = model.createFunctionDefinition("f1");
    model.removeFunctionDefinition(f1.getId());
   
    try {
      SBMLWriter.write(doc, System.out, ' ', (short) 2);
    } catch (Exception exc) {
      exc.printStackTrace();
View Full Code Here

Examples of org.sbml.jsbml.FunctionDefinition

        //
        // FunctionDefinition
        //
        for (String functionDefinitionId : relatedFunctionsIdSet) {
            FunctionDefinition func = model.getFunctionDefinition(functionDefinitionId);
            getRelatedFunctionsId(relatedFunctionsIdSet, allFunctionsIdSet, func.getMath());
        }
        for (String functionDefinitionId : relatedFunctionsIdSet) {
            subModel.addFunctionDefinition(model.getFunctionDefinition(functionDefinitionId).clone());
        }
View Full Code Here

Examples of org.sbml.jsbml.FunctionDefinition

    assertEquals(M.getEvent(-2), null);
  }

  @Test
  public void test_Model_add_get_FunctionDefinitions() throws ParseException {
    FunctionDefinition fd1 = new FunctionDefinition(2, 4);
    FunctionDefinition fd2 = new FunctionDefinition(2, 4);
    fd1.setId("fd1");
    fd2.setId("fd2");
    fd1.setMath(ASTNode.parseFormula("lambda(2)"));
    fd2.setMath(ASTNode.parseFormula("lambda(x, x+2)"));
    M.addFunctionDefinition(fd1);
    M.addFunctionDefinition(fd2);
    assertTrue(M.getFunctionDefinitionCount() == 2);
    // assertTrue(!M.getFunctionDefinition(0).equals(fd1)); // would be the same in jsbml
    // assertTrue(!M.getFunctionDefinition(1).equals(fd2));
View Full Code Here

Examples of org.sbml.jsbml.FunctionDefinition

    assertTrue(M.createEventAssignment() == null);
  }

  @Test
  public void test_Model_createFunctionDefinition() {
    FunctionDefinition fd = M.createFunctionDefinition();
    assertTrue(fd != null);
    assertTrue(M.getFunctionDefinitionCount() == 1);
    assertEquals(M.getFunctionDefinition(0), fd);
  }
View Full Code Here

Examples of org.sbml.jsbml.FunctionDefinition

    assertEquals(M.getEvent("e3"), null);
  }

  @Test
  public void test_Model_getFunctionDefinitionById() throws ParseException {
    FunctionDefinition fd1 = new FunctionDefinition(2, 4);
    FunctionDefinition fd2 = new FunctionDefinition(2, 4);
    fd1.setId("sin");
    fd2.setId("cos");
    fd1.setMath(ASTNode.parseFormula("lambda(2)"));
    fd2.setMath(ASTNode.parseFormula("lambda(2)"));
    M.addFunctionDefinition(fd1);
    M.addFunctionDefinition(fd2);
    assertTrue(M.getFunctionDefinitionCount() == 2);
    //assertTrue(!M.getFunctionDefinition("sin").equals(fd1));
    // assertTrue(!M.getFunctionDefinition("cos").equals(fd2));
View Full Code Here

Examples of org.sbml.jsbml.FunctionDefinition

    o3 = null;
  }

  @Test
  public void test_Model_removeFunctionDefinition() {
    FunctionDefinition o1, o2, o3;
    o1 = M.createFunctionDefinition();
    o2 = M.createFunctionDefinition();
    o3 = M.createFunctionDefinition();
    o3.setId("test");
    assertTrue(M.removeFunctionDefinition(0).equals(o1));
View Full Code Here

Examples of org.sbml.jsbml.FunctionDefinition

   
    ASTNode astNode = (ASTNode) contextObject;
   
    // System.out.println("MathMLStaxParser : processCharactersOf : context type : " + astNode.getType());

    FunctionDefinition functionDef = null;
   
    try {
      functionDef = astNode.getParentSBMLObject().getModel().getFunctionDefinition(characters.trim());
    } catch(NullPointerException e) {
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.