private boolean advanceApiUpTo(TreeSet<AreaPanelInfo> sortedApiTree,AreaPanelInfo api,int time){
  AreaPanel ap=api.ap();
  TimeTree rootTt=ap.getTimeTree();
  TimeTree tt=rootTt.getEncompassigTimeTreeOrMaxTimeTreeBeforeTime(time,true);
  if (tt == null || tt.id == api.currTtId)   return false;
  sortedApiTree.remove(api);
  if (api.setTt(tt,Integer.MAX_VALUE))   sortedApiTree.add(api);
  return true;
}

private boolean advanceApiUpTo ( TreeSet < AreaPanelInfo > sortedApiTree , AreaPanelInfo api , int time ) { AreaPanel ap = api . ap ( ) ; TimeTree rootTt = ap . getTimeTree ( ) ; TimeTree tt = rootTt . getEncompassigTimeTreeOrMaxTimeTreeBeforeTime ( time , true ) ; if ( tt == null || tt . id == api . currTtId ) return false ; sortedApiTree . remove ( api ) ; if ( api . setTt ( tt , Integer . MAX_VALUE ) ) sortedApiTree . add ( api ) ; return true ; }
moves api to the latest value before time .
