Class ModuleUtils

    • Constructor Detail

      • ModuleUtils

        public ModuleUtils()
    • Method Detail

      • convertArgsToStem

        public QDLStem convertArgsToStem​(Polyad polyad,
                                         Object arg,
                                         State state,
                                         String component)
        Converts a couple of different arguments to the form [[a0{,b0}],[a1{,b1}],...,[an{,bn}] or (if a single argument that is a stem) can pass back:

        {key0:[[a0{,b0}], key1:[a1{,b1}],...}

        where the bk are optional. All ak, bk are strings. a,b -> [[a,b]] (pair of arguments, function is dyadic [a,b] ->[[a,b]] (simple list, convert to nested list [a0,a1,...] -> [[a0],[a1],...] allow for scalars Use in both module import and load for consistent arguments

        Parameters:
        polyad -
        state -
        component -
        Returns:
      • doJavaModuleLoad

        public List<String> doJavaModuleLoad​(State state,
                                             String resourceName,
                                             JavaModuleConfig javaModuleConfig)
        Load a single java module, returning a null if it failed or the FQ name if it worked.
        Parameters:
        state -
        resourceName -
      • doQDLModuleLoad

        public List<String> doQDLModuleLoad​(State state,
                                            String resourceName)
        Load the module(s) in a single resource.
        Parameters:
        state -
        resourceName -
        Returns:
      • deserializeFromJSON

        public Module deserializeFromJSON​(State state,
                                          net.sf.json.JSONObject json,
                                          boolean useModule,
                                          SerializationState serializationState)
                                   throws Throwable
        Parameters:
        state -
        json -
        useModule - if this module is used (i.e. imported to current scope) vs. imported
        serializationState -
        Returns:
        Throws:
        Throwable
      • updateSerializedState

        public void updateSerializedState​(net.sf.json.JSONObject jsonObject,
                                          State state,
                                          SerializationState serializationState)
                                   throws Throwable
        There are two steps to deserialzing a workspace. First, run the QDL which sets up the (arbitrarily complex) network of objects. Then make a second pass with any state objects that have been updated.
        Parameters:
        jsonObject -
        serializationState -
        Throws:
        Throwable
      • getStack

        protected net.sf.json.JSONArray getStack​(net.sf.json.JSONObject state,
                                                 String tag)
      • applyState

        protected void applyState​(Module module,
                                  net.sf.json.JSONObject serializedState)
        For modules only. Applies the serialized module state. If the module was created with the shared state, then only the local tables are updated.
        Parameters:
        module -
        serializedState -