Search in sources :

Example 1 with ABSDynamicProductLine

use of abs.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(abs.backend.java.lib.runtime.ABSDynamicObject) ABSClosure(abs.backend.java.lib.runtime.ABSClosure) ABSDynamicProductLine(abs.backend.java.lib.runtime.ABSDynamicProductLine) ABSDynamicProduct(abs.backend.java.lib.runtime.ABSDynamicProduct) ABSDynamicReconfiguration(abs.backend.java.lib.runtime.ABSDynamicReconfiguration)

Aggregations

ABSClosure (abs.backend.java.lib.runtime.ABSClosure)1 ABSDynamicObject (abs.backend.java.lib.runtime.ABSDynamicObject)1 ABSDynamicProduct (abs.backend.java.lib.runtime.ABSDynamicProduct)1 ABSDynamicProductLine (abs.backend.java.lib.runtime.ABSDynamicProductLine)1 ABSDynamicReconfiguration (abs.backend.java.lib.runtime.ABSDynamicReconfiguration)1