Mercurial > hg > jslab
view src/samer/core_/CompoundAgent.java @ 8:5e3cbbf173aa tip
Reorganise some more
author | samer |
---|---|
date | Fri, 05 Apr 2019 22:41:58 +0100 |
parents | bf79fb79ee13 |
children |
line wrap: on
line source
/* * CompoundAgent.java * * Copyright (c) 2000, Samer Abdallah, King's College London. * All rights reserved. * * This software is provided AS iS and WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. */ package samer.core; /** An Agent that is a composition of two given Agents. */ public class CompoundAgent implements Agent { Agent a1, a2; public CompoundAgent(Agent a1,Agent a2) { this.a1=a1; this.a2=a2; } /** This reports the commands from both the child agents. Duplicate commands are not removed. */ public void getCommands(Registry r) { a1.getCommands(r); r.group(); a2.getCommands(r); } /** Forwards the the command on to BOTH child agents in the order specified in the constructor. */ public void execute( String name, Environment env) throws Exception { a1.execute(name,env); a2.execute(name,env); } }