1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Compiler warnings.

This commit is contained in:
Sergey Prigogin 2008-04-27 06:43:57 +00:00
parent a602cd1826
commit d6d86766bb
2 changed files with 25 additions and 30 deletions

View file

@ -17,7 +17,6 @@ import java.util.Comparator;
* @author ddaoust * @author ddaoust
*/ */
public class HashTable implements Cloneable { public class HashTable implements Cloneable {
protected static final int minHashSize = 2; protected static final int minHashSize = 2;
protected int currEntry = -1; protected int currEntry = -1;
@ -40,8 +39,7 @@ public class HashTable implements Cloneable{
if (size > minHashSize) { if (size > minHashSize) {
hashTable = new int[size * 2]; hashTable = new int[size * 2];
nextTable = new int[size]; nextTable = new int[size];
} } else {
else {
hashTable = null; hashTable = null;
nextTable = null; nextTable = null;
} }
@ -103,7 +101,6 @@ public class HashTable implements Cloneable{
} }
protected void resize(int size) { protected void resize(int size) {
if (size > minHashSize) { if (size > minHashSize) {
hashTable = new int[size * 2]; hashTable = new int[size * 2];
nextTable = new int[size]; nextTable = new int[size];

View file

@ -23,7 +23,7 @@ import java.util.List;
/** /**
* @author aniefer * @author aniefer
*/ */
public abstract class ObjectTable<T> extends HashTable implements Cloneable{ public abstract class ObjectTable<T> extends HashTable {
protected T[] keyTable; protected T[] keyTable;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -101,7 +101,6 @@ public abstract class ObjectTable<T> extends HashTable implements Cloneable{
protected void removeEntry(int i) { protected void removeEntry(int i) {
// Remove the entry from the keyTable, shifting everything over if necessary // Remove the entry from the keyTable, shifting everything over if necessary
int hash = hash(keyTable[i]); int hash = hash(keyTable[i]);
if (i < currEntry) if (i < currEntry)
System.arraycopy(keyTable, i + 1, keyTable, i, currEntry - i); System.arraycopy(keyTable, i + 1, keyTable, i, currEntry - i);
@ -110,11 +109,9 @@ public abstract class ObjectTable<T> extends HashTable implements Cloneable{
// Make sure you remove the value before calling super where currEntry will change // Make sure you remove the value before calling super where currEntry will change
removeEntry(i, hash); removeEntry(i, hash);
} }
protected final int lookup(Object buffer){ protected final int lookup(Object buffer){
if (hashTable != null) { if (hashTable != null) {
int hash = hash(buffer); int hash = hash(buffer);
@ -126,9 +123,10 @@ public abstract class ObjectTable<T> extends HashTable implements Cloneable{
return i; return i;
// Follow the next chain // Follow the next chain
for (i = nextTable[i] - 1; i >= 0 && nextTable[i] != i + 1; i = nextTable[i] - 1) for (i = nextTable[i] - 1; i >= 0 && nextTable[i] != i + 1; i = nextTable[i] - 1) {
if (buffer.equals(keyTable[i])) if (buffer.equals(keyTable[i]))
return i; return i;
}
return -1; return -1;
} }