Package eu.planets_project.pp.plato.model.tree

Examples of eu.planets_project.pp.plato.model.tree.ObjectiveTree


        assert true;
    }

    @Test
    public void testImportXML()  {
        ObjectiveTree t = new TreeLoader().load("data/trees/pdfa.xml");
        TreeNode n = t.getRoot();
        assert "PDF/A".equals(n.getName());
        assert n instanceof Node;
        Node node = (Node) n;
        assert node.getChildren().size() == 4;
        assert node.getChildren().get(1).getWeight()==0.15;
View Full Code Here


        assert node.getChildren().get(1).getWeight()==0.15;
    }

    @Test
    public void testProjectPersistence() {
        ObjectiveTree t = new TreeLoader().load("data/trees/pdfa.xml");
        Plan p = new Plan();
        p.getPlanProperties().setName("Plato-Testproject number");
        p.getPlanProperties().setAuthor("Christoph Becker");

        Decision d = new Decision();
View Full Code Here

     * samples can be found in data/trees.
     * @return {@link ObjectiveTree} created from the xml file,
     * or <code>null</code> if there was an error
     */
    public ObjectiveTree load(String file) {
        ObjectiveTree tree = new ObjectiveTree();

        Digester digester = new Digester();
        digester.setValidating(false);
        digester.push(tree);

View Full Code Here

            log.error("Document is not a valid Freemind file. Cause: " + e.getMessage());
            return null;
        }

        // traverse temp structure of map and nodes and create ObjectiveTree
        ObjectiveTree tree = new ObjectiveTree();
        tree.setRoot(map.getObjectiveTreeRoot(hasUnits, hasLeaves));
        if (tree.getRoot().isLeaf()) {
            return null;
        }
        return tree;
    }
View Full Code Here

    public ObjectiveTree loadFreeMind(String file, boolean hasUnits, boolean hasLeaves){
        return loadFreeMindStream(Thread.currentThread().getContextClassLoader().getResourceAsStream(file), hasUnits, hasLeaves);
    }

    public void test(String file) {
        ObjectiveTree t = load(file);
    }
View Full Code Here

        log.debug("FileName: " + fileName);
        log.debug("Length of File: " + file.length);
        log.debug("HasUnits is: " + hasUnits.isBool());
        if (fileName.endsWith("mm")) {
             InputStream istream = new ByteArrayInputStream(this.file);
             ObjectiveTree newtree = new TreeLoader().loadFreeMindStream(
                  istream, this.hasUnits.isBool(), true);

            if (newtree == null) {
                log.debug("File is corrupted and new Tree cannot be built");
                FacesMessages.instance().add(FacesMessage.SEVERITY_ERROR, "This is not a valid Freemind file, maybe it is corrupted. Please make sure you added at least one level of nodes to the midmap.");
                return null;
            }
            // delete old tree
            nodesToDelete.add(selectedPlan.getTree().getRoot());

           
            selectedPlan.getTree().setRoot(newtree.getRoot());
            // make sure all scales are set according to measurement infos
            selectedPlan.getTree().adjustScalesToMeasurements(descriptor);
            selectedPlan.getTree().setWeightsInitialized(false);

        } else if ("".equals(fileName)) {
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.model.tree.ObjectiveTree

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.