Changes between Version 31 and Version 32 of ProtocolOne


Ignore:
Timestamp:
Jun 29, 2011 12:16:09 PM (13 years ago)
Author:
jherwitz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ProtocolOne

    v31 v32  
    1515 * [[Compound Functions]]
    1616
    17 '''Flow of Execution'''
    18 To create a Quagent, simply create a new client using the Client constructor. The constructor takes one argument, which must specify the IP address of the Quagents server.
     17= Flow of Execution =
     18To create a Quagent, simply instantiate a new client using the Client constructor. The constructor takes one argument, which must specify the IP address of the Quagents server.
    1919
    2020''Example:''
     
    4242
    4343== Command Structure ==
    44 [[ProtocolOne]] provides the user two ways of executing Quagent commands. Both of these adhere to a unique programming paradigm - one method is [http://en.wikipedia.org/wiki/Object-oriented_programming Object-Oriented] while the other is [http://en.wikipedia.org/wiki/Functional_programming Functional]. These methods are (approximately) equivalent in usability and accessibility, so the user may choose to use whichever paradigm is preferred.
     44[[ProtocolOne]] provides the user two ways of executing Quagent commands. Both of these adhere to a distinct programming paradigm - one method is [http://en.wikipedia.org/wiki/Object-oriented_programming Object-Oriented] while the other is [http://en.wikipedia.org/wiki/Functional_programming Functional]. These methods are (approximately) equivalent in usability and accessibility, so the user may choose to use whichever paradigm is preferred.
    4545The user may choose to execute commands by either explicitly instantiating the command objects or calling a relevant function. Internally, all commands are represented as command-specific objects. These objects handle writing the specified command to the server, automatically update data fields with any relevant server data response, and maintain auxiliary data related to the command, such as command [[exitcode]] and runtime. To execute a command explicitly using the object, simply call the member function {{{run()}}}. Function calls automatically instantiate, run, and return the relevant object.
    4646It is important to note that all Commands are implemented as [http://download.oracle.com/javase/1.4.2/docs/api/java/util/TimerTask.html TimerTasks], so a user may easily implement an application involving high-level scheduling or planning using [http://download.oracle.com/javase/1.4.2/docs/api/java/util/Timer.html Timers] (this is actually how the periodic execution is implemented).
     
    4949''Example''
    5050The following two code blocks are identical.
     51''Functional''
    5152{{{
    5253client.fireWeapon();
    5354}}}
     55''Object-Oriented''
    5456{{{
    5557FireWeapon fw = new FireWeapon();
     
    5961
    6062= Retrieving Data =
     63Client/Server data response in Quagents 3 is asynchronous. Thus, the object-oriented and functional methods of execution do not directly return related data. Instead, the user gets a reference to the related command object. This object automatically updates data specific to itself as it is read from the socket. The user must poll this object using object query functions to gain access to data. The following example illustrates this interaction.
    6164
    6265The following is an example of a complete Quagents session: