Search in sources :

Example 6 with ObjectMsg

use of abs.backend.java.lib.net.msg.ObjectMsg in project abstools by abstools.

the class DefaultRouter method getNextNode.

@Override
public NetNode getNextNode(Msg m) {
    if (m instanceof ObjectTargetMsg) {
        ObjectTargetMsg om = (ObjectTargetMsg) m;
        ABSObject target = om.getTarget();
        if (routeForObject.containsKey(target)) {
            return routeForObject.get(target).getNextNode();
        } else {
            return node.defaultRoute();
        }
    } else if (m instanceof ObjectMsg) {
        ObjectMsg om = (ObjectMsg) m;
        NetCOG target = om.getCOG();
        if (routeForCOG.containsKey(target)) {
            return routeForCOG.get(target).getNextNode();
        } else {
            return node.defaultRoute();
        }
    } else {
        return node.defaultRoute();
    }
}
Also used : ObjectTargetMsg(abs.backend.java.lib.net.msg.ObjectTargetMsg) ABSObject(abs.backend.java.lib.runtime.ABSObject) ObjectMsg(abs.backend.java.lib.net.msg.ObjectMsg)

Aggregations

ObjectMsg (abs.backend.java.lib.net.msg.ObjectMsg)6 ABSObject (abs.backend.java.lib.runtime.ABSObject)3 Test (org.junit.Test)3 ObjectTargetMsg (abs.backend.java.lib.net.msg.ObjectTargetMsg)2 COGMsg (abs.backend.java.lib.net.msg.COGMsg)1