Search in sources :

Example 1 with ABSDynamicProductLine

use of org.abs_models.backend.java.lib.runtime.ABSDynamicProductLine in project abstools by abstools.

the class ProductLine method setupAPI.

private static void setupAPI() {
    thisClass.setName("ProductLine");
    /* 
         * MetaABS ProductLine API -- cf. abslang.abs module ABS.Meta 
         */
    thisClass.addMethod(/*ABSDynamicProduct*/
    "getCurrentProduct", new ABSClosure() {

        @Override
        public ABSDynamicProduct exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicProduct currentProd = t.__ABS_getRuntime().getDSPL().getCurrentProduct();
            return currentProd;
        }
    });
    thisClass.addMethod(/*ABSDynamicProduct*/
    "getProduct", new ABSClosure() {

        @Override
        public ABSDynamicProduct exec(ABSDynamicObject t, ABSValue... params) {
            ABSString name = (ABSString) params[0];
            ABSDynamicProduct product = t.__ABS_getRuntime().getDSPL().getProduct(name.getString());
            return product;
        }
    });
    thisClass.addMethod(/*ABSUnit*/
    "reconfigure", new ABSClosure() {

        @Override
        public ABSUnit exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicProduct targetProd = (ABSDynamicProduct) params[0];
            ABSDynamicProductLine pl = t.__ABS_getRuntime().getDSPL();
            pl.reconfigure(targetProd);
            return ABSUnit.UNIT;
        }
    });
    thisClass.addMethod(/*ABSUnit*/
    "addProduct", new ABSClosure() {

        @Override
        public ABSUnit exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicProduct product = (ABSDynamicProduct) params[0];
            t.__ABS_getRuntime().getDSPL().addProduct(product);
            return ABSUnit.UNIT;
        }
    });
    thisClass.addMethod(/*ABSUnit*/
    "removeProduct", new ABSClosure() {

        @Override
        public ABSUnit exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicProduct product = (ABSDynamicProduct) params[0];
            t.__ABS_getRuntime().getDSPL().removeProduct(product);
            return ABSUnit.UNIT;
        }
    });
    thisClass.addMethod(/*ABSUnit*/
    "addReconfiguration", new ABSClosure() {

        @Override
        public ABSUnit exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicReconfiguration recf = (ABSDynamicReconfiguration) params[0];
            t.__ABS_getRuntime().getDSPL().addReconfiguration(recf);
            return ABSUnit.UNIT;
        }
    });
    thisClass.addMethod(/*ABSUnit*/
    "removeReconfiguration", new ABSClosure() {

        @Override
        public ABSUnit exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicReconfiguration recf = (ABSDynamicReconfiguration) params[0];
            t.__ABS_getRuntime().getDSPL().removeReconfiguration(recf);
            return ABSUnit.UNIT;
        }
    });
}
Also used : ABSDynamicObject(org.abs_models.backend.java.lib.runtime.ABSDynamicObject) ABSClosure(org.abs_models.backend.java.lib.runtime.ABSClosure) ABSDynamicProductLine(org.abs_models.backend.java.lib.runtime.ABSDynamicProductLine) ABSDynamicProduct(org.abs_models.backend.java.lib.runtime.ABSDynamicProduct) ABSUnit(org.abs_models.backend.java.lib.types.ABSUnit) ABSValue(org.abs_models.backend.java.lib.types.ABSValue) ABSString(org.abs_models.backend.java.lib.types.ABSString) ABSDynamicReconfiguration(org.abs_models.backend.java.lib.runtime.ABSDynamicReconfiguration)

Aggregations

ABSClosure (org.abs_models.backend.java.lib.runtime.ABSClosure)1 ABSDynamicObject (org.abs_models.backend.java.lib.runtime.ABSDynamicObject)1 ABSDynamicProduct (org.abs_models.backend.java.lib.runtime.ABSDynamicProduct)1 ABSDynamicProductLine (org.abs_models.backend.java.lib.runtime.ABSDynamicProductLine)1 ABSDynamicReconfiguration (org.abs_models.backend.java.lib.runtime.ABSDynamicReconfiguration)1 ABSString (org.abs_models.backend.java.lib.types.ABSString)1 ABSUnit (org.abs_models.backend.java.lib.types.ABSUnit)1 ABSValue (org.abs_models.backend.java.lib.types.ABSValue)1