/** * ****************************************************************** determines if a card at row * and position is covered * * @exception: IllegalArgumentException if row or position is invalid * @exception: IllegalStateException if there is no card there */ public boolean isCovered(PositionCard pc) { if (pc == null) { throw new IllegalArgumentException("Pyramid::isCovered() received null argument."); } return isCovered(pc.getRow(), pc.getPosition()); }
/** * **************************************************************** Adds a PositionCard to the * pyramid returns false if there is already a card there * * @exception: IllegalArgumentException if the positioncard is null */ public boolean addCard(PositionCard pc) { if (pc == null) { throw new IllegalArgumentException("Cannot add null card to pyramid"); } int r = pc.getRow(); int p = pc.getPosition(); if (pyrArray[r][p] != null) { return false; } pyrArray[r][p] = pc; hasChanged(); return true; }