@@ -19262,6 +19262,17 @@ else if (pars.size() == 1)
1926219262 }
1926319263 }
1926419264
19265+ if ("excludingAt".equals(data) &&
19266+ arrayIndex == null &&
19267+ pars != null)
19268+ { if (pars.size() == 1)
19269+ { Expression res =
19270+ Expression.simplifyExcludingAt(objR,
19271+ (Expression) pars.get(0));
19272+ return res;
19273+ }
19274+ }
19275+
1926519276 if ("insertAt".equals(data) &&
1926619277 arrayIndex == null &&
1926719278 pars != null)
@@ -19286,7 +19297,30 @@ else if (pars.size() == 1)
1928619297 }
1928719298 }
1928819299
19289- // excludingSubrange, setSubrange, + regex ops
19300+ if ("excludingSubrange".equals(data) &&
19301+ arrayIndex == null &&
19302+ pars != null)
19303+ { if (pars.size() == 2)
19304+ { Expression res =
19305+ Expression.simplifyExcludingSubrange(objR,
19306+ (Expression) pars.get(0),
19307+ (Expression) pars.get(1));
19308+ return res;
19309+ }
19310+ }
19311+
19312+ if ("setSubrange".equals(data) &&
19313+ arrayIndex == null &&
19314+ pars != null)
19315+ { if (pars.size() == 3)
19316+ { Expression res =
19317+ Expression.simplifySetSubrange(objR,
19318+ (Expression) pars.get(0),
19319+ (Expression) pars.get(1),
19320+ (Expression) pars.get(2));
19321+ return res;
19322+ }
19323+ }
1929019324
1929119325 BasicExpression res = (BasicExpression) clone();
1929219326 res.objectRef = objR;
@@ -19417,6 +19451,7 @@ public java.util.Map collectionOperatorUses(int level,
1941719451 data.equals("insertInto") ||
1941819452 data.equals("subrange") ||
1941919453 data.equals("setAt") ||
19454+ data.equals("excludingAt") ||
1942019455 data.equals("excludingSubrange") ||
1942119456 data.equals("setSubrange"))
1942219457 { Vector opers = (Vector) res.get(level);
@@ -19483,6 +19518,14 @@ public java.util.Map collectionOperatorUses(int level,
1948319518 Map uses, Vector messages)
1948419519 { // level |-> [x.setAt(i,y), etc]
1948519520
19521+ if (parameters != null)
19522+ { for (int i = 0; i < parameters.size(); i++)
19523+ { Expression par = (Expression) parameters.get(i);
19524+ par.collectionOperatorUses(level, res, vars,
19525+ uses, messages);
19526+ }
19527+ }
19528+
1948619529 /* JOptionPane.showInputDialog("Collection uses of " + this + " " + level + " " + objectRef + " " + parameters); */
1948719530
1948819531 if (objectRef != null || parameters != null ||
@@ -19491,11 +19534,7 @@ public java.util.Map collectionOperatorUses(int level,
1949119534 Vector vuses = variablesUsedIn(vars);
1949219535 int syncom = syntacticComplexity();
1949319536
19494- /* JOptionPane.showInputDialog("Complexity of " + this +
19495- " = " + syncom + " uses = " + vuses +
19496- " level: " + level + " sideeffect: " + sideeffect); */
19497-
19498- if (syncom >= TestParameters.energyCloneSizeLimit &&
19537+ if (syncom > TestParameters.energyCloneSizeLimit &&
1949919538 level > 1 && vuses.size() == 0 && !sideeffect)
1950019539 { messages.add("!!! Warning (LCE): The expression " + this + " may be independent of the iterator variables " + vars + "\n" +
1950119540 "!!! Use Extract local variable to optimise.");
@@ -19506,12 +19545,24 @@ public java.util.Map collectionOperatorUses(int level,
1950619545 int oescount = (int) uses.get("LCE");
1950719546 uses.set("LCE", oescount+1);
1950819547 }
19548+ else if (syncom > 1 &&
19549+ level > 1 && vuses.size() == 0 && !sideeffect)
19550+ { messages.add("! Warning (OEW): The expression " + this + " may be independent of the iterator variables " + vars + "\n" +
19551+ "! Use Extract local variable to optimise.");
19552+ refactorELV = true;
19553+ int yScore = (int) uses.get("yellow");
19554+ uses.set("yellow", yScore+1);
19555+ messages.add("");
19556+ int oewcount = (int) uses.get("OEW");
19557+ uses.set("OEW", oewcount+1);
19558+ }
1950919559 } // Any non-trivial basic expression
1951019560
1951119561 if (data.equals("insertAt") ||
1951219562 data.equals("insertInto") ||
1951319563 data.equals("subrange") ||
1951419564 data.equals("setAt") ||
19565+ data.equals("excludingAt") ||
1951519566 data.equals("excludingSubrange") ||
1951619567 data.equals("setSubrange"))
1951719568 { Vector opers = (Vector) res.get(level);
0 commit comments