/* XBN Java: Generically useful, non-GUI Java code. http://sourceforge.net/projects/xbnjava Copyright (C) 1997-2003, Jeff Epstein All rights reserved. Modifications: No Redistribution in binary form, with or without modifications, are permitted provided that the following conditions are met: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * If modifications are made to source code then this license should indicate that fact in the "Modifications" section above. * Neither the author, nor the contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [NOTE: This license contains NO advertising clause.] */ package xbn.array.primitive; import xbn.XBNObject; /**

Configuration for ordering rules to impose onto the PrimitiveArray. This object, as a whole, is provided directly to the PrimitiveArrayRule constructor.

Source code:  PAROrderDir.java

@version 0.9b @author Jeff Epstein, http://sourceforge.net/projects/xbnjava. **/ public class PAROrderDir extends XBNObject implements Cloneable { private boolean bOrdered = false; private boolean bDirectionAscDesc = false; /**

Create a PAROrderDir with default settings.

Equal to PAROrderDir(false, false)

**/ public PAROrderDir() { this(false, false); } /**

Create a PAROrderDir.

Equal to PAROrderDir(true, b_directionAscDesc)

**/ public PAROrderDir(boolean b_directionAscDesc) { this(true, b_directionAscDesc); } /**

Create a PAROrderDir.

@param b_rdrd If true, then the array must be ordered, in the direction defined by b_orderAscDesc. If false, the array need not be ordered, and b_orderAscDesc parameter is ignored. See isOrdered. @param b_orderAscDesc When true, the array must be in ascending order (one to ten). If false, the array must be ordered in descending order (ten to one). If b_rdrd is false, this parameter is ignored. See getDirectionAscDesc. **/ public PAROrderDir(boolean b_rdrd, boolean b_directionAscDesc) { bOrdered = b_rdrd; bDirectionAscDesc = b_directionAscDesc; } /**

Is it required for the values in the array to be ordered?

@return b_rdrd Exactly as provided to the constructor. **/ public final boolean isOrdered() { return bOrdered; } /**

If ordering is required, in which direction must the order be?. See isOrdered. This function is useless when isOrdered equals false.

@return b_directionAscDesc Exactly as provided to the constructor. **/ public final boolean getDirectionAscDesc() { return bDirectionAscDesc; } /**

Does this PAROrderDir have any restrictions?

@return isOrdered() **/ public boolean isRestricted() { return isOrdered(); } /**

Get some information about this PAROrderDir.

**/ public String toString() { return this.getClass().getName() + ": isOrdered()=" + isOrdered() + ", getDirectionAscDesc()=" + getDirectionAscDesc(); } //Cloning...START /**

Get a full (deep) copy of this PAROrderDir.

@return (PAROrderDir)clone() **/ public final PAROrderDir getPARODClone() { try { return (PAROrderDir)clone(); } catch(CloneNotSupportedException cnsx) { throwAX("getPARODClone [SHOULD NEVER HAPPEN!]: " + cnsx.toString()); } //Never reached. Required for compile. return null; } /**

Get a full (deep) copy of this PAROrderDir as an Object.

Equal to (new PAROrderDir(isOrdered(), getDirectionAscDesc()))

**/ protected Object clone() throws CloneNotSupportedException { return (new PAROrderDir(isOrdered(), getDirectionAscDesc())); } //Cloning...END }