public class StateSet extends AbstractStateSet
Constructor and Description |
---|
StateSet()
Creates an empty state-set
|
StateSet(List<byte[]> successors)
Creates a state-set with the given list of states
|
StateSet(List<byte[]> successors,
double p)
Creates a state-set with the given list of states and their probability of occurrence
|
StateSet(State s)
Creates a state-set with the given state
|
StateSet(StateSet _states)
Clones a given state-set
|
Modifier and Type | Method and Description |
---|---|
void |
add(State s)
Adds a state to the given state-set
|
void |
addAll(StateSet set)
Adds a set of states to the state-set
|
void |
addCumulative(State s)
Adds a state to the state-set (whenever the given state is already present within the state-set,
the probability of the state to be inserted is added to the original state in the state-set)
|
boolean |
contains(State state)
Checks whether a given state is contained in the state-set
|
boolean |
contains(String key)
Checks whether a given state (based on its key) is in the state-set
|
StateSet |
getExitStateSet()
Returns the states accessible from the state-set
|
State |
getFirstState()
Accesses the first state in the state-set (useful to iterate and remove)
|
Collection<String> |
getKeys()
Returns a collection with the keys of the states in the state-set
|
double |
getProbability(State s)
Returns the probability of a given state in the state-set
|
State |
getProbableExitState(State s)
Randomly accesses a probable exit state from a given state in the state-set
|
State |
getProbableRandomState()
Selects a state by adequately considering the probabilities of the states in the state-set
|
State |
getState(String sKey)
Returns a state given its key
|
Collection<State> |
getStates()
Returns a collection with the states in the state-set
|
State |
getUniformRandomState()
Selects a state assuming an uniform distribution of the probabilities of the states in the state-set
|
boolean |
hasExits() |
boolean |
hasOverlapping(StateSet set)
Checks whether two state-sets share states
|
boolean |
hasPaths() |
boolean |
isEmpty()
Checks whether the state-set has states
|
void |
remove(State s)
Removes a given state from the state-set
|
void |
setExitStates(StateSet exit)
Stores the set of reachable states from the current state-set
|
void |
setProbPaths(FinalPaths exit)
Stores the set of outgoing transitions from the current state-set
|
int |
size()
Returns the number of states in the state-set
|
String |
toLongString()
Detailed description of the states in the state-set as a String object
|
String |
toString() |
double |
totalProbability()
Sums the probability of all of the internal states
|
getKey, setKey
public StateSet()
public StateSet(State s)
s
- state to be enclosed within the state-setpublic StateSet(List<byte[]> successors)
successors
- states to be included in the new state-setpublic StateSet(List<byte[]> successors, double p)
successors
- states to be included in the new state-setp
- probability associated with each of the given set of states (between 0 and 1)public StateSet(StateSet _states)
_states
- the states to be included in the cloned state-setpublic State getState(String sKey)
sKey
- the key of the desirable statepublic void add(State s)
s
- the state to be addedpublic void addCumulative(State s)
s
- the state to be addedpublic void addAll(StateSet set)
set
- the set of states to be addedpublic boolean hasOverlapping(StateSet set)
set
- the state-set to be comparedpublic boolean isEmpty()
public boolean contains(State state)
AbstractStateSet
contains
in class AbstractStateSet
state
- state to be checkedpublic boolean contains(String key)
key
- identifier of the state to be checkedpublic int size()
size
in class AbstractStateSet
public Collection<State> getStates()
public Collection<String> getKeys()
getKeys
in class AbstractStateSet
public State getFirstState()
public State getUniformRandomState()
public State getProbableRandomState()
public double getProbability(State s)
s
- the state whose probability is to be checkedpublic double totalProbability()
public void remove(State s)
v
- the state to be removed from the state-setpublic String toLongString()
public void setProbPaths(FinalPaths exit)
exit
- the set of outgoing transitions from the current state-setpublic boolean hasExits()
public boolean hasPaths()
public StateSet getExitStateSet()
setExitStates
public void setExitStates(StateSet exit)
exit
- the set of states accessible from the current state-setCopyright © 2005–2020. All rights reserved.