Methods Summary |
---|
public synchronized void | addCategory(java.lang.String categoryName, java.lang.String storeName)
addCategoryImpl(storeName, categoryName);
|
private static native void | addCategoryImpl(java.lang.String storeName, java.lang.String categoryName)
|
public synchronized void | addLandmark(java.lang.String storeName, LandmarkImpl landmark, java.lang.String category)
try {
if ((landmark.getRecordId()) > 0 &&
(landmark.getStoreName() == storeName) &&
(category != null)) {
try {
updateLandmark(storeName, landmark);
} catch (LandmarkException ex) {
landmark.setRecordId(0);
}
if (landmark.getRecordId() > 0) {
addLandmarkToCategoryImpl(storeName, landmark.getRecordId(),
category);
return;
}
}
} catch (IllegalArgumentException e) {
// if it is happened, the landmark is deleted from store.
// Just continue to add Landmark
}
landmark.setRecordId(
addLandmarkToStoreImpl(storeName, landmark, category));
landmark.setStoreName(storeName);
|
private static native void | addLandmarkToCategoryImpl(java.lang.String storeName, int landmarkID, java.lang.String categoryName)
|
private static native int | addLandmarkToStoreImpl(java.lang.String storeName, LandmarkImpl landmark, java.lang.String categoryName)
|
public synchronized void | addStoreName(java.lang.String storeName)
try {
createLandmarkStore(storeName);
} catch (IllegalArgumentException e) {
throw new IOException(e.getMessage());
}
|
private static native java.lang.String | categoryGetNext(int listHandle)
|
private static native void | closeCategoryList(int listHandle)
|
private static native void | closeLandmarkList(int listHandle)
|
private static native void | closeLandmarkStoreList(int listHandle)
|
private static native void | createLandmarkStore(java.lang.String name)
|
public synchronized void | deleteCategory(java.lang.String categoryName, java.lang.String storeName)
deleteCategoryImpl(storeName, categoryName);
|
private static native void | deleteCategoryImpl(java.lang.String storeName, java.lang.String categoryName)
|
public synchronized void | deleteLandmark(java.lang.String storeName, LandmarkImpl lm)
// If the store names are not the same or
// they are the same and both are null (for the default LMS)
// but the landmark does not belong to a LMS
if ((lm.getStoreName() != storeName) || (lm.getRecordId() == 0)) {
throw new LandmarkException("This landmark belongs to a " +
"different store: " + lm.getStoreName());
}
deleteLandmarkFromStoreImpl(storeName, lm.getRecordId());
|
private static native void | deleteLandmarkFromCategoryImpl(java.lang.String storeName, int landmarkID, java.lang.String category)
|
private static native void | deleteLandmarkFromStoreImpl(java.lang.String storeName, int landmarkID)
|
public synchronized java.util.Vector | getCategories(java.lang.String storeName)
Vector categories = new Vector();
int listHandle;
String category;
listHandle = openCategoryList(storeName);
if (listHandle != 0) {
try {
while ((category = categoryGetNext(listHandle)) != null) {
if (category.length() == 0) {
break;
}
categories.addElement(category);
}
} finally {
closeCategoryList(listHandle);
}
}
return categories;
|
public static com.sun.j2me.location.LocationPersistentStorage | getInstance()
if(storage == null) {
storage = new LocationPersistentStorage();
}
return storage;
|
public java.util.Enumeration | getLandmarksEnumeration(java.lang.String storeName, java.lang.String category, java.lang.String name, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude)
Vector landmarks = new Vector();
int landmarkID = 0;
int listHandle;
listHandle = openLandmarkList(storeName, category);
if (listHandle != 0) {
try {
boolean val = true;
do {
LandmarkImpl landmark = new LandmarkImpl("", null,
null, null);
landmarkID = landmarkGetNext(listHandle, landmark);
if (landmarkID != 0) {
if (name != null) {
if (!name.equals(landmark.getName())) {
continue;
}
}
if (landmark.getQualifiedCoordinates() != null) {
double lat = landmark.getQualifiedCoordinates().
getLatitude();
double lon = landmark.getQualifiedCoordinates().
getLongitude();
if (minLongitude > maxLongitude) {
val = (minLatitude <= lat) && (maxLatitude >= lat)
&& ((minLongitude < lon) || (maxLongitude > lon));
} else {
val = (minLatitude <= lat) && (minLongitude <= lon) &&
(maxLongitude >= lon) && (maxLatitude >= lat);
}
}
if (val) {
landmark.setRecordId(landmarkID);
landmark.setStoreName(storeName);
landmarks.addElement(landmark);
}
}
} while (landmarkID != 0);
} finally {
closeLandmarkList(listHandle);
}
Enumeration en = landmarks.elements();
if (en.hasMoreElements()) {
return en;
}
}
return null;
|
private static native int | landmarkGetNext(int listHandle, LandmarkImpl landmark)
|
private static native java.lang.String | landmarkStoreGetNext(int listHandle)
|
public static synchronized java.lang.String[] | listStoreNames()
Vector vectStores = new Vector();
String storeName;
int hndl = openLandmarkStoreList();
do {
storeName = landmarkStoreGetNext(hndl);
if ((storeName != null) && (storeName.length()>0)) {
vectStores.addElement(storeName);
} else {
closeLandmarkStoreList(hndl);
storeName = null;
}
} while(storeName != null);
String[] arrStores = null;
if(vectStores.size()>0) {
arrStores = new String[vectStores.size()];
vectStores.copyInto(arrStores);
}
return arrStores;
|
private static native int | openCategoryList(java.lang.String name)
|
private static native int | openLandmarkList(java.lang.String storeName, java.lang.String categoryName)
|
private static native int | openLandmarkStoreList()
|
public void | removeLandmarkFromCategory(java.lang.String storeName, LandmarkImpl lm, java.lang.String category)
if ((lm.getRecordId() > 0) && (lm.getStoreName() == storeName)) {
deleteLandmarkFromCategoryImpl(
storeName, lm.getRecordId(), category);
}
|
private static native void | removeLandmarkStore(java.lang.String name)
|
public synchronized void | removeStoreName(java.lang.String storeName)
// cannot delete default LandmarkStore
if(storeName == null) {
throw new
NullPointerException("the default store can't be deleted");
}
// remove file with landmarks
removeLandmarkStore(storeName);
|
public synchronized void | updateLandmark(java.lang.String storeName, LandmarkImpl landmark)
if ((landmark.getRecordId()) > 0 &&
(landmark.getStoreName() == storeName)) {
try {
updateLandmarkImpl(storeName, landmark.getRecordId(),
landmark);
} catch (IllegalArgumentException ex) {
throw new LandmarkException(ex.getMessage());
}
return;
} else {
throw new LandmarkException(
"Landmark does not belong to this store");
}
|
private static native void | updateLandmarkImpl(java.lang.String storeName, int landmarkID, LandmarkImpl landmark)
|