Skip to content

Commit f676b07

Browse files
authored
Add files via upload
1 parent 116b2ce commit f676b07

19 files changed

+2667
-0
lines changed

version24/ValueMatching.class

1.69 KB
Binary file not shown.

version24/ValueMatching.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/******************************
2+
* Copyright (c) 2003--2024 Kevin Lano
3+
* This program and the accompanying materials are made available under the
4+
* terms of the Eclipse Public License 2.0 which is available at
5+
* http://www.eclipse.org/legal/epl-2.0
6+
*
7+
* SPDX-License-Identifier: EPL-2.0
8+
* *****************************/
9+
/* package: TransformationSynthesis */
10+
11+
12+
public class ValueMatching
13+
{ Expression src;
14+
Expression trg;
15+
16+
public ValueMatching(Expression s, Expression t)
17+
{ src = s;
18+
trg = t;
19+
}
20+
21+
public ValueMatching(String s, String t)
22+
{ src = new BasicExpression(s);
23+
trg = new BasicExpression(t);
24+
}
25+
26+
public String toString()
27+
{ return src + " |--> " + trg; }
28+
29+
public boolean isIdentityMapping()
30+
{ String ss = (src + "").trim();
31+
String tt = (trg + "").trim();
32+
if ("_1".equals(ss) && "_1".equals(tt))
33+
{ return true; }
34+
if ("_0".equals(ss) && "_0".equals(tt))
35+
{ return true; }
36+
if (ss.startsWith("\"") && ss.endsWith("\"") &&
37+
tt.startsWith("\"") && tt.endsWith("\"") &&
38+
ss.substring(1,ss.length()-1).trim().equals(
39+
tt.substring(1,tt.length()-1).trim()))
40+
{ System.out.println(">>> Identity mapping: " + ss + " |--> " + tt);
41+
return true;
42+
}
43+
return false;
44+
}
45+
46+
public ValueMatching invert()
47+
{ return new ValueMatching(trg,src); }
48+
49+
public boolean equals(Object obj)
50+
{ if (obj instanceof ValueMatching)
51+
{ ValueMatching vm = (ValueMatching) obj;
52+
if (src.equals(vm.src) && trg.equals(vm.trg))
53+
{ return true; }
54+
}
55+
return false;
56+
}
57+
}

version24/VarAnalInfo.class

899 Bytes
Binary file not shown.

version24/VarAnalInfo.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import java.util.Vector;
2+
3+
/******************************
4+
* Copyright (c) 2003,2019 Kevin Lano
5+
* This program and the accompanying materials are made available under the
6+
* terms of the Eclipse Public License 2.0 which is available at
7+
* http://www.eclipse.org/legal/epl-2.0
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
* *****************************/
11+
12+
class VarAnalInfo extends Named
13+
{ Vector allvars = new Vector();
14+
Vector locals = new Vector();
15+
Vector foreign = new Vector();
16+
17+
VarAnalInfo(String nme, Vector allvs)
18+
{ super(nme);
19+
allvars = allvs;
20+
}
21+
22+
public void setLocals(Vector locs)
23+
{ locals = locs; }
24+
25+
public Vector getLocals()
26+
{ return (Vector) locals.clone(); }
27+
28+
public void addLocal(String var)
29+
{ locals.add(var); }
30+
31+
public Object clone()
32+
{ VarAnalInfo res = new VarAnalInfo(label,allvars);
33+
res.setLocals(locals);
34+
res.foreign = (Vector) foreign.clone();
35+
return res;
36+
}
37+
}
38+

version24/VectorUtil.class

15.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)