Class ModelUtilities


  • public class ModelUtilities
    extends java.lang.Object
    A collection of utilities for manipulating a Ptolemy model. FIXME: Currently there is only one major operation for invoke the execution of a model. We may add more later.
    Since:
    Ptolemy II 4.1
    Version:
    $Id$
    Author:
    Yang Zhao
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Yellow (eal)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static RecordToken executeModel​(java.net.URL url, RecordToken args, java.lang.String[] resultLabels)
      This method takes a url specifying the model to be execute.
      static RecordToken executeModel​(CompositeActor model, RecordToken args, java.lang.String[] resultLabels)
      This method takes model argument which is type of CompositeActor.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • executeModel

        public static RecordToken executeModel​(java.net.URL url,
                                               RecordToken args,
                                               java.lang.String[] resultLabels)
                                        throws IllegalActionException
        This method takes a url specifying the model to be execute. The args argument is a record token that will be used to set corresponding attributes of the specified model by naming match, (see _setAttribute() method). The results of executing the model is returned back by setting the value of some Attributes. In particular, only Attributes that have name matches the resultLabels are returned. The return result is a RecordToken which has the resultLabels as its field.
        Parameters:
        url - The Model url.
        args - A set of attributes of the specified model.
        resultLabels - Labels of the returned result.
        Returns:
        The execution result.
        Throws:
        IllegalActionException - If can not parse the url or failed to execute the model.
      • executeModel

        public static RecordToken executeModel​(CompositeActor model,
                                               RecordToken args,
                                               java.lang.String[] resultLabels)
                                        throws IllegalActionException
        This method takes model argument which is type of CompositeActor. The args argument is a record token that will be used to set corresponding attributes of the specified model by naming match, (see _setAttribute() method). The results of executing the model is returned back by setting the value of some Attributes. In particular, only Attributes that have name matches the resultLabels are returned. The return result is a RecordToken which has the resultLabels as its field.
        Parameters:
        model - The Model.
        args - A set of attributes of the specified model.
        resultLabels - Labels of the returned result.
        Returns:
        The execution result.
        Throws:
        IllegalActionException - If failed to execute the model.