Package unbbayes.draw

Examples of unbbayes.draw.UShapeProbabilisticNode


      switch (getAction()) {

      case CREATE_CONTINUOUS_NODE: {
        newNode = controller.insertContinuousNode(e.getX(), e.getY());
        UShapeProbabilisticNode shape = new UShapeProbabilisticNode(
            this, newNode, (int) newNode.getPosition().x
                - newNode.getWidth() / 2, (int) newNode
                .getPosition().y
                - newNode.getHeight() / 2, newNode.getWidth(),
            newNode.getHeight());
        addShape(shape);
        shape.setState(UShape.STATE_SELECTED, null);
        showCPT(newNode);
      }
        break;
      case CREATE_PROBABILISTIC_NODE: {
        newNode = controller
            .insertProbabilisticNode(e.getX(), e.getY());
        UShapeProbabilisticNode shape = new UShapeProbabilisticNode(
            this, newNode, (int) newNode.getPosition().x
                - newNode.getWidth() / 2, (int) newNode
                .getPosition().y
                - newNode.getHeight() / 2, newNode.getWidth(),
            newNode.getHeight());
        addShape(shape);
        shape.setState(UShape.STATE_SELECTED, null);
        showCPT(newNode);

      }
        break;
      case CREATE_DECISION_NODE: {
        newNode = controller.insertDecisionNode(e.getX(), e.getY());
        UShapeDecisionNode shape = new UShapeDecisionNode(this,
            newNode, (int) newNode.getPosition().x
                - newNode.getWidth() / 2, (int) newNode
                .getPosition().y
                - newNode.getHeight() / 2, newNode.getWidth(),
            newNode.getHeight());
        addShape(shape);
        shape.setState(UShape.STATE_SELECTED, null);
        showCPT(newNode);
      }
        break;
      case CREATE_UTILITY_NODE: {
        newNode = controller.insertUtilityNode(e.getX(), e.getY());
        UShapeUtilityNode shape = new UShapeUtilityNode(
            this,
            newNode,
            (int) newNode.getPosition().x - newNode.getWidth() / 2,
            (int) newNode.getPosition().y - newNode.getHeight() / 2,
            newNode.getWidth(), newNode.getHeight());
        addShape(shape);
        shape.setState(UShape.STATE_SELECTED, null);
        showCPT(newNode);
      }
        break;
      case ADD_PLUGIN_NODE: {
        // build new node
        newNode = this.getNodeDataTransferObject().getNodeBuilder()
            .buildNode();
        newNode.setPosition(e.getX(), e.getY());

        // add new node into network
        this.controller.getNetwork().addNode(newNode);

        // build a new shape for new node
        UShape shape = null;
        try {
          shape = this.getNodeDataTransferObject().getShapeBuilder()
              .build().getUShape(newNode, this);
        } catch (IllegalAccessException e1) {
          throw new RuntimeException(e1);
        } catch (InstantiationException e1) {
          throw new RuntimeException(e1);
        }

        // add shape into this pane (canvas)
        addShape(shape);

        // set this node/shape as selected
        shape.setState(UShape.STATE_SELECTED, null);

        shape.update();

        // notify the probability function panel's builder that a new
        // node is currently "selected" as owner
        this.getNodeDataTransferObject()
            .getProbabilityFunctionPanelBuilder()
View Full Code Here


        shape = new UShapeGMMNode(this, newNode,
            (int) newNode.getPosition().x, (int) newNode
                .getPosition().y, newNode.getWidth(), newNode
                .getHeight());
      } else if (newNode instanceof ProbabilisticNode) {
        shape = new UShapeProbabilisticNode(this, newNode,
            (int) newNode.getPosition().x, (int) newNode
                .getPosition().y, newNode.getWidth(), newNode
                .getHeight());
      } else if (newNode instanceof DecisionNode) {
        shape = new UShapeDecisionNode(this, newNode, (int) newNode
View Full Code Here

        PotentialTable auxTabProb = (PotentialTable)((IRandomVariable) node)
            .getProbabilityFunction();
        auxTabProb.addVariable(node);
        auxTabProb.setValue(0, 1);

        UShapeProbabilisticNode shape = new UShapeProbabilisticNode(
            m_Canvas, (ProbabilisticNode) node, (int) node
                .getPosition().x
                - node.getWidth() / 2,
            (int) node.getPosition().y - node.getHeight() / 2, node
                .getWidth(), node.getHeight());
        m_Canvas.addShape(shape);
        shape.setShapeType(UShapeProbabilisticNode.STYPE_BAR);

        // Test
        ProbabilisticNode node2 = new ProbabilisticNode();
        node2.setPosition(160, 80);
        node2.appendState("firstStateProbabilisticName");
        node2.setName("123456789abcdefghijklmnopqrstuvwxyz");
        node2.setDescription(node2.getName());
        PotentialTable auxTabProb2 =(PotentialTable) ((IRandomVariable) node2)
            .getProbabilityFunction();
        auxTabProb2.addVariable(node2);
        auxTabProb2.setValue(0, 1);

        UShapeProbabilisticNode shape2 = new UShapeProbabilisticNode(
            m_Canvas, (ProbabilisticNode) node2, (int) node2
                .getPosition().x
                - node2.getWidth() / 2, (int) node2
                .getPosition().y
                - node2.getHeight() / 2, node2.getWidth(),
View Full Code Here

TOP

Related Classes of unbbayes.draw.UShapeProbabilisticNode

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.