private boolean isValidTuple(Tuple tp,int statWindow,long curTime,long maxTimeToKeepInSec){
  if (tp.getValue() < 0)   return false;
  logger.debug("Checking tuple [" + tp.toString() + "], "+ "current timestamp ["+ curTime+ "], "+ "time difference ["+ (curTime - tp.timestamp) / 1000 + "] s");
  if ((curTime - maxTimeToKeepInSec * 1000) > tp.getTimestamp()) {
    logger.debug("Removing an expired tuple [" + tp.toString() + "], current timestamp ["+ curTime+ "]");
    return false;
  }
 else   if ((curTime - tp.getTimestamp()) > statWindow * 1000 + 1) {
    if (tp.getEvaluateCount() < 2)     logger.warn("Delete un-evaluated tuple [" + tp.toString() + "] of application "+ appId+ " with current timestamp ["+ curTime+ "] while the evaluation count is "+ tp.getEvaluateCount());
 else     logger.debug("Expired tuple [" + tp.toString() + "]  with current timestamp ["+ curTime+ "] while the evaluation count is "+ tp.getEvaluateCount());
    return false;
  }
  return true;
}

private boolean isValidTuple ( Tuple tp , int statWindow , long curTime , long maxTimeToKeepInSec ) { if ( tp . getValue ( ) < 0 ) return false ; logger . debug ( "Checking tuple [" + tp . toString ( ) + "], " + "current timestamp [" + curTime + "], " + "time difference [" + ( curTime - tp . timestamp ) / 1000 + "] s" ) ; if ( ( curTime - maxTimeToKeepInSec * 1000 ) > tp . getTimestamp ( ) ) { logger . debug ( "Removing an expired tuple [" + tp . toString ( ) + "], current timestamp [" + curTime + "]" ) ; return false ; } else if ( ( curTime - tp . getTimestamp ( ) ) > statWindow * 1000 + 1 ) { if ( tp . getEvaluateCount ( ) < 2 ) logger . warn ( "Delete un-evaluated tuple [" + tp . toString ( ) + "] of application " + appId + " with current timestamp [" + curTime + "] while the evaluation count is " + tp . getEvaluateCount ( ) ) ; else logger . debug ( "Expired tuple [" + tp . toString ( ) + "]  with current timestamp [" + curTime + "] while the evaluation count is " + tp . getEvaluateCount ( ) ) ; return false ; } return true ; }
checks if a tuple is valid when evaluate triggers
