public boolean stop(){
  if (timeBased) {
    return (System.currentTimeMillis() >= nextGate);
  }
 else {
    return (nextGate < 0);
  }
}

public boolean stop ( ) { if ( timeBased ) { return ( System . currentTimeMillis ( ) >= nextGate ) ; } else { return ( nextGate < 0 ) ; } }
check whether we should stop .
