}
//To make the below code a bit more consice...START
boolean bNullOk = getPARString().getPARDupNullLen().isNullOk();
RCLength rclArray = getPARString().getPARDupNullLen().getRCLength();
boolean bDupsOk = getPARString().getPARDupNullLen().areDupsOk();
boolean bContainmentOk = getPARString().getPARSContain().isContainmentOk();
boolean bOrderedContainment = getPARString().getPARSContain().mustBeOrdered();
boolean bContainOrderAscDesc = getPARString().getPARSContain().getOrderDirAscDesc();
boolean bNullLmntOk = getPARString().getPARSElement().isNullLmntOk();
RCLength rclLmnt = getPARString().getPARSElement().getRCLength();
boolean bAXIfBad = (s_callingClsFnc != null || s_varName != null);
//To make the below code a bit more consice...END
if(!bNullOk) {
if(isNull()) {
setPAViolation(new PAViolation(PAViolation.getType_NULL()));
if(bAXIfBad) {
throwAXIllegal(s_callingClsFnc, s_varName, "isNull() equals true.");
}
return false;
}
} else if(isNull()) {
//A null array cannot be analyzed further.
declareNoViolation();
return true;
}
//The array is not null.
if(!rclArray.isValid(getLength())) {
setPAViolation(new PAViolation(PAViolation.getType_LENGTH()));
if(bAXIfBad) {
throwAXIllegal(s_callingClsFnc, s_varName, "the number of elements in the array (" + getLength() + ") is illegal according to getPARString().getPARDupNullLen().getRCLength().isValid().");
}
return false;
} else if(getLength() < 1) {
//The array is zero elements in length, and this is okay.
//An empty array can, but does not need to be analyzed further.
declareNoViolation();
return true;
}
//The string array has at least one element.
final String sLMNT = "element ";
final String sPRN_QT = " ('";
for(int i = 0; i < getLength(); i++) {
if(!bNullLmntOk && getString(i) == null) {
//A null element is bad.
setPAViolation(new PAViolation(PAViolation.getType_SLMNT_NULL(), i));
if(bAXIfBad) {
throwAXIllegal(s_callingClsFnc, s_varName, sLMNT + i + " is null.");
}
return false;
}
//If the element is null, this is okee dokee.
if(getString(i) != null && !rclLmnt.isValid(getString(i).length())) {
setPAViolation(new PAViolation(PAViolation.getType_SLMNT_LENGTH(), i));;
if(bAXIfBad) {
throwAXIllegal(s_callingClsFnc, s_varName, "the length of element " + i + sPRN_QT + getString(i) + "', length " + getString(i).length() + ") is illegal according to getPARString().getPARSElement().getRCLength().isValid().");
}