Java Reference
In-Depth Information
"Mixer1201" -> Mixer1201
"StarPress1401" -> StarPress1401
"ShellAssembler1301" -> ShellAssembler1301
"Fuser1101" -> Fuser1101
"UnloadBuffer1501" -> UnloadBuffer1501
This context maps machine names to instances of Machine . You can program
a CarryCommand object, for example, to carry material from two machines to the buffer:
package com.oozinoz.robot.interpreter;
import java.util.*;
import com.oozinoz.machine.*;
public class ShowCarry
{
public static void main(String[] args)
{
Context c = MachineLine.createContext();
Variable x = new Variable("x");
Machine ub = c.lookup("UnloadBuffer1501");
CarryCommand comm =
new CarryCommand(x, new Constant(ub));
c.assign(x, c.lookup("Mixer1201"));
comm.execute(c);
c.assign(x, c.lookup("StarPress1401"));
comm.execute(c);
}
}
The CarryCommand object directs the robot to move material. A log of the machine line's
response to the command executions is:
Robot will carry from Mixer1201 to UnloadBuffer1501
Mixer1201 unloading
Robot will carry from StarPress1401 to UnloadBuffer1501
StarPress1401 unloading
Note that the CarryCommand object is reusable. To obtain this kind of flexibility, other
Command classes also define themselves using Term objects, as Figure 25.3 shows.
Search WWH ::




Custom Search