summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-25 13:45:26 (EDT)
committerEike Stepper2007-08-25 13:45:26 (EDT)
commit2976c8ef0612b4f265946f4900210ea3a5b353a3 (patch)
tree623a468a9fbf1daaa5b1ade89a7b870962d565fa
parent7cf8d2fd1dd46333d6efe77568be169ddc0b1afc (diff)
downloadcdo-2976c8ef0612b4f265946f4900210ea3a5b353a3.zip
cdo-2976c8ef0612b4f265946f4900210ea3a5b353a3.tar.gz
cdo-2976c8ef0612b4f265946f4900210ea3a5b353a3.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TypeManager.java9
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java26
2 files changed, 29 insertions, 6 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TypeManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TypeManager.java
index a104d53..a0edd45 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TypeManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TypeManager.java
@@ -148,7 +148,14 @@ public class TypeManager extends QueueWorker<ObjectEntry> implements ITypeManage
}
TypeEntry entry = new TypeEntry(classifierID, packageID);
- objectTypeMap.put(id, entry);
+ if (id.isMeta())
+ {
+ metaObjectTypeMap.put(id, entry);
+ }
+ else
+ {
+ objectTypeMap.put(id, entry);
+ }
}
@Override
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java
index c0fee41..30f532a 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java
@@ -82,6 +82,11 @@ public abstract class SortedFileMap<K extends Comparable, V> implements Closeabl
return index * entrySize;
}
+ public long getValuePosition(long index)
+ {
+ return getPosition(index) + getKeySize();
+ }
+
public K getMaxKey()
{
if (entryCount == 0)
@@ -110,7 +115,7 @@ public abstract class SortedFileMap<K extends Comparable, V> implements Closeabl
{
try
{
- long pos = getPosition(index) + getKeySize();
+ long pos = getValuePosition(index);
randomAccessFile.seek(pos);
return readValue(input);
}
@@ -145,7 +150,8 @@ public abstract class SortedFileMap<K extends Comparable, V> implements Closeabl
long index = search(key);
if (index >= 0)
{
- long pos = randomAccessFile.getFilePointer();
+ long pos = getValuePosition(index);
+ randomAccessFile.seek(pos);
V oldValue = readValue(input);
randomAccessFile.seek(pos);
writeValue(output, value);
@@ -155,18 +161,21 @@ public abstract class SortedFileMap<K extends Comparable, V> implements Closeabl
index = -index - 1;
for (long i = entryCount; i > index; --i)
{
- randomAccessFile.seek((i - 1) * entrySize);
+ randomAccessFile.seek(getPosition(i - 1));
K k = readKey(input);
+ randomAccessFile.seek(getValuePosition(i - 1));
V v = readValue(input);
- randomAccessFile.seek(i * entrySize);
+ randomAccessFile.seek(getPosition(i));
writeKey(output, k);
+ randomAccessFile.seek(getValuePosition(i));
writeValue(output, v);
}
++entryCount;
randomAccessFile.seek(getPosition(index));
writeKey(output, key);
+ randomAccessFile.seek(getValuePosition(index));
writeValue(output, value);
return null;
}
@@ -188,17 +197,24 @@ public abstract class SortedFileMap<K extends Comparable, V> implements Closeabl
while (low <= high)
{
long mid = low + high >> 1;
- randomAccessFile.seek(mid * entrySize);
+ randomAccessFile.seek(getPosition(mid));
Comparable midVal = readKey(input);
int cmp = midVal.compareTo(key);
if (cmp < 0)
+ {
low = mid + 1;
+ }
else if (cmp > 0)
+ {
high = mid - 1;
+ }
else
+ {
return mid; // key found
+ }
}
+
return -(low + 1); // key not found.
}