public class Repository extends Object
Data
objects available in Raven.Data
,
RepositoryListener
Modifier and Type | Field and Description |
---|---|
static String |
NAME_PATTERN
The NAME Pattern of valid names
|
Modifier and Type | Method and Description |
---|---|
void |
addRepositoryListener(RepositoryListener l)
Adds the Repository Listener
l to this repository. |
boolean |
contains(Data data)
Returns
true if and only if the object data is
contained in this repository. |
boolean |
contains(String name)
Returns
true if and only if an object with name name is
contained in this repository. |
Data |
get(String name)
Returns the object with the name
name . |
Set<String> |
getAllAutomata()
Returns a set with the names of all automata contained in this repository.
|
Set<String> |
getAllGraphs()
Returns a set with the names of all graphs contained in this repository.
|
String |
getName(Data item)
Returns the name of object
data . |
Set<String> |
getNames()
Returns the names of the data object contained in this repository.
|
static Repository |
getRepository()
Returns the repository used for this instance of Raven.
|
boolean |
isAutomaton(String name)
Returns
true if and only if the object with
name name is of type #Automaton; |
boolean |
isCospan(String name)
Returns
true if and only if the object with
name name is of type #Cospan; |
boolean |
isDecomposition(String name)
Returns
true if and only if the object with
name name is of type #Decomposition; |
boolean |
isGraph(String name)
Returns
true if and only if the object with
name name is of type #Graph; |
static boolean |
isNameValid(String name)
Checks whether the name is correct with respect to the pattern of allowed names.
|
boolean |
isSignature(String name)
Returns
true if and only if the object with
name name is of type #Signature; |
boolean |
put(String name,
Data item)
Adds a new object
item with the name name
to this repository. |
void |
remove(String name)
Removes the object with the name
name
from the repository |
boolean |
rename(String name,
String replacement)
Renames an existing data object with the name
name to replacement . |
public static final String NAME_PATTERN
public static Repository getRepository()
public static boolean isNameValid(String name)
name
- the name to be checkedtrue
if the name is valid, false
otherwisepublic void addRepositoryListener(RepositoryListener l)
l
to this repository.l
- the listener to receive repository eventspublic Set<String> getAllAutomata()
public Set<String> getAllGraphs()
public Set<String> getNames()
public boolean contains(String name)
true
if and only if an object with name name
is
contained in this repository.name
- the name of an objecttrue
if an object has been found,
false
otherwisepublic boolean contains(Data data)
true
if and only if the object data
is
contained in this repository.data
- the objecttrue
if the object has been found,
false
otherwisepublic boolean isAutomaton(String name)
true
if and only if the object with
name name
is of type #Automaton;name
- the name of the objecttrue
if the object is an automaton,
false
otherwisepublic boolean isCospan(String name)
true
if and only if the object with
name name
is of type #Cospan;name
- the name of the objecttrue
if the object is an cospan,
false
otherwisepublic boolean isDecomposition(String name)
true
if and only if the object with
name name
is of type #Decomposition;name
- the name of the objecttrue
if the object is a decomposition,
false
otherwisepublic boolean isGraph(String name)
true
if and only if the object with
name name
is of type #Graph;name
- the name of the objecttrue
if the object is a graph,
false
otherwisepublic boolean isSignature(String name)
true
if and only if the object with
name name
is of type #Signature;name
- the name of the objecttrue
if the object is a signature,
false
otherwisepublic boolean put(String name, Data item)
item
with the name name
to this repository.
If the name is already used for another object, the other
is replaced by the new object. If the new object is already
contained in this repository (with another name), the object
will not be added twice.name
- the name of the new objectitem
- the new objecttrue
if the name-object pair has been added
successfully, false
otherwiseNullPointerException
- thrown if either the name
or the object is null
.IllegalArgumentException
- thrown if the name is not validisNameValid(String)
public boolean rename(String name, String replacement)
name
to replacement
. If the
operation has been successful, it returns true
, otherwise, if no data object with the
given name can be found or the replacement name is already in use, false
is returned.name
- the name of the data object to be renamedreplacement
- the new name of the affected data settrue
if the operation has been successful, false
otherwiseNullPointerException
- thrown if either the name or the replacement is null
.IllegalArgumentException
- thrown if the name or the replacement is empty or the
replacement is not a valid name.isNameValid(String)
public Data get(String name)
name
.name
- the name of the requested objectnull
otherwisepublic String getName(Data item)
data
.item
- the object whose name is requestednull
otherwisepublic void remove(String name)
name
from the repositoryname
- the name of the object to be removed