Package org.jspace
Class SequentialSpace
java.lang.Object
org.jspace.SequentialSpace
- All Implemented Interfaces:
Space
- Direct Known Subclasses:
PileSpace,QueueSpace,RandomSpace
public class SequentialSpace extends java.lang.Object implements Space
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SequentialSpace()Create an unbounded sequential space.SequentialSpace(int bound)Create a new sequential space with bound that limits the number of tuples that can be inserted in the space. -
Method Summary
Modifier and Type Method Description protected voidaddTuple(Tuple tuple)protected java.util.LinkedList<java.lang.Object[]>findAllTuples(Template template, boolean toRemove)protected TuplefindTuple(Template template, boolean toRemove)java.lang.Object[]get(TemplateField... fields)Retrieves (and remove) a tuple matching the requested template.java.util.LinkedList<java.lang.Object[]>getAll(TemplateField... fields)Retrieves (and remove) all the tuples matching a template.java.lang.Object[]getp(TemplateField... fields)Retrieves (and remove) a tuple matching the requested template.booleanput(java.lang.Object... fields)Adds a tuple in the space.java.lang.Object[]query(TemplateField... fields)Reads (without removing) a tuple matching the requested template.java.util.LinkedList<java.lang.Object[]>queryAll(TemplateField... fields)Reads (without removing) all the tuples matching the requested template.java.lang.Object[]queryp(TemplateField... fields)Reads (without removing) a tuple matching the requested template.intsize()Returns the number of tuples that are stored in the space.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
bound
protected final int bound -
tuples
-
-
Constructor Details
-
SequentialSpace
public SequentialSpace()Create an unbounded sequential space. -
SequentialSpace
public SequentialSpace(int bound)Create a new sequential space with bound that limits the number of tuples that can be inserted in the space.- Parameters:
bound- max number of tuples in the space.
-
-
Method Details
-
put
public boolean put(java.lang.Object... fields) throws java.lang.InterruptedExceptionDescription copied from interface:SpaceAdds a tuple in the space. -
addTuple
-
get
Description copied from interface:SpaceRetrieves (and remove) a tuple matching the requested template. A template is rendered as an array ofTemplateField. The returned, sayresultwill satisfy the following properties:-
result.length==fields.length; - for any
i,fields[i].match(return[i])==true.
-
-
findTuple
-
findAllTuples
protected java.util.LinkedList<java.lang.Object[]> findAllTuples(Template template, boolean toRemove) -
getp
Description copied from interface:SpaceRetrieves (and remove) a tuple matching the requested template. A template is rendered as an array ofTemplateField. The returned, sayresultwill satisfy the following properties:-
result.length==fields.length; - for any
i,fields[i].match(return[i])==true.
nullis returned. -
-
getAll
Description copied from interface:SpaceRetrieves (and remove) all the tuples matching a template. If no matching tuple is found, the empty list is returned. -
query
Description copied from interface:SpaceReads (without removing) a tuple matching the requested template. A template is rendered as an array ofTemplateField. The returned, sayresultwill satisfy the following properties:-
result.length==fields.length; - for any
i,fields[i].match(return[i])==true.
-
-
queryp
Description copied from interface:SpaceReads (without removing) a tuple matching the requested template. A template is rendered as an array ofTemplateField. The returned, sayresultwill satisfy the following properties:-
result.length==fields.length; - for any
i,fields[i].match(return[i])==true.
nullis returned if no matching tuple is found. -
-
queryAll
Description copied from interface:SpaceReads (without removing) all the tuples matching the requested template. A template is rendered as an array ofTemplateField. The returned, sayresultwill satisfy the following properties:-
result.length==fields.length; - for any
i,fields[i].match(return[i])==true.
-
-
size
public int size()Description copied from interface:SpaceReturns the number of tuples that are stored in the space.
-