|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.microedition.location.services.NavigationInstruction
public class NavigationInstruction
This class collects the instructions for navigating a route segment.
Each NavigationInstruction
object has the instructions in
different MIME types and a geographical area within which the instruction
should be given. The instruction may be
any content that has a registered MIME type. An application using the instructions
determines the proper object to be used based on the MIME type of the
instruction. For example, an instruction with MIME type "image/png"
could be casted into javax.microedition.lcdui.Image
object.
The mapping between MIME types and objects used to represent that content
will be done in outside this specification.
An application may add content in several MIME types to an instruction.
Content of one type is added in the constructor, and additional content with
method addInstruction
method. If there is a need to update the content, a new
NavigationInstruction
object must be created.
Constructor Summary | |
---|---|
NavigationInstruction(java.lang.Object instruction,
java.lang.String mimeType,
GeographicArea coverageArea)
Constructs a NavigationInstruction object with the given
parameters. |
Method Summary | |
---|---|
void |
addInstruction(java.lang.Object instruction,
java.lang.String mimeType)
Adds the instruction for navigation. |
boolean |
equals(java.lang.Object obj)
Overriding the equals method in Object class to compare the
equality of values in two NavigatoinInstruction objects. |
GeographicArea |
getCoverageArea()
Returns the coverage area of the instruction. |
java.lang.Object |
getInstruction(java.lang.String mimeType)
Returns the navigation instruction for the requested MIME type. |
java.lang.String[] |
getMimeTypes()
Returns the MIME types of the instructions that have been set in this object. |
int |
hashCode()
Overriding the hashCode method in Object class. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NavigationInstruction(java.lang.Object instruction, java.lang.String mimeType, GeographicArea coverageArea)
Constructs a NavigationInstruction
object with the given
parameters. The actual instruction is given as an Object
,
since it varies based on the MIME type of the instruction. The
mimeType
parameter ties the instruction into certain MIME type.
The coverageArea
parameter defines the geographical area within
what the instruction should be given. The input values are
validated only for non-null
values.
instruction
- the instruction for navigating a route segmentmimeType
- the MIME type of the instructioncoverageArea
- the area within what the instruction should be given
java.lang.NullPointerException
- if instruction
,
mimeType
or coverageArea
is
null
Method Detail |
---|
public java.lang.Object getInstruction(java.lang.String mimeType)
Returns the navigation instruction for the requested MIME type. The
method returns the values set in the constructor or with method
addInstruction
.
An application casts the returned Object
into right type object
based on the mimeType
parameter. If the instruction for the
requested MIME type does not exist in this object, this method returns
null
. The assigned MIME types can be retrieved with method
getMimeTypes
.
mimeType
- the MIME type of the requested instruction
null
if the instruction
for requested MIME type has not been set
java.lang.NullPointerException
- if mimeType
is null
public void addInstruction(java.lang.Object instruction, java.lang.String mimeType)
Adds the instruction for navigation. The instruction is passed in as an
Object
. The MIME type of the instruction is defined with
mimeType
parameter. If this object already has an instruction
with the given MIME type set, an IllegalArgumentException
is
thrown.
instruction
- the instruction for navigationmimeType
- the MIME type of the instruction
java.lang.IllegalArgumentException
- if this object already has an
instruction with the given mimeType
set
java.lang.NullPointerException
- if instruction
or
mimeType
is null
public GeographicArea getCoverageArea()
Returns the coverage area of the instruction. The instruction should be given when the coverage area is entered.
public java.lang.String[] getMimeTypes()
Returns the MIME types of the instructions that have been set in this object.
The MIME types are given in the constructor and in the
addInstruction
method. The MIME type can be used to request appropriate instruction with
the getInstruction
method.
public boolean equals(java.lang.Object obj)
Overriding the equals method in Object
class to compare the
equality of values in two NavigatoinInstruction
objects. Two
NavigationInstruction
objects are equal, if the fields are
equal.
equals
in class java.lang.Object
obj
- object to which the comparison is done
true
if all fields in the objects are equal,
else false
public int hashCode()
Overriding the hashCode
method in Object
class.
The method returns a hash code value for the route object. Two
NavigationInstruction
objects that are equal must have
the same hash code. For more information see
java.lang.Object.hashCode()
method.
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |