Package net.sourceforge.marathon.api.module

Examples of net.sourceforge.marathon.api.module.Module


        createDirectories(moduleDir);
        File modFile = createFile(moduleDir[0], singleMethodFile);
        writeIntoFile(methodDefWithArgsDefaultAssignment, modFile);

        ModuleList moduleList = new ModuleList(createPythonInterpreter(), moduleDir);
        Module root = moduleList.getRoot();
        Assert.assertTrue("Module structure did not match directory structure.", verifyModuleStructure(root, testDirectory));

        List<Module> moduleForModuleDirs = root.getChildren();
        Module modForFirstDir = moduleForModuleDirs.get(0);
        List<Module> modForFilesAndDirsInModDir = modForFirstDir.getChildren();
        Module modForSingleMethodFile = modForFilesAndDirsInModDir.get(0);
        Assert.assertTrue(modForSingleMethodFile.isFile());
        List<Function> functionsInFile = modForSingleMethodFile.getFunctions();
        Assert.assertEquals(1, functionsInFile.size());

        Function function = functionsInFile.get(0);
        Assert.assertEquals(function.getName(), "methodWithArgs");
View Full Code Here


        createDirectories(moduleDir);
        File modFile = createFile(moduleDir[0], singleMethodFile);
        writeIntoFile(defWithDoc, modFile);

        ModuleList moduleList = new ModuleList(createPythonInterpreter(), moduleDir);
        Module root = moduleList.getRoot();
        Assert.assertTrue("Module structure did not match directory structure.", verifyModuleStructure(root, testDirectory));

        List<Module> moduleForModuleDirs = root.getChildren();
        Module modForFirstDir = moduleForModuleDirs.get(0);
        List<Module> modForFilesAndDirsInModDir = modForFirstDir.getChildren();
        Module modForSingleMethodFile = modForFilesAndDirsInModDir.get(0);
        Assert.assertTrue(modForSingleMethodFile.isFile());
        List<Function> functionsInFile = modForSingleMethodFile.getFunctions();
        Assert.assertEquals(1, functionsInFile.size());

        Function function = functionsInFile.get(0);
        Assert.assertEquals("methodWithDoc", function.getName());
View Full Code Here

        createDirectories(moduleDir);
        File modFile = createFile(moduleDir[0], methodWithWindowFile);
        writeIntoFile(methodWithWindowDefn, modFile);

        ModuleList moduleList = new ModuleList(createPythonInterpreter(), moduleDir);
        Module root = moduleList.getRoot();
        Assert.assertTrue("Module structure did not match directory structure.", verifyModuleStructure(root, testDirectory));

        List<Module> moduleForModuleDirs = root.getChildren();
        Module modForFirstDir = moduleForModuleDirs.get(0);
        List<Module> modForFilesAndDirsInModDir = modForFirstDir.getChildren();
        Module modForSingleMethodFile = modForFilesAndDirsInModDir.get(0);
        Assert.assertTrue(modForSingleMethodFile.isFile());
        List<Function> functionsInFile = modForSingleMethodFile.getFunctions();
        Assert.assertEquals(1, functionsInFile.size());

        Function function = functionsInFile.get(0);
        Assert.assertEquals(function.getName(), "methodWithWindow");
View Full Code Here

        createDirectories(moduleDir);
        File modFile = createFile(moduleDir[0], methodWithWindowFile);
        writeIntoFile(methodWithWindowInBetweenDefn, modFile);

        ModuleList moduleList = new ModuleList(createPythonInterpreter(), moduleDir);
        Module root = moduleList.getRoot();
        Assert.assertTrue("Module structure did not match directory structure.", verifyModuleStructure(root, testDirectory));

        List<Module> moduleForModuleDirs = root.getChildren();
        Module modForFirstDir = moduleForModuleDirs.get(0);
        List<Module> modForFilesAndDirsInModDir = modForFirstDir.getChildren();
        Module modForSingleMethodFile = modForFilesAndDirsInModDir.get(0);
        Assert.assertTrue(modForSingleMethodFile.isFile());
        List<Function> functionsInFile = modForSingleMethodFile.getFunctions();
        Assert.assertEquals(1, functionsInFile.size());

        Function function = functionsInFile.get(0);
        Assert.assertEquals(function.getName(), "methodWithWindow");
View Full Code Here

        createDirectories(moduleDir);
        File modFile = createFile(moduleDir[0], methodWithWindowFile);
        writeIntoFile(methodWithWindowDefnWithComment, modFile);

        ModuleList moduleList = new ModuleList(createPythonInterpreter(), moduleDir);
        Module root = moduleList.getRoot();
        Assert.assertTrue("Module structure did not match directory structure.", verifyModuleStructure(root, testDirectory));

        List<Module> moduleForModuleDirs = root.getChildren();
        Module modForFirstDir = moduleForModuleDirs.get(0);
        List<Module> modForFilesAndDirsInModDir = modForFirstDir.getChildren();
        Module modForSingleMethodFile = modForFilesAndDirsInModDir.get(0);
        Assert.assertTrue(modForSingleMethodFile.isFile());
        List<Function> functionsInFile = modForSingleMethodFile.getFunctions();
        Assert.assertEquals(1, functionsInFile.size());

        Function function = functionsInFile.get(0);
        Assert.assertEquals(function.getName(), "methodWithWindow");
View Full Code Here

        return prefix + functionCall;
    }

    private String getPrefixForImport(Function function) {
        StringBuilder require = new StringBuilder();
        Module parent = function.getParent();
        while (parent.getParent() != null) {
            require.insert(0, '.').insert(0, parent.getName());
            parent = parent.getParent();
        }
        return require.toString();
    }
View Full Code Here

     * correspondingly under a root module.
     *
     * @return The root module.
     */
    private Module importModules() {
        Module root = loadModulesFromDirs();
        return root;
    }
View Full Code Here

     * @param module
     * @return
     */
    private String getImportStatement(Module module) {
        String require = module.getName();
        Module parent = module.getParent();
        while (parent.getParent() != null) {
            require = parent.getName() + "." + require;
            parent = parent.getParent();
        }
        if (require.trim().equals(""))
            return "";
        return "import " + require;
    }
View Full Code Here

     * Loads the modules from all the Module directories.
     *
     * @return
     */
    private Module loadModulesFromDirs() {
        Module root = new Module("Root", null);
        for (int i = 0; i < moduleDirs.length; i++) {
            File moduleDir = new File(moduleDirs[i]);
            Module moduleForDir = createModuleForDir(moduleDir, root);
            if (moduleForDir != null)
                root.addChild(moduleForDir);
        }
        return root;
    }
View Full Code Here

        super(window, recorder, finder, scriptModel, windowMonitor);
        this.runtime = runtime;
    }

    public Component getContent() {
        Module topModule = runtime.getModuleFunctions();
        DefaultMutableTreeNode root = topModule.createTreeNode(null);
        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        panel.add(createFunctionPanel(root), BorderLayout.CENTER);
        panel.add(createButtonPanel(), BorderLayout.SOUTH);
        return panel;
View Full Code Here

TOP

Related Classes of net.sourceforge.marathon.api.module.Module

Copyright © 2018 www.massapicom. 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.