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

The following examples show how to use java.util.Calendar#getLeastMaximum() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
/**
 * 4956227: getLeastMaximum(WEEK_OF_MONTH) return diff. val. for Greg. and Buddhist Calendar
 */
static void testLeastMax() {
    Calendar bc = getBuddhistCalendar();
    // Specify THAI_LOCALE to get the same params for WEEK
    // calculations (6904680).
    Calendar gc = new GregorianCalendar(THAI_LOCALE);
    for (int f = 0; f < Calendar.FIELD_COUNT; f++) {
        if (f == ERA || f == YEAR) {
            continue;
        }
        int bn = bc.getLeastMaximum(f);
        int gn = gc.getLeastMaximum(f);
        if (bn != gn) {
            throw new RuntimeException("inconsistent Least Max value for " + Koyomi.getFieldName(f)
                                       + ": Buddhist=" + bn
                                       + ": Gregorian=" + gn);
        }
    }
}
 
Example 2
Source Project: coming   File: Arja_0097_s.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 3
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 4
/**
 * {@inheritDoc}
 */
@Override
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 5
Source Project: coming   File: Arja_00117_t.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 6
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 7
Source Project: coming   File: Lang_50_FastDateFormat_t.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 8
/**
 * 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 9
Source Project: coming   File: Arja_00150_s.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 10
Source Project: coming   File: Elixir_008_t.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 11
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 12
Source Project: logging-log4j2   File: FastDatePrinter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 13
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 14
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 15
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 16
Source Project: coming   File: Lang_56_FastDateFormat_t.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 17
Source Project: coming   File: Arja_0071_t.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 18
Source Project: coming   File: Lang_56_FastDateFormat_s.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}
 
Example 19
/** 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 20
Source Project: coming   File: Lang_38_FastDateFormat_s.java    License: MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void appendTo(StringBuffer buffer, Calendar calendar) {
    int value = calendar.get(Calendar.HOUR);
    if (value == 0) {
        value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
    }
    mRule.appendTo(buffer, value);
}