/** * Gets list of all acceptable cardinalities for this expression from its parent. * * <ol> * <li>evaluates index of this expression in parent * <li>calls parent's <code>getRequiredCardinalities(index)</code> method * </ol> * * If this expression doesn't have any parent (it is legal for testing, but not for real use * case), returns list of all cardinalities. * * @param context TODO * @return list of all acceptable cardinalities for this expression from its parent */ protected final Cardinality[] getParentRequiredCardinalities(final ValidationContext context) { if (getParent() != null) { final int index = getParent() .getNodeGroups() .getGroupSupporting(getQtiClassName()) .getChildren() .indexOf(this); return getParent().getRequiredCardinalities(context, index); } return Cardinality.values(); }