Package gnu.expr
Class LitTable
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- gnu.kawa.util.AbstractHashTable<HashNode<K,V>,K,V>
-
- gnu.kawa.util.GeneralHashTable<Object,Object>
-
- gnu.expr.LitTable
-
- All Implemented Interfaces:
DataOutput
,ObjectOutput
,AutoCloseable
,Map<Object,Object>
public class LitTable extends GeneralHashTable<Object,Object> implements ObjectOutput
Manages the literals of a Compilation. Implements ObjectOutput, because we use externalization to determine how literals get compiled into code that re-creates the literal.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
-
Fields inherited from class gnu.kawa.util.AbstractHashTable
DEFAULT_INITIAL_SIZE, mask, num_bindings, table
-
-
Constructor Summary
Constructors Constructor Description LitTable(Compilation comp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
emit()
Literal
findLiteral(Object value)
void
flush()
int
hash(Object key)
Calculate hash code of a key.protected boolean
matches(Object key1, Object key2)
Compare two keys for equivalence.void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
void
writeBoolean(boolean v)
void
writeByte(int v)
void
writeBytes(String s)
void
writeChar(int v)
void
writeChars(String v)
void
writeDouble(double v)
void
writeFloat(float v)
void
writeInt(int v)
void
writeLong(long v)
void
writeObject(Object obj)
void
writeShort(int v)
void
writeUTF(String v)
-
Methods inherited from class gnu.kawa.util.GeneralHashTable
allocEntries, getEntryHashCode, getEntryNext, getNode, makeEntry, setEntryNext
-
Methods inherited from class gnu.kawa.util.AbstractHashTable
clear, entrySet, get, get, getOrDefault, hashToIndex, matches, put, put, rehash, remove, size
-
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
LitTable
public LitTable(Compilation comp)
-
-
Method Detail
-
hash
public int hash(Object key)
Description copied from class:AbstractHashTable
Calculate hash code of a key.
-
matches
protected boolean matches(Object key1, Object key2)
Description copied from class:AbstractHashTable
Compare two keys for equivalence. Override this and theAbstractHashTable.hash(Object)
method if you want a different equivalence relation.
-
emit
public void emit() throws IOException
- Throws:
IOException
-
flush
public void flush()
- Specified by:
flush
in interfaceObjectOutput
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceObjectOutput
-
write
public void write(int b) throws IOException
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Throws:
IOException
-
writeBytes
public void writeBytes(String s) throws IOException
- Specified by:
writeBytes
in interfaceDataOutput
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceObjectOutput
- Throws:
IOException
-
writeBoolean
public void writeBoolean(boolean v)
- Specified by:
writeBoolean
in interfaceDataOutput
-
writeChar
public void writeChar(int v)
- Specified by:
writeChar
in interfaceDataOutput
-
writeByte
public void writeByte(int v)
- Specified by:
writeByte
in interfaceDataOutput
-
writeShort
public void writeShort(int v)
- Specified by:
writeShort
in interfaceDataOutput
-
writeInt
public void writeInt(int v)
- Specified by:
writeInt
in interfaceDataOutput
-
writeLong
public void writeLong(long v)
- Specified by:
writeLong
in interfaceDataOutput
-
writeFloat
public void writeFloat(float v)
- Specified by:
writeFloat
in interfaceDataOutput
-
writeDouble
public void writeDouble(double v)
- Specified by:
writeDouble
in interfaceDataOutput
-
writeUTF
public void writeUTF(String v)
- Specified by:
writeUTF
in interfaceDataOutput
-
writeChars
public void writeChars(String v)
- Specified by:
writeChars
in interfaceDataOutput
-
writeObject
public void writeObject(Object obj) throws IOException
- Specified by:
writeObject
in interfaceObjectOutput
- Throws:
IOException
-
-