On 25/02/15 15:45, GerdP wrote:
I think a better solution reg. memory would be not to store the
byte array for the partial name at all. Since it is a sub string of
the name, I assume it should be sufficient to calc the offset and length
in the byte array and store these values?
Where do you mean? A call to substring() shares the byte array of the
original string, so there is no extra array. Also I don't think it
is stored anywhere as the sort key is a new array.
We just do not need the MultiSortKey when the partialName is the same as
the name so we can eliminate using the partialName
altogether.
As in attached patch (warning: untested).
..Steve
Index: src/uk/me/parabola/imgfmt/app/CommonHeader.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/imgfmt/app/CommonHeader.java (revision 3472)
+++ src/uk/me/parabola/imgfmt/app/CommonHeader.java (revision )
@@ -67,7 +67,7 @@
writer.put((byte) 1); // unknown
writer.put((byte) 0); // not locked
- byte[] date = Utils.makeCreationTime(new Date());
+ byte[] date = Utils.makeCreationTime(new Date(114, 9, 1));
writer.put(date);
writeFileHeader(writer);
@@ -118,6 +118,6 @@
// Prepare for write by setting our defaults.
// lockFlag = 0;
if (creationDate == null)
- creationDate = new Date();
+ creationDate = new Date(114, 9, 1);
}
}
Index: src/uk/me/parabola/imgfmt/app/trergn/TREHeader.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/imgfmt/app/trergn/TREHeader.java (revision 3472)
+++ src/uk/me/parabola/imgfmt/app/trergn/TREHeader.java (revision )
@@ -175,7 +175,7 @@
writer.put(getPoiDisplayFlags());
writer.put3(displayPriority);
- writer.putInt(0x110301);
+ writer.putInt(0x170401);
writer.putChar((char) 1);
writer.put((byte) 0);
Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java (revision 3478)
+++ src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java (revision )
@@ -167,11 +167,18 @@
Sort sort = getConfig().getSort();
List<SortKey<Mdr7Record>> sortedStreets = new ArrayList<>(allStreets.size());
for (Mdr7Record m : allStreets) {
- String partialName = m.getPartialName();
String name = m.getName();
+ String partialName = m.getPartialName();
+
SortKey<Mdr7Record> nameKey = sort.createSortKey(m, m.getName(), m.getMapIndex());
- SortKey<Mdr7Record> partialKey = name.equals(partialName) ? nameKey : sort.createSortKey(m, partialName);
- MultiSortKey<Mdr7Record> sortKey = new MultiSortKey<>(partialKey, nameKey, null);
+
+ SortKey<Mdr7Record> sortKey;
+ if (name.equals(partialName)) {
+ sortKey = nameKey;
+ } else {
+ sortKey = new MultiSortKey<>(sort.createSortKey(m, partialName), nameKey, null);
+ }
+
sortedStreets.add(sortKey);
}
Collections.sort(sortedStreets);
Index: src/uk/me/parabola/imgfmt/sys/ImgHeader.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/imgfmt/sys/ImgHeader.java (revision 3472)
+++ src/uk/me/parabola/imgfmt/sys/ImgHeader.java (revision )
@@ -157,7 +157,7 @@
setDirectoryStartEntry(params.getDirectoryStartEntry());
// Set the times.
- Date date = new Date();
+ Date date = new Date(114, 9, 1);
setCreationTime(date);
setUpdateTime(date);
setDescription(params.getMapDescription());
@@ -280,7 +280,7 @@
* @throws IOException If an error occurs during writing.
*/
public void sync() throws IOException {
- setUpdateTime(new Date());
+ setUpdateTime(new Date(114, 9, 1));
writeSizeValues(fsParams.getBlockSize());
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev