|
|
@ -38,78 +38,77 @@ public class SystemRename extends SystemDefn |
|
|
// Vectors for pairs of actions to be renamed |
|
|
// Vectors for pairs of actions to be renamed |
|
|
private Vector<String> from; |
|
|
private Vector<String> from; |
|
|
private Vector<String> to; |
|
|
private Vector<String> to; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Constructors |
|
|
// Constructors |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SystemRename() |
|
|
public SystemRename() |
|
|
{ |
|
|
{ |
|
|
from = new Vector<String>(); |
|
|
from = new Vector<String>(); |
|
|
to = new Vector<String>(); |
|
|
to = new Vector<String>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SystemRename(SystemDefn s) |
|
|
public SystemRename(SystemDefn s) |
|
|
{ |
|
|
{ |
|
|
operand = s; |
|
|
operand = s; |
|
|
from = new Vector<String>(); |
|
|
from = new Vector<String>(); |
|
|
to = new Vector<String>(); |
|
|
to = new Vector<String>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set methods |
|
|
// Set methods |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setOperand(SystemDefn s) |
|
|
public void setOperand(SystemDefn s) |
|
|
{ |
|
|
{ |
|
|
operand = s; |
|
|
operand = s; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addRename(String s1, String s2) |
|
|
public void addRename(String s1, String s2) |
|
|
{ |
|
|
{ |
|
|
from.addElement(s1); |
|
|
from.addElement(s1); |
|
|
to.addElement(s2); |
|
|
to.addElement(s2); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setRename(int i, String s1, String s2) |
|
|
public void setRename(int i, String s1, String s2) |
|
|
{ |
|
|
{ |
|
|
from.setElementAt(s1, i); |
|
|
from.setElementAt(s1, i); |
|
|
to.setElementAt(s2, i); |
|
|
to.setElementAt(s2, i); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get methods |
|
|
// Get methods |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SystemDefn getOperand() |
|
|
public SystemDefn getOperand() |
|
|
{ |
|
|
{ |
|
|
return operand; |
|
|
return operand; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getNumRenames() |
|
|
public int getNumRenames() |
|
|
{ |
|
|
{ |
|
|
return from.size(); |
|
|
return from.size(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getFrom(int i) |
|
|
public String getFrom(int i) |
|
|
{ |
|
|
{ |
|
|
return from.elementAt(i); |
|
|
return from.elementAt(i); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getTo(int i) |
|
|
public String getTo(int i) |
|
|
{ |
|
|
{ |
|
|
return to.elementAt(i); |
|
|
return to.elementAt(i); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getNewName(String s) |
|
|
public String getNewName(String s) |
|
|
{ |
|
|
{ |
|
|
int i; |
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i = from.indexOf(s); |
|
|
i = from.indexOf(s); |
|
|
if (i == -1) { |
|
|
if (i == -1) { |
|
|
return s; |
|
|
return s; |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return (String)to.elementAt(i); |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
return (String) to.elementAt(i); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Methods required for SystemDefn (all subclasses should implement): |
|
|
// Methods required for SystemDefn (all subclasses should implement): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@SuppressWarnings("deprecation") |
|
|
@SuppressWarnings("deprecation") |
|
|
public void getModules(Vector<String> v) |
|
|
public void getModules(Vector<String> v) |
|
|
@ -129,16 +128,17 @@ public class SystemRename extends SystemDefn |
|
|
{ |
|
|
{ |
|
|
int i, n; |
|
|
int i, n; |
|
|
String s; |
|
|
String s; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add action names in renames |
|
|
// add action names in renames |
|
|
// (only look in 'to' vector because we're only |
|
|
// (only look in 'to' vector because we're only |
|
|
// interested in actions _introduced_) |
|
|
// interested in actions _introduced_) |
|
|
n = getNumRenames(); |
|
|
n = getNumRenames(); |
|
|
for (i = 0; i < n; i++) { |
|
|
for (i = 0; i < n; i++) { |
|
|
s = getTo(i); |
|
|
s = getTo(i); |
|
|
if (!(v.contains(s))) v.addElement(s); |
|
|
|
|
|
|
|
|
if (!(v.contains(s))) |
|
|
|
|
|
v.addElement(s); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// recurse |
|
|
// recurse |
|
|
operand.getSynchs(v); |
|
|
operand.getSynchs(v); |
|
|
} |
|
|
} |
|
|
@ -148,47 +148,54 @@ public class SystemRename extends SystemDefn |
|
|
{ |
|
|
{ |
|
|
int i, n; |
|
|
int i, n; |
|
|
String s; |
|
|
String s; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add action names in renames |
|
|
// add action names in renames |
|
|
// (only look in 'to' vector because we're only |
|
|
// (only look in 'to' vector because we're only |
|
|
// interested in actions _introduced_) |
|
|
// interested in actions _introduced_) |
|
|
n = getNumRenames(); |
|
|
n = getNumRenames(); |
|
|
for (i = 0; i < n; i++) { |
|
|
for (i = 0; i < n; i++) { |
|
|
s = getTo(i); |
|
|
s = getTo(i); |
|
|
if (!(v.contains(s))) v.addElement(s); |
|
|
|
|
|
|
|
|
if (!(v.contains(s))) |
|
|
|
|
|
v.addElement(s); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// recurse |
|
|
// recurse |
|
|
operand.getSynchs(v, modulesFile); |
|
|
operand.getSynchs(v, modulesFile); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void getReferences(Vector<String> v) |
|
|
|
|
|
{ |
|
|
|
|
|
operand.getReferences(v); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Methods required for ASTElement: |
|
|
// Methods required for ASTElement: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Object accept(ASTVisitor v) throws PrismLangException |
|
|
public Object accept(ASTVisitor v) throws PrismLangException |
|
|
{ |
|
|
{ |
|
|
return v.visit(this); |
|
|
return v.visit(this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public String toString() |
|
|
public String toString() |
|
|
{ |
|
|
{ |
|
|
int i, n; |
|
|
int i, n; |
|
|
String s = ""; |
|
|
String s = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s = s + operand + "{"; |
|
|
s = s + operand + "{"; |
|
|
n = getNumRenames(); |
|
|
n = getNumRenames(); |
|
|
for (i = 0; i < n-1; i++) { |
|
|
|
|
|
|
|
|
for (i = 0; i < n - 1; i++) { |
|
|
s = s + getFrom(i) + "<-" + getTo(i) + ","; |
|
|
s = s + getFrom(i) + "<-" + getTo(i) + ","; |
|
|
} |
|
|
} |
|
|
if (n > 0) { |
|
|
if (n > 0) { |
|
|
s = s + getFrom(n-1) + "<-" + getTo(n-1); |
|
|
|
|
|
|
|
|
s = s + getFrom(n - 1) + "<-" + getTo(n - 1); |
|
|
} |
|
|
} |
|
|
s = s + "}"; |
|
|
s = s + "}"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return s; |
|
|
return s; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SystemDefn deepCopy() |
|
|
public SystemDefn deepCopy() |
|
|
{ |
|
|
{ |
|
|
|