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 voidclose()voidemit()LiteralfindLiteral(Object value)voidflush()inthash(Object key)Calculate hash code of a key.protected booleanmatches(Object key1, Object key2)Compare two keys for equivalence.voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)voidwriteBoolean(boolean v)voidwriteByte(int v)voidwriteBytes(String s)voidwriteChar(int v)voidwriteChars(String v)voidwriteDouble(double v)voidwriteFloat(float v)voidwriteInt(int v)voidwriteLong(long v)voidwriteObject(Object obj)voidwriteShort(int v)voidwriteUTF(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:AbstractHashTableCalculate hash code of a key.
-
matches
protected boolean matches(Object key1, Object key2)
Description copied from class:AbstractHashTableCompare 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:
flushin interfaceObjectOutput
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceObjectOutput
-
write
public void write(int b) throws IOException- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Throws:
IOException
-
writeBytes
public void writeBytes(String s) throws IOException
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Specified by:
writein interfaceDataOutput- Specified by:
writein interfaceObjectOutput- Throws:
IOException
-
writeBoolean
public void writeBoolean(boolean v)
- Specified by:
writeBooleanin interfaceDataOutput
-
writeChar
public void writeChar(int v)
- Specified by:
writeCharin interfaceDataOutput
-
writeByte
public void writeByte(int v)
- Specified by:
writeBytein interfaceDataOutput
-
writeShort
public void writeShort(int v)
- Specified by:
writeShortin interfaceDataOutput
-
writeInt
public void writeInt(int v)
- Specified by:
writeIntin interfaceDataOutput
-
writeLong
public void writeLong(long v)
- Specified by:
writeLongin interfaceDataOutput
-
writeFloat
public void writeFloat(float v)
- Specified by:
writeFloatin interfaceDataOutput
-
writeDouble
public void writeDouble(double v)
- Specified by:
writeDoublein interfaceDataOutput
-
writeUTF
public void writeUTF(String v)
- Specified by:
writeUTFin interfaceDataOutput
-
writeChars
public void writeChars(String v)
- Specified by:
writeCharsin interfaceDataOutput
-
writeObject
public void writeObject(Object obj) throws IOException
- Specified by:
writeObjectin interfaceObjectOutput- Throws:
IOException
-
-