Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
74f6a15333
27 changed files with 190 additions and 196 deletions
|
@ -54,7 +54,7 @@ import net.osmand.core.samples.android.sample1.search.objects.PoiTypeSearchObjec
|
|||
import net.osmand.core.samples.android.sample1.search.objects.PoiTypeSearchObject.ObjectType;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.SearchObject;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.SearchObject.SearchObjectType;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectSearchToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.SearchToken;
|
||||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
|
@ -210,6 +210,7 @@ public class MainActivity extends Activity {
|
|||
res = poiTypesHelper.findPoiTypes(keyword);
|
||||
}
|
||||
|
||||
/*
|
||||
for (AbstractPoiType pt : res) {
|
||||
if (pt instanceof PoiCategory) {
|
||||
result.add(new PoiTypeSearchObject(ObjectType.CATEGORY,
|
||||
|
@ -224,6 +225,7 @@ public class MainActivity extends Activity {
|
|||
poiType.getTranslation(), poiType.getKeyName(), poiType.getCategory().getKeyName()));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -234,9 +236,9 @@ public class MainActivity extends Activity {
|
|||
processSearchResult(searchObjects);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Map<SearchObjectType, SearchToken> objectTokensMap = searchAPI.getObjectTokens();
|
||||
ObjectSearchToken lastObjectToken = searchAPI.getLastObjectToken();
|
||||
for (SearchToken token : objectTokensMap.values()) {
|
||||
Map<SearchObjectType, ObjectToken> objectTokensMap = searchAPI.getObjectTokens();
|
||||
ObjectToken lastObjectToken = searchAPI.getLastObjectToken();
|
||||
for (ObjectToken token : objectTokensMap.values()) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append(" • ");
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@ public class BuildingSearchListItem extends SearchListPositionItem {
|
|||
private String nameStr;
|
||||
private String typeStr;
|
||||
|
||||
public BuildingSearchListItem(SampleApplication app, BuildingSearchObject searchObject) {
|
||||
super(app, searchObject);
|
||||
public BuildingSearchListItem(SampleApplication app, BuildingSearchObject buildingObject) {
|
||||
super(app, buildingObject);
|
||||
|
||||
nameStr = searchObject.getName(MapUtils.LANGUAGE);
|
||||
nameStr = buildingObject.getName(MapUtils.LANGUAGE);
|
||||
|
||||
Building building = searchObject.getBuilding();
|
||||
Building building = buildingObject.getBaseObject();
|
||||
|
||||
Street street = building.getStreet();
|
||||
if (street != null) {
|
||||
|
|
|
@ -9,10 +9,10 @@ public class CitySearchListItem extends SearchListPositionItem{
|
|||
private String nameStr;
|
||||
private String typeStr;
|
||||
|
||||
public CitySearchListItem(SampleApplication app, CitySearchObject searchObject) {
|
||||
super(app, searchObject);
|
||||
public CitySearchListItem(SampleApplication app, CitySearchObject cityObject) {
|
||||
super(app, cityObject);
|
||||
|
||||
nameStr = searchObject.getName(MapUtils.LANGUAGE);
|
||||
nameStr = cityObject.getName(MapUtils.LANGUAGE);
|
||||
typeStr = "City";
|
||||
}
|
||||
|
||||
|
|
|
@ -26,20 +26,20 @@ public class PoiSearchListItem extends SearchListPositionItem {
|
|||
private String nameStr;
|
||||
private String typeStr;
|
||||
|
||||
public PoiSearchListItem(SampleApplication app, PoiSearchObject searchObject) {
|
||||
super(app, searchObject);
|
||||
amenity = parseAmenity(searchObject);
|
||||
public PoiSearchListItem(SampleApplication app, PoiSearchObject poiObject) {
|
||||
super(app, poiObject);
|
||||
amenity = parseAmenity(poiObject);
|
||||
nameStr = amenity.getName(MapUtils.LANGUAGE);
|
||||
typeStr = getTypeStr();
|
||||
}
|
||||
|
||||
private Amenity parseAmenity(PoiSearchObject searchItem) {
|
||||
private Amenity parseAmenity(PoiSearchObject poiObject) {
|
||||
|
||||
String categoryName = "";
|
||||
String subcategoryName = "";
|
||||
Map<String, String> values = new HashMap<>();
|
||||
|
||||
net.osmand.core.jni.Amenity coreAmenity = searchItem.getAmenity();
|
||||
net.osmand.core.jni.Amenity coreAmenity = poiObject.getBaseObject();
|
||||
DecodedCategoryList catList = coreAmenity.getDecodedCategories();
|
||||
if (catList.size() > 0) {
|
||||
DecodedCategory decodedCategory = catList.get(0);
|
||||
|
@ -63,7 +63,7 @@ public class PoiSearchListItem extends SearchListPositionItem {
|
|||
PoiCategory category = poiTypes.getPoiCategoryByName(categoryName);
|
||||
a.setType(category);
|
||||
a.setSubType(subcategoryName);
|
||||
a.setName(searchItem.getNativeName());
|
||||
a.setName(poiObject.getNativeName());
|
||||
|
||||
QStringStringHash localizedNamesMap = coreAmenity.getLocalizedNames();
|
||||
QStringList locNamesKeys = localizedNamesMap.keys();
|
||||
|
|
|
@ -10,10 +10,10 @@ public class PostcodeSearchListItem extends SearchListPositionItem {
|
|||
private String nameStr;
|
||||
private String typeStr;
|
||||
|
||||
public PostcodeSearchListItem(SampleApplication app, PostcodeSearchObject searchObject) {
|
||||
super(app, searchObject);
|
||||
public PostcodeSearchListItem(SampleApplication app, PostcodeSearchObject postcodeObject) {
|
||||
super(app, postcodeObject);
|
||||
|
||||
nameStr = searchObject.getNativeName();
|
||||
nameStr = postcodeObject.getNativeName();
|
||||
typeStr = "Postcode";
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ public class SearchListPositionItem extends SearchListItem {
|
|||
private double latitude;
|
||||
private double longitude;
|
||||
|
||||
public SearchListPositionItem(SampleApplication app, SearchPositionObject searchObject) {
|
||||
super(app, searchObject);
|
||||
PointI position31 = searchObject.getPosition31();
|
||||
public SearchListPositionItem(SampleApplication app, SearchPositionObject positionObject) {
|
||||
super(app, positionObject);
|
||||
PointI position31 = positionObject.getPosition31();
|
||||
LatLon latLon = Utilities.convert31ToLatLon(position31);
|
||||
latitude = latLon.getLatitude();
|
||||
longitude = latLon.getLongitude();
|
||||
|
|
|
@ -11,12 +11,12 @@ public class StreetIntersectionSearchListItem extends SearchListPositionItem {
|
|||
private String nameStr;
|
||||
private String typeStr;
|
||||
|
||||
public StreetIntersectionSearchListItem(SampleApplication app, StreetIntersectionSearchObject searchObject) {
|
||||
super(app, searchObject);
|
||||
public StreetIntersectionSearchListItem(SampleApplication app, StreetIntersectionSearchObject intersectionObject) {
|
||||
super(app, intersectionObject);
|
||||
|
||||
nameStr = searchObject.getName(MapUtils.LANGUAGE);
|
||||
nameStr = intersectionObject.getName(MapUtils.LANGUAGE);
|
||||
|
||||
StreetIntersection streetIntersection = searchObject.getStreetIntersection();
|
||||
StreetIntersection streetIntersection = intersectionObject.getBaseObject();
|
||||
|
||||
Street street = streetIntersection.getStreet();
|
||||
if (street != null) {
|
||||
|
|
|
@ -10,12 +10,12 @@ public class StreetSearchListItem extends SearchListPositionItem {
|
|||
private String nameStr;
|
||||
private String typeStr;
|
||||
|
||||
public StreetSearchListItem(SampleApplication app, StreetSearchObject searchObject) {
|
||||
super(app, searchObject);
|
||||
public StreetSearchListItem(SampleApplication app, StreetSearchObject streetObject) {
|
||||
super(app, streetObject);
|
||||
|
||||
nameStr = searchObject.getName(MapUtils.LANGUAGE);
|
||||
nameStr = streetObject.getName(MapUtils.LANGUAGE);
|
||||
|
||||
StreetGroup streetGroup = searchObject.getStreet().getStreetGroup();
|
||||
StreetGroup streetGroup = streetObject.getBaseObject().getStreetGroup();
|
||||
if (streetGroup != null) {
|
||||
typeStr = streetGroup.getNativeName() + " — " + getTypeStr(streetGroup);
|
||||
} else {
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand.core.samples.android.sample1.adapters;
|
|||
|
||||
import net.osmand.core.samples.android.sample1.MapUtils;
|
||||
import net.osmand.core.samples.android.sample1.SampleApplication;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.CitySearchObject;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.VillageSearchObject;
|
||||
|
||||
public class VillageSearchListItem extends SearchListPositionItem{
|
||||
|
@ -10,10 +9,10 @@ public class VillageSearchListItem extends SearchListPositionItem{
|
|||
private String nameStr;
|
||||
private String typeStr;
|
||||
|
||||
public VillageSearchListItem(SampleApplication app, VillageSearchObject searchObject) {
|
||||
super(app, searchObject);
|
||||
public VillageSearchListItem(SampleApplication app, VillageSearchObject villageObject) {
|
||||
super(app, villageObject);
|
||||
|
||||
nameStr = searchObject.getName(MapUtils.LANGUAGE);
|
||||
nameStr = villageObject.getName(MapUtils.LANGUAGE);
|
||||
typeStr = "Village";
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.osmand.core.samples.android.sample1.search.objects.SearchObject.Searc
|
|||
import net.osmand.core.samples.android.sample1.search.requests.CoreSearchRequest;
|
||||
import net.osmand.core.samples.android.sample1.search.requests.IntermediateSearchRequest;
|
||||
import net.osmand.core.samples.android.sample1.search.requests.SearchRequest;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectSearchToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.SearchToken;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -115,11 +115,11 @@ public class SearchAPI {
|
|||
this.searchObjects = searchObjects;
|
||||
}
|
||||
|
||||
public Map<SearchObjectType, SearchToken> getObjectTokens() {
|
||||
public Map<SearchObjectType, ObjectToken> getObjectTokens() {
|
||||
return searchString.getCompleteObjectTokens();
|
||||
}
|
||||
|
||||
public ObjectSearchToken getLastObjectToken() {
|
||||
public ObjectToken getLastObjectToken() {
|
||||
return searchString.getLastObjectToken();
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class SearchAPI {
|
|||
SearchApiCallback intermediateSearchCallback,
|
||||
SearchApiCallback coreSearchCallback) {
|
||||
|
||||
searchString.setQueryText(query);
|
||||
searchString.setPlainText(query);
|
||||
startSearchInternal(maxSearchResults, intermediateSearchCallback, coreSearchCallback);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class SearchAPI {
|
|||
|
||||
searchString.completeQuery(searchObject);
|
||||
startSearchInternal(maxSearchResults, intermediateSearchCallback, coreSearchCallback);
|
||||
return searchString.getQueryText();
|
||||
return searchString.getPlainText();
|
||||
}
|
||||
|
||||
private void startSearchInternal(int maxSearchResults,
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.osmand.core.samples.android.sample1.search.objects.SearchObject.Searc
|
|||
import net.osmand.core.samples.android.sample1.search.objects.SearchPositionObject;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.StreetGroupSearchObject;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.StreetSearchObject;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectSearchToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.SearchToken;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -33,7 +33,7 @@ public class SearchScope {
|
|||
private ObfsCollection obfsCollection;
|
||||
private SearchString searchString;
|
||||
private String lang;
|
||||
private Map<SearchObjectType, SearchToken> objectTokens;
|
||||
private Map<SearchObjectType, ObjectToken> objectTokens;
|
||||
private PointI searchLocation31;
|
||||
private AreaI searchableArea;
|
||||
private AreaI obfAreaFilter;
|
||||
|
@ -110,7 +110,7 @@ public class SearchScope {
|
|||
if (objectTokens.containsKey(SearchObjectType.STREET)) {
|
||||
StreetSearchObject streetSearchObject =
|
||||
(StreetSearchObject) objectTokens.get(SearchObjectType.STREET).getSearchObject();
|
||||
criteria.setAddressFilter(streetSearchObject.getStreet());
|
||||
criteria.setAddressFilter(streetSearchObject.getBaseObject());
|
||||
if (objectTokens.containsKey(SearchObjectType.POSTCODE)) {
|
||||
PostcodeSearchObject postcodeSearchObject =
|
||||
(PostcodeSearchObject) objectTokens.get(SearchObjectType.POSTCODE).getSearchObject();
|
||||
|
@ -118,13 +118,13 @@ public class SearchScope {
|
|||
}
|
||||
} else if (objectTokens.containsKey(SearchObjectType.CITY)) {
|
||||
criteria.setAddressFilter(((StreetGroupSearchObject) objectTokens.get(SearchObjectType.CITY)
|
||||
.getSearchObject()).getStreetGroup());
|
||||
.getSearchObject()).getBaseObject());
|
||||
} else if (objectTokens.containsKey(SearchObjectType.VILLAGE)) {
|
||||
criteria.setAddressFilter(((StreetGroupSearchObject) objectTokens.get(SearchObjectType.VILLAGE)
|
||||
.getSearchObject()).getStreetGroup());
|
||||
.getSearchObject()).getBaseObject());
|
||||
} else if (objectTokens.containsKey(SearchObjectType.POSTCODE)) {
|
||||
criteria.setAddressFilter(((StreetGroupSearchObject) objectTokens.get(SearchObjectType.POSTCODE)
|
||||
.getSearchObject()).getStreetGroup());
|
||||
.getSearchObject()).getBaseObject());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ public class SearchScope {
|
|||
if (token.getType() == SearchToken.TokenType.NAME_FILTER
|
||||
&& !token.hasEmptyQuery()) {
|
||||
boolean suggeston = token == searchString.getLastToken();
|
||||
newToken = new ObjectSearchToken(token, searchObjects.get(0), suggeston);
|
||||
newToken = new ObjectToken(token, searchObjects.get(0), suggeston);
|
||||
searchString.replaceToken(token, newToken);
|
||||
}
|
||||
}
|
||||
|
@ -220,22 +220,22 @@ public class SearchScope {
|
|||
|
||||
case STREET:
|
||||
StreetSearchObject streetSearchObject = (StreetSearchObject) searchObject;
|
||||
Street street = streetSearchObject.getStreet();
|
||||
Street street = streetSearchObject.getBaseObject();
|
||||
if (!citySelected) {
|
||||
priority = getPriorityByDistance(9.0, streetSearchObject.getDistance());
|
||||
} else {
|
||||
boolean streetFromSelectedCity = false;
|
||||
for (SearchToken st : objectTokens.values()) {
|
||||
for (ObjectToken st : objectTokens.values()) {
|
||||
if (st.getSearchObject() instanceof StreetGroupSearchObject) {
|
||||
StreetGroup streetGroup =
|
||||
((StreetGroupSearchObject) st.getSearchObject()).getStreetGroup();
|
||||
((StreetGroupSearchObject) st.getSearchObject()).getBaseObject();
|
||||
if (streetGroup.getId().getId().equals(street.getStreetGroup().getId().getId())) {
|
||||
streetFromSelectedCity = true;
|
||||
break;
|
||||
}
|
||||
} else if (st.getSearchObject() instanceof StreetSearchObject) {
|
||||
StreetGroup streetGroup =
|
||||
((StreetSearchObject) st.getSearchObject()).getStreet().getStreetGroup();
|
||||
((StreetSearchObject) st.getSearchObject()).getBaseObject().getStreetGroup();
|
||||
if (streetGroup.getId().getId().equals(street.getStreetGroup().getId().getId())) {
|
||||
streetFromSelectedCity = true;
|
||||
break;
|
||||
|
@ -256,10 +256,10 @@ public class SearchScope {
|
|||
}
|
||||
|
||||
private double getCityType(StreetGroupSearchObject searchObject) {
|
||||
if (searchObject.getStreetGroup().getType() == ObfAddressStreetGroupType.CityOrTown) {
|
||||
if (searchObject.getStreetGroup().getSubtype() == ObfAddressStreetGroupSubtype.City) {
|
||||
if (searchObject.getBaseObject().getType() == ObfAddressStreetGroupType.CityOrTown) {
|
||||
if (searchObject.getBaseObject().getSubtype() == ObfAddressStreetGroupSubtype.City) {
|
||||
return 1.0;
|
||||
} else if (searchObject.getStreetGroup().getSubtype() == ObfAddressStreetGroupSubtype.Town) {
|
||||
} else if (searchObject.getBaseObject().getSubtype() == ObfAddressStreetGroupSubtype.Town) {
|
||||
return 1.5;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import android.support.annotation.NonNull;
|
|||
import net.osmand.core.samples.android.sample1.MapUtils;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.SearchObject;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.SearchObject.SearchObjectType;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.NameFilterSearchToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectSearchToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.NameFilterToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.SearchToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.SearchToken.TokenType;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -18,7 +18,7 @@ import java.util.Map;
|
|||
|
||||
public class SearchString {
|
||||
|
||||
private String queryText = "";
|
||||
private String plainText = "";
|
||||
private List<SearchToken> tokens = new ArrayList<>();
|
||||
private String lang;
|
||||
|
||||
|
@ -28,21 +28,21 @@ public class SearchString {
|
|||
|
||||
public SearchString copy() {
|
||||
SearchString res = new SearchString(lang);
|
||||
res.queryText = queryText;
|
||||
res.plainText = plainText;
|
||||
res.tokens = new ArrayList<>(tokens);
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getQueryText() {
|
||||
return queryText;
|
||||
public String getPlainText() {
|
||||
return plainText;
|
||||
}
|
||||
|
||||
public void setQueryText(String queryText) {
|
||||
int newTextLength = queryText.length();
|
||||
int currTextLength = this.queryText.length();
|
||||
public void setPlainText(String plainText) {
|
||||
int newTextLength = plainText.length();
|
||||
int currTextLength = this.plainText.length();
|
||||
boolean isNewText = currTextLength == 0
|
||||
|| newTextLength == 0
|
||||
|| !this.queryText.regionMatches(0, queryText, 0,
|
||||
|| !this.plainText.regionMatches(0, plainText, 0,
|
||||
newTextLength > currTextLength ? currTextLength : newTextLength);
|
||||
|
||||
int lastKnownTokenIndex = -1;
|
||||
|
@ -55,7 +55,7 @@ public class SearchString {
|
|||
int lastTokenIndex = token.getLastIndex();
|
||||
if (lastTokenIndex > newTextLength - 1
|
||||
|| token.hasEmptyQuery()
|
||||
|| (lastTokenIndex < newTextLength - 1 && !startWithDelimiter(queryText.substring(lastTokenIndex + 1)))) {
|
||||
|| (lastTokenIndex < newTextLength - 1 && !startWithDelimiter(plainText.substring(lastTokenIndex + 1)))) {
|
||||
brokenTokenIndex = i;
|
||||
break;
|
||||
}
|
||||
|
@ -76,53 +76,53 @@ public class SearchString {
|
|||
if (newTextLength - 1 > lastKnownTokenIndex) {
|
||||
int firstWordIndex = lastKnownTokenIndex + 1;
|
||||
for (int i = lastKnownTokenIndex + 1; i < newTextLength; i++) {
|
||||
char c = queryText.charAt(i);
|
||||
char c = plainText.charAt(i);
|
||||
if (isDelimiterChar(c)) {
|
||||
if (i == firstWordIndex) {
|
||||
firstWordIndex++;
|
||||
} else {
|
||||
SearchToken token = new NameFilterSearchToken(firstWordIndex, queryText.substring(firstWordIndex, i));
|
||||
SearchToken token = new NameFilterToken(firstWordIndex, plainText.substring(firstWordIndex, i));
|
||||
tokens.add(token);
|
||||
firstWordIndex = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (firstWordIndex <= newTextLength - 1) {
|
||||
SearchToken token = new NameFilterSearchToken(firstWordIndex, queryText.substring(firstWordIndex));
|
||||
SearchToken token = new NameFilterToken(firstWordIndex, plainText.substring(firstWordIndex));
|
||||
tokens.add(token);
|
||||
} else if (endWithDelimeter(queryText)) {
|
||||
} else if (endWithDelimeter(plainText)) {
|
||||
SearchToken lastToken = getLastToken();
|
||||
if (lastToken.getType() == TokenType.SEARCH_OBJECT) {
|
||||
((ObjectSearchToken) lastToken).applySuggestion();
|
||||
if (lastToken.getType() == TokenType.OBJECT) {
|
||||
((ObjectToken) lastToken).applySuggestion();
|
||||
}
|
||||
SearchToken token = new NameFilterSearchToken(firstWordIndex, "");
|
||||
SearchToken token = new NameFilterToken(firstWordIndex, "");
|
||||
tokens.add(token);
|
||||
}
|
||||
}
|
||||
|
||||
this.queryText = queryText;
|
||||
this.plainText = plainText;
|
||||
}
|
||||
|
||||
public void completeQuery(@NonNull SearchObject searchObject) {
|
||||
String newQueryText;
|
||||
String text;
|
||||
String objectName = searchObject.getName(lang);
|
||||
int startIndex;
|
||||
SearchToken lastToken = getLastToken();
|
||||
if (lastToken == null || lastToken.hasEmptyQuery()) {
|
||||
startIndex = queryText.length();
|
||||
newQueryText = queryText + objectName + " ";
|
||||
startIndex = plainText.length();
|
||||
text = plainText + objectName + " ";
|
||||
} else {
|
||||
startIndex = lastToken.getStartIndex();
|
||||
newQueryText = queryText.substring(0, startIndex) + objectName + " ";
|
||||
text = plainText.substring(0, startIndex) + objectName + " ";
|
||||
}
|
||||
ObjectSearchToken token = new ObjectSearchToken(startIndex, objectName, searchObject, false);
|
||||
ObjectToken token = new ObjectToken(startIndex, objectName, searchObject, false);
|
||||
if (lastToken == null) {
|
||||
tokens.add(token);
|
||||
} else {
|
||||
tokens.set(tokens.size() - 1, token);
|
||||
}
|
||||
tokens.add(new NameFilterSearchToken(newQueryText.length(), ""));
|
||||
queryText = newQueryText;
|
||||
tokens.add(new NameFilterToken(text.length(), ""));
|
||||
plainText = text;
|
||||
}
|
||||
|
||||
private boolean endWithDelimeter(String text) {
|
||||
|
@ -138,13 +138,13 @@ public class SearchString {
|
|||
return c == ',' || c == ' ';
|
||||
}
|
||||
|
||||
public NameFilterSearchToken getNextNameFilterToken() {
|
||||
NameFilterSearchToken res = null;
|
||||
public NameFilterToken getNextNameFilterToken() {
|
||||
NameFilterToken res = null;
|
||||
if (!tokens.isEmpty()) {
|
||||
for (int i = tokens.size() - 1; i >= 0; i--) {
|
||||
SearchToken token = tokens.get(i);
|
||||
if (token.getType() == TokenType.NAME_FILTER) {
|
||||
res = (NameFilterSearchToken) token;
|
||||
res = (NameFilterToken) token;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -160,13 +160,13 @@ public class SearchString {
|
|||
return null;
|
||||
}
|
||||
|
||||
public ObjectSearchToken getLastObjectToken() {
|
||||
ObjectSearchToken res = null;
|
||||
public ObjectToken getLastObjectToken() {
|
||||
ObjectToken res = null;
|
||||
if (!tokens.isEmpty()) {
|
||||
for (int i = tokens.size() - 1; i >= 0; i--) {
|
||||
SearchToken token = tokens.get(i);
|
||||
if (token.getType() == TokenType.SEARCH_OBJECT) {
|
||||
res = (ObjectSearchToken) token;
|
||||
if (token.getType() == TokenType.OBJECT) {
|
||||
res = (ObjectToken) token;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -183,11 +183,11 @@ public class SearchString {
|
|||
return false;
|
||||
}
|
||||
|
||||
public Map<SearchObjectType, SearchToken> getCompleteObjectTokens() {
|
||||
Map<SearchObjectType, SearchToken> map = new LinkedHashMap<>();
|
||||
public Map<SearchObjectType, ObjectToken> getCompleteObjectTokens() {
|
||||
Map<SearchObjectType, ObjectToken> map = new LinkedHashMap<>();
|
||||
for (SearchToken token : tokens) {
|
||||
if (token.getType() == TokenType.SEARCH_OBJECT && !((ObjectSearchToken)token).isSuggestion()) {
|
||||
map.put(token.getSearchObject().getType(), token);
|
||||
if (token.getType() == TokenType.OBJECT && !((ObjectToken)token).isSuggestion()) {
|
||||
map.put(((ObjectToken)token).getSearchObject().getType(), (ObjectToken)token);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
@ -196,8 +196,8 @@ public class SearchString {
|
|||
public List<SearchObject> getCompleteObjects() {
|
||||
List<SearchObject> list = new ArrayList<>();
|
||||
for (SearchToken token : tokens) {
|
||||
if (token.getType() == TokenType.SEARCH_OBJECT && !((ObjectSearchToken)token).isSuggestion()) {
|
||||
list.add(token.getSearchObject());
|
||||
if (token.getType() == TokenType.OBJECT && !((ObjectToken)token).isSuggestion()) {
|
||||
list.add(((ObjectToken)token).getSearchObject());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
@ -206,13 +206,13 @@ public class SearchString {
|
|||
public static void main(String[] args){
|
||||
//test
|
||||
SearchString searchString = new SearchString(MapUtils.LANGUAGE);
|
||||
searchString.setQueryText("cit");
|
||||
searchString.setQueryText("city");
|
||||
searchString.setQueryText("city ");
|
||||
searchString.setQueryText("city s");
|
||||
searchString.setQueryText("city st");
|
||||
searchString.setQueryText("city street ");
|
||||
searchString.setQueryText("city street 8");
|
||||
searchString.setQueryText("new");
|
||||
searchString.setPlainText("cit");
|
||||
searchString.setPlainText("city");
|
||||
searchString.setPlainText("city ");
|
||||
searchString.setPlainText("city s");
|
||||
searchString.setPlainText("city st");
|
||||
searchString.setPlainText("city street ");
|
||||
searchString.setPlainText("city street 8");
|
||||
searchString.setPlainText("new");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,28 +4,24 @@ import net.osmand.core.jni.Building;
|
|||
import net.osmand.core.jni.PointI;
|
||||
import net.osmand.core.jni.QStringStringHash;
|
||||
|
||||
public class BuildingSearchObject extends SearchPositionObject {
|
||||
public class BuildingSearchObject extends SearchPositionObject<Building> {
|
||||
|
||||
public BuildingSearchObject(Building building) {
|
||||
super(SearchObjectType.BUILDING, building);
|
||||
}
|
||||
|
||||
public Building getBuilding() {
|
||||
return (Building) getInternalObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointI getPosition31() {
|
||||
return getBuilding().getPosition31();
|
||||
return getBaseObject().getPosition31();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNativeName() {
|
||||
return getBuilding().getNativeName();
|
||||
return getBaseObject().getNativeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QStringStringHash getLocalizedNames() {
|
||||
return getBuilding().getLocalizedNames();
|
||||
return getBaseObject().getLocalizedNames();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package net.osmand.core.samples.android.sample1.search.objects;
|
|||
import net.osmand.core.jni.PointI;
|
||||
import net.osmand.core.jni.QStringStringHash;
|
||||
|
||||
public class CoordinatesSearchObject extends SearchPositionObject {
|
||||
public class CoordinatesSearchObject extends SearchPositionObject<PointI> {
|
||||
|
||||
public CoordinatesSearchObject(PointI position31) {
|
||||
super(SearchObjectType.COORDINATES, position31);
|
||||
|
@ -11,7 +11,7 @@ public class CoordinatesSearchObject extends SearchPositionObject {
|
|||
|
||||
@Override
|
||||
public PointI getPosition31() {
|
||||
return (PointI) getInternalObject();
|
||||
return getBaseObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,28 +4,24 @@ import net.osmand.core.jni.Amenity;
|
|||
import net.osmand.core.jni.PointI;
|
||||
import net.osmand.core.jni.QStringStringHash;
|
||||
|
||||
public class PoiSearchObject extends SearchPositionObject {
|
||||
public class PoiSearchObject extends SearchPositionObject<Amenity> {
|
||||
|
||||
public PoiSearchObject(Amenity amenity) {
|
||||
super(SearchObjectType.POI, amenity);
|
||||
}
|
||||
|
||||
public Amenity getAmenity() {
|
||||
return (Amenity) getInternalObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointI getPosition31() {
|
||||
return getAmenity().getPosition31();
|
||||
return getBaseObject().getPosition31();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNativeName() {
|
||||
return getAmenity().getNativeName();
|
||||
return getBaseObject().getNativeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QStringStringHash getLocalizedNames() {
|
||||
return getAmenity().getLocalizedNames();
|
||||
return getBaseObject().getLocalizedNames();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,26 @@
|
|||
package net.osmand.core.samples.android.sample1.search.objects;
|
||||
|
||||
/**
|
||||
* Created by Alexey Kulish on 30/06/16.
|
||||
*/
|
||||
public class PoiTypeObject {
|
||||
|
||||
private String name;
|
||||
private String keyName;
|
||||
private String categoryKeyName;
|
||||
|
||||
public PoiTypeObject(String name, String keyName, String categoryKeyName) {
|
||||
this.name = name;
|
||||
this.keyName = keyName;
|
||||
this.categoryKeyName = categoryKeyName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getKeyName() {
|
||||
return keyName;
|
||||
}
|
||||
|
||||
public String getCategoryKeyName() {
|
||||
return categoryKeyName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,9 @@ package net.osmand.core.samples.android.sample1.search.objects;
|
|||
|
||||
import net.osmand.core.jni.QStringStringHash;
|
||||
|
||||
public class PoiTypeSearchObject extends SearchObject {
|
||||
public class PoiTypeSearchObject extends SearchObject<PoiTypeObject> {
|
||||
|
||||
private ObjectType objectType;
|
||||
private String name;
|
||||
private String keyName;
|
||||
private String categoryKeyName;
|
||||
|
||||
public enum ObjectType {
|
||||
CATEGORY,
|
||||
|
@ -15,12 +12,9 @@ public class PoiTypeSearchObject extends SearchObject {
|
|||
TYPE
|
||||
}
|
||||
|
||||
public PoiTypeSearchObject(ObjectType objectType, String name, String keyName, String categoryKeyName) {
|
||||
super(SearchObjectType.POI_TYPE, null);
|
||||
public PoiTypeSearchObject(ObjectType objectType, PoiTypeObject poiTypeObject) {
|
||||
super(SearchObjectType.POI_TYPE, poiTypeObject);
|
||||
this.objectType = objectType;
|
||||
this.name = name;
|
||||
this.keyName = keyName;
|
||||
this.categoryKeyName = categoryKeyName;
|
||||
}
|
||||
|
||||
public ObjectType getObjectType() {
|
||||
|
@ -28,16 +22,16 @@ public class PoiTypeSearchObject extends SearchObject {
|
|||
}
|
||||
|
||||
public String getKeyName() {
|
||||
return keyName;
|
||||
return getBaseObject().getKeyName();
|
||||
}
|
||||
|
||||
public String getCategoryKeyName() {
|
||||
return categoryKeyName;
|
||||
return getBaseObject().getCategoryKeyName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNativeName() {
|
||||
return name;
|
||||
return getBaseObject().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package net.osmand.core.samples.android.sample1.search.objects;
|
|||
|
||||
import net.osmand.core.jni.QStringStringHash;
|
||||
|
||||
public abstract class SearchObject {
|
||||
public abstract class SearchObject<T> {
|
||||
|
||||
public enum SearchObjectType {
|
||||
CITY,
|
||||
|
@ -17,21 +17,21 @@ public abstract class SearchObject {
|
|||
}
|
||||
|
||||
private SearchObjectType type;
|
||||
private Object internalObject;
|
||||
private T baseObject;
|
||||
|
||||
private double priority;
|
||||
|
||||
protected SearchObject(SearchObjectType type, Object internalObject) {
|
||||
protected SearchObject(SearchObjectType type, T baseObject) {
|
||||
this.type = type;
|
||||
this.internalObject = internalObject;
|
||||
this.baseObject = baseObject;
|
||||
}
|
||||
|
||||
public SearchObjectType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
protected Object getInternalObject() {
|
||||
return internalObject;
|
||||
public T getBaseObject() {
|
||||
return baseObject;
|
||||
}
|
||||
|
||||
public abstract String getNativeName();
|
||||
|
|
|
@ -2,12 +2,12 @@ package net.osmand.core.samples.android.sample1.search.objects;
|
|||
|
||||
import net.osmand.core.jni.PointI;
|
||||
|
||||
public abstract class SearchPositionObject extends SearchObject {
|
||||
public abstract class SearchPositionObject<T> extends SearchObject<T> {
|
||||
|
||||
private double distance;
|
||||
|
||||
public SearchPositionObject(SearchObjectType type, Object internalObject) {
|
||||
super(type, internalObject);
|
||||
public SearchPositionObject(SearchObjectType type, T object) {
|
||||
super(type, object);
|
||||
}
|
||||
|
||||
public abstract PointI getPosition31();
|
||||
|
|
|
@ -4,28 +4,24 @@ import net.osmand.core.jni.PointI;
|
|||
import net.osmand.core.jni.QStringStringHash;
|
||||
import net.osmand.core.jni.StreetGroup;
|
||||
|
||||
public abstract class StreetGroupSearchObject extends SearchPositionObject {
|
||||
public abstract class StreetGroupSearchObject extends SearchPositionObject<StreetGroup> {
|
||||
|
||||
public StreetGroupSearchObject(SearchObjectType type, StreetGroup streetGroup) {
|
||||
super(type, streetGroup);
|
||||
}
|
||||
|
||||
public StreetGroup getStreetGroup() {
|
||||
return (StreetGroup) getInternalObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointI getPosition31() {
|
||||
return getStreetGroup().getPosition31();
|
||||
return getBaseObject().getPosition31();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNativeName() {
|
||||
return getStreetGroup().getNativeName();
|
||||
return getBaseObject().getNativeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QStringStringHash getLocalizedNames() {
|
||||
return getStreetGroup().getLocalizedNames();
|
||||
return getBaseObject().getLocalizedNames();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,28 +4,24 @@ import net.osmand.core.jni.PointI;
|
|||
import net.osmand.core.jni.QStringStringHash;
|
||||
import net.osmand.core.jni.StreetIntersection;
|
||||
|
||||
public class StreetIntersectionSearchObject extends SearchPositionObject {
|
||||
public class StreetIntersectionSearchObject extends SearchPositionObject<StreetIntersection> {
|
||||
|
||||
public StreetIntersectionSearchObject(StreetIntersection streetIntersection) {
|
||||
super(SearchObjectType.STREET_INTERSECTION, streetIntersection);
|
||||
}
|
||||
|
||||
public StreetIntersection getStreetIntersection() {
|
||||
return (StreetIntersection) getInternalObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointI getPosition31() {
|
||||
return getStreetIntersection().getPosition31();
|
||||
return getBaseObject().getPosition31();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNativeName() {
|
||||
return getStreetIntersection().getNativeName();
|
||||
return getBaseObject().getNativeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QStringStringHash getLocalizedNames() {
|
||||
return getStreetIntersection().getLocalizedNames();
|
||||
return getBaseObject().getLocalizedNames();
|
||||
}
|
||||
}
|
|
@ -4,28 +4,24 @@ import net.osmand.core.jni.PointI;
|
|||
import net.osmand.core.jni.QStringStringHash;
|
||||
import net.osmand.core.jni.Street;
|
||||
|
||||
public class StreetSearchObject extends SearchPositionObject {
|
||||
public class StreetSearchObject extends SearchPositionObject<Street> {
|
||||
|
||||
public StreetSearchObject(Street street) {
|
||||
super(SearchObjectType.STREET, street);
|
||||
}
|
||||
|
||||
public Street getStreet() {
|
||||
return (Street) getInternalObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointI getPosition31() {
|
||||
return getStreet().getPosition31();
|
||||
return getBaseObject().getPosition31();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNativeName() {
|
||||
return getStreet().getNativeName();
|
||||
return getBaseObject().getNativeName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected QStringStringHash getLocalizedNames() {
|
||||
return getStreet().getLocalizedNames();
|
||||
return getBaseObject().getLocalizedNames();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ import net.osmand.core.samples.android.sample1.search.SearchScope;
|
|||
import net.osmand.core.samples.android.sample1.search.SearchString;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.PoiSearchObject;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.SearchObject;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.SearchObjectsHelper;
|
||||
import net.osmand.core.samples.android.sample1.search.SearchObjectsHelper;
|
||||
import net.osmand.core.samples.android.sample1.search.objects.SearchPositionObject;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.NameFilterSearchToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectSearchToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.NameFilterToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.ObjectToken;
|
||||
import net.osmand.core.samples.android.sample1.search.tokens.SearchToken;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -85,11 +85,11 @@ public class CoreSearchRequest extends SearchRequest {
|
|||
|
||||
SearchString searchString = searchScope.getSearchString();
|
||||
SearchToken lastToken = searchString.getLastToken();
|
||||
NameFilterSearchToken token = searchString.getNextNameFilterToken();
|
||||
NameFilterToken token = searchString.getNextNameFilterToken();
|
||||
while (token != null && !cancelled) {
|
||||
if (!token.hasEmptyQuery()) {
|
||||
res = doCoreSearch(token);
|
||||
List<SearchObject> externalObjects = searchCallback.fetchExternalObjects(token.getQueryText(), searchString.getCompleteObjects());
|
||||
List<SearchObject> externalObjects = searchCallback.fetchExternalObjects(token.getPlainText(), searchString.getCompleteObjects());
|
||||
if (externalObjects != null) {
|
||||
res.addAll(externalObjects);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class CoreSearchRequest extends SearchRequest {
|
|||
|
||||
if (lastToken == null || lastToken.hasEmptyQuery()) {
|
||||
// 2.4 Search considered to be complete if there no NF in the end (not finished or not regonized objects)
|
||||
ObjectSearchToken lastObjectToken = searchString.getLastObjectToken();
|
||||
ObjectToken lastObjectToken = searchString.getLastObjectToken();
|
||||
if (lastObjectToken == null) {
|
||||
// Last object = [] - none. We display list of poi categories (recents separate tab)
|
||||
List<SearchObject> externalObjects = searchCallback.fetchExternalObjects("", null);
|
||||
|
@ -124,15 +124,15 @@ public class CoreSearchRequest extends SearchRequest {
|
|||
break;
|
||||
case CITY:
|
||||
// Last object - City. Display (list of streets could be quite long)
|
||||
res = doCoreSearch(new NameFilterSearchToken(0, ""));
|
||||
res = doCoreSearch(new NameFilterToken(0, ""));
|
||||
break;
|
||||
case STREET:
|
||||
// Last object - Street. Display building and intersetcting street
|
||||
res = doCoreSearch(new NameFilterSearchToken(0, ""));
|
||||
res = doCoreSearch(new NameFilterToken(0, ""));
|
||||
break;
|
||||
case POSTCODE:
|
||||
// Last object - Postcode. Display building and streets
|
||||
res = doCoreSearch(new NameFilterSearchToken(0, ""));
|
||||
res = doCoreSearch(new NameFilterToken(0, ""));
|
||||
break;
|
||||
case BUILDING:
|
||||
// Last object - Building - object is found
|
||||
|
@ -151,7 +151,7 @@ public class CoreSearchRequest extends SearchRequest {
|
|||
amenityResultsCounter = 0;
|
||||
addressResultsCounter = 0;
|
||||
|
||||
String keyword = token.getQueryText();
|
||||
String keyword = token.getPlainText();
|
||||
final List<SearchObject> searchObjects = new ArrayList<>();
|
||||
|
||||
AmenitiesByNameSearch amByNameSearch = null;
|
||||
|
|
|
@ -23,7 +23,7 @@ public class IntermediateSearchRequest extends SearchRequest {
|
|||
|
||||
SearchToken token = searchScope.getSearchString().getLastToken();
|
||||
if (token != null && token.getType() == SearchToken.TokenType.NAME_FILTER) {
|
||||
keyword = token.getQueryText().toLowerCase();
|
||||
keyword = token.getPlainText().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@ package net.osmand.core.samples.android.sample1.search.tokens;
|
|||
public class NameFilterToken extends SearchToken {
|
||||
|
||||
public NameFilterToken(int startIndex, String plainText) {
|
||||
super(TokenType.NAME_FILTER, startIndex, plainText, null);
|
||||
super(TokenType.NAME_FILTER, startIndex, plainText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,18 +4,25 @@ import net.osmand.core.samples.android.sample1.search.objects.SearchObject;
|
|||
|
||||
public class ObjectToken extends SearchToken {
|
||||
|
||||
private SearchObject searchObject;
|
||||
private boolean suggestion = true;
|
||||
|
||||
public ObjectToken(SearchToken searchToken, SearchObject searchObject, boolean suggestion) {
|
||||
super(TokenType.SEARCH_OBJECT, searchToken.getStartIndex(), searchToken.getPlainText(), searchObject);
|
||||
super(TokenType.OBJECT, searchToken.getStartIndex(), searchToken.getPlainText());
|
||||
this.searchObject = searchObject;
|
||||
this.suggestion = suggestion;
|
||||
}
|
||||
|
||||
public ObjectToken(int startIndex, String plainText, SearchObject searchObject, boolean suggestion) {
|
||||
super(TokenType.SEARCH_OBJECT, startIndex, plainText, searchObject);
|
||||
super(TokenType.OBJECT, startIndex, plainText);
|
||||
this.searchObject = searchObject;
|
||||
this.suggestion = suggestion;
|
||||
}
|
||||
|
||||
public SearchObject getSearchObject() {
|
||||
return searchObject;
|
||||
}
|
||||
|
||||
public boolean isSuggestion() {
|
||||
return suggestion;
|
||||
}
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
package net.osmand.core.samples.android.sample1.search.tokens;
|
||||
|
||||
import net.osmand.core.samples.android.sample1.search.objects.SearchObject;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
public abstract class SearchToken {
|
||||
|
||||
public enum TokenType {
|
||||
SEARCH_OBJECT,
|
||||
OBJECT,
|
||||
NAME_FILTER
|
||||
}
|
||||
|
||||
private TokenType type;
|
||||
private SearchObject searchObject;
|
||||
private int startIndex;
|
||||
protected String queryText;
|
||||
protected String plainText;
|
||||
|
||||
public SearchToken(TokenType type, int startIndex, String queryText, SearchObject searchObject) {
|
||||
public SearchToken(TokenType type, int startIndex, String plainText) {
|
||||
this.type = type;
|
||||
this.startIndex = startIndex;
|
||||
this.queryText = queryText;
|
||||
this.searchObject = searchObject;
|
||||
this.plainText = plainText;
|
||||
}
|
||||
|
||||
public TokenType getType() {
|
||||
|
@ -30,19 +27,15 @@ public abstract class SearchToken {
|
|||
return startIndex;
|
||||
}
|
||||
|
||||
public String getQueryText() {
|
||||
return queryText;
|
||||
public String getPlainText() {
|
||||
return plainText;
|
||||
}
|
||||
|
||||
public int getLastIndex() {
|
||||
return startIndex + queryText.length() - 1;
|
||||
}
|
||||
|
||||
public SearchObject getSearchObject() {
|
||||
return searchObject;
|
||||
return startIndex + plainText.length() - 1;
|
||||
}
|
||||
|
||||
public boolean hasEmptyQuery() {
|
||||
return Algorithms.isEmpty(queryText);
|
||||
return Algorithms.isEmpty(plainText);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue