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

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


    }

    @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


                vector.add(0, 0L);
        }
       
        for(int np = 0; np < nodeCount; np++) {
                Long x = vector.get(np);
                TreeNode child = node.getChildren().get(np);
                double oldWeight = child.getWeight();
                double newWeight = oldWeight + (x * STEP -LIMIT);
                child.setWeight(newWeight);
        }

        counter++;
        if(counter >= rounds) {
            counter = 0;
View Full Code Here

            setDescription(leaf);
            setMIU(leaf);
            return leaf;
        } else {
            // We start with assuming that I'm a Node
            TreeNode node =  new eu.planets_project.pp.plato.model.tree.Node();

            setNameAndWeight(node);
            setDescription(node);
            for (Node n : children) {
                if (hasLeaves && n.isLeaf()) {
View Full Code Here

    /**
     * Resets the transformer of all leaves to the default transformer.
     * @see eu.planets_project.pp.plato.action.workflow.IdentifyRequirementsAction#resetTransformers()
     */
    private void resetTransformers(){
        TreeNode root = this.selectedPlan.getTree().getRoot();
        for (Leaf leaf : root.getAllLeaves()) {
            /*
             * maybe the scaletype is not set yet
             * -> leaf.setDefaultTransformer has to handle null-values itself
             */
            if ((leaf.getScale() == null) ||
View Full Code Here

        return null;
    }


    private void removeNode(Object nodeToRemove) {
        TreeNode node = (TreeNode) nodeToRemove;
        if (node.getParent() != null) {
            // parent has been changed
            ((Node) node.getParent()).touch();
            ((Node) node.getParent()).removeChild(node);
            if(treeHelper != null) {
                treeHelper.closeNode(node);
            }
        }
        nodesToDelete.add(node);
View Full Code Here

     * @see #selectFragmentForSaving(Object)
     */
    public String saveFragmentHere(Object object) {
        log.info("Saving " + selectedFragment + " to " + object);
        Node target = (Node) object;
        TreeNode clone = selectedFragment.clone();
       
        clone.setName(tempNode.getName());
        clone.setDescription(tempNode.getDescription());
       
        target.addChild(clone);
        clone.touchAll(user.getUsername()); // the newly added TreeNode should be touched.
        //FacesMessages.instance().add(FacesMessage.SEVERITY_INFO, "Successfully stored node \"" + selectedFragment.getName() + "\" into fragment library as a child node of \"" + ((Node) object).getName() + "\"");
       
        em.persist(em.merge(target));
        fragmentOperationCompleted();
        return null;
View Full Code Here

     *
     * @see {@link #selectInsertionTarget(Object)}
     */
    public String insertThisFragment(Object object) {

        TreeNode clone = ((TreeNode) object).clone();
       
        selectedPlan.getTree().getRoot().touch();

        // Insert into the tree
        ((Node) selectedFragment).addChild(clone);
View Full Code Here

     * @param object The selected {@link TreeNode} from the template-tree which is in fact the root node of a template that will be cloned to replace the current objective tree
     */
    @RaiseEvent("reload")
    public String useTemplate(Object object) {
        log.info("Using template " + ((TreeNode) object).getName());
        TreeNode newRoot = ((TreeNode) object).clone();
                    
        selectedPlan.getTree().setWeightsInitialized(false);
        nodesToDelete.add(selectedPlan.getTree().getRoot());
        selectedPlan.getTree().setRoot(newRoot);
        changed = "true";
View Full Code Here

        // because the user wouldn't be able to leave this step: Going to 'Define
        // Basis' is not possible as the project hasn't been saved so far.
        //
        // We 'activate' the changed flag so that the user is asked to either
        // save the project or discard changes.
        TreeNode root = new Node();
        root.setName("Root");
        selectedPlan.getTree().setRoot(root);
       
        // ok - the selected project is free - unlock the old project
        unlockProject();
       
View Full Code Here

        //
        // We 'activate' the changed flag so that the user is asked to either
        // save the project or discard changes.
        changed = "T";

        TreeNode root = new Node();
        root.setName("Root");
        selectedPlan.getTree().setRoot(root);

//        PolicyNode policyRoot = new PolicyNode();
//        policyRoot.setName("Policy");
//        selectedPlan.getProjectBasis().getPolicyTree().setRoot(policyRoot);
View Full Code Here

TOP

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

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.