Java Code Examples for java.util.Calendar#getMaximum()

The following examples show how to use java.util.Calendar#getMaximum() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: 1_FastDateFormat.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 2
Source File: DateSet.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/** Sets the given {@code value} with the specified unit in the calendar; For {@link Calendar#YEAR}, caps the value. */
@Override
void integerManipulation(Callable<Void> stopChecker, Calendar cal, int unit, int value) {
	if (unit == Calendar.YEAR) {
		if (value < -cal.getLeastMaximum(unit)) {
			value = -cal.getLeastMaximum(unit);
		} else if (value >= cal.getMaximum(unit)) {
			value = cal.getMaximum(unit) - 1;
		}
	}
	cal.set(unit, value);
}
 
Example 3
Source File: FastDateFormat.java    From box-android-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 4
Source File: FastDatePrinter.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 5
Source File: Lang_18_FastDateFormat_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@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);
}
 
Example 6
Source File: Arja_00117_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@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);
}
 
Example 7
Source File: FastDateFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 8
Source File: Arja_00134_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@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);
}
 
Example 9
Source File: 1_FastDateFormat.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 10
Source File: 1_FastDateFormat.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 11
Source File: Arja_00150_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@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);
}
 
Example 12
Source File: Arja_0097_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@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);
}
 
Example 13
Source File: FastDateFormat.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 14
Source File: 1_FastDateFormat.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 15
Source File: CalendarRegression.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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");
    }
}
 
Example 16
Source File: FastDateFormat.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@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);
}
 
Example 17
Source File: Lang_56_FastDateFormat_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@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);
}
 
Example 18
Source File: Arja_00134_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@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);
}
 
Example 19
Source File: Arja_0019_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * {@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);
}
 
Example 20
Source File: StringUtils.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
}