public class Signature extends Object implements Serializable
Interner
would. In addition, it stores, for
each symbol f, its arity, i.e. the number of children that a node with label
f must have in a well-formed tree. Every symbol must have a unique arity.Constructor and Description |
---|
Signature()
This creates a new, empty signature.
|
Modifier and Type | Method and Description |
---|---|
void |
addAllConstants(Tree<HomomorphismSymbol> tree)
Adds all the constants from the tree to the signature.
|
Tree<Integer> |
addAllSymbols(Tree<String> tree)
Adds all the symbols in the tree to the signature and returns a new tree
with all the symbols replaced their ids in the signature.
|
int |
addSymbol(String symbol,
int arity)
Adds this symbol to the signature with the given arity.
|
void |
clear()
Removes all symbols from this signature.
|
Object |
clone() |
boolean |
contains(String symbol)
Returns true if the symbol is known to this signature.
|
int |
getArity(int symbolId)
Returns the arity of the symbol associated with the given id.
|
int |
getArityForLabel(String symbol)
Returns the arity of the given symbol in this signature.
|
SignatureMapper |
getIdentityMapper()
Obtains an identity mapper for this signature (every id is mapped to itself).
|
int |
getIdForSymbol(String symbol)
Obtains the id for the given symbol.
|
SignatureMapper |
getMapperTo(Signature other)
Obtains a signature mapper between this signature on the given other
signature.
|
int |
getMaxArity()
Returns the maximum arity of any symbol in this signature.
|
int |
getMaxSymbolId()
Returns the highest symbol ID that has been used in this signature.
|
Collection<String> |
getSymbols()
Obtains a collection of all the symbols known to the signature.
|
Map<String,Integer> |
getSymbolsWithArities()
Returns a map which contains the pairs of symbols and arities known
to this signature.
|
boolean |
isWritable()
Can be used to check whether this signature can be printed.
|
int[] |
remap(Signature other)
Returns an arrary x such that the symbol with ID i in this signature is
the same as the symbol with ID x[i] in the other signature.
|
Tree<String> |
resolve(Tree<Integer> tree)
Returns a new tree with all the integers replaced by the symbols associated
with these integers in this signature.
|
String |
resolveSymbolId(int id)
Returns the symbol associated with the given id, or null if no such symbol
exists.
|
Collection<String> |
resolveSymbolIDs(IntCollection ids)
Collects all the symbols for the given list of ints.
|
String |
toString() |
public Signature()
public SignatureMapper getMapperTo(Signature other)
other
- public SignatureMapper getIdentityMapper()
public void clear()
public Collection<String> getSymbols()
public int getArityForLabel(String symbol)
symbol
- public int getArity(int symbolId)
symbolId
- public String resolveSymbolId(int id)
id
- public Collection<String> resolveSymbolIDs(IntCollection ids)
ids
- public int getIdForSymbol(String symbol)
symbol
- public boolean contains(String symbol)
symbol
- public int addSymbol(String symbol, int arity)
symbol
- arity
- public boolean isWritable()
public int getMaxSymbolId()
public Map<String,Integer> getSymbolsWithArities()
public Tree<String> resolve(Tree<Integer> tree)
tree
- public Tree<Integer> addAllSymbols(Tree<String> tree)
tree
- public void addAllConstants(Tree<HomomorphismSymbol> tree)
tree
- public int[] remap(Signature other)
other
- public int getMaxArity()
Copyright © 2017. All rights reserved.