use of pcgen.facade.core.InfoFacade in project pcgen by PCGen.
the class RandomChooser method makeChoice.
@Override
public boolean makeChoice(ChooserFacade chooserFacade) {
while (chooserFacade.getRemainingSelections().get() > 0 && !chooserFacade.getAvailableList().isEmpty()) {
ListFacade<InfoFacade> availableList = chooserFacade.getAvailableList();
final InfoFacade addObj = availableList.getElementAt(RandomUtil.getRandomInt(availableList.getSize() - 1));
chooserFacade.addSelected(addObj);
}
if (chooserFacade.getRemainingSelections().get() == 0 || !chooserFacade.isRequireCompleteSelection()) {
chooserFacade.commit();
return true;
}
chooserFacade.rollback();
return false;
}
Aggregations