Class PtolemyEffigy.Factory

    • Method Detail

      • canCreateBlankEffigy

        public boolean canCreateBlankEffigy()
        Return true, indicating that this effigy factory is capable of creating an effigy without a URL being specified.
        Overrides:
        canCreateBlankEffigy in class EffigyFactory
        Returns:
        True.
      • createEffigy

        public Effigy createEffigy​(CompositeEntity container,
                                   java.net.URL base,
                                   java.net.URL input)
                            throws java.lang.Exception
        Create a new effigy in the given container by reading the input URL. If the input URL is null, then create a blank effigy. The blank effigy will have a new model associated with it. If this effigy factory contains an entity or an attribute named "blank", then the new model will be a clone of that object. Otherwise, it will be an instance of TypedCompositeActor. If the URL does not end with extension ".xml" or ".moml" (case insensitive), then return null. If the URL points to an XML file that is not a MoML file, then also return null. A MoML file is required to have the MoML DTD designation in the first five lines. That is, it must contain a line beginning with the string "<!DOCTYPE" and ending with the string 'PUBLIC \"-//UC Berkeley//DTD MoML"'. The specified base is used to expand any relative file references within the URL. If the input URL contains a "#", then the fragment after the "#" assumed to be a dot separated path to an inner model and the inner model is opened.
        Overrides:
        createEffigy in class EffigyFactory
        Parameters:
        container - The container for the effigy.
        base - The base for relative file references, or null if there are no relative file references.
        input - The input URL.
        Returns:
        A new instance of PtolemyEffigy, or null if the URL does not specify a Ptolemy II model.
        Throws:
        java.lang.Exception - If the URL cannot be read, or if the data is malformed in some way.