当前位置: 首页>>代码示例>>Java>>正文


Java Calendar.getMaximum方法代码示例

本文整理汇总了Java中java.util.Calendar.getMaximum方法的典型用法代码示例。如果您正苦于以下问题:Java Calendar.getMaximum方法的具体用法?Java Calendar.getMaximum怎么用?Java Calendar.getMaximum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Calendar的用法示例。


在下文中一共展示了Calendar.getMaximum方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: NeedsUpdate

import java.util.Calendar; //导入方法依赖的package包/类
public boolean NeedsUpdate() {
    Calendar today = Calendar.getInstance();

    _logger.Debug("Today:\n" + today.toString());
    _logger.Debug("LastUpdate:\n" + _lastUpdate.toString());

    int daysSinceLastUpdate = today.get(Calendar.DAY_OF_YEAR) - _lastUpdate.get(Calendar.DAY_OF_YEAR);
    if (daysSinceLastUpdate < 0) {
        daysSinceLastUpdate += today.getMaximum(Calendar.DAY_OF_YEAR);
    }

    if (daysSinceLastUpdate >= _updateInterval) {
        _logger.Warn("Account needs update! " + String.valueOf(daysSinceLastUpdate));
        return true;
    }

    _logger.Debug("Account does not need an update!");

    return false;
}
 
开发者ID:GuepardoApps,项目名称:PasswordSafe-AndroidClient,代码行数:21,代码来源:AccountModel.java

示例2: appendTo

import java.util.Calendar; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
    int value = calendar.get(Calendar.HOUR_OF_DAY);
    if (value == 0) {
        value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:12,代码来源:FastDatePrinter.java

示例3: appendTo

import java.util.Calendar; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR_OF_DAY);
    if (value == 0) {
        value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:FastDateFormat.java

示例4: Test4118384

import java.util.Calendar; //导入方法依赖的package包/类
/**
 * Make sure maximum for HOUR field is 11, not 12.
 */
public void Test4118384() {
    Calendar cal = Calendar.getInstance();
    if (cal.getMaximum(HOUR) != 11
            || cal.getLeastMaximum(HOUR) != 11
            || cal.getActualMaximum(HOUR) != 11) {
        errln("Fail: maximum of HOUR field should be 11");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:CalendarRegression.java

示例5: renderCalendar

import java.util.Calendar; //导入方法依赖的package包/类
/**
 * 界面渲染
 */
private void renderCalendar() {
    SimpleDateFormat sdf = new SimpleDateFormat(displayFormat);
    txtDate.setText(sdf.format(curDate.getTime()));
    selectedDate = curDate.getTime();

    if (cells == null) {
        cells = new ArrayList<>();
    } else {
        cells.clear();
    }
    Calendar calendar = (Calendar) curDate.clone();

    calendar.set(Calendar.DAY_OF_MONTH, 1);
    int prevDays = calendar.get(Calendar.DAY_OF_WEEK) - 1;
    calendar.add(Calendar.DAY_OF_MONTH, -prevDays);

    int maxCellCount;
    int maxDayNum = calendar.getMaximum(Calendar.DAY_OF_MONTH) + prevDays;
    //确定cells的数量
    if (maxDayNum > 5 * 7) {
        maxCellCount = 6 * 7;
    } else if (maxDayNum > 4 * 7) {
        maxCellCount = 5 * 7;
    } else {
        maxCellCount = 4 * 7;
    }
    while (cells.size() < maxCellCount) {
        cells.add(calendar.getTime());
        calendar.add(Calendar.DAY_OF_MONTH, 1);
    }
    calendarAdapter = new CalendarAdapter(getContext(), cells);
    calendarGridView.setAdapter(calendarAdapter);
}
 
开发者ID:codekongs,项目名称:ImageClassify,代码行数:37,代码来源:CalendarView.java

示例6: getDaysDifference

import java.util.Calendar; //导入方法依赖的package包/类
private static int getDaysDifference(Calendar before, Calendar after) {
    int diff = after.get(Calendar.DAY_OF_YEAR) - before.get(Calendar.DAY_OF_YEAR);
    diff = diff + (before.getMaximum(Calendar.DAY_OF_YEAR) * (after.get(Calendar.YEAR) - before.get(Calendar.YEAR)));

    return diff;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:StringUtils.java

示例7: getWeekDifference

import java.util.Calendar; //导入方法依赖的package包/类
private static int getWeekDifference(Calendar before, Calendar after) {
    int diff = after.get(Calendar.WEEK_OF_YEAR) - before.get(Calendar.WEEK_OF_YEAR);
    diff = diff + (before.getMaximum(Calendar.WEEK_OF_YEAR) * (after.get(Calendar.YEAR) - before.get(Calendar.YEAR)));

    return diff;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:StringUtils.java

示例8: addRepeatTask

import java.util.Calendar; //导入方法依赖的package包/类
private void addRepeatTask(Task task){
    task.setAlreadyRepeating(true);

    Calendar repeatCalender = Calendar.getInstance();
    repeatCalender.setTimeInMillis(dateDialog.getDatePicker().getMaxDate());

    Calendar taskCalender = task.getTaskDate();

    int currentYear = taskCalender.get(Calendar.YEAR);
    int maxYear = repeatCalender.get(Calendar.YEAR);

    switch (task.getRepeatCategory()){
        case 1:
            int currentWeek = taskCalender.get(Calendar.WEEK_OF_YEAR);
            int maxWeek = repeatCalender.getMaximum(Calendar.WEEK_OF_YEAR);
            Log.d(TAG, "Adding weekly repeat task");
            while (currentYear < maxYear){
                if (currentYear > todayCalender.get(Calendar.YEAR)){
                    currentWeek = repeatCalender.getMinimum(Calendar.WEEK_OF_YEAR)- 1;
                }
                taskCalender.set(Calendar.YEAR, currentYear);
                while (currentWeek < maxWeek){
                    taskCalender.set(Calendar.WEEK_OF_YEAR, ++currentWeek);
                    task.setTaskDate(taskCalender);
                    presenter.addTask(task, true);
                    Log.d(TAG, "Adding for week - " + currentWeek);
                }
                currentYear++;
                Log.d(TAG, "Adding for year - " + currentYear);
            }
            break;
        case 2:
            int currentMonth = taskCalender.get(Calendar.MONTH);
            int maxMonth = repeatCalender.getMaximum(Calendar.MONTH);
            Log.d(TAG, "Adding monthly repeat task");
            while (currentYear < maxYear){
                if (currentYear > todayCalender.get(Calendar.YEAR)){
                    currentMonth = repeatCalender.getMinimum(Calendar.MONTH) - 1;
                }
                taskCalender.set(Calendar.YEAR, currentYear);
                while (currentMonth < maxMonth){
                    taskCalender.set(Calendar.MONTH,
                            ++currentMonth);
                    task.setTaskDate(taskCalender);
                    presenter.addTask(task, true);
                }
                currentYear++;
            }
            break;
        case 3:
            while (currentYear < maxYear){
                Log.d(TAG, "Adding yearly repeat task");
                taskCalender.set(Calendar.YEAR,
                        ++currentYear);
                task.setTaskDate(taskCalender);
                presenter.addTask(task, true);
            }
            break;
    }
}
 
开发者ID:aumarbello,项目名称:Tasks,代码行数:61,代码来源:TaskListFragment.java


注:本文中的java.util.Calendar.getMaximum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。