0.10.8-alpha
ca.uqac.lif.cep.util.Multiset Class Reference

A set where each element can be present more than once. More...

Classes

class  GetCardinalities
 Gets the cardinalities of each element in a multiset. More...
 
class  Insert
 Given a multiset and an element, returns a new multiset with this element added to it. More...
 
class  PutInto
 Puts incoming events into a multiset, and returns this set. More...
 

Public Member Functions

 Multiset ()
 Creates an empty multiset. More...
 
 Multiset (Multiset m)
 Creates a multiset from the contents of another one. More...
 
Multiset addAll (Multiset b)
 Performs the union of two multisets. More...
 
boolean addAll (Collection<? extends Object > arg0)
 
Object getAnyElement ()
 Picks one element of the multiset. More...
 
boolean contains (Object o)
 Checks if an element is contained (at least once) into this multiset. More...
 
Multiset addElement (Object o)
 Adds an element to this multiset. More...
 
boolean add (Object o)
 
int get (Object o)
 Gets the cardinality of an element. More...
 
Set< Object > keySet ()
 Gets the (normal) set of all elements in this multiset. More...
 
Multiset removeElement (Object o, int times)
 Removes an element from this multiset. More...
 
int size ()
 Gets the size of the multiset. More...
 
void clear ()
 
String toString ()
 
boolean containsAll (Collection<?> arg0)
 
boolean isEmpty ()
 
Iterator< Object > iterator ()
 
boolean remove (Object arg0)
 
boolean remove (Object arg0, int times)
 Removes an element a number of times. More...
 
boolean removeAll (Collection<?> arg0)
 
boolean retainAll (Collection<?> arg0)
 
Object [] toArray ()
 

Static Public Attributes

static final transient GetCardinalities getCardinalities = new GetCardinalities()
 A single visible instance of the GetCardinalities function. More...
 

Detailed Description

A set where each element can be present more than once.

Author
Sylvain Hallé
Since
0.9

Definition at line 35 of file Multiset.java.

Constructor & Destructor Documentation

◆ Multiset() [1/2]

ca.uqac.lif.cep.util.Multiset.Multiset ( )

Creates an empty multiset.

Definition at line 51 of file Multiset.java.

◆ Multiset() [2/2]

ca.uqac.lif.cep.util.Multiset.Multiset ( Multiset  m)

Creates a multiset from the contents of another one.

Parameters
mThe other multiset

Definition at line 61 of file Multiset.java.

Member Function Documentation

◆ add()

boolean ca.uqac.lif.cep.util.Multiset.add ( Object  o)

Definition at line 156 of file Multiset.java.

◆ addAll() [1/2]

Multiset ca.uqac.lif.cep.util.Multiset.addAll ( Multiset  b)

Performs the union of two multisets.

Parameters
bThe multiset to add
Returns
This multiset

Definition at line 73 of file Multiset.java.

◆ addAll() [2/2]

boolean ca.uqac.lif.cep.util.Multiset.addAll ( Collection<? extends Object >  arg0)

Definition at line 91 of file Multiset.java.

◆ addElement()

Multiset ca.uqac.lif.cep.util.Multiset.addElement ( Object  o)

Adds an element to this multiset.

Parameters
oThe element
Returns
This multiset

Definition at line 141 of file Multiset.java.

◆ clear()

void ca.uqac.lif.cep.util.Multiset.clear ( )

Definition at line 225 of file Multiset.java.

◆ contains()

boolean ca.uqac.lif.cep.util.Multiset.contains ( Object  o)

Checks if an element is contained (at least once) into this multiset.

Parameters
oThe element
Returns
true if the element is contained at least once, false otherwise

Definition at line 126 of file Multiset.java.

◆ containsAll()

boolean ca.uqac.lif.cep.util.Multiset.containsAll ( Collection<?>  arg0)

Definition at line 237 of file Multiset.java.

◆ get()

int ca.uqac.lif.cep.util.Multiset.get ( Object  o)

Gets the cardinality of an element.

Parameters
oThe element
Returns
The cardinality

Definition at line 167 of file Multiset.java.

◆ getAnyElement()

Object ca.uqac.lif.cep.util.Multiset.getAnyElement ( )

Picks one element of the multiset.

This assumes you don't care about what element of the multiset you get, as long as you get one.

Returns
An element of the multiset, or null if the multiset is empty

Definition at line 110 of file Multiset.java.

◆ isEmpty()

boolean ca.uqac.lif.cep.util.Multiset.isEmpty ( )

Definition at line 266 of file Multiset.java.

◆ iterator()

Iterator<Object> ca.uqac.lif.cep.util.Multiset.iterator ( )

Definition at line 272 of file Multiset.java.

◆ keySet()

Set<Object> ca.uqac.lif.cep.util.Multiset.keySet ( )

Gets the (normal) set of all elements in this multiset.

In other words, turns this multiset into a regular set.

Returns
The set of elements

Definition at line 181 of file Multiset.java.

◆ remove() [1/2]

boolean ca.uqac.lif.cep.util.Multiset.remove ( Object  arg0)

Definition at line 278 of file Multiset.java.

◆ remove() [2/2]

boolean ca.uqac.lif.cep.util.Multiset.remove ( Object  arg0,
int  times 
)

Removes an element a number of times.

Parameters
arg0The element
timesThe number of times to remove it
Returns
true if the element was removed at least once, false otherwise

Definition at line 290 of file Multiset.java.

◆ removeAll()

boolean ca.uqac.lif.cep.util.Multiset.removeAll ( Collection<?>  arg0)

Definition at line 301 of file Multiset.java.

◆ removeElement()

Multiset ca.uqac.lif.cep.util.Multiset.removeElement ( Object  o,
int  times 
)

Removes an element from this multiset.

Parameters
oThe element
timesThe number of times to remove this element
Returns
This multiset

Definition at line 192 of file Multiset.java.

◆ retainAll()

boolean ca.uqac.lif.cep.util.Multiset.retainAll ( Collection<?>  arg0)

Definition at line 326 of file Multiset.java.

◆ size()

int ca.uqac.lif.cep.util.Multiset.size ( )

Gets the size of the multiset.

Returns
The size

Definition at line 214 of file Multiset.java.

◆ toArray()

Object [] ca.uqac.lif.cep.util.Multiset.toArray ( )

Definition at line 374 of file Multiset.java.

◆ toString()

String ca.uqac.lif.cep.util.Multiset.toString ( )

Definition at line 231 of file Multiset.java.

Member Data Documentation

◆ getCardinalities

final transient GetCardinalities ca.uqac.lif.cep.util.Multiset.getCardinalities = new GetCardinalities()
static

A single visible instance of the GetCardinalities function.

Definition at line 40 of file Multiset.java.


The documentation for this class was generated from the following file: