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

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


        d2.setActionNeeded("also no actions needed");
        d2.setReason("Reason, why no actions are needed? Hmm...");

        q.setDecision(d2);

        Node rootN = new Node();
        rootN.setName("Minimalist root node");

        Node childNode = new Node();
        childNode.setName("Image properties");
        rootN.addChild(childNode);

        Leaf leafWithUnit = new Leaf();
        leafWithUnit.setName("Amount of Pixel");
        leafWithUnit.changeScale(new PositiveIntegerScale());
        leafWithUnit.getScale().setUnit("px");
        childNode.addChild(leafWithUnit);

        Leaf ordinalLeaf = new Leaf();
        ordinalLeaf.setName("Karma");
        OrdinalScale ordinalScale = new OrdinalScale();
        ordinalScale.setRestriction("Good/Bad/Evil");
View Full Code Here


public class NodeTester {
   
    @Test
    public void isCompletelySpecified(){
        Node node = new Node();
        Leaf leaf = new Leaf();
        leaf.setName("Name");
        node.addChild(leaf);
        node.addChild(leaf);
        Leaf leaf2 = new Leaf();
        leaf2.setName("Name2");
        node.addChild(leaf2);
        node.addChild(leaf2);
        List<String> nodelist = new ArrayList<String>();
        System.out.println(node.getChildren().size());
        node.isCompletelySpecified(nodelist);
        System.out.println(nodelist.size());
        for (String string : nodelist) {
            System.out.println(string);
        }
       
View Full Code Here

    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

        alternatives.add(a2);
        alternatives.add(a3);
        alternatives.add(a4);
        alternatives.add(a5);
       
        root = new Node();
        root.addChild(sf1);
        root.addChild(sf2);
        root.addChild(sf3);
       
    }
View Full Code Here

   
    @BeforeClass
    public void setUp() {
        alternatives.add(a1);
        alternatives.add(a2);
        root = new Node();
        root.addChild(sf1);
        root.addChild(sf2);
       
    }
View Full Code Here

public class TreeNodeTest {

    @Test
    public void testNormalizeWeights() {
        Node parent = new Node();
        Node child1 = new Node();
        child1.setWeight(10);
        Node child2 = new Node();
        child2.setWeight(1);
        Node child3 = new Node();
        child3.setWeight(0.1);
        parent.addChild(child1);
        parent.addChild(child2);
        parent.addChild(child3);
        parent.normalizeWeights();
        double sum = 0;
View Full Code Here

       
    }
   
    @Test
    public void testNormalizeWeightsRandom() {
        Node parent = new Node();
        for(int i = 0; i < 100; i++) {
            Node child = new Node();
            child.setWeight(Math.random());
            parent.addChild(child);
        }
        parent.normalizeWeights();
        double sum = 0;
        for(TreeNode t : parent.getChildren()) {
View Full Code Here

    /**
     * Attaches a new Leaf to the given object (which is, hopefully, a Node)
     */
    public void addLeaf(Object object) {
        if (object instanceof Node) {
            Node node = (Node) object;
            node.addChild(new Leaf());
            log.debug("Leaf added: to NODE");
            // this node has been changed()
            node.touch();
            expandNode(node);
           
        }
    }
View Full Code Here

    /**
     * Attaches a new Node to the given object (which is, hopefully, a Node)
     */
    public void addNode(Object object) {
        if (object instanceof Node) {
            Node node = (Node) object;
            node.addChild(new Node());
            // this node has been changed()
            node.touch();
            expandNode(node);
            }
    }
View Full Code Here

        // Set "Save"-mode
        // MK: saveFragment is never read
        // saveFragment.setBool(true);
       
        // outject name and description
        tempNode= new Node();
        tempNode.setName( selectedFragment.getName());
        tempNode.setDescription(selectedFragment.getDescription());
       
        selectTemplateLibrary("Public Templates");
        return null;
View Full Code Here

TOP

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

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.