コード例 #1
0
  @Override
  public void process(CtElement candidate) {
    if (!isToBeProcessed(candidate)) return;

    CtModifiable cm = (CtModifiable) candidate;
    ModifierKind mk = cm.getVisibility();

    do cm.setVisibility(kinds[r.nextInt(kinds.length)]);
    while (cm.getVisibility() == mk);

    infoWriter(candidate, mk.toString(), cm.getVisibility().toString(), mutatorName);
  }
コード例 #2
0
  @Override
  public boolean isToBeProcessed(CtElement candidate) {
    if (!(candidate instanceof CtModifiable)) return false;

    CtModifiable cm = (CtModifiable) candidate;
    if (!(cm instanceof CtVariable)) return false;

    ModifierKind mk = cm.getVisibility();

    for (int i = kinds.length - 1; i >= 0; i--)
      if (mk == kinds[i]) return (r.nextInt(100) < CHANCE); // SELECTOR
    return false;
  }