private boolean match(MatchNode matchNode, IMatchable object) { if (!object.match(matchNode, this)) { return false; } int expr_index = 0; int stat_index = 0; for (MatchNode childNode : matchNode.getChildren()) { boolean isStatement = childNode.getType() == MatchNode.MATCHNODE_STATEMENT; IMatchable childObject = object.findObject(childNode, isStatement ? stat_index : expr_index); if (childObject == null || !match(childNode, childObject)) { return false; } if (isStatement) { stat_index++; } else { expr_index++; } } return true; }
public boolean match(IMatchable object) { variables.clear(); return match(this.rootNode, object); }
@Override public boolean match(MatchNode matchNode, MatchEngine engine) { if (matchNode.getType() != MatchNode.MATCHNODE_EXPRENT) { return false; } for (Entry<MatchProperties, RuleValue> rule : matchNode.getRules().entrySet()) { MatchProperties key = rule.getKey(); if (key == MatchProperties.EXPRENT_TYPE && this.type != (Integer)rule.getValue().value) { return false; } if (key == MatchProperties.EXPRENT_RET && !engine.checkAndSetVariableValue((String)rule.getValue().value, this)) { return false; } } return true; }
@Override public boolean match(MatchNode matchNode, MatchEngine engine) { if (!super.match(matchNode, engine)) { return false; } RuleValue rule = matchNode.getRules().get(MatchProperties.EXPRENT_FIELD_NAME); if (rule != null) { if (rule.isVariable()) { return engine.checkAndSetVariableValue((String)rule.value, this.name); } else { return rule.value.equals(this.name); } } return true; } }
@Override public IMatchable findObject(MatchNode matchNode, int index) { IMatchable object = super.findObject(matchNode, index); if (object != null) { return object; } if (matchNode.getType() == MatchNode.MATCHNODE_EXPRENT) { String position = (String)matchNode.getRuleValue(MatchProperties.EXPRENT_POSITION); if ("head".equals(position)) { return getHeadexprent(); } } return null; }
private static boolean collapseInlinedClass14(Statement stat) { boolean ret = class14Builder.match(stat); if (ret) { String class_name = (String)class14Builder.getVariableValue("$classname$"); AssignmentExprent assignment = (AssignmentExprent)class14Builder.getVariableValue("$assignfield$"); FieldExprent fieldExpr = (FieldExprent)class14Builder.getVariableValue("$field$"); assignment.replaceExprent(assignment.getRight(), new ConstExprent(VarType.VARTYPE_CLASS, class_name, null)); List<Exprent> data = new ArrayList<>(stat.getFirst().getExprents()); stat.setExprents(data); SequenceHelper.destroyAndFlattenStatement(stat); ClassWrapper wrapper = (ClassWrapper)DecompilerContext.getProperty(DecompilerContext.CURRENT_CLASS_WRAPPER); if (wrapper != null) { wrapper.getHiddenMembers().add(InterpreterUtil.makeUniqueKey(fieldExpr.getName(), fieldExpr.getDescriptor().descriptorString)); } } return ret; } }
@Override public boolean match(MatchNode matchNode, MatchEngine engine) { if (!super.match(matchNode, engine)) { return false; } Integer type = (Integer)matchNode.getRuleValue(MatchProperties.EXPRENT_EXITTYPE); return type == null || this.exitType == type; } }
@Override public boolean match(MatchNode matchNode, MatchEngine engine) { if (!super.match(matchNode, engine)) { return false; } RuleValue rule = matchNode.getRules().get(MatchProperties.EXPRENT_VAR_INDEX); if (rule != null) { if (rule.isVariable()) { return engine.checkAndSetVariableValue((String)rule.value, this.index); } else { return this.index == Integer.valueOf((String)rule.value); } } return true; } }
private boolean match(MatchNode matchNode, IMatchable object) { if(!object.match(matchNode, this)) { return false; } int expr_index = 0; int stat_index = 0; for(MatchNode childNode : matchNode.getChildren()) { boolean isStatement = childNode.getType() == MatchNode.MATCHNODE_STATEMENT; IMatchable childObject = object.findObject(childNode, isStatement ? stat_index : expr_index); if(childObject == null || !match(childNode, childObject)) { return false; } if(isStatement) { stat_index++; } else { expr_index++; } } return true; }
@Override public boolean match(MatchNode matchNode, MatchEngine engine) { if (matchNode.getType() != MatchNode.MATCHNODE_STATEMENT) { return false; for (Entry<MatchProperties, RuleValue> rule : matchNode.getRules().entrySet()) { switch (rule.getKey()) { case STATEMENT_TYPE: if (!engine.checkAndSetVariableValue((String)rule.getValue().value, this)) { return false;
@Override public IMatchable findObject(MatchNode matchNode, int index) { if (matchNode.getType() != MatchNode.MATCHNODE_EXPRENT) { return null; } List<Exprent> lstAllExprents = getAllExprents(); if (lstAllExprents == null || lstAllExprents.isEmpty()) { return null; } String position = (String)matchNode.getRuleValue(MatchProperties.EXPRENT_POSITION); if (position != null) { if (position.matches("-?\\d+")) { return lstAllExprents.get((lstAllExprents.size() + Integer.parseInt(position)) % lstAllExprents.size()); // care for negative positions } } else if (index < lstAllExprents.size()) { // use 'index' parameter return lstAllExprents.get(index); } return null; }
@Override public boolean match(MatchNode matchNode, MatchEngine engine) { if (!super.match(matchNode, engine)) { return false; } Integer type = (Integer)matchNode.getRuleValue(MatchProperties.EXPRENT_FUNCTYPE); return type == null || this.funcType == type; } }
public boolean match(IMatchable object) { variables.clear(); return match(this.rootNode, object); }
@Override public boolean match(MatchNode matchNode, MatchEngine engine) { if (!super.match(matchNode, engine)) { return false; } for (Entry<MatchProperties, RuleValue> rule : matchNode.getRules().entrySet()) { RuleValue value = rule.getValue(); MatchProperties key = rule.getKey(); if (key == MatchProperties.EXPRENT_CONSTTYPE) { if (!value.value.equals(this.constType)) { return false; } } else if (key == MatchProperties.EXPRENT_CONSTVALUE) { if (value.isVariable() && !engine.checkAndSetVariableValue(value.value.toString(), this.value)) { return false; } } } return true; } }
@Override public IMatchable findObject(MatchNode matchNode, int index) { int node_type = matchNode.getType(); if (node_type == MatchNode.MATCHNODE_STATEMENT && !this.stats.isEmpty()) { String position = (String)matchNode.getRuleValue(MatchProperties.STATEMENT_POSITION); if (position != null) { if (position.matches("-?\\d+")) { return this.stats.get((this.stats.size() + Integer.parseInt(position)) % this.stats.size()); // care for negative positions } } else if (index < this.stats.size()) { // use 'index' parameter return this.stats.get(index); } } else if (node_type == MatchNode.MATCHNODE_EXPRENT && this.exprents != null && !this.exprents.isEmpty()) { String position = (String)matchNode.getRuleValue(MatchProperties.EXPRENT_POSITION); if (position != null) { if (position.matches("-?\\d+")) { return this.exprents.get((this.exprents.size() + Integer.parseInt(position)) % this.exprents.size()); // care for negative positions } } else if (index < this.exprents.size()) { // use 'index' parameter return this.exprents.get(index); } } return null; }
@Override public boolean match(MatchNode matchNode, MatchEngine engine) { if (!super.match(matchNode, engine)) { return false; } Integer type = (Integer)matchNode.getRuleValue(MatchProperties.STATEMENT_IFTYPE); return type == null || this.iftype == type; } }
for (Entry<MatchProperties, RuleValue> rule : matchNode.getRules().entrySet()) { RuleValue value = rule.getValue(); if (value.isVariable() && (value.parameter >= lstParameters.size() || !engine.checkAndSetVariableValue(value.value.toString(), lstParameters.get(value.parameter)))) { return false;
public boolean match(MatchNode matchNode, MatchEngine engine) { if(!super.match(matchNode, engine)) { return false; } RuleValue rule = matchNode.getRules().get(MatchProperties.EXPRENT_FIELD_NAME); if(rule != null) { if(rule.isVariable()) { if(!engine.checkAndSetVariableValue((String)rule.value, this.name)) { return false; } } else { if(!rule.value.equals(this.name)) { return false; } } } return true; } }
public boolean match(MatchNode matchNode, MatchEngine engine) { if(!super.match(matchNode, engine)) { return false; } RuleValue rule = matchNode.getRules().get(MatchProperties.EXPRENT_VAR_INDEX); if(rule != null) { if(rule.isVariable()) { if(!engine.checkAndSetVariableValue((String)rule.value, this.index)) { return false; } } else { if(this.index != Integer.valueOf((String)rule.value).intValue()) { return false; } } } return true; }