Search in sources :

Example 6 with ABSString

use of abs.backend.java.lib.types.ABSString in project abstools by abstools.

the class TestSystemObserver method objectInitialized.

@Override
public void objectInitialized(ObjectView o) {
    if (o.getClassName().equals("FieldClass")) {
        try {
            ABSString s = (ABSString) o.getFieldValue("field");
            System.out.println("FIELD VALUE=" + s.getString());
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }
    }
}
Also used : ABSString(abs.backend.java.lib.types.ABSString)

Example 7 with ABSString

use of abs.backend.java.lib.types.ABSString in project abstools by abstools.

the class Delta method setupMetaAPI.

/*
     * Define the methods of this class
     */
public static void setupMetaAPI() {
    thisClass.setName("Delta");
    thisClass.addMethod(/*ABSString*/
    "getName", new ABSClosure() {

        @Override
        public ABSString exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicDelta delta = (ABSDynamicDelta) t;
            return ABSString.fromString(delta.getName());
        }
    });
    thisClass.addMethod(/*ABSUnit*/
    "apply", new ABSClosure() {

        @Override
        public ABSValue exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicDelta delta = (ABSDynamicDelta) t;
            delta.apply();
            return ABSUnit.UNIT;
        }
    });
}
Also used : ABSDynamicObject(abs.backend.java.lib.runtime.ABSDynamicObject) ABSClosure(abs.backend.java.lib.runtime.ABSClosure) ABSDynamicDelta(abs.backend.java.lib.runtime.ABSDynamicDelta) ABSValue(abs.backend.java.lib.types.ABSValue) ABSString(abs.backend.java.lib.types.ABSString)

Example 8 with ABSString

use of abs.backend.java.lib.types.ABSString in project abstools by abstools.

the class Feature method setupMetaAPI.

/*
     * Define the methods of this class
     */
public static void setupMetaAPI() {
    thisClass.setName("Feature");
    thisClass.addMethod(/*ABSString*/
    "getName", new ABSClosure() {

        @Override
        public ABSString exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicFeature f = (ABSDynamicFeature) t;
            return ABSString.fromString(f.getName());
        }
    });
    thisClass.addMethod(/*ABSString*/
    "getAttributes", new ABSClosure() {

        @Override
        public ABSString exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicFeature f = (ABSDynamicFeature) t;
            // TODO
            return ABSString.fromString("Not Implemented Yet");
        }
    });
}
Also used : ABSDynamicObject(abs.backend.java.lib.runtime.ABSDynamicObject) ABSClosure(abs.backend.java.lib.runtime.ABSClosure) ABSDynamicFeature(abs.backend.java.lib.runtime.ABSDynamicFeature) ABSValue(abs.backend.java.lib.types.ABSValue) ABSString(abs.backend.java.lib.types.ABSString)

Example 9 with ABSString

use of abs.backend.java.lib.types.ABSString in project abstools by abstools.

the class Product method setupMetaAPI.

/*
     * Define the methods of this class
     */
public static void setupMetaAPI() {
    thisClass.setName("Product");
    /*
         * MetaABS Product API -- cf. abslang.abs module ABS.Meta
         */
    thisClass.addMethod(/*ABSString*/
    "getName", new ABSClosure() {

        @Override
        public ABSString exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicProduct thisP = (ABSDynamicProduct) t;
            return ABSString.fromString(thisP.getName());
        }
    });
    thisClass.addMethod(/*List<ABSDynamicFeature>*/
    "getFeatures", new ABSClosure() {

        @Override
        public ABSValue exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicProduct thisP = (ABSDynamicProduct) t;
            ArrayList<ABSDynamicFeature> features = new ArrayList<>();
            for (ABSDynamicFeature f : thisP.getFeatures()) {
                features.add(f);
            }
            return ListUtils.toABSList(features);
        }
    });
    thisClass.addMethod(/*Set<ABSDynamicProduct>*/
    "getConfigurableProducts", new ABSClosure() {

        @Override
        public ABSValue exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicProduct thisP = (ABSDynamicProduct) t;
            return ListUtils.toABSSet(thisP.getConfigurableProducts());
        }
    });
    thisClass.addMethod(/*ABSDynamicReconfiguration*/
    "getReconfiguration", new ABSClosure() {

        @Override
        public ABSDynamicReconfiguration exec(ABSDynamicObject t, ABSValue... params) {
            ABSDynamicProduct thisP = (ABSDynamicProduct) t;
            ABSDynamicProduct targetP = (ABSDynamicProduct) params[0];
            return thisP.getReconfiguration(targetP);
        }
    });
}
Also used : ABSDynamicObject(abs.backend.java.lib.runtime.ABSDynamicObject) ABSClosure(abs.backend.java.lib.runtime.ABSClosure) ABSDynamicFeature(abs.backend.java.lib.runtime.ABSDynamicFeature) ABSDynamicProduct(abs.backend.java.lib.runtime.ABSDynamicProduct) ArrayList(java.util.ArrayList) ABSValue(abs.backend.java.lib.types.ABSValue) ABSString(abs.backend.java.lib.types.ABSString) ABSDynamicReconfiguration(abs.backend.java.lib.runtime.ABSDynamicReconfiguration)

Aggregations

ABSString (abs.backend.java.lib.types.ABSString)9 ABSClosure (abs.backend.java.lib.runtime.ABSClosure)6 ABSDynamicObject (abs.backend.java.lib.runtime.ABSDynamicObject)6 ABSValue (abs.backend.java.lib.types.ABSValue)6 ABSDynamicFeature (abs.backend.java.lib.runtime.ABSDynamicFeature)2 ABSDynamicProduct (abs.backend.java.lib.runtime.ABSDynamicProduct)2 ABSDynamicReconfiguration (abs.backend.java.lib.runtime.ABSDynamicReconfiguration)2 ABSDynamicUpdate (abs.backend.java.lib.runtime.ABSDynamicUpdate)2 ABSUnit (abs.backend.java.lib.types.ABSUnit)2 ABSDynamicClass (abs.backend.java.lib.runtime.ABSDynamicClass)1 ABSDynamicDelta (abs.backend.java.lib.runtime.ABSDynamicDelta)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Scanner (java.util.Scanner)1