Ejemplo n.º 1
0
  private ArrayList<Element> removeEquationFromList(
      ArrayList<Element> list, ArrayList<Element> equationElement) {

    for (Element element : equationElement) list.remove(element);

    return list;
  }
Ejemplo n.º 2
0
  private ArrayList<Element> sortList(ArrayList<Element> list) {

    ArrayList<Element> listSorted = new ArrayList<>();
    ArrayList<Element> elements = new ArrayList<>(Element.values());

    for (Element element : elements)
      while (list.contains(element)) {
        list.remove(element);
        listSorted.add(element);
      }

    return listSorted;
  }
Ejemplo n.º 3
0
  private boolean listContainsEquation(
      ArrayList<Element> list, ArrayList<Element> equationElement) {

    ArrayList<Element> listClone = list.clone();

    for (Element element : equationElement) {

      if (listClone.contains(element)) listClone.remove(element);
      else return false;
    }

    return true;
  }
Ejemplo n.º 4
0
  public boolean isPerfectPosition(ArrayList<Element> list) {

    for (ArrayList<Element> pPosition : this.perfectPositions) {

      if (pPosition.size() != list.size()) continue;

      ArrayList<Element> listTemp = list.clone();

      boolean notFound = false;

      for (Element element : pPosition)
        if (listTemp.contains(element)) listTemp.remove(element);
        else notFound = true;

      if (notFound) continue;

      if (!listTemp.isEmpty()) continue;

      return true;
    }

    return false;
  }
 public final void remove(int index) {
   lines.remove(index);
 }