Package ptolemy.moml

Examples of ptolemy.moml.MoMLParser$LinkRequest


        // Construct the first automaton
        URL url = MoMLApplication.specToURL(firstMoML);

        // following the comments in MoMLApplication, use the same URL for
        // the two arguments (base and URL) to parse().
        MoMLParser parser = new MoMLParser();
        InterfaceAutomaton firstAutomaton = (InterfaceAutomaton) parser.parse(
                url, url);
        firstAutomaton.addPorts();

        // Construct the second automaton
        url = MoMLApplication.specToURL(secondMoML);

        // following the comments in MoMLApplication, use the same URL for
        // the two arguments (base and URL) to parse().  Also, a new instance
        // of MoMLParser must be used to parse each file, otherwise
        // the same automaton will be returned the second time parse() is
        // called.
        parser = new MoMLParser();

        InterfaceAutomaton secondAutomaton = (InterfaceAutomaton) parser.parse(
                url, url);
        secondAutomaton.addPorts();

        // Compute the projection and write result
        firstAutomaton.project(secondAutomaton);
View Full Code Here


            // following the comments in MoMLApplication, use the same URL for
            // the two arguments (base and URL) to parse(). Also, a instance
            // of MoMLParser must be used to parse each file, otherwise
            // the same automaton will be returned the second time parse() is
            // called.
            MoMLParser parser = new MoMLParser();
            automata[i] = (InterfaceAutomaton) parser.parse(url, url);
            automata[i].addPorts();

            System.out.println("\n" + automata[i].getInfo() + "\n");
        }
    }
View Full Code Here

            // following the comments in MoMLApplication, use the same URL for
            // the two arguments (base and URL) to parse(). Also, a instance
            // of MoMLParser must be used to parse each file, otherwise
            // the same automaton will be returned the second time parse() is
            // called.
            MoMLParser parser = new MoMLParser();
            automata[i] = (InterfaceAutomaton) parser.parse(url, url);
            automata[i].addPorts();
        }

        InterfaceAutomaton composition = automata[0];
View Full Code Here

        // Construct the super automaton
        URL url = MoMLApplication.specToURL(superMoML);

        // following the comments in MoMLApplication, use the same URL for
        // the two arguments (base and URL) to parse().
        MoMLParser parser = new MoMLParser();
        InterfaceAutomaton superAutomaton = (InterfaceAutomaton) parser.parse(
                url, url);
        superAutomaton.addPorts();

        // Construct the sub automaton
        url = MoMLApplication.specToURL(subMoML);

        // following the comments in MoMLApplication, use the same URL for
        // the two arguments (base and URL) to parse().  Also, a new instance
        // of MoMLParser must be used to parse each file, otherwise
        // the same automaton will be returned the second time parse() is
        // called.
        parser = new MoMLParser();

        InterfaceAutomaton subAutomaton = (InterfaceAutomaton) parser.parse(
                url, url);
        subAutomaton.addPorts();

        // Compute alternating simulation
        Set alternatingSimulation = superAutomaton
View Full Code Here

            // on the vergil.toolbox package.
            //
            // VisibleParameterEditorFactor _editorFactory =
            //        new VisibleParameterEditorFactory(container, "_editorFactory");
            if (_parser == null) {
                _parser = new MoMLParser();
            }

            // setContext calls parser.reset()
            _parser.setContext(container);
View Full Code Here

            // We need the GeneratorAttribute, but we already
            // filtered it out in KernelMain, and we updated
            // it in copernicus.kernel.Copernicus, so we
            // the values inside the GeneratorAttribute inside _model
            // are likely to be wrong.
            MoMLParser parser = new MoMLParser();

            CompositeActor toplevel;

            // Get the old filters, save them, add our own
            // filters, use them, remove our filters,
            // and then readd the old filters in the finally clause.
            // We do something
            // similar in GeneratorAttribute.updateModelAttributes()
            List oldFilters = MoMLParser.getMoMLFilters();
            MoMLParser.setMoMLFilters(null);

            try {
                // Handle Backward Compatibility.
                MoMLParser.addMoMLFilters(BackwardCompatibility.allFilters());

                // We don't call parseFile() here because it calls gets
                // the user.dir property.
                toplevel = (CompositeActor) parser.parse(null, new File(
                        _generatorAttributeFileName).toURI().toURL());
            } finally {
                // Restore the saved momlfilters
                MoMLParser.setMoMLFilters(oldFilters);
            }
View Full Code Here

                && elementName.equals("entity") && (container != null)
                && container.getFullName().equals(_currentActorFullName)) {
            _currentlyProcessingActorThatMayNeedAnIcon = false;

            if (_parser == null) {
                _parser = new MoMLParser();
            }

            // setContext calls parser.reset()
            _parser.setContext(container);
View Full Code Here

            // Read modelsFileName and parse each model, looking
            // for classes in which we are interested.
            modelReader = new BufferedReader(new FileReader(modelsFileName));
            String modelName;
            MoMLParser parser = new MoMLParser();

            // Handle backward compatibility issues
            MoMLParser.setMoMLFilters(BackwardCompatibility.allFilters());

            // Add a MoML filter that updates the values of classesToBeIndexed
            // with models that contain classes named by the key of
            // classesToBeIndexed
            NamedObjClassesSeen namedObjClassesSeen = new NamedObjClassesSeen(
                    classesToBeIndexed);
            MoMLParser.addMoMLFilter(namedObjClassesSeen);

            // Add a filter to remove the graphical classes
            // This is safe to do because our NamedObjClassesSeen filter
            // runs before we then remove the graphical classes.
            RemoveGraphicalClasses removeGraphicalClasses = new RemoveGraphicalClasses();
            removeGraphicalClasses.setRemoveGR(true);
            MoMLParser.addMoMLFilter(removeGraphicalClasses);

            while ((modelName = modelReader.readLine()) != null) {
                // Reset the list of classes seen, read the model
                // The filter updates the classesToBeIndexed hashMap
                namedObjClassesSeen.reset(modelName);
                //URL modelURL = new File(modelName).toURL();
                try {
                    URL modelURL = FileUtilities.nameToURL(modelName, null,
                            null);
                    System.out.println("Parsing: " + modelURL);
                    parser.reset();
                    parser.parse(null, modelURL);
                } catch (Exception ex) {
                    System.err.println("Warning, failed to parse " + modelName);
                    ex.printStackTrace();
                }
            }
View Full Code Here

     @exception Exception If there is a problem reading or writing
     *  a file.
     */
    public static void main(String[] args) throws Exception {
        try {
            MoMLParser parser = new MoMLParser();

            // The list of filters is static, so we reset it in case there
            // filters were already added.
            MoMLParser.setMoMLFilters(null);

            // Add the backward compatibility filters.
            MoMLParser.setMoMLFilters(BackwardCompatibility.allFilters());

            MoMLParser.addMoMLFilter(new RemoveGraphicalClasses());
            MoMLParser.addMoMLFilter(new HideAnnotationNames());
            NamedObj topLevel = parser.parseFile(args[0]);
            System.out.println(topLevel.exportMoML());
        } catch (Throwable throwable) {
            System.err.println("Failed to filter \"" + args[0] + "\"");
            throwable.printStackTrace();
            System.exit(1);
View Full Code Here

    // copy the model and remove the GeneratorTableau
    private static void _copyModelRemoveGeneratorTableau(URL modelPathURL,
            File newModelFile) throws Exception {
        // Create a parser.
        MoMLParser parser = new MoMLParser();

        // Get the old filters, save them, add our own
        // filters, use them, remove our filters,
        // and then readd the old filters in the finally clause.
        List oldFilters = MoMLParser.getMoMLFilters();
        MoMLParser.setMoMLFilters(null);

        // Parse the model and get the name of the model.
        try {
            // Handle Backward Compatibility.
            MoMLParser.addMoMLFilters(BackwardCompatibility.allFilters());

            // This is a bit of a misnomer, we remove only
            // GeneratorTableauAttribute here so that the Vergil applet has
            // the graphical classes
            RemoveGraphicalClasses removeGraphicalClasses = new RemoveGraphicalClasses();
            RemoveGraphicalClasses.clear();
            removeGraphicalClasses.put(
                    "ptolemy.copernicus.gui.GeneratorTableauAttribute", null);
            MoMLParser.addMoMLFilter(removeGraphicalClasses);

            // Parse the model.
            CompositeActor toplevel = null;
            toplevel = (CompositeActor) parser
                    .parse(modelPathURL, modelPathURL);

            FileWriter writer = null;

            try {
View Full Code Here

TOP

Related Classes of ptolemy.moml.MoMLParser$LinkRequest

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.