| java.lang.Object org.joda.time.base.AbstractPartial
All known Subclasses: org.joda.time.Partial, org.joda.time.base.BasePartial, org.joda.time.base.BaseLocal,
Method Summary | |
public int | compareTo(Object partial) Compares this partial with another returning an integer
indicating the order. | public boolean | equals(Object partial) Compares this ReadablePartial with another returning true if the chronology,
field types and values are equal. | public int | get(DateTimeFieldType type) Get the value of one of the fields of a datetime. | abstract protected DateTimeField | getField(int index, Chronology chrono) Gets the field for a specific index in the chronology specified. | public DateTimeField | getField(int index) Gets the field at the specifed index. | public DateTimeFieldType | getFieldType(int index) Gets the field type at the specifed index. | public DateTimeFieldType[] | getFieldTypes() Gets an array of the field types that this partial supports. | public DateTimeField[] | getFields() Gets an array of the fields that this partial supports. | public int[] | getValues() Gets an array of the value of each of the fields that this partial supports. | public int | hashCode() Gets a hash code for the ReadablePartial that is compatible with the
equals method. | public int | indexOf(DateTimeFieldType type) Gets the index of the specified field, or -1 if the field is unsupported. | protected int | indexOf(DurationFieldType type) Gets the index of the first fields to have the specified duration,
or -1 if the field is unsupported. | protected int | indexOfSupported(DateTimeFieldType type) Gets the index of the specified field, throwing an exception if the
field is unsupported. | protected int | indexOfSupported(DurationFieldType type) Gets the index of the first fields to have the specified duration,
throwing an exception if the field is unsupported. | public boolean | isAfter(ReadablePartial partial) Is this partial later than the specified partial.
The fields are compared in order, from largest to smallest.
The first field that is non-equal is used to determine the result.
You may not pass null into this method. | public boolean | isBefore(ReadablePartial partial) Is this partial earlier than the specified partial.
The fields are compared in order, from largest to smallest.
The first field that is non-equal is used to determine the result.
You may not pass null into this method. | public boolean | isEqual(ReadablePartial partial) Is this partial the same as the specified partial.
The fields are compared in order, from largest to smallest.
If all fields are equal, the result is true.
You may not pass null into this method. | public boolean | isSupported(DateTimeFieldType type) Checks whether the field specified is supported by this partial. | public DateTime | toDateTime(ReadableInstant baseInstant) Resolves this partial against another complete instant to create a new
full instant. | public String | toString(DateTimeFormatter formatter) Uses the specified formatter to convert this partial to a String.
Parameters: formatter - the formatter to use, null means use toString() . |
AbstractPartial | protected AbstractPartial()(Code) | | Constructor.
|
compareTo | public int compareTo(Object partial)(Code) | | Compares this partial with another returning an integer
indicating the order.
The fields are compared in order, from largest to smallest.
The first field that is non-equal is used to determine the result.
The specified object must be a partial instance whose field types
match those of this partial.
NOTE: This implementation violates the Comparable contract.
This method will accept any instance of ReadablePartial as input.
However, it is possible that some implementations of ReadablePartial
exist that do not extend AbstractPartial, and thus will throw a
ClassCastException if compared in the opposite direction.
The cause of this problem is that ReadablePartial doesn't define
the compareTo() method, however we can't change that until v2.0.
Parameters: partial - an object to check against negative if this is less, zero if equal, positive if greater throws: ClassCastException - if the partial is the wrong classor if it has field types that don't match throws: NullPointerException - if the partial is null since: 1.1 |
equals | public boolean equals(Object partial)(Code) | | Compares this ReadablePartial with another returning true if the chronology,
field types and values are equal.
Parameters: partial - an object to check against true if fields and values are equal |
get | public int get(DateTimeFieldType type)(Code) | | Get the value of one of the fields of a datetime.
The field specified must be one of those that is supported by the partial.
Parameters: type - a DateTimeFieldType instance that is supported by this partial the value of that field throws: IllegalArgumentException - if the field is null or not supported |
getField | abstract protected DateTimeField getField(int index, Chronology chrono)(Code) | | Gets the field for a specific index in the chronology specified.
This method must not use any instance variables.
Parameters: index - the index to retrieve Parameters: chrono - the chronology to use the field throws: IndexOutOfBoundsException - if the index is invalid |
getFieldTypes | public DateTimeFieldType[] getFieldTypes()(Code) | | Gets an array of the field types that this partial supports.
The fields are returned largest to smallest, for example Hour, Minute, Second.
the fields supported in an array that may be altered, largest to smallest |
getFields | public DateTimeField[] getFields()(Code) | | Gets an array of the fields that this partial supports.
The fields are returned largest to smallest, for example Hour, Minute, Second.
the fields supported in an array that may be altered, largest to smallest |
getValues | public int[] getValues()(Code) | | Gets an array of the value of each of the fields that this partial supports.
The fields are returned largest to smallest, for example Hour, Minute, Second.
Each value corresponds to the same array index as getFields()
the current values of each field in an array that may be altered, largest to smallest |
hashCode | public int hashCode()(Code) | | Gets a hash code for the ReadablePartial that is compatible with the
equals method.
a suitable hash code |
indexOf | public int indexOf(DateTimeFieldType type)(Code) | | Gets the index of the specified field, or -1 if the field is unsupported.
Parameters: type - the type to check, may be null which returns -1 the index of the field, -1 if unsupported |
indexOf | protected int indexOf(DurationFieldType type)(Code) | | Gets the index of the first fields to have the specified duration,
or -1 if the field is unsupported.
Parameters: type - the type to check, may be null which returns -1 the index of the field, -1 if unsupported |
indexOfSupported | protected int indexOfSupported(DateTimeFieldType type)(Code) | | Gets the index of the specified field, throwing an exception if the
field is unsupported.
Parameters: type - the type to check, not null the index of the field throws: IllegalArgumentException - if the field is null or not supported |
indexOfSupported | protected int indexOfSupported(DurationFieldType type)(Code) | | Gets the index of the first fields to have the specified duration,
throwing an exception if the field is unsupported.
Parameters: type - the type to check, not null the index of the field throws: IllegalArgumentException - if the field is null or not supported |
isAfter | public boolean isAfter(ReadablePartial partial)(Code) | | Is this partial later than the specified partial.
The fields are compared in order, from largest to smallest.
The first field that is non-equal is used to determine the result.
You may not pass null into this method. This is because you need
a time zone to accurately determine the current date.
Parameters: partial - a partial to check against, must not be null true if this date is after the date passed in throws: IllegalArgumentException - if the specified partial is null throws: ClassCastException - if the partial has field types that don't match since: 1.1 |
isBefore | public boolean isBefore(ReadablePartial partial)(Code) | | Is this partial earlier than the specified partial.
The fields are compared in order, from largest to smallest.
The first field that is non-equal is used to determine the result.
You may not pass null into this method. This is because you need
a time zone to accurately determine the current date.
Parameters: partial - a partial to check against, must not be null true if this date is before the date passed in throws: IllegalArgumentException - if the specified partial is null throws: ClassCastException - if the partial has field types that don't match since: 1.1 |
isEqual | public boolean isEqual(ReadablePartial partial)(Code) | | Is this partial the same as the specified partial.
The fields are compared in order, from largest to smallest.
If all fields are equal, the result is true.
You may not pass null into this method. This is because you need
a time zone to accurately determine the current date.
Parameters: partial - a partial to check against, must not be null true if this date is the same as the date passed in throws: IllegalArgumentException - if the specified partial is null throws: ClassCastException - if the partial has field types that don't match since: 1.1 |
isSupported | public boolean isSupported(DateTimeFieldType type)(Code) | | Checks whether the field specified is supported by this partial.
Parameters: type - the type to check, may be null which returns false true if the field is supported |
toDateTime | public DateTime toDateTime(ReadableInstant baseInstant)(Code) | | Resolves this partial against another complete instant to create a new
full instant. The combination is performed using the chronology of the
specified instant.
For example, if this partial represents a time, then the result of this
method will be the datetime from the specified base instant plus the
time from this partial.
Parameters: baseInstant - the instant that provides the missing fields, null means now the combined datetime |
toString | public String toString(DateTimeFormatter formatter)(Code) | | Uses the specified formatter to convert this partial to a String.
Parameters: formatter - the formatter to use, null means use toString() . the formatted string since: 1.1 |
|
|