projects
/
sbp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
61a0c83
)
add Serializable to util classes
author
adam
<adam@megacz.com>
Sun, 27 May 2007 20:26:01 +0000
(16:26 -0400)
committer
adam
<adam@megacz.com>
Sun, 27 May 2007 20:26:01 +0000
(16:26 -0400)
darcs-hash:
20070527202601
-5007d-
3d09bfa657c0d97b5dca2800c9dc048543bcc6a6
.gz
src/edu/berkeley/sbp/Parser.java
patch
|
blob
|
history
src/edu/berkeley/sbp/util/EmptyIterator.java
patch
|
blob
|
history
src/edu/berkeley/sbp/util/IntegerTopology.java
patch
|
blob
|
history
src/edu/berkeley/sbp/util/Range.java
patch
|
blob
|
history
src/edu/berkeley/sbp/util/TopologicalBag.java
patch
|
blob
|
history
src/edu/berkeley/sbp/util/VisitableMap.java
patch
|
blob
|
history
diff --git
a/src/edu/berkeley/sbp/Parser.java
b/src/edu/berkeley/sbp/Parser.java
index
a3730b6
..
8af8005
100644
(file)
--- a/
src/edu/berkeley/sbp/Parser.java
+++ b/
src/edu/berkeley/sbp/Parser.java
@@
-106,7
+106,7
@@
public abstract class Parser<Token, NodeType> {
// Table //////////////////////////////////////////////////////////////////////////////
/** an SLR(1) parse table which may contain conflicts */
// 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;
/** the start state */
final State<Token> start;
@@
-118,13
+118,13
@@
public abstract class Parser<Token, NodeType> {
private int master_state_idx = 0;
/** all the states for this table */
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 */
/** 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 */
/** 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(); }
Topology<Token> emptyTopology() { return Parser.this.emptyTopology(); }
@@
-263,10
+263,10
@@
public abstract class Parser<Token, NodeType> {
* space+time complexity in otherwise simple grammars. There
* is an example of this in the regression suite.
*/
* 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++;
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>>();
public HashSet<State<Token>> conjunctStates = new HashSet<State<Token>>();
HashMap<Sequence,State<Token>> gotoSetNonTerminals = new HashMap<Sequence,State<Token>>();
diff --git
a/src/edu/berkeley/sbp/util/EmptyIterator.java
b/src/edu/berkeley/sbp/util/EmptyIterator.java
index
2c099f3
..
bcb2aa5
100644
(file)
--- a/
src/edu/berkeley/sbp/util/EmptyIterator.java
+++ b/
src/edu/berkeley/sbp/util/EmptyIterator.java
@@
-2,8
+2,9
@@
package edu.berkeley.sbp.util;
import java.util.*;
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(); }
public void remove() { throw new Error(); }
public boolean hasNext() { return false; }
public T next() { throw new Error(); }
diff --git
a/src/edu/berkeley/sbp/util/IntegerTopology.java
b/src/edu/berkeley/sbp/util/IntegerTopology.java
index
a84768e
..
316e59c
100644
(file)
--- a/
src/edu/berkeley/sbp/util/IntegerTopology.java
+++ b/
src/edu/berkeley/sbp/util/IntegerTopology.java
@@
-9,7
+9,7
@@
import edu.berkeley.sbp.*;
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 */
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;
private final Range.Set rs;
private final Functor<V,Integer> f;
diff --git
a/src/edu/berkeley/sbp/util/Range.java
b/src/edu/berkeley/sbp/util/Range.java
index
9dae4a3
..
b803480
100644
(file)
--- a/
src/edu/berkeley/sbp/util/Range.java
+++ b/
src/edu/berkeley/sbp/util/Range.java
@@
-35,12
+35,13
@@
package edu.berkeley.sbp.util;
import java.util.*;
import java.text.*;
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).
*/
/**
* 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;
private boolean negInf, posInf;
private long min,max;
@@
-269,7
+270,7
@@
public class Range {
*
* @author Justin F. Chapweske
*/
*
* @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;
public static final int DEFAULT_CAPACITY = 16;
diff --git
a/src/edu/berkeley/sbp/util/TopologicalBag.java
b/src/edu/berkeley/sbp/util/TopologicalBag.java
index
eb71cdc
..
e3bd1b7
100644
(file)
--- a/
src/edu/berkeley/sbp/util/TopologicalBag.java
+++ b/
src/edu/berkeley/sbp/util/TopologicalBag.java
@@
-14,7
+14,7
@@
import java.lang.ref.*;
//
/** a mapping from topologies over <tt>K</tt> to <i>sets of</i> values of type <tt>V</tt> */
//
/** 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>>();
// 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>>();
diff --git
a/src/edu/berkeley/sbp/util/VisitableMap.java
b/src/edu/berkeley/sbp/util/VisitableMap.java
index
314f55e
..
944f891
100644
(file)
--- a/
src/edu/berkeley/sbp/util/VisitableMap.java
+++ b/
src/edu/berkeley/sbp/util/VisitableMap.java
@@
-2,9
+2,10
@@
package edu.berkeley.sbp.util;
import java.util.*;
package edu.berkeley.sbp.util;
import java.util.*;
+import java.io.*;
/** a Map that knows how to apply an Invokable to all its elements */
/** 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);
/** 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);