Go to Post Is there a way to spotlight an entire thread? - ctt956 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 13-02-2014, 08:40
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 103
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
CommandGroup questions

I have a couple of questions regarding how command groups are processed.

As an example, lets assume that I want to:
  • Run CommandA first and wait for it to complete.
  • Then run CommandB and CommandC at the same time.
  • After CommandB and CommandC complete I then want to run CommandD.

I'm assuming the following would generate this sequence:

Code:
public static Command buildMyCommand() {
  CommandGroup bc = new CommandGroup();
  bc.addParallel(new CommandB());
  bc.addParallel(new CommandC());

  CommandGroup cmd = new CommandGroup();
  cmd.addSequential(new CommandA());
  cmd.addSequential(bc);
  cmd.addSequential(new CommandD());

  return cmd;
}
From my understanding of how addParallel() and addSequential() work, the above could also be written as:

Code:
public static Command buildMyCommand() {
  CommandGroup cmd = new CommandGroup();
  cmd.addSequential(new CommandA());
  // Start of first command to run in parallel
  cmd.addParallel(new CommandB());
  // End of commands to run in parallel (runs in parallel with CommandB)
  cmd.addSequential(new CommandC());
  cmd.addSequential(new CommandD());

  return cmd;
}
So, my first question is: Would the two versions of buildMyCommand() shown above produce the same results when run?

My next questions have to do with what happens to a command group when things don't complete nicely:
  • If CommandA from the example command group above was interrupted, would the entire command group be interrupted? For example, let's assume CommandA was waiting for something to move into position and CommandB performed a firing action. If CommandA was interrupted, would CommandB still run, or would the interruption stop CommandB from ever being run?
  • Secondly, Assume CommandA has used the setTimeout() method or was added to the group with a timeout option to indicate that it has 2 seconds to complete. If the timeout is reached, will the rest of the commands complete in the sequence?

Thanks,
Paul
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi