Java Code Examples for org.joda.time.DateTimeField#getMinimumValue()

The following examples show how to use org.joda.time.DateTimeField#getMinimumValue() . 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: DividedDateTimeField.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Construct a DividedDateTimeField that compliments the given
 * RemainderDateTimeField.
 *
 * @param remainderField  complimentary remainder field, like "yearOfCentury()".
 * @param type  the field type this field will actually use
 */
public DividedDateTimeField(RemainderDateTimeField remainderField, DateTimeFieldType type) {
    super(remainderField.getWrappedField(), type);
    int divisor = iDivisor = remainderField.iDivisor;
    iDurationField = remainderField.iRangeField;

    DateTimeField field = getWrappedField();
    int i = field.getMinimumValue();
    int min = (i >= 0) ? i / divisor : ((i + 1) / divisor - 1);

    int j = field.getMaximumValue();
    int max = (j >= 0) ? j / divisor : ((j + 1) / divisor - 1);

    iMin = min;
    iMax = max;
}
 
Example 2
Source File: OffsetDateTimeField.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the field to wrap, like "year()".
 * @param type  the field type this field actually uses
 * @param offset  offset to add to field values
 * @param minValue  minimum allowed value
 * @param maxValue  maximum allowed value
 * @throws IllegalArgumentException if offset is zero
 */
public OffsetDateTimeField(DateTimeField field, DateTimeFieldType type, int offset,
                           int minValue, int maxValue) {
    super(field, type);
            
    if (offset == 0) {
        throw new IllegalArgumentException("The offset cannot be zero");
    }

    iOffset = offset;

    if (minValue < (field.getMinimumValue() + offset)) {
        iMin = field.getMinimumValue() + offset;
    } else {
        iMin = minValue;
    }
    if (maxValue > (field.getMaximumValue() + offset)) {
        iMax = field.getMaximumValue() + offset;
    } else {
        iMax = maxValue;
    }
}
 
Example 3
Source File: DividedDateTimeField.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the field to wrap, like "year()".
 * @param rangeField  the range field, null to derive
 * @param type  the field type this field will actually use
 * @param divisor  divisor, such as 100 years in a century
 * @throws IllegalArgumentException if divisor is less than two
 */
public DividedDateTimeField(DateTimeField field, DurationField rangeField,
                            DateTimeFieldType type, int divisor) {
    super(field, type);
    if (divisor < 2) {
        throw new IllegalArgumentException("The divisor must be at least 2");
    }
    DurationField unitField = field.getDurationField();
    if (unitField == null) {
        iDurationField = null;
    } else {
        iDurationField = new ScaledDurationField(
            unitField, type.getDurationType(), divisor);
    }
    iRangeDurationField = rangeField;
    iDivisor = divisor;
    int i = field.getMinimumValue();
    int min = (i >= 0) ? i / divisor : ((i + 1) / divisor - 1);
    int j = field.getMaximumValue();
    int max = (j >= 0) ? j / divisor : ((j + 1) / divisor - 1);
    iMin = min;
    iMax = max;
}
 
Example 4
Source File: OffsetDateTimeField.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the field to wrap, like "year()".
 * @param type  the field type this field actually uses
 * @param offset  offset to add to field values
 * @param minValue  minimum allowed value
 * @param maxValue  maximum allowed value
 * @throws IllegalArgumentException if offset is zero
 */
public OffsetDateTimeField(DateTimeField field, DateTimeFieldType type, int offset,
                           int minValue, int maxValue) {
    super(field, type);
            
    if (offset == 0) {
        throw new IllegalArgumentException("The offset cannot be zero");
    }

    iOffset = offset;

    if (minValue < (field.getMinimumValue() + offset)) {
        iMin = field.getMinimumValue() + offset;
    } else {
        iMin = minValue;
    }
    if (maxValue > (field.getMaximumValue() + offset)) {
        iMax = field.getMaximumValue() + offset;
    } else {
        iMax = maxValue;
    }
}
 
Example 5
Source File: DividedDateTimeField.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the field to wrap, like "year()".
 * @param type  the field type this field will actually use
 * @param divisor  divisor, such as 100 years in a century
 * @throws IllegalArgumentException if divisor is less than two
 */
public DividedDateTimeField(DateTimeField field,
                            DateTimeFieldType type, int divisor) {
    super(field, type);
            
    if (divisor < 2) {
        throw new IllegalArgumentException("The divisor must be at least 2");
    }

    DurationField unitField = field.getDurationField();
    if (unitField == null) {
        iDurationField = null;
    } else {
        iDurationField = new ScaledDurationField(
            unitField, type.getDurationType(), divisor);
    }

    iDivisor = divisor;

    int i = field.getMinimumValue();
    int min = (i >= 0) ? i / divisor : ((i + 1) / divisor - 1);

    int j = field.getMaximumValue();
    int max = (j >= 0) ? j / divisor : ((j + 1) / divisor - 1);

    iMin = min;
    iMax = max;
}
 
Example 6
Source File: Arja_00111_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 7
Source File: JGenProg2017_00142_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 8
Source File: Cardumen_00190_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 9
Source File: Cardumen_0072_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 10
Source File: Cardumen_00283_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 11
Source File: Cardumen_00138_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 12
Source File: JGenProg2017_00123_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 13
Source File: Arja_00147_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 14
Source File: Arja_00111_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 15
Source File: Cardumen_00240_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 16
Source File: Arja_0051_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 17
Source File: JGenProg2017_0043_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 18
Source File: Arja_0088_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 19
Source File: JGenProg2015_0010_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}
 
Example 20
Source File: JGenProg2017_00123_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the field type this field will actually use
 * @throws IllegalArgumentException if wrapped field's minimum value is not zero
 */
public ZeroIsMaxDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super(field, type);
    if (field.getMinimumValue() != 0) {
        throw new IllegalArgumentException("Wrapped field's minumum value must be zero");
    }
}