Constructors Summary |
---|
public FieldPosition(int field)Creates a FieldPosition object for the given field. Fields are
identified by constants, whose names typically end with _FIELD,
in the various subclasses of Format.
this.field = field;
|
public FieldPosition(Format$Field attribute)Creates a FieldPosition object for the given field constant. Fields are
identified by constants defined in the various Format
subclasses. This is equivalent to calling
new FieldPosition(attribute, -1) .
this(attribute, -1);
|
public FieldPosition(Format$Field attribute, int fieldID)Creates a FieldPosition object for the given field.
The field is identified by an attribute constant from one of the
Field subclasses as well as an integer field ID
defined by the Format subclasses. Format
subclasses that are aware of Field should give precedence
to attribute and ignore fieldID if
attribute is not null. However, older Format
subclasses may not be aware of Field and rely on
fieldID . If the field has no corresponding integer
constant, fieldID should be -1.
this.attribute = attribute;
this.field = fieldID;
|
Methods Summary |
---|
public boolean | equals(java.lang.Object obj)Overrides equals
if (obj == null) return false;
if (!(obj instanceof FieldPosition))
return false;
FieldPosition other = (FieldPosition) obj;
if (attribute == null) {
if (other.attribute != null) {
return false;
}
}
else if (!attribute.equals(other.attribute)) {
return false;
}
return (beginIndex == other.beginIndex
&& endIndex == other.endIndex
&& field == other.field);
|
public int | getBeginIndex()Retrieves the index of the first character in the requested field.
return beginIndex;
|
public int | getEndIndex()Retrieves the index of the character following the last character in the
requested field.
return endIndex;
|
public int | getField()Retrieves the field identifier.
return field;
|
public java.text.Format$Field | getFieldAttribute()Returns the field identifier as an attribute constant
from one of the Field subclasses. May return null if
the field is specified only by an integer field ID.
return attribute;
|
java.text.Format$FieldDelegate | getFieldDelegate()Returns a Format.FieldDelegate instance that is associated
with the FieldPosition. When the delegate is notified of the same
field the FieldPosition is associated with, the begin/end will be
adjusted.
return new Delegate();
|
public int | hashCode()Returns a hash code for this FieldPosition.
return (field << 24) | (beginIndex << 16) | endIndex;
|
private boolean | matchesField(java.text.Format$Field attribute)Return true if the receiver wants a Format.Field value and
attribute is equal to it.
if (this.attribute != null) {
return this.attribute.equals(attribute);
}
return false;
|
private boolean | matchesField(java.text.Format$Field attribute, int field)Return true if the receiver wants a Format.Field value and
attribute is equal to it, or true if the receiver
represents an inteter constant and field equals it.
if (this.attribute != null) {
return this.attribute.equals(attribute);
}
return (field == this.field);
|
public void | setBeginIndex(int bi)Sets the begin index. For use by subclasses of Format.
beginIndex = bi;
|
public void | setEndIndex(int ei)Sets the end index. For use by subclasses of Format.
endIndex = ei;
|
public java.lang.String | toString()Return a string representation of this FieldPosition.
return getClass().getName() +
"[field=" + field + ",attribute=" + attribute +
",beginIndex=" + beginIndex +
",endIndex=" + endIndex + ']";
|