本文整理汇总了Java中rescuecore2.messages.Command类的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Command类属于rescuecore2.messages包,在下文中一共展示了Command类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MrlCommandLayer
import rescuecore2.messages.Command; //导入依赖的package包/类
/**
* Construct a new CommandLayer.
*/
public MrlCommandLayer() {
commands = new ArrayList<Command>();
renderMove = true;
renderExtinguish = true;
renderClear = true;
renderLoad = true;
renderUnload = true;
renderRescue = true;
renderMoveAction = new RenderMoveAction();
renderExtinguishAction = new RenderExtinguishAction();
renderClearAction = new RenderClearAction();
renderRescueAction = new RenderRescueAction();
renderLoadAction = new RenderLoadAction();
renderUnloadAction = new RenderUnloadAction();
}
示例2: think
import rescuecore2.messages.Command; //导入依赖的package包/类
@Override
protected final void think(int time, ChangeSet changed, Collection<Command> heard)
{
this.startProcessTime = System.currentTimeMillis();
if (time <= this.ignoreTime)
{
send(new AKSubscribe(getID(), time, 1));
}
else {
this.receiveBeforeEvent(time, changed);
// try
// {
this.manager.receiveMessage(time, heard);
// } catch (Exception s) { System.out.println("'");}
}
this.think(time, changed);
if (time > this.ignoreTime) {
this.send(this.manager.createSendMessage(super.getID()));
this.sendAfterEvent(time, changed);
}
}
示例3: viewObject
import rescuecore2.messages.Command; //导入依赖的package包/类
@Override
protected void viewObject(Object o) {
super.viewObject(o);
if (o instanceof Command) {
commands.add((Command) o);
}
}
示例4: render
import rescuecore2.messages.Command; //导入依赖的package包/类
@Override
public Collection<RenderedObject> render(Graphics2D graphics, ScreenTransform transform, int width, int height) {
synchronized (commands) {
Collection<RenderedObject> result = new ArrayList<RenderedObject>();
g = graphics;
t = transform;
for (Command next : commands) {
if (renderMove && next instanceof AKMove) {
if (StaticViewProperties.selectedObject != null && (next).getAgentID().equals(StaticViewProperties.selectedObject.getID())) {
renderMove((AKMove) next);
}
}
if (renderExtinguish && next instanceof AKExtinguish) {
renderExtinguish((AKExtinguish) next);
}
if (renderClear && next instanceof AKClear) {
renderClear((AKClear) next);
}
if (renderClear && next instanceof AKClearArea) {
renderClearArea((AKClearArea) next);
}
if (renderRescue && next instanceof AKRescue) {
renderRescue((AKRescue) next);
}
if (renderLoad && next instanceof AKLoad) {
renderLoad((AKLoad) next);
}
if (renderUnload && next instanceof AKUnload) {
renderUnload((AKUnload) next);
}
}
return result;
}
}
示例5: receiveMessage
import rescuecore2.messages.Command; //导入依赖的package包/类
public void receiveMessage(int time, Collection<Command> heard)
{
this.kernelTime = time;
this.receivedMessages.clear();
this.heardAgentHelp = false;
for (BitOutputStream bos : bitOutputStreamList)
{ bos.reset(); }
for (Command command : heard)
{
if (command instanceof AKSpeak)
{
if (agentID == command.getAgentID()) { continue; }
byte[] data = ((AKSpeak)command).getContent();
if (data.length <= 0) { continue; }
if (((AKSpeak) command).getChannel() == 0)
{
String voice = new String(data);
if ("Help".equalsIgnoreCase(voice) || "Ouch".equalsIgnoreCase(voice))
{
//System.out.println(voice + " : " + command.getAgentID() + " : " );
this.heardAgentHelp = true;
continue;
}
String[] voiceData =
voice.split(this.voiceConfig.getMessageSeparator());
this.receiveVoiceMessage(
(AKSpeak)command,
Arrays.copyOfRange(voiceData, 1, voiceData.length - 1),
this.receivedMessages);
// TODO: refactoring
}
else
{
this.receiveRadioMessage((AKSpeak)command, this.receivedMessages);
}
}
}
}