本文整理了Java中net.time4j.tz.ZonalTransition.getPreviousOffset()
方法的一些代码示例,展示了ZonalTransition.getPreviousOffset()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonalTransition.getPreviousOffset()
方法的具体详情如下:
包路径:net.time4j.tz.ZonalTransition
类名称:ZonalTransition
方法名:getPreviousOffset
[英]Returns the total shift before this transition.
[中]返回此转换之前的总班次。
代码示例来源:origin: net.time4j/time4j-olson
@Override
public ZonalOffset getInitialOffset() {
return ZonalOffset.ofTotalSeconds(
this.transitions[0].getPreviousOffset());
}
代码示例来源:origin: net.time4j/time4j-olson
static void writeTransitions(
ZonalTransition[] transitions,
int size,
DataOutput out
) throws IOException {
int n = Math.min(size, transitions.length);
out.writeInt(n);
if (n > 0) {
int stdOffset = transitions[0].getPreviousOffset();
writeOffset(out, stdOffset);
for (int i = 0; i < n; i++) {
stdOffset = writeTransition(transitions[i], stdOffset, out);
}
}
}
代码示例来源:origin: net.time4j/time4j-olson
private static int searchLocal(
long localSecs,
ZonalTransition[] transitions
) {
int low = 0;
int high = transitions.length - 1;
while (low <= high) {
int middle = (low + high) / 2;
ZonalTransition zt = transitions[middle];
int offset = Math.max(zt.getTotalOffset(), zt.getPreviousOffset());
if (zt.getPosixTime() + offset <= localSecs) {
low = middle + 1;
} else {
high = middle - 1;
}
}
return low;
}
代码示例来源:origin: net.time4j/time4j-olson
static void dump(
ZonalTransition transition,
Appendable buffer
) throws IOException {
Moment ut = Moment.of(transition.getPosixTime(), TimeScale.POSIX);
buffer.append(">>> Transition at: ").append(ut.toString());
buffer.append(" from ").append(format(transition.getPreviousOffset()));
buffer.append(" to ").append(format(transition.getTotalOffset()));
buffer.append(", DST=");
buffer.append(format(transition.getDaylightSavingOffset()));
buffer.append(NEW_LINE);
}
代码示例来源:origin: net.time4j/time4j-olson
private static Object readCompositeTransitionModel(ObjectInput in)
throws IOException, ClassNotFoundException {
List<ZonalTransition> transitions = readTransitions(in);
return TransitionModel.of(
ZonalOffset.ofTotalSeconds(transitions.get(0).getPreviousOffset()),
transitions,
readRules(in),
false,
false);
}
代码示例来源:origin: net.time4j/time4j-olson
List<ZonalOffset> getValidOffsets(
GregorianDate localDate,
long localSecs
) {
long preModel = this.initial.getPosixTime();
int last = this.initial.getTotalOffset();
int max = Math.max(this.initial.getPreviousOffset(), last);
if (localSecs <= preModel + max) {
return TransitionModel.toList(last);
}
for (ZonalTransition t : this.getTransitions(localDate)) {
long tt = t.getPosixTime();
last = t.getTotalOffset();
if (t.isGap()) {
if (localSecs < tt + t.getPreviousOffset()) {
return TransitionModel.toList(t.getPreviousOffset());
} else if (localSecs < tt + last) {
return Collections.emptyList();
}
} else if (t.isOverlap()) {
if (localSecs < tt + last) {
return TransitionModel.toList(t.getPreviousOffset());
} else if (localSecs < tt + t.getPreviousOffset()) {
return TransitionModel.toList(last, t.getPreviousOffset());
}
}
}
return TransitionModel.toList(last);
}
代码示例来源:origin: net.time4j/time4j-olson
ZonalTransition getConflictTransition(
GregorianDate localDate,
long localSecs
) {
long preModel = this.initial.getPosixTime();
int max =
Math.max(
this.initial.getPreviousOffset(),
this.initial.getTotalOffset());
if (localSecs <= preModel + max) {
return null;
}
for (ZonalTransition t : this.getTransitions(localDate)) {
long tt = t.getPosixTime();
if (t.isGap()) {
if (localSecs < tt + t.getPreviousOffset()) {
return null; // offset = t.getPreviousOffset()
} else if (localSecs < tt + t.getTotalOffset()) {
return t;
}
} else if (t.isOverlap()) {
if (localSecs < tt + t.getTotalOffset()) {
return null; // offset = t.getPreviousOffset()
} else if (localSecs < tt + t.getPreviousOffset()) {
return t;
}
}
}
return null; // offset = lastTotalOffset
}
代码示例来源:origin: net.time4j/time4j-olson
static void checkSanity(
ZonalTransition[] transitions,
List<ZonalTransition> original
) {
int previous = transitions[0].getTotalOffset();
for (int i = 1; i < transitions.length; i++) {
if (previous != transitions[i].getPreviousOffset()) {
Moment m =
Moment.of(transitions[i].getPosixTime(), TimeScale.POSIX);
throw new IllegalArgumentException(
"Model inconsistency detected at: " + m
+ " (" + transitions[i].getPosixTime() + ") "
+ " in transitions: " + original);
} else {
previous = transitions[i].getTotalOffset();
}
}
}
代码示例来源:origin: net.time4j/time4j-olson
private static void writeRuleBasedTransitionModel(
Object obj,
ObjectOutput out
) throws IOException {
RuleBasedTransitionModel model = (RuleBasedTransitionModel) obj;
ZonalTransition initial = model.getInitialTransition();
long posixTime = initial.getPosixTime();
if (
(posixTime >= POSIX_TIME_1825)
&& (posixTime < POSIX_TIME_1825 + QUARTERS_IN_24_BITS)
&& ((posixTime % 900) == 0)
) {
int data = (int) ((posixTime - POSIX_TIME_1825) / 900);
out.writeByte((data >>> 16) & 0xFF);
out.writeByte((data >>> 8) & 0xFF);
out.writeByte(data & 0xFF);
} else {
out.writeByte(0xFF);
out.writeLong(initial.getPosixTime());
}
writeOffset(out, initial.getPreviousOffset());
writeOffset(out, initial.getTotalOffset());
int dst = initial.getDaylightSavingOffset();
if (initial.isDaylightSaving() && (dst == 0)) {
dst = Integer.MAX_VALUE;
}
writeOffset(out, dst);
writeRules(model.getRules(), out);
}
代码示例来源:origin: net.time4j/time4j-olson
ZonalTransition first =
getNextTransition(initial.getPosixTime(), initial, sortedRules);
if (initial.getTotalOffset() != first.getPreviousOffset()) {
throw new IllegalArgumentException(
"Inconsistent model: " + initial + " / " + rules);
代码示例来源:origin: net.time4j/time4j-olson
if (test.getPosixTime() + test.getPreviousOffset() <= localSecs) {
return Collections.emptyList();
assert (test.getPosixTime() + test.getPreviousOffset() > localSecs);
if (test.getPosixTime() + test.getTotalOffset() <= localSecs) {
return TransitionModel.toList(
test.getTotalOffset(),
test.getPreviousOffset());
return TransitionModel.toList(test.getPreviousOffset());
代码示例来源:origin: net.time4j/time4j-olson
ZonalOffset.ofTotalSeconds(t.get(0).getPreviousOffset());
代码示例来源:origin: net.time4j/time4j-core
int offset = conflict.getTotalOffset();
if (this.overlapResolver == OverlapResolver.EARLIER_OFFSET) {
offset = conflict.getPreviousOffset();
代码示例来源:origin: net.time4j/time4j-olson
if (test.getPosixTime() + test.getPreviousOffset() <= localSecs) {
return test;
assert (test.getPosixTime() + test.getPreviousOffset() > localSecs);
if (test.getPosixTime() + test.getTotalOffset() <= localSecs) {
return test;
代码示例来源:origin: net.time4j/time4j-core
offset = conflict.getPreviousOffset();
内容来源于网络,如有侵权,请联系作者删除!