public void simplify()
  {
top:for(Element elem1 : array)
    {
      for(Element elem2 : array)
      {
      if(elem1 != elem2 && elem1.getClass().getName().equals("PowerSupply") == false && elem2.getClass().getName().equals("PowerSupply") == false)
      {
          if(elem1.getConnections("first").indexOf(elem2) != -1 && elem1.getConnections("second").indexOf(elem2) != -1)
          {
            replaceParallel(elem1,elem2);
            break top;
          }
          else if(elem1.getConnections("second").indexOf(elem2) !=-1 && elem1.getConnections("second").size() == 1)
          {
            replaceSerial(elem1,elem2);
            break top;
          }
        }
      }
    }
  }