public DateTimeZone toDateTimeZone(String id,boolean outputID){
  if (id == null) {
    throw new IllegalArgumentException();
  }
  ArrayList<Transition> transitions=new ArrayList<Transition>();
  DSTZone tailZone=null;
  long millis=Long.MIN_VALUE;
  int saveMillis=0;
  int ruleSetCount=iRuleSets.size();
  for (int i=0; i < ruleSetCount; i++) {
    RuleSet rs=iRuleSets.get(i);
    Transition next=rs.firstTransition(millis);
    if (next == null) {
      continue;
    }
    addTransition(transitions,next);
    millis=next.getMillis();
    saveMillis=next.getSaveMillis();
    rs=new RuleSet(rs);
    while ((next=rs.nextTransition(millis,saveMillis)) != null) {
      if (addTransition(transitions,next)) {
        if (tailZone != null) {
          break;
        }
      }
      millis=next.getMillis();
      saveMillis=next.getSaveMillis();
      if (tailZone == null && i == ruleSetCount - 1) {
        tailZone=rs.buildTailZone(id);
      }
    }
    millis=rs.getUpperLimit(saveMillis);
  }
  if (transitions.size() == 0) {
    if (tailZone != null) {
      return tailZone;
    }
    return buildFixedZone(id,"UTC",0,0);
  }
  if (transitions.size() == 1 && tailZone == null) {
    Transition tr=transitions.get(0);
    return buildFixedZone(id,tr.getNameKey(),tr.getWallOffset(),tr.getStandardOffset());
  }
  PrecalculatedZone zone=PrecalculatedZone.create(id,outputID,transitions,tailZone);
  if (zone.isCachable()) {
    return CachedDateTimeZone.forZone(zone);
  }
  return zone;
}

public DateTimeZone toDateTimeZone ( String id , boolean outputID ) { if ( id == null ) { throw new IllegalArgumentException ( ) ; } ArrayList < Transition > transitions = new ArrayList < Transition > ( ) ; DSTZone tailZone = null ; long millis = Long . MIN_VALUE ; int saveMillis = 0 ; int ruleSetCount = iRuleSets . size ( ) ; for ( int i = 0 ; i < ruleSetCount ; i ++ ) { RuleSet rs = iRuleSets . get ( i ) ; Transition next = rs . firstTransition ( millis ) ; if ( next == null ) { continue ; } addTransition ( transitions , next ) ; millis = next . getMillis ( ) ; saveMillis = next . getSaveMillis ( ) ; rs = new RuleSet ( rs ) ; while ( ( next = rs . nextTransition ( millis , saveMillis ) ) != null ) { if ( addTransition ( transitions , next ) ) { if ( tailZone != null ) { break ; } } millis = next . getMillis ( ) ; saveMillis = next . getSaveMillis ( ) ; if ( tailZone == null && i == ruleSetCount - 1 ) { tailZone = rs . buildTailZone ( id ) ; } } millis = rs . getUpperLimit ( saveMillis ) ; } if ( transitions . size ( ) == 0 ) { if ( tailZone != null ) { return tailZone ; } return buildFixedZone ( id , "UTC" , 0 , 0 ) ; } if ( transitions . size ( ) == 1 && tailZone == null ) { Transition tr = transitions . get ( 0 ) ; return buildFixedZone ( id , tr . getNameKey ( ) , tr . getWallOffset ( ) , tr . getStandardOffset ( ) ) ; } PrecalculatedZone zone = PrecalculatedZone . create ( id , outputID , transitions , tailZone ) ; if ( zone . isCachable ( ) ) { return CachedDateTimeZone . forZone ( zone ) ; } return zone ; }
processes all the rules and builds a datetimezone .
