// Table //////////////////////////////////////////////////////////////////////////////
/** an SLR(1) parse table which may contain conflicts */
- class Table extends Grammar<Token> {
+ class Table extends Grammar<Token> implements Serializable {
/** the start state */
final State<Token> start;
private int master_state_idx = 0;
/** all the states for this table */
- HashSet<State<Token>> all_states = new HashSet<State<Token>>();
+ private transient HashSet<State<Token>> all_states = new HashSet<State<Token>>();
/** all the doomed states in this table */
- HashMap<HashSet<Position>,State<Token>> doomed_states = new HashMap<HashSet<Position>,State<Token>>();
+ private transient HashMap<HashSet<Position>,State<Token>> doomed_states = new HashMap<HashSet<Position>,State<Token>>();
/** all the non-doomed states in this table */
- HashMap<HashSet<Position>,State<Token>> normal_states = new HashMap<HashSet<Position>,State<Token>>();
+ private transient HashMap<HashSet<Position>,State<Token>> normal_states = new HashMap<HashSet<Position>,State<Token>>();
Topology<Token> emptyTopology() { return Parser.this.emptyTopology(); }
* space+time complexity in otherwise simple grammars. There
* is an example of this in the regression suite.
*/
- class State<Token> implements IntegerMappable, Iterable<Position> {
+ class State<Token> implements IntegerMappable, Serializable {
public final int idx = master_state_idx++;
- private final HashSet<Position> hs;
+ private final transient HashSet<Position> hs;
public HashSet<State<Token>> conjunctStates = new HashSet<State<Token>>();
HashMap<Sequence,State<Token>> gotoSetNonTerminals = new HashMap<Sequence,State<Token>>();
package edu.berkeley.sbp.util;
import java.util.*;
+import java.io.*;
-public final class EmptyIterator<T> implements Iterable<T>, Iterator<T> {
+public final class EmptyIterator<T> implements Iterable<T>, Iterator<T>, Serializable {
public void remove() { throw new Error(); }
public boolean hasNext() { return false; }
public T next() { throw new Error(); }
import edu.berkeley.sbp.util.*;
/** implementation of <tt>Topology</tt> for any class for which there is a mapping to the <tt>int</tt>s */
-public class IntegerTopology<V> implements Topology<V> {
+public class IntegerTopology<V> implements Topology<V>, Serializable {
private final Range.Set rs;
private final Functor<V,Integer> f;
package edu.berkeley.sbp.util;
import java.util.*;
import java.text.*;
+import java.io.*;
/**
* This class represents a range of integers (incuding positive and negative
* infinity).
*/
-public class Range {
+public class Range implements Serializable {
private boolean negInf, posInf;
private long min,max;
*
* @author Justin F. Chapweske
*/
- public static class Set implements Iterable<Range> {
+ public static class Set implements Iterable<Range>, Serializable {
public static final int DEFAULT_CAPACITY = 16;
//
/** a mapping from topologies over <tt>K</tt> to <i>sets of</i> values of type <tt>V</tt> */
-public class TopologicalBag<K,V> implements MapBag<Topology<K>,V>, VisitableMap<K,V> {
+public class TopologicalBag<K,V> implements MapBag<Topology<K>,V>, VisitableMap<K,V>, Serializable {
// CRUCIAL INVARIANT: keys in this hashmap MUST be disjoint or the universe will implode
private final HashMap<Topology<K>,HashSet<V>> h = new HashMap<Topology<K>,HashSet<V>>();
package edu.berkeley.sbp.util;
import java.util.*;
+import java.io.*;
/** a Map that knows how to apply an Invokable to all its elements */
-public interface VisitableMap<K,V> {
+public interface VisitableMap<K,V> extends Serializable {
/** invokes <tt>ivbc</tt> on each element of this map, passing constant arguments <tt>b</tt> and <tt>c</tt> */
public <B> void invoke(K k, Invokable<V,B> ivbc, B b);