Java Code Examples for org.jetbrains.java.decompiler.util.InterpreterUtil#equalObjects()

The following examples show how to use org.jetbrains.java.decompiler.util.InterpreterUtil#equalObjects() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SSAUConstructorSparseEx.java    From JByteMod-Beta with GNU General Public License v2.0 6 votes vote down vote up
private static boolean mapsEqual(SFormsFastMapDirect map1, SFormsFastMapDirect map2) {

    if (map1 == null) {
      return map2 == null;
    } else if (map2 == null) {
      return false;
    }

    if (map1.size() != map2.size()) {
      return false;
    }

    for (Entry<Integer, FastSparseSet<Integer>> ent2 : map2.entryList()) {
      if (!InterpreterUtil.equalObjects(map1.get(ent2.getKey()), ent2.getValue())) {
        return false;
      }
    }

    return true;
  }
 
Example 2
Source File: SSAConstructorSparseEx.java    From JByteMod-Beta with GNU General Public License v2.0 6 votes vote down vote up
private static boolean mapsEqual(SFormsFastMapDirect map1, SFormsFastMapDirect map2) {

    if (map1 == null) {
      return map2 == null;
    } else if (map2 == null) {
      return false;
    }

    if (map1.size() != map2.size()) {
      return false;
    }

    for (Entry<Integer, FastSparseSet<Integer>> ent2 : map2.entryList()) {
      if (!InterpreterUtil.equalObjects(map1.get(ent2.getKey()), ent2.getValue())) {
        return false;
      }
    }

    return true;
  }
 
Example 3
Source File: SwitchExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this) {
    return true;
  }

  if (o == null || !(o instanceof SwitchExprent)) {
    return false;
  }

  SwitchExprent sw = (SwitchExprent) o;
  return InterpreterUtil.equalObjects(value, sw.getValue());
}
 
Example 4
Source File: VarType.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this) {
    return true;
  }

  if (o == null || !(o instanceof VarType)) {
    return false;
  }

  VarType vt = (VarType) o;
  return type == vt.type && arrayDim == vt.arrayDim && InterpreterUtil.equalObjects(value, vt.value);
}
 
Example 5
Source File: ArrayExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof ArrayExprent))
    return false;

  ArrayExprent arr = (ArrayExprent) o;
  return InterpreterUtil.equalObjects(array, arr.getArray()) && InterpreterUtil.equalObjects(index, arr.getIndex());
}
 
Example 6
Source File: ConstExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof ConstExprent))
    return false;

  ConstExprent cn = (ConstExprent) o;
  return InterpreterUtil.equalObjects(constType, cn.getConstType()) && InterpreterUtil.equalObjects(value, cn.getValue());
}
 
Example 7
Source File: FieldExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof FieldExprent))
    return false;

  FieldExprent ft = (FieldExprent) o;
  return InterpreterUtil.equalObjects(name, ft.getName()) && InterpreterUtil.equalObjects(classname, ft.getClassname()) && isStatic == ft.isStatic()
      && InterpreterUtil.equalObjects(instance, ft.getInstance()) && InterpreterUtil.equalObjects(descriptor, ft.getDescriptor());
}
 
Example 8
Source File: InvocationExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof InvocationExprent))
    return false;

  InvocationExprent it = (InvocationExprent) o;
  return InterpreterUtil.equalObjects(name, it.getName()) && InterpreterUtil.equalObjects(classname, it.getClassname()) && isStatic == it.isStatic()
      && InterpreterUtil.equalObjects(instance, it.getInstance()) && InterpreterUtil.equalObjects(descriptor, it.getDescriptor())
      && functype == it.getFunctype() && InterpreterUtil.equalLists(lstParameters, it.getLstParameters());
}
 
Example 9
Source File: MonitorExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof MonitorExprent))
    return false;

  MonitorExprent me = (MonitorExprent) o;
  return monType == me.getMonType() && InterpreterUtil.equalObjects(value, me.getValue());
}
 
Example 10
Source File: ExitExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof ExitExprent))
    return false;

  ExitExprent et = (ExitExprent) o;
  return exitType == et.getExitType() && InterpreterUtil.equalObjects(value, et.getValue());
}
 
Example 11
Source File: AssignmentExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof AssignmentExprent))
    return false;

  AssignmentExprent as = (AssignmentExprent) o;
  return InterpreterUtil.equalObjects(left, as.getLeft()) && InterpreterUtil.equalObjects(right, as.getRight()) && condType == as.getCondType();
}
 
Example 12
Source File: IfExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof IfExprent))
    return false;

  IfExprent ie = (IfExprent) o;
  return InterpreterUtil.equalObjects(condition, ie.getCondition());
}
 
Example 13
Source File: VarExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof VarExprent))
    return false;

  VarExprent ve = (VarExprent) o;
  return index == ve.getIndex() && version == ve.getVersion() && InterpreterUtil.equalObjects(getVarType(), ve.getVarType()); // FIXME: varType comparison redundant?
}
 
Example 14
Source File: NewExprent.java    From JByteMod-Beta with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object o) {
  if (o == this)
    return true;
  if (o == null || !(o instanceof NewExprent))
    return false;

  NewExprent ne = (NewExprent) o;
  return InterpreterUtil.equalObjects(newType, ne.getNewType()) && InterpreterUtil.equalLists(lstDims, ne.getLstDims())
      && InterpreterUtil.equalObjects(constructor, ne.getConstructor()) && directArrayInit == ne.directArrayInit
      && InterpreterUtil.equalLists(lstArrayElements, ne.getLstArrayElements());
}
 
Example 15
Source File: StackVarsProcessor.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private static boolean isVersionToBeReplaced(VarVersionPair usedvar,
                                             Map<Integer, Set<VarVersionPair>> mapVars,
                                             SSAUConstructorSparseEx ssau,
                                             VarVersionPair leftpaar) {
    VarVersionsGraph ssuversions = ssau.getSsuversions();

    SFormsFastMapDirect mapLiveVars = ssau.getLiveVarVersionsMap(usedvar);
    if (mapLiveVars == null) {
        // dummy version, predecessor of a phi node
        return false;
    }

    // compare protected ranges
    if (!InterpreterUtil.equalObjects(ssau.getMapVersionFirstRange().get(leftpaar),
            ssau.getMapVersionFirstRange().get(usedvar))) {
        return false;
    }

    for (Entry<Integer, Set<VarVersionPair>> ent : mapVars.entrySet()) {
        FastSparseSet<Integer> liveverset = mapLiveVars.get(ent.getKey());
        if (liveverset == null) {
            return false;
        }

        Set<VarVersionNode> domset = new HashSet<>();
        for (VarVersionPair verpaar : ent.getValue()) {
            domset.add(ssuversions.nodes.getWithKey(verpaar));
        }

        boolean isdom = false;

        for (Integer livever : liveverset) {
            VarVersionNode node = ssuversions.nodes.getWithKey(new VarVersionPair(ent.getKey().intValue(), livever.intValue()));

            if (ssuversions.isDominatorSet(node, domset)) {
                isdom = true;
                break;
            }
        }

        if (!isdom) {
            return false;
        }
    }

    return true;
}
 
Example 16
Source File: StackVarsProcessor.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isVersionToBeReplaced(VarVersionPair usedvar, HashMap<Integer, HashSet<VarVersionPair>> mapVars,
    SSAUConstructorSparseEx ssau, VarVersionPair leftpaar) {

  VarVersionsGraph ssuversions = ssau.getSsuversions();

  SFormsFastMapDirect mapLiveVars = ssau.getLiveVarVersionsMap(usedvar);
  if (mapLiveVars == null) {
    // dummy version, predecessor of a phi node
    return false;
  }

  // compare protected ranges
  if (!InterpreterUtil.equalObjects(ssau.getMapVersionFirstRange().get(leftpaar), ssau.getMapVersionFirstRange().get(usedvar))) {
    return false;
  }

  for (Entry<Integer, HashSet<VarVersionPair>> ent : mapVars.entrySet()) {
    FastSparseSet<Integer> liveverset = mapLiveVars.get(ent.getKey());
    if (liveverset == null) {
      return false;
    }

    HashSet<VarVersionNode> domset = new HashSet<>();
    for (VarVersionPair verpaar : ent.getValue()) {
      domset.add(ssuversions.nodes.getWithKey(verpaar));
    }

    boolean isdom = false;

    for (Integer livever : liveverset) {
      VarVersionNode node = ssuversions.nodes.getWithKey(new VarVersionPair(ent.getKey().intValue(), livever.intValue()));

      if (ssuversions.isDominatorSet(node, domset)) {
        isdom = true;
        break;
      }
    }

    if (!isdom) {
      return false;
    }
  }

  return true;
}
 
Example 17
Source File: ClassesProcessor.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
private static boolean equal(Inner o1, Inner o2) {
  return o1.type == o2.type && o1.accessFlags == o2.accessFlags && InterpreterUtil.equalObjects(o1.simpleName, o2.simpleName);
}
 
Example 18
Source File: ClassesProcessor.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
private static boolean equal(Inner o1, Inner o2) {
    return o1.type == o2.type && o1.accessFlags == o2.accessFlags && InterpreterUtil.equalObjects(o1.simpleName, o2.simpleName);
}