ctSim.model.bots.components
Class MousePictureComponent

java.lang.Object
  extended by ctSim.model.bots.components.BotComponent<Void>
      extended by ctSim.model.bots.components.MousePictureComponent
All Implemented Interfaces:
BotComponent.CanRead, BotComponent.CanWrite, BotComponent.CanWriteAsynchronously

public class MousePictureComponent
extends BotComponent<Void>
implements BotComponent.CanRead, BotComponent.CanWrite, BotComponent.CanWriteAsynchronously


Nested Class Summary
 
Nested classes/interfaces inherited from class ctSim.model.bots.components.BotComponent
BotComponent.CanRead, BotComponent.CanWrite, BotComponent.CanWriteAsynchronously, BotComponent.ConnectionFlags, BotComponent.SimpleActuator, BotComponent.SimpleSensor
 
Constructor Summary
MousePictureComponent()
          Mausbild-Komponente
 
Method Summary
 void addCompletionListener(Runnable li)
           
 void addImageListener(Runnable1<Image> li)
           
 void askForWrite(CommandOutputStream s)
          Schreibanforderung
 String getDescription()
           
 int getHeight()
           
 Command.Code getHotCmdCode()
          Nicht aufrufen – sollte nur von askForWrite() und offerRead() verwendet werden.
 String getName()
           
 int getWidth()
           
 void readFrom(Command c)
          Erwartet 18×18 = 324 Pixel in dieser Reihenfolge: 18 36 ... 324 ... ... ... ... 2 20 ... ... 1 19 ... 307
 void removeCompletionListener(Runnable li)
           
 void removeImageListener(Runnable1<Image> li)
           
 void requestPicture()
          Bild anfordern
 void setAsyncWriteStream(CommandOutputStream s)
          Setzt Asynchronen-Schreib-Stream
 void updateExternalModel()
          Nur auf dem EDT laufenlassen
 void writeTo(Command c)
          No-op: Wir implementieren die, weil wir laut Interface müssen, aber wir brauchen die nicht weil wir ja askForWrite() überschrieben haben.
 
Methods inherited from class ctSim.model.bots.components.BotComponent
getExternalModel, isGuiEditable, offerAsyncWriteStream, offerRead, readsCommands, setFlags, writesAsynchronously, writesSynchronously
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MousePictureComponent

public MousePictureComponent()
Mausbild-Komponente

Method Detail

setAsyncWriteStream

public void setAsyncWriteStream(CommandOutputStream s)
Description copied from interface: BotComponent.CanWriteAsynchronously
Setzt Asynchronen-Schreib-Stream

Specified by:
setAsyncWriteStream in interface BotComponent.CanWriteAsynchronously
Parameters:
s - OutputStream
See Also:
BotComponent.CanWriteAsynchronously.setAsyncWriteStream(ctSim.model.CommandOutputStream)

requestPicture

public void requestPicture()
                    throws IOException
Bild anfordern

Throws:
IOException

askForWrite

public void askForWrite(CommandOutputStream s)
Description copied from class: BotComponent
Schreibanforderung

Overrides:
askForWrite in class BotComponent<Void>
Parameters:
s - CommandOutputStream
See Also:
BotComponent.askForWrite(ctSim.model.CommandOutputStream)

readFrom

public void readFrom(Command c)
Erwartet 18×18 = 324 Pixel in dieser Reihenfolge:
  18  36 ... 324
 ... ... ... ...
   2  20 ... ...
   1  19 ... 307
 

Specified by:
readFrom in interface BotComponent.CanRead
Parameters:
c - Command

writeTo

public void writeTo(Command c)
No-op: Wir implementieren die, weil wir laut Interface müssen, aber wir brauchen die nicht weil wir ja askForWrite() überschrieben haben.

Specified by:
writeTo in interface BotComponent.CanWrite
Parameters:
c - Command

getWidth

public int getWidth()
Returns:
Breite

getHeight

public int getHeight()
Returns:
Hoehe

getHotCmdCode

public Command.Code getHotCmdCode()
Description copied from interface: BotComponent.CanRead
Nicht aufrufen – sollte nur von askForWrite() und offerRead() verwendet werden.

Specified by:
getHotCmdCode in interface BotComponent.CanRead
Specified by:
getHotCmdCode in interface BotComponent.CanWrite
Returns:
Command-Code
See Also:
BotComponent.CanRead.getHotCmdCode()

getName

public String getName()
Specified by:
getName in class BotComponent<Void>
Returns:
Gibt den Namen der Komponente zurück
See Also:
BotComponent.getName()

getDescription

public String getDescription()
Specified by:
getDescription in class BotComponent<Void>
Returns:
Beschreibung der Komponente
See Also:
BotComponent.getDescription()

addImageListener

public void addImageListener(Runnable1<Image> li)
Parameters:
li - Listener

removeImageListener

public void removeImageListener(Runnable1<Image> li)
Parameters:
li - Listener

addCompletionListener

public void addCompletionListener(Runnable li)
Parameters:
li - Listener

removeCompletionListener

public void removeCompletionListener(Runnable li)
Parameters:
li - Listener

updateExternalModel

public void updateExternalModel()
Description copied from class: BotComponent
Nur auf dem EDT laufenlassen

Specified by:
updateExternalModel in class BotComponent<Void>
See Also:
BotComponent.updateExternalModel()