Package ptolemy.kernel.util

Examples of ptolemy.kernel.util.NamedObj


            }

            // Either cache is not valid, or the variable is not in the cache.
            _variablesDependentOnVersion = workspace().getVersion();

            NamedObj reference = _reference;

            if (_reference == null) {
                reference = Variable.this.getContainer();
            }
View Full Code Here


        /** Return the list of identifiers within the scope.
         *  @return The list of variable names within the scope.
         */
        public Set identifierSet() {
            NamedObj reference = _reference;

            if (_reference == null) {
                reference = Variable.this.getContainer();
            }

View Full Code Here

    /** Create a NamedObjAnalysis.
     *  @param method  The Soot method.
     *  @param thisBinding The NamedObj.
     */
    public NamedObjAnalysis(SootMethod method, NamedObj thisBinding) {
        _errorObject = new NamedObj();

        try {
            _errorObject.setName("Error");
        } catch (Exception ex) {
            // Ignore..
View Full Code Here

        while (fields.hasNext()) {
            SootField oldField = (SootField) fields.next();

            // Check that the field has a ValueTag that points to object.
            NamedObj fieldObject = (NamedObj) ValueTag.getFieldObject(oldField);

            if (fieldObject != object) {
                continue;
            }
View Full Code Here

    public Tableau createTableau(Effigy effigy) throws Exception {
        if (!(effigy instanceof PtolemyEffigy)) {
            return null;
        }

        NamedObj model = ((PtolemyEffigy) effigy).getModel();

        if (model instanceof CompositeEntity) {
            String name = entityName.stringValue();
            NamedObj toOpen = null;

            if (!name.trim().equals("")) {
                toOpen = ((CompositeEntity) model).getEntity(name);
            } else {
                List entities = ((CompositeEntity) model).entityList();
View Full Code Here

                throw new InternalErrorException(e);
            }
            _relation = null;
        }

        NamedObj container = getContainer();
        if (container instanceof TypedCompositeActor) {
            // If the container is not a typed composite actor, then don't create
            // a relation. Probably the container is a library.
            try {
                _relation = new TypedIORelation(
                        (TypedCompositeActor) container, container
                                .uniqueName("publisherRelation"));
                // Prevent the relation and its links from being exported.
                _relation.setPersistent(false);
                // Prevent the relation from showing up in vergil.
                new Parameter(_relation, "_hide", BooleanToken.TRUE);
View Full Code Here

        }

        public void createEditor(NamedObj object, Frame parent) {
            // Perform the highlighting.
            try {
                NamedObj container = HighlightEntities.this.getContainer();
                if (container instanceof CompositeEntity) {
                    ArrayToken names = (ArrayToken) entityNames.getToken();
                    if (names != null && names.length() > 0) {
                        StringBuffer moml = new StringBuffer("<group>");
                        for (int i = 0; i < names.length(); i++) {
                            String name = ((StringToken) names.getElement(i))
                                    .stringValue();
                            ComponentEntity entity = ((CompositeEntity) container)
                                    .getEntity(name);
                            if (entity != null) {
                                moml.append("<entity name=\"");
                                moml.append(name);
                                moml.append("\">");
                                moml.append(_highlightColor.exportMoML());
                                moml.append("</entity>");
                            }
                        }
                        moml.append("</group>");
                        container.requestChange(new MoMLChangeRequest(this,
                                container, moml.toString()));
                    } else {
                        // Clear all highlights.
                        StringBuffer moml = new StringBuffer("<group>");
                        for (Object entity : ((CompositeEntity) container)
                                .entityList()) {
                            if (((ComponentEntity) entity)
                                    .getAttribute("_highlightColor") != null) {
                                moml.append("<entity name=\"");
                                moml.append(((ComponentEntity) entity)
                                        .getName());
                                moml.append("\">");
                                moml
                                        .append("<deleteProperty name=\"_highlightColor\"/>");
                                moml.append("</entity>");
                            }
                        }
                        moml.append("</group>");
                        container.requestChange(new MoMLChangeRequest(this,
                                container, moml.toString()));
                    }
                }
            } catch (IllegalActionException e1) {
                MessageHandler.error("Failed to set highlight colors", e1);
View Full Code Here

            Iterator destinations = _destinations.iterator();
            Iterator channels = _numbers.iterator();
            Iterator parseTrees = _parseTrees.iterator();

            while (destinations.hasNext()) {
                NamedObj nextDestination = (NamedObj) destinations.next();

                // Need to get the next channel even if it's not used.
                Integer channel = (Integer) channels.next();
                ASTPtRootNode parseTree = (ASTPtRootNode) parseTrees.next();
                Token token;

                // In MultirateFSMDirector, the initial transition from
                // the initial state is taken during preinitialize() if
                // the initial state does not have a refinement, therefore
                // _scope need to be initialized here. -- Gang
                if (_scope == null) {
                    FSMActor fsmActor = (FSMActor) getContainer()
                            .getContainer();
                    _scope = fsmActor.getPortScope();
                }

                try {
                    token = _parseTreeEvaluator.evaluateParseTree(parseTree,
                            _scope);
                } catch (IllegalActionException ex) {
                    // Chain exceptions to get the actor that
                    // threw the exception.
                    throw new IllegalActionException(this, ex,
                            "Expression invalid.");
                }

                if (nextDestination instanceof IOPort) {
                    IOPort destination = (IOPort) nextDestination;

                    try {
                        if (channel != null) {
                            if (token == null) {
                                destination.sendClear(channel.intValue());

                                if (_debugging) {
                                    _debug(getFullName() + " port: "
                                            + destination.getName()
                                            + " channel: " + channel.intValue()
                                            + ", Clear!");
                                }
                            } else {
                                destination.send(channel.intValue(), token);

                                if (_debugging) {
                                    _debug(getFullName() + " port: "
                                            + destination.getName()
                                            + " channel: " + channel.intValue()
                                            + ", token: " + token);
                                }
                            }
                        } else {
                            if (token == null) {
                                destination.broadcastClear();

                                if (_debugging) {
                                    _debug(getFullName() + " port: "
                                            + destination.getName()
                                            + " broadcast Clear!");
                                }
                            } else {
                                destination.broadcast(token);

                                if (_debugging) {
                                    _debug(getFullName() + " port: "
                                            + destination.getName()
                                            + " broadcast token: " + token);
                                }
                            }
                        }
                    } catch (NoRoomException ex) {
                        throw new IllegalActionException(this,
                                "Cannot complete action: " + ex.getMessage());
                    } catch (UnknownResultException ex) {
                        // Produce no output.
                    }
                } else if (nextDestination instanceof Variable) {
                    Variable destination = (Variable) nextDestination;

                    try {
                        //Token token = variable.getToken();
                        destination.setToken(token);

                        // Force all dependents to re-evaluate.
                        // This makes the parameters in the actors of
                        // the refinement take on new values immediately
                        // after the action is committed.
                        destination.validate();

                        if (_debugging) {
                            _debug(getFullName() + " variable: "
                                    + destination.getName() + ", value: "
                                    + token);
                        }
                    } catch (UnknownResultException ex) {
                        destination.setUnknown(true);
                    }
                } else {
                    throw new IllegalActionException(this,
                            "Destination is neither an IOPort nor a Variable: "
                                    + nextDestination.getFullName());
                }
            }
        }
    }
View Full Code Here

        // Note, the parameter is final so we do not assign to it,
        // so we are sure that we call getReadAccess on the same object.
        try {
            object.workspace().getReadAccess();

            NamedObj topLevel = object.toplevel();
            NamedObj container = object;

            while (container != null) {
                List attrList = container
                        .attributeList(UndoStackAttribute.class);

                if (attrList.size() > 0) {
                    return (UndoStackAttribute) attrList.get(0);
                }

                container = container.getContainer();
            }

            // If we get here, there is no such attribute.
            // Create and attach a new instance.
            try {
View Full Code Here

     */
    protected ContinuousDirector _enclosingContinuousDirector() {
        if (_enclosingContinuousDirectorVersion != _workspace.getVersion()) {
            // Update the cache.
            _enclosingContinuousDirector = null;
            NamedObj container = getContainer();
            while (container != null) {
                // On the first pass, the container will be the immediate
                // container, whose director is this one, so update the
                // container first.
                container = container.getContainer();
                if (container instanceof Actor) {
                    Director director = ((Actor) container).getDirector();
                    if (director instanceof ContinuousDirector) {
                        _enclosingContinuousDirector = (ContinuousDirector) director;
                        break;
View Full Code Here

TOP

Related Classes of ptolemy.kernel.util.NamedObj

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.