package bwapi; import bwapi.*; import java.util.Map; import java.util.HashMap; import java.util.Collection; import java.util.List; /** UnitCommand objects are currently used only as arguments to one function - Unit::issueCommand. While units can be issued commands the normal way via the Unit methods (i.e. Unit::attack), in some cases you may want to have a function that can process any unit command, such as when you're writing a proxy for BWAPI. */ public class UnitCommand { /** Returns the type of the command */ public UnitCommandType getType() { return getType_native(pointer); } private static Map instances = new HashMap(); private UnitCommand(long pointer) { this.pointer = pointer; } private static UnitCommand get(long pointer) { UnitCommand instance = instances.get(pointer); if (instance == null ) { instance = new UnitCommand(pointer); instances.put(pointer, instance); } return instance; } private long pointer; private native UnitCommandType getType_native(long pointer); }