Package ptolemy.graph

Examples of ptolemy.graph.Node


        // Sets of variables used to track the fixed point iteration.
        LinkedList workList = new LinkedList(_variableToChangeContext.keySet());

        while (!workList.isEmpty()) {
            Variable variable = (Variable) workList.removeFirst();
            Node node = _dependencyGraph.node(variable);
            Entity changeContext = (Entity) _variableToChangeContext
                    .get(variable);

            for (Iterator outputEdges = _dependencyGraph.outputEdges(node)
                    .iterator(); outputEdges.hasNext();) {
                Node sinkNode = ((Edge) outputEdges.next()).sink();
                Variable targetVariable = (Variable) sinkNode.getWeight();

                if (_updateChangeContext(targetVariable, changeContext)
                        && !workList.contains(targetVariable)) {
                    workList.addLast(targetVariable);
                }
View Full Code Here


        for (int i = 0; i < size; i++) {
            for (int j = 0; j < size; j++) {
                _transitiveClosure[i][j] = false;
            }

            Node node = graph().node(i);
            Iterator outputEdges = ((DirectedGraph) graph()).outputEdges(node)
                    .iterator();

            while (outputEdges.hasNext()) {
                int sinkLabel = ((DirectedGraph) graph())
View Full Code Here

        if (nodeLabels[startNodeLabel][endNodeLabel] != -1) {
            shortestPath = new ArrayList();
            shortestPath.add(endNode);

            Node nodeOnPath = endNode;

            while (nodeOnPath != startNode) {
                int nodeOnPathLabel = graph().nodeLabel(nodeOnPath);
                nodeOnPath = graph().node(
                        nodeLabels[startNodeLabel][nodeOnPathLabel]);
View Full Code Here

                _predecessors[0][i][j] = -1;

                _allPairShortestPath[0][i][j] = Double.MAX_VALUE;
            }

            Node node = graph().node(i);
            Iterator outputEdges = ((DirectedGraph) graph()).outputEdges(node)
                    .iterator();

            while (outputEdges.hasNext()) {
                Edge edge = (Edge) outputEdges.next();
View Full Code Here

    protected Object _compute() {
        ArrayList sinkNodes = new ArrayList();
        Iterator nodes = graph().nodes().iterator();

        while (nodes.hasNext()) {
            Node node = (Node) nodes.next();

            if (((DirectedGraph) graph()).outputEdgeCount(node) == 0) {
                sinkNodes.add(node);
            }
        }
View Full Code Here

    ////                         private methods                   ////
    // Add the dependence information from the given attribute to the
    // dependence graph.
    private void _addDependencyDeclaration(DependencyDeclaration declaration) {
        Variable variable = (Variable) declaration.getContainer();
        Node targetNode = _getNode(variable);

        for (Iterator dependents = declaration.getDependents().iterator(); dependents
                .hasNext();) {
            Variable dependent = (Variable) dependents.next();
            Node dependentNode = _getNode(dependent);

            //  if (!_dependencyGraph.edgeExists(node, targetNode)) {
            _dependencyGraph.addEdge(dependentNode, targetNode);

            //}
View Full Code Here

        }
    }

    // Collect all of the constraints from the given variable.
    private void _collectVariableConstraints(Variable variable) {
        Node targetNode = _getNode(variable);

        // compute the variables.
        try {
            Set freeIdentifiers = variable.getFreeIdentifiers();

            for (Iterator names = freeIdentifiers.iterator(); names.hasNext();) {
                String name = (String) names.next();
                Variable dependent = ModelScope.getScopedVariable(variable,
                        variable, name);

                if (dependent != null) {
                    Node dependentNode = _getNode(dependent);
                    _dependencyGraph.addEdge(dependentNode, targetNode);
                }
            }
        } catch (IllegalActionException ex) {
            // Assume that this will be changed later...
View Full Code Here

TOP

Related Classes of ptolemy.graph.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.