View Single Post
  #20   Spotlight this post!  
Unread 27-01-2015, 13:19
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Command Based Programming (Threads?)

Quote:
Originally Posted by notmattlythgoe View Post
As to the second question. Something like this would work for a single command doing multiple things based on time.

Code:
public void execute() {
     if (timeSinceInitialized() < sometime) {
          do something;
     } else if(timeSinceInitialized() < some bigger time) {
          do something 2;
     } else {
          do something 3;
     }
}
Again, is this the correct interpretation of the above code?
- "something" will be executed every 20ms as long as "timeSinceInitialized()" is less than "sometime"

- "something 2" will be executed every 20ms as long as "timeSinceInitialized()" is greater than or equal to "sometime" and less than "sometime bigger time"

- "something 3" will be executed every 20ms as long as "timeSinceInitialized()" is greater than or equal to "some bigger time"
Reply With Quote