java.util.BitSet#previousSetBit ( )源码实例Demo

下面列出了java.util.BitSet#previousSetBit ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TencentKona-8   文件: Label.java
private boolean isVariablePartitioningEqual(final Stack other, final int toSlot) {
    // No difference in the symbol boundaries before the toSlot
    final BitSet diff = other.getSymbolBoundaryCopy();
    diff.xor(symbolBoundary);
    return diff.previousSetBit(toSlot - 1) == -1;
}
 
源代码2 项目: jdk8u60   文件: Label.java
private boolean isVariablePartitioningEqual(final Stack other, final int toSlot) {
    // No difference in the symbol boundaries before the toSlot
    final BitSet diff = other.getSymbolBoundaryCopy();
    diff.xor(symbolBoundary);
    return diff.previousSetBit(toSlot - 1) == -1;
}
 
源代码3 项目: jstarcraft-core   文件: LunarExpression.java
@Override
public ZonedDateTime getPreviousDateTime(ZonedDateTime dateTime) {
    LunarDate lunar = new LunarDate(dateTime.toLocalDate());
    int year = lunar.getYear();
    boolean leap = lunar.isLeap();
    int month = lunar.getMonth();
    int day = lunar.getDay();
    int size = LunarDate.getDaySize(year, leap, month);
    BitSet days = getDays(size);
    LocalTime time = dateTime.toLocalTime();
    int hour = time.getHour();
    int minute = time.getMinute();
    int second = time.getSecond();
    second = seconds.previousSetBit(second - 1);
    if (second == -1) {
        second = seconds.previousSetBit(59);
        minute--;
    }
    minute = minutes.previousSetBit(minute);
    if (minute == -1) {
        second = seconds.previousSetBit(59);
        minute = minutes.previousSetBit(59);
        hour--;
    }
    hour = hours.previousSetBit(hour);
    if (hour == -1) {
        second = seconds.previousSetBit(59);
        minute = minutes.previousSetBit(59);
        hour = hours.previousSetBit(23);
        day--;
    }
    day = days.previousSetBit(day);
    if (day == -1) {
        second = seconds.previousSetBit(59);
        minute = minutes.previousSetBit(59);
        hour = hours.previousSetBit(23);
    }
    while (day == -1) {
        // 从是闰月到非闰月
        if (leap && month == LunarDate.getLeapMonth(year)) {
            leap = false;
        } else {
            month--;
            // 从非闰月到是闰月
            if (month == LunarDate.getLeapMonth(year)) {
                leap = true;
            }
        }
        // 月份是否变化
        if (!months.get(month)) {
            month = months.previousSetBit(month);
            if (month == -1) {
                month = months.previousSetBit(12);
                year--;
                year = years.previousSetBit(year - LunarDate.MINIMUM_YEAR);
                if (year == -1) {
                    return null;
                }
                year += LunarDate.MINIMUM_YEAR;
            }
            // 可能是闰月
            leap = month == LunarDate.getLeapMonth(year);
        }
        size = LunarDate.getDaySize(year, leap, month);
        days = getDays(size);
        day = days.previousSetBit(30);
    }
    if (!years.get(year - LunarDate.MINIMUM_YEAR)) {
        return null;
    }
    lunar = new LunarDate(year, leap, month, day);
    LocalDate date = lunar.getDate();
    return ZonedDateTime.of(date, LocalTime.of(hour, minute, second), dateTime.getZone());
}
 
源代码4 项目: jstarcraft-core   文件: IslamicExpression.java
@Override
public ZonedDateTime getPreviousDateTime(ZonedDateTime dateTime) {
    IslamicDate islamic = new IslamicDate(dateTime.toLocalDate());
    int year = islamic.getYear();
    int month = islamic.getMonth();
    int day = islamic.getDay();
    int size = IslamicDate.getDaySize(year, month);
    BitSet days = getDays(size);
    LocalTime time = dateTime.toLocalTime();
    int hour = time.getHour();
    int minute = time.getMinute();
    int second = time.getSecond();
    second = seconds.previousSetBit(second - 1);
    if (second == -1) {
        second = seconds.previousSetBit(59);
        minute--;
    }
    minute = minutes.previousSetBit(minute);
    if (minute == -1) {
        second = seconds.previousSetBit(59);
        minute = minutes.previousSetBit(59);
        hour--;
    }
    hour = hours.previousSetBit(hour);
    if (hour == -1) {
        second = seconds.previousSetBit(59);
        minute = minutes.previousSetBit(59);
        hour = hours.previousSetBit(23);
        day--;
    }
    day = days.previousSetBit(day);
    if (day == -1) {
        second = seconds.previousSetBit(59);
        minute = minutes.previousSetBit(59);
        hour = hours.previousSetBit(23);
    }
    while (day == -1) {
        month--;
        if (!months.get(month)) {
            month = months.previousSetBit(month);
            if (month == -1) {
                month = months.previousSetBit(12);
                year--;
                year = years.previousSetBit(year - IslamicDate.MINIMUM_YEAR);
                if (year == -1) {
                    return null;
                }
                year += IslamicDate.MINIMUM_YEAR;
            }
        }
        size = IslamicDate.getDaySize(year, month);
        days = getDays(size);
        day = days.previousSetBit(30);
    }
    if (!years.get(year - IslamicDate.MINIMUM_YEAR)) {
        return null;
    }
    islamic = new IslamicDate(year, month, day);
    LocalDate date = islamic.getDate();
    return ZonedDateTime.of(date, LocalTime.of(hour, minute, second), dateTime.getZone());
}
 
源代码5 项目: openjdk-jdk8u   文件: Label.java
private boolean isVariablePartitioningEqual(final Stack other, final int toSlot) {
    // No difference in the symbol boundaries before the toSlot
    final BitSet diff = other.getSymbolBoundaryCopy();
    diff.xor(symbolBoundary);
    return diff.previousSetBit(toSlot - 1) == -1;
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: Label.java
private boolean isVariablePartitioningEqual(final Stack other, final int toSlot) {
    // No difference in the symbol boundaries before the toSlot
    final BitSet diff = other.getSymbolBoundaryCopy();
    diff.xor(symbolBoundary);
    return diff.previousSetBit(toSlot - 1) == -1;
}
 
源代码7 项目: openjdk-jdk9   文件: Label.java
private boolean isVariablePartitioningEqual(final Stack other, final int toSlot) {
    // No difference in the symbol boundaries before the toSlot
    final BitSet diff = other.getSymbolBoundaryCopy();
    diff.xor(symbolBoundary);
    return diff.previousSetBit(toSlot - 1) == -1;
}
 
源代码8 项目: hottub   文件: Label.java
private boolean isVariablePartitioningEqual(final Stack other, final int toSlot) {
    // No difference in the symbol boundaries before the toSlot
    final BitSet diff = other.getSymbolBoundaryCopy();
    diff.xor(symbolBoundary);
    return diff.previousSetBit(toSlot - 1) == -1;
}
 
源代码9 项目: jdk8u_nashorn   文件: Label.java
private boolean isVariablePartitioningEqual(final Stack other, final int toSlot) {
    // No difference in the symbol boundaries before the toSlot
    final BitSet diff = other.getSymbolBoundaryCopy();
    diff.xor(symbolBoundary);
    return diff.previousSetBit(toSlot - 1) == -1;
}