public void changeBalance(Subscriber ss, Double cost) { sslist = jsrw.readSubscr(); for (int i = 0; i < sslist.size(); i++) { sslist = jsrw.readSubscr(); if (sslist.get(i).equalsSubscr(ss)) sslist.get(i).replenish(cost); } jsrw.rewriteSubscr(sslist); }
public void changeBalance(String phNumber, Double cost) { sslist = jsrw.readSubscr(); for (int i = 0; i < sslist.size(); i++) { String subnumber = sslist.get(i).getPhnumber(); if (subnumber.equals(phNumber)) { sslist.get(i).replenish(cost); } } jsrw.rewriteSubscr(sslist); }
public void findSubscr(String str, DefaultListModel listModel) { if (str.isEmpty()) listModel.addElement("Пожалуйста, введите запрос"); else { sslist = jsrw.readSubscr(); for (Subscriber subscr : sslist) { String subname = subscr.getFullName(); String subnumber = subscr.getPhnumber(); if ((subname.contains(str) || subnumber.contains(str)) && !str.isEmpty()) { listModel.addElement(subnumber + ' ' + subname + ' ' + subscr.getBalance()); } } if (listModel.isEmpty()) listModel.addElement("Совпадений не найдено"); } }
public List<Subscriber> getSslist() { sslist = jsrw.readSubscr(); return sslist; }