From f855eec6f9538810584b47df29bab9bcfc25ac6c Mon Sep 17 00:00:00 2001 From: denys Date: Thu, 4 Aug 2016 12:15:31 +0300 Subject: [PATCH] CollatorStringMatcher.java fix --- .../src/net/osmand/CollatorStringMatcher.java | 37 ++++++++---- eclipse-compile/appcompat/.classpath | 4 +- eclipse-compile/cardview/.classpath | 3 +- eclipse-compile/design/.classpath | 3 +- eclipse-compile/gridlayout/.classpath | 5 +- .../gridlayout/bin/AndroidManifest.xml | 20 +++++++ eclipse-compile/gridlayout/bin/R.txt | 56 ++++++++++++++++++ .../bin/android-support-v7-gridlayout.jar | Bin 0 -> 166 bytes .../gridlayout/bin/classes/.readme | 2 + eclipse-compile/gridlayout/bin/jarlist.cache | 3 + eclipse-compile/gridlayout/project.properties | 2 +- 11 files changed, 117 insertions(+), 18 deletions(-) create mode 100644 eclipse-compile/gridlayout/bin/AndroidManifest.xml create mode 100644 eclipse-compile/gridlayout/bin/R.txt create mode 100644 eclipse-compile/gridlayout/bin/android-support-v7-gridlayout.jar create mode 100644 eclipse-compile/gridlayout/bin/classes/.readme create mode 100644 eclipse-compile/gridlayout/bin/jarlist.cache diff --git a/OsmAnd-java/src/net/osmand/CollatorStringMatcher.java b/OsmAnd-java/src/net/osmand/CollatorStringMatcher.java index 96e4f92d44..eac6e598c9 100644 --- a/OsmAnd-java/src/net/osmand/CollatorStringMatcher.java +++ b/OsmAnd-java/src/net/osmand/CollatorStringMatcher.java @@ -66,19 +66,34 @@ public class CollatorStringMatcher implements StringMatcher { * @return true if part is contained in base */ public static boolean ccontains(Collator collator, String base, String part) { - int pos = 0; - if (part.length() > 3) { - // improve searching by searching first 3 characters - pos = cindexOf(collator, pos, part.substring(0, 3), base); - if (pos == -1) { - return false; +// int pos = 0; +// if (part.length() > 3) { +// // improve searching by searching first 3 characters +// pos = cindexOf(collator, pos, part.substring(0, 3), base); +// if (pos == -1) { +// return false; +// } +// } +// pos = cindexOf(collator, pos, part, base); +// if (pos == -1) { +// return false; +// } +// return true; + + if (base.length() <= part.length()) + return collator.equals(base, part); + + for (int pos = 0; pos <= base.length() - part.length() + 1; pos++) { + String temp = base.substring(pos, base.length()); + + for (int length = temp.length(); length >= 0; length--) { + String temp2 = temp.substring(0, length); + if (collator.equals(temp2, part)) + return true; } } - pos = cindexOf(collator, pos, part, base); - if (pos == -1) { - return false; - } - return true; + + return false; } private static int cindexOf(Collator collator, int start, String part, String base) { diff --git a/eclipse-compile/appcompat/.classpath b/eclipse-compile/appcompat/.classpath index 7bc01d9a9c..51769745b2 100644 --- a/eclipse-compile/appcompat/.classpath +++ b/eclipse-compile/appcompat/.classpath @@ -1,9 +1,9 @@ - - + + diff --git a/eclipse-compile/cardview/.classpath b/eclipse-compile/cardview/.classpath index 92ab9b2c93..51769745b2 100644 --- a/eclipse-compile/cardview/.classpath +++ b/eclipse-compile/cardview/.classpath @@ -1,8 +1,9 @@ - + + diff --git a/eclipse-compile/design/.classpath b/eclipse-compile/design/.classpath index 92ab9b2c93..51769745b2 100644 --- a/eclipse-compile/design/.classpath +++ b/eclipse-compile/design/.classpath @@ -1,8 +1,9 @@ - + + diff --git a/eclipse-compile/gridlayout/.classpath b/eclipse-compile/gridlayout/.classpath index a4763d1eec..d57ec02513 100644 --- a/eclipse-compile/gridlayout/.classpath +++ b/eclipse-compile/gridlayout/.classpath @@ -1,8 +1,9 @@ + + - - + diff --git a/eclipse-compile/gridlayout/bin/AndroidManifest.xml b/eclipse-compile/gridlayout/bin/AndroidManifest.xml new file mode 100644 index 0000000000..97f7be8d2c --- /dev/null +++ b/eclipse-compile/gridlayout/bin/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/eclipse-compile/gridlayout/bin/R.txt b/eclipse-compile/gridlayout/bin/R.txt new file mode 100644 index 0000000000..d9b927a43d --- /dev/null +++ b/eclipse-compile/gridlayout/bin/R.txt @@ -0,0 +1,56 @@ +int attr alignmentMode 0x7f010004 +int attr columnCount 0x7f010002 +int attr columnOrderPreserved 0x7f010006 +int attr layout_column 0x7f01000a +int attr layout_columnSpan 0x7f01000b +int attr layout_columnWeight 0x7f01000c +int attr layout_gravity 0x7f01000d +int attr layout_row 0x7f010007 +int attr layout_rowSpan 0x7f010008 +int attr layout_rowWeight 0x7f010009 +int attr orientation 0x7f010000 +int attr rowCount 0x7f010001 +int attr rowOrderPreserved 0x7f010005 +int attr useDefaultMargins 0x7f010003 +int dimen default_gap 0x7f020000 +int id alignBounds 0x7f030002 +int id alignMargins 0x7f030003 +int id bottom 0x7f030004 +int id center 0x7f030005 +int id center_horizontal 0x7f030006 +int id center_vertical 0x7f030007 +int id clip_horizontal 0x7f030008 +int id clip_vertical 0x7f030009 +int id end 0x7f03000a +int id fill 0x7f03000b +int id fill_horizontal 0x7f03000c +int id fill_vertical 0x7f03000d +int id horizontal 0x7f030000 +int id left 0x7f03000e +int id right 0x7f03000f +int id start 0x7f030010 +int id top 0x7f030011 +int id vertical 0x7f030001 +int[] styleable GridLayout { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 } +int styleable GridLayout_alignmentMode 4 +int styleable GridLayout_columnCount 2 +int styleable GridLayout_columnOrderPreserved 6 +int styleable GridLayout_orientation 0 +int styleable GridLayout_rowCount 1 +int styleable GridLayout_rowOrderPreserved 5 +int styleable GridLayout_useDefaultMargins 3 +int[] styleable GridLayout_Layout { 0x010100f4, 0x010100f5, 0x010100f6, 0x010100f7, 0x010100f8, 0x010100f9, 0x010100fa, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d } +int styleable GridLayout_Layout_android_layout_height 1 +int styleable GridLayout_Layout_android_layout_margin 2 +int styleable GridLayout_Layout_android_layout_marginBottom 6 +int styleable GridLayout_Layout_android_layout_marginLeft 3 +int styleable GridLayout_Layout_android_layout_marginRight 5 +int styleable GridLayout_Layout_android_layout_marginTop 4 +int styleable GridLayout_Layout_android_layout_width 0 +int styleable GridLayout_Layout_layout_column 10 +int styleable GridLayout_Layout_layout_columnSpan 11 +int styleable GridLayout_Layout_layout_columnWeight 12 +int styleable GridLayout_Layout_layout_gravity 13 +int styleable GridLayout_Layout_layout_row 7 +int styleable GridLayout_Layout_layout_rowSpan 8 +int styleable GridLayout_Layout_layout_rowWeight 9 diff --git a/eclipse-compile/gridlayout/bin/android-support-v7-gridlayout.jar b/eclipse-compile/gridlayout/bin/android-support-v7-gridlayout.jar new file mode 100644 index 0000000000000000000000000000000000000000..dfe6e3d417970ebbbb537291b554ca207d4f0f7a GIT binary patch literal 166 zcmWIWW@Zs#;Nak3$gE}ZWIzHU3@i-3t|5-Po_=onzK(vLZmz*0dcJP|PBAb%e#*oU w;LXmlrgf1B3s4Ue5C?cOGKnxC%tDp}nS}~)nH=EF$_7%&2!w7x+6$}=0P33>MF0Q* literal 0 HcmV?d00001 diff --git a/eclipse-compile/gridlayout/bin/classes/.readme b/eclipse-compile/gridlayout/bin/classes/.readme new file mode 100644 index 0000000000..4bcebad80c --- /dev/null +++ b/eclipse-compile/gridlayout/bin/classes/.readme @@ -0,0 +1,2 @@ +This hidden file is there to ensure there is an src folder. +Once we support binary library this will go away. \ No newline at end of file diff --git a/eclipse-compile/gridlayout/bin/jarlist.cache b/eclipse-compile/gridlayout/bin/jarlist.cache new file mode 100644 index 0000000000..0565465f22 --- /dev/null +++ b/eclipse-compile/gridlayout/bin/jarlist.cache @@ -0,0 +1,3 @@ +# cache for current jar dependency. DO NOT EDIT. +# format is +# Encoding is UTF-8 diff --git a/eclipse-compile/gridlayout/project.properties b/eclipse-compile/gridlayout/project.properties index 8109e7b59e..b2ef7dccc5 100644 --- a/eclipse-compile/gridlayout/project.properties +++ b/eclipse-compile/gridlayout/project.properties @@ -12,4 +12,4 @@ # Project target. target=android-23 -android.library=true \ No newline at end of file +android.library=true