|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpaul.DataStructs.RelFacts
public abstract class RelFacts
RelFacts
contains common relation factories. For each
kind of relation factory, we have a corresponding static method.
Note: some relation factories that used to exist as separate
classes are now static inner classes of this class. They are
provided mostly to simplify porting old code (programmers only have
to change a few import
statements).
Nested Class Summary | |
---|---|
static class |
RelFacts.COWRelationFactory<K,V>
Deprecated. As of jpaul 2.2, use cow(RelationFactory) instead. |
static class |
RelFacts.MapSetRelationFactory<K,V>
Deprecated. As of jpaul 2.2, use mapSet() or mapSet(MapFactory,SetFactory) instead. |
Constructor Summary | |
---|---|
RelFacts()
|
Method Summary | ||
---|---|---|
static
|
cow(RelationFactory<K,V> underRelFact)
Returns a relation factory that generates "copy-on-write" (COW) relations. |
|
static
|
mapSet()
Returns a relation factory that generates Relation s interface backed by a
LinkedHashMap from keys to
LinkedHashSet s of values. |
|
static
|
mapSet(MapFactory<K,java.util.Set<V>> mapFact,
SetFactory<V> setFact)
Returns a relation factory that generates Relation s interface backed by a Map
from keys to Set s of values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RelFacts()
Method Detail |
---|
public static <K,V> RelationFactory<K,V> mapSet()
Relation
s interface backed by a
LinkedHashMap
from keys to
LinkedHashSet
s of values. This relation factory
is very good for programs that use only a few large relations.
public static <K,V> RelationFactory<K,V> mapSet(MapFactory<K,java.util.Set<V>> mapFact, SetFactory<V> setFact)
Relation
s interface backed by a Map
from keys to Set
s of values. The map is created
by mapFact
and the sets by setFact
.
The two parameters allow the programmer to finely tune the
relations from the program.
public static <K,V> RelationFactory<K,V> cow(RelationFactory<K,V> underRelFact)
The internal representation of a COW representation maintains a "sharing" counter to identify cases when the representation is not shared with anyone (and hence, no cloning is necessary before a mutation).
Cloning a COW relation is a constant time operation. COW relations are good when it is hard to determine statically whether a clone of a relation will be mutated: they delay the real cloning until the first mutation (if any).
underRelFact
- Relation factory for generating the
relations used in the representation of the generated COW
relations.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |