public interface ProcessSignature extends CircusSignature
A process signature consists of the process name, possibly empty generic formal parameters, possibly empty formal parameters or indexes, and the channels usage. Generic actuals must be resolved while type checking similarly to Z and ObjectZ (see ClassSignature and oz.TypeChecker).
List[SignatureList] getSignatureList(), where SignatureList can be: + ZSignatureList - list of Z Signature + ActionSignatureList - list of Circus ActionSignature + NameSetSignatureList - list of Circus NameSetSignature + ChannnelSetSignatureList - list of Circus ChannelSetSignature + CommunicationSignatureList - list of Circus CommunicationSignature Methods available: a) List[SignatureList] getSignatureList() = method by GnAST b) ZSignatureList getMainSignatures() = getSignatureList().get(MAIN_SIGNATURES_INDEX); 1) Signature getFormalParamOrIndexes() = getMainSignatures().get(FORMAL_PARAMS_INDEX); 2) Signature getUsedChannels() = getMainSignatures().get(USED_CHANNELS_INDEX); 3) Signature getStateSignature() = getMainSignatures().get(STATE_SIGNATURE_INDEX); c) ZSignatureList getLocalZSignatures() = getSignatureList().get(ZLOCAL_SIGNATURES_INDEX); d) ActionSignatureList getActionSignatures() = getSignatureList().get(ACTION_SIGNATURES_INDEX); e) CommunicationSignatureList getUsedCommunications() = getSignatureList().get(COMM_SIGNATURES_INDEX); f) NameSetSignatureList getUsedNameSets() = getSignatureList().get(NAMESET_SIGNATURES_INDEX); g) ChannelSetSignatureList getUsedChannelSets() = getSignatureList().get(CHANNEL_SIGNATURES_INDEX); h) ProcessSignatureList getProcessSignatures() = getSignatureList().get(PROCESS_SIGNATURES_INDEX); i) boolean isBasicProcess() = getProcessSignatures().isEmpty(); Types not provided by GnAST : NameSetSignatureList : Map[ZName, List[NameSet]] ChannelSetSignatureList : Map[ZName, List[ChannelSet]] CommunicationSignatureList: Map[ZName, List[Communication]] Meaning: GLOBAL_INVAIRNAT: all methods return a non-null value a) access method by GnAST - automatically b) access method by GnAST - manually via vm 1) formal parameters or indexes, depending on getUsage() 2) used channels and their declared types, which could be generic 3) state signature as declared by \circstate\ expressions (i.e., it does not include local variables added to the state) INVARIANT: isBasicProcess() || getStateSignature().isEmpty() (i.e., only basic process can have state signatures, which can be empty) c) list of Z signatures for Z paragraphs, commands, and TransformerPara declared within a basic process (i.e., VarDeclCommand will add variables to the process state scope, but not to the process state signature) INVARIANT: isBasicProcess() || getLocalZSignatures().isEmpty() (i.e., only basic process can have local paragraphs, which can be empty) d) list of Circus ActionSignature for actions declared within a basic process INVARIANT: IF isBasicProcess() THEN !getActionSignatures().isEmpty() ELSE getActionSignatures().isEmpty() (i.e., only basic process can have actions, which cannot be empty because they have at least the main action) e) list of used communications by each action (Map[ZName, List[Communication]]) (i.e., the communications in each pair are annotated as a power type of CommunicationType. CommunicationType contains the instantiated channel type as well as the type of each field, which may be different from the channel type; e.g., suppose that "[X, Y] c \in X \cross Y" and "c.0.1" is used, the communication type is: CommType[c:\arithmos \cross \arithmos; i: \nat; j: \nat]) INVARIANT: isBasicProcess() || getUsedNameSets().isEmpty() (i.e., only basic process can have name sets, which can be empty) f) list of used name sets by each action (Map[ZName, List[NameSet]]) (i.e., the name sets in each pair are annotated as a power type of NameSetType) INVARIANT: isBasicProcess() || getUsedNameSets().isEmpty() (i.e., only basic process can have name sets, which can be empty) g) list of used channel sets by each action (Map[ZName, List[ChannelSet]]) (i.e., the channel sets in each pair are annotated as a power type of ChannelSetType) NOTE: parallel processes can have channel sets, which are mapped to the process name h) list of process signatures related to this process (i.e., a compound processes, ultimatelly formed by basic processes) i) auxiliary method to add invariants (as assertions) to other methods NOTE: Tools that semantically represent all processes as basic process can use the information on getProcessSignatures() to collect all basic process information and build a merged signature according to the Circus refinement calculus. Indexes: MAIN_SIGNATURES_INDEX = 0; FORMAL_PARAMS_INDEX = 0; USED_CHANNELS_INDEX = 1; STATE_SIGNATURE_INDEX = 2; ZLOCAL_SIGNATURES_INDEX = 1; ACTION_SIGNATURES_INDEX = 2; COMM_SIGNATURES_INDEX = 3; PROCESS_SIGNATURES_INDEX= 4; NAMESET_SIGNATURES_INDEX= 5; CHANNEL_SIGNATURES_INDEX= 6; PS: We leave getSignatureList() unbounded to allow further extension with new lists if needed, where minOccurs MUST be at least CHANNEL_SIGNATURES_INDEX=+1 (6) Process channel sets only - INVARIANT: !isBasicProcess() || getProcessChannelSets().isEmpty() (i.e., only parallel processes, which are not basic processes, can have them) Because BasicProcessSignature uses yet another SignatureList, we need more than one SignatureList, so we have a list of signature lists! So, we add through GnAST the following convenience methods:
| Modifier and Type | Field and Description |
|---|---|
static int |
ACTION_SIGNATURES_INDEX |
static int |
FORMAL_PARAMS_INDEX
/* Indexes used by access methods below *
|
static int |
LOCALZ_SIGNATURES_INDEX |
static int |
MAIN_SIGNATURES_INDEX |
static int |
PROCESS_SIGNATURES_INDEX |
static int |
STATE_SIGNATURE_INDEX |
| Modifier and Type | Method and Description |
|---|---|
Map<ZName,ActionSignatureList> |
getActions()
This is a convenience method.
|
ActionSignatureList |
getActionSignatures()
This is a convenience method.
|
ZSignatureList |
getBasicProcessLocalZSignatures()
This is a convenience method.
|
CallUsage |
getCallUsage()
Returns the CallUsage element.
|
CircusChannelSetList |
getCircusProcessChannelSets()
This is a convenience method.
|
Signature |
getFormalParamsOrIndexes()
This is a convenience method.
|
ZNameList |
getGenFormals()
Returns the GenFormals element.
|
Map<ZName,ZSignatureList> |
getLocalZSignatures()
This is a convenience method.
|
ZSignatureList |
getMainSignatures()
This is a convenience method.
|
ChannelSetList |
getProcessChannelSets()
Returns the ProcessChannelSets element.
|
Name |
getProcessName()
This is a convenience method for getName.
|
ProcessSignatureList |
getProcessSignatures()
This is a convenience method.
|
ZName |
getProcessZName()
This is a convenience method.
|
ListTerm<SignatureList> |
getSignatureList()
Returns the SignatureList elements.
|
Signature |
getStateSignature()
This is a convenience method.
|
StateUpdate |
getStateUpdate()
Returns the StateUpdate element.
|
Map<ZName,Signature> |
getUsedChannels()
This is a convenience method.
|
List<NameTypePair> |
getUsedChannelsAsList() |
Map<ZName,CircusChannelSetList> |
getUsedChannelSets()
This is a convenience method.
|
List<ChannelSet> |
getUsedChannelSetsAsList() |
Map<ZName,CircusCommunicationList> |
getUsedCommunications()
This is a convenience method.
|
List<Communication> |
getUsedCommunicationsAsList() |
Map<ZName,CircusNameSetList> |
getUsedNameSets()
This is a convenience method.
|
List<NameSet> |
getUsedNameSetsAsList() |
boolean |
isBasicProcessSignature()
Returns true whether or not this signature is for a basic process or not.
|
boolean |
isEmptyProcessSignature()
Returns true whether or not this signature is empty.
|
void |
setCallUsage(CallUsage callUsage)
Sets the CallUsage element.
|
Signature |
setFormalParamsOrIndexes(Signature sig)
This is a convenience method.
|
void |
setGenFormals(ZNameList genFormals)
Sets the GenFormals element.
|
void |
setProcessChannelSets(ChannelSetList processChannelSets)
Sets the ProcessChannelSets element.
|
void |
setProcessName(Name name)
This is a convenience method for setName(name).
|
Signature |
setStateSignature(Signature sig)
This is a convenience method.
|
void |
setStateUpdate(StateUpdate stateUpdate)
Sets the StateUpdate element.
|
getName, getZName, setNamestatic final int FORMAL_PARAMS_INDEX
static final int STATE_SIGNATURE_INDEX
static final int MAIN_SIGNATURES_INDEX
static final int PROCESS_SIGNATURES_INDEX
static final int ACTION_SIGNATURES_INDEX
static final int LOCALZ_SIGNATURES_INDEX
ZNameList getGenFormals()
void setGenFormals(ZNameList genFormals)
genFormals - the GenFormals element.getGenFormals()ListTerm<SignatureList> getSignatureList()
Returns the SignatureList elements.
To add or remove elements, use the methods provided by the List interface (that's why there is no need for a setter method).
ChannelSetList getProcessChannelSets()
void setProcessChannelSets(ChannelSetList processChannelSets)
processChannelSets - the ProcessChannelSets element.getProcessChannelSets()StateUpdate getStateUpdate()
void setStateUpdate(StateUpdate stateUpdate)
stateUpdate - the StateUpdate element.getStateUpdate()CallUsage getCallUsage()
void setCallUsage(CallUsage callUsage)
callUsage - the CallUsage element.getCallUsage()Name getProcessName()
ZName getProcessZName()
void setProcessName(Name name)
name - the process nameCircusChannelSetList getCircusProcessChannelSets()
ZSignatureList getMainSignatures()
Signature getFormalParamsOrIndexes()
Signature setFormalParamsOrIndexes(Signature sig)
sig - new non-null (possibly empty) state signatureSignature getStateSignature()
Signature setStateSignature(Signature sig)
sig - new non-null (possibly empty) state signatureProcessSignatureList getProcessSignatures()
boolean isBasicProcessSignature()
boolean isEmptyProcessSignature()
ZSignatureList getBasicProcessLocalZSignatures()
ActionSignatureList getActionSignatures()
Map<ZName,ZSignatureList> getLocalZSignatures()
java.util.Map result = new java.util.HashMap();
if (isBasicProcessSignature())
{
assert !result.containsKey(getProcessZName());
result.put(getProcessZName(), getBasicProcessLocalZSignatures());
}
else
{
for (net.sourceforge.czt.circus.ast.ProcessSignature pSig : getProcessSignatures())
{
for(java.util.Map.Entry entry : pSig.getLocalZSignatures().entrySet())
{
assert !result.containsKey(entry.getKey());
result.put(entry.getKey(), entry.getValue());
}
}
}
return result;
The getActions() method have a similar pattern but access getActionSignatures() within the ProcessSignature instanceMap<ZName,ActionSignatureList> getActions()
Map<ZName,Signature> getUsedChannels()
java.util.Map result = new java.util.HashMap();
if (isBasicProcessSignature())
{
for (net.sourceforge.czt.circus.ast.ActionSignature aSig : getActionSignatures())
{
assert !result.containsKey(aSig.getActionZName());
result.put(aSig.getActionZName(), aSig.getUsedChannels());
}
}
else
{
net.sourceforge.czt.z.ast.ZName procName = getProcessZName();
for (net.sourceforge.czt.circus.ast.ProcessSignature pSig : getProcessSignatures())
{
for(java.util.Map.Entry entry : pSig.getUsedChannels().entrySet())
{
net.sourceforge.czt.z.ast.ZName newKey = fullQualifiedName(procName, entry.getKey());
assert !result.containsKey(newKey);
result.put(newKey, entry.getValue());
}
}
}
return result;
The remaining methods have a similar pattern but access different (corresponding) lists
within getActionSignatures() for all ProcessSignature instances in getProcessSignatures().List<NameTypePair> getUsedChannelsAsList()
Map<ZName,CircusCommunicationList> getUsedCommunications()
List<Communication> getUsedCommunicationsAsList()
Map<ZName,CircusChannelSetList> getUsedChannelSets()
List<ChannelSet> getUsedChannelSetsAsList()
Map<ZName,CircusNameSetList> getUsedNameSets()
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.