/** *Setstimezone'sGMToffsetvalueto<code>offset</code>.If *<code>startTime</code>isfuturetime,thenthe{@link *#willRawOffsetChange}valueissettotrue. *@paramoffsettheGMToffsetvalueinmilliseconds *@paramstartTimetheUTCtimeatwhichtheGMToffsetisineffective
*/ void setRawOffset(int offset, long startTime) { // if this rawOffset is for the future time, let the run-time // look for the current GMT offset. if (startTime > Time.getCurrentTime()) {
willRawOffsetChange = true;
}
setRawOffset(offset);
}
/** *Addsthespecifiedtransitioninformationtotheendofthetransitiontable. *@paramtimetheUTCtimeatwhichthistransitionhappens *@paramoffsetthetotalamountoftheoffsetfromGMTinmilliseconds *@paramdstOffsettheamountoftimeinmillisecondssavedatthistransition
*/ void addTransition(long time, int offset, int dstOffset) { if (transitions == null) {
transitions = new ArrayList<Long>();
offsets = new ArrayList<Integer>();
dstOffsets = new ArrayList<Integer>();
}
transitions.add(time);
offsets.add(offset);
dstOffsets.add(dstOffset);
}
/** *@returnthetypeofhistoricaldaylightsavingtime *observation.
*/ int getDSTType() { return dstType;
}
/** *Addsthespecifiedzonerecordtothezonerecordslist. *@paramrecthezonerecord
*/ void addUsedRec(ZoneRec rec) { if (usedZoneRecs == null) {
usedZoneRecs = new ArrayList<ZoneRec>();
}
usedZoneRecs.add(rec);
}
/** *Addsthespecifiedrulerecordtotherulerecordslist. *@paramrectherulerecord
*/ void addUsedRec(RuleRec rec) { if (usedRuleRecs == null) {
usedRuleRecs = new ArrayList<RuleRec>();
} // if the last used rec is the same as the given rec, avoid // putting the same rule. int n = usedRuleRecs.size(); for (int i = 0; i < n; i++) { if (usedRuleRecs.get(i).equals(rec)) { return;
}
}
usedRuleRecs.add(rec);
}
/** *@returnthelastdaylightsavingamount.
*/ int getLastDSTSaving() { return lastSaving;
}
/** *CalculatestheCRC32valuefromthetransitiontableandsets *thevalueto<code>crc32</code>.
*/ void checksum() { if (transitions == null) {
crc32 = 0; return;
}
Checksum sum = new Checksum(); for (int i = 0; i < transitions.size(); i++) { int offset = offsets.get(i); // adjust back to make the transition in local time
sum.update(transitions.get(i) + offset);
sum.update(offset);
sum.update(dstOffsets.get(i));
}
crc32 = (int)sum.getValue();
}
/** *RemovesunnecessarytransitionsforJavatimezonesupport.
*/ void optimize() { // if there is only one offset, delete all transitions. This // could happen if only time zone abbreviations changed. if (gmtOffsets.size() == 1) {
transitions = null;
usedRuleRecs = null;
setDSTType(NO_DST); return;
} for (int i = 0; i < (transitions.size() - 2); i++) { // don't remove the last one if (transitions.get(i) == transitions.get(i+1)) {
transitions.remove(i);
offsets.remove(i);
dstOffsets.remove(i);
i--;
}
}
for (int i = 0; i < (transitions.size() - 2); i++) { // don't remove the last one if (offsets.get(i) == offsets.get(i+1)
&& dstOffsets.get(i) == dstOffsets.get(i+1)) {
transitions.remove(i+1);
offsets.remove(i+1);
dstOffsets.remove(i+1);
i--;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.