xbn.array
Class CompareArrays

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.array.CompareArrays

public class CompareArrays
extends XBNObject

Compare the values in two PrimitiveArrays. See PrimitiveArray.

Source code:  CompareArrays.java


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
CompareArrays()
          Create a CompareArrays with default settings.
CompareArrays(CAConfig ca_config)
          Create a CompareArrays.
 
Method Summary
 void crashIfBadValues(PrimitiveArray pa_rqd, PrimitiveArray pa_actual)
          If the actual values are illegal crash with an explanation.
 void crashIfBadValues(String s_callingClsFnc, String s_rqdName, String s_actualName, PrimitiveArray pa_rqd, PrimitiveArray pa_actual)
          If the actual values are illegal crash with an explanation.
 boolean doAssumePAActlValid()
          Should it be assumed (by hasRqdValues) that the actual PrimitiveArray is (individually) valid and ready for comparison?
 boolean doAssumePARqdValid()
          Should it be assumed (by hasRqdValues) that the required PrimitiveArray is (individually) valid and ready for comparison?
 boolean doAssumePAsValid()
          Should it be assumed (by hasRqdValues) that both the required and actual PrimitiveArrays are (individually) valid and ready for comparison?
 CAConfig getCAConfig()
          Get the CAConfig for direct maniplation.
 boolean hasRqdValues(PrimitiveArray pa_rqd, PrimitiveArray pa_actual)
          Are the actual values legal, according to both the rules in CAConfig and the "required" values?
 boolean hasRqdValues(String s_callingClsFnc, String s_rqdName, String s_actualName, PrimitiveArray pa_rqd, PrimitiveArray pa_actual)
          Are the actual values legal, according to both the rules in CAConfig and the "required" values?
 void setAssumePAActlValid(boolean b_assumePAActlValid)
          Declare if it should be assumed (by hasRqdValues) that the actual PrimitiveArray is (individually) valid and ready for comparison.
 void setAssumePARqdValid(boolean b_assumePARqdValid)
          Declare if it should be assumed (by hasRqdValues) that the required PrimitiveArray is (individually) valid and ready for comparison.
 void setAssumePAsValid(boolean b_assumePAsValid)
          Declare if it should be assumed (by hasRqdValues) that both the required and actual PrimitiveArrays are (individually) valid and ready for comparison.
protected  void throwAXBad(String s_callingClsFnc, String s_actualName, PrimitiveArray pa_rqd, PrimitiveArray pa_actual, String s_currently)
          Used internally, by hasRqdValues.
 
Methods inherited from class xbn.XBNObject
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompareArrays

public CompareArrays()

Create a CompareArrays with default settings.

Equal to CompareArrays(new CAConfig())


CompareArrays

public CompareArrays(CAConfig ca_config)

Create a CompareArrays.

Parameters:
ca_config - Defines the rules used when comparing the two PrimitiveArrays. May not be null. See getCAConfig.
Method Detail

getCAConfig

public CAConfig getCAConfig()

Get the CAConfig for direct maniplation.

Returns:
ca_config Exactly as provided to the constructor.

setAssumePAsValid

public final void setAssumePAsValid(boolean b_assumePAsValid)

Declare if it should be assumed (by hasRqdValues) that both the required and actual PrimitiveArrays are (individually) valid and ready for comparison. See hasRqdValues and PrimitiveArray.wasValidated.

Get with doAssumePAsValid.

hasRqdValues expects that both pa_rqd.wasValidated() and pa_actual.wasValidated() equal true and pa_rqd.getPrimitiveArrayRule().getPARDupNullLen().areDupsOk(), pa_rqd.getPrimitiveArrayRule().getPARDupNullLen().isNullOk() and pa_actual.getPrimitiveArrayRule().getPARDupNullLen().isNullOk() all equal false.

If pa_actual and pa_rqd are both definitely valid--you knew this before you even created the PrimitiveArrays--then don't waste time validating them. Just call this function with "true", and the hasRqdValues function will just assume that the above requirements have been met, without checking. Understand you will get unpredictable results if you use this function but shouldn't.

This function first calls setAssumePARqdValid(b_assumePAsValid) and then setAssumePAActlValid(b_assumePAsValid)


doAssumePAsValid

public final boolean doAssumePAsValid()

Should it be assumed (by hasRqdValues) that both the required and actual PrimitiveArrays are (individually) valid and ready for comparison?

Set with setAssumePAsValid.

Returns:
(doAssumePARqdValid() && doAssumePAActlValid())

setAssumePARqdValid

public final void setAssumePARqdValid(boolean b_assumePARqdValid)

Declare if it should be assumed (by hasRqdValues) that the required PrimitiveArray is (individually) valid and ready for comparison. See setAssumePAsValid for information.

Get with doAssumePARqdValid.

Parameters:
b_assumePARqdValid - Should hasRqdValues assume that the required PrimitiveArray is individually valid? If true, yes. If false, no.

doAssumePARqdValid

public final boolean doAssumePARqdValid()

Should it be assumed (by hasRqdValues) that the required PrimitiveArray is (individually) valid and ready for comparison?

Returns:
b_assumePARqdValid Exactly as provided to setAssumePARqdValid

setAssumePAActlValid

public final void setAssumePAActlValid(boolean b_assumePAActlValid)

Declare if it should be assumed (by hasRqdValues) that the actual PrimitiveArray is (individually) valid and ready for comparison. See setAssumePAsValid for information.

Get with doAssumePARqdValid.

Parameters:
b_assumePARqdValid - Should hasRqdValues assume that the required PrimitiveArray is individually valid? If true, yes. If false, no.

doAssumePAActlValid

public final boolean doAssumePAActlValid()

Should it be assumed (by hasRqdValues) that the actual PrimitiveArray is (individually) valid and ready for comparison?

Returns:
b_assumePAActlValid Exactly as provided to setAssumePAActlValid

hasRqdValues

public boolean hasRqdValues(PrimitiveArray pa_rqd,
                            PrimitiveArray pa_actual)

Are the actual values legal, according to both the rules in CAConfig and the "required" values?

Equal to hasRqdValues(null, null, null, pa_rqd, pa_actual)


hasRqdValues

public boolean hasRqdValues(String s_callingClsFnc,
                            String s_rqdName,
                            String s_actualName,
                            PrimitiveArray pa_rqd,
                            PrimitiveArray pa_actual)

Are the actual values legal, according to both the rules in CAConfig and the "required" values?

Parameters:
s_callingClsFnc - The fully-qualified name of the class-dot-function for use in potential error messages only. This is the place where the error message should appear that it was generated from. For example: xbn.array.CompareArrays.hasRqdValues. If any of s_callingClsFnc, s_rqdName, or s_actualName are non-null, when this function would normally return false, it will instead throw an AssertException, with a descriptive error message.
s_rqdName - The descriptive name of pa_rqd, for potential error messages only.
s_actualName - The descriptive name of pa_actual, for potential error messages only.
pa_rqd - The required values. May not be null, nor a different type than pa_actual.
pa_actual - The actual values to analyze and validate. May not be null, nor a different type than pa_rqd.
Returns:
true pa_actual has required valuse, as determined by the rules in the CAConfig and pa_rqd.
false If pa_actual does not have values as required.

crashIfBadValues

public void crashIfBadValues(PrimitiveArray pa_rqd,
                             PrimitiveArray pa_actual)

If the actual values are illegal crash with an explanation. Otherwise do nothing.

Equal to crashIfBadValues("xbn.array.CompareArrays.crashIfBadValues", "pa_rqd" ,"pa_actual", pa_rqd, pa_actual)


crashIfBadValues

public void crashIfBadValues(String s_callingClsFnc,
                             String s_rqdName,
                             String s_actualName,
                             PrimitiveArray pa_rqd,
                             PrimitiveArray pa_actual)

If the actual values are illegal crash with an explanation. Otherwise do nothing.

Equal to hasRqdValues("xbn.array.CompareArrays.crashIfBadValues", "pa_rqd" ,"pa_actual", pa_rqd, pa_actual) (supressing the return value)

Before calling hasRqdValues, all string parameters are analyzed to ensure they are non-null and at least one character in length.


throwAXBad

protected void throwAXBad(String s_callingClsFnc,
                          String s_actualName,
                          PrimitiveArray pa_rqd,
                          PrimitiveArray pa_actual,
                          String s_currently)

Used internally, by hasRqdValues. See the code for hasRqdValues.




Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo