/* 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; import xbn.array.primitive.PARString; /**
An APObject for UniqueStrings. See UniqueString.
Source code: UniqueStringAP.java
Create an UniqueStringAP from the array of UniqueStrings.
Equal to APObject(a_unqStrMD)
@param a_unqStrMD The array of UniqueStrings. May not be null. **/ public UniqueStringAP(UniqueString[] a_unqStrMD) { super(a_unqStrMD); throwAXIfNull(a_unqStrMD, "a_unqStrMD", sCNSTR); } /**Get the UniqueString at the requested array index.
@return(UniqueString)getObject(i_dx)
**/
public final UniqueString getUniqueString(int i_dx) {
return (UniqueString)getObject(i_dx);
}
/**
Get a shallow clone of the internally-held array of UniqueStrings. The array is copied, but the elements are the same as provided to the constructor.
For a deep clone, use getAOUSClone.
**/ public final synchronized UniqueString[] getAOUSShallowClone() { if(isNull()) { return null; } if(ausShallowClone != null) { return ausShallowClone; } UniqueString[] aUniqueString = new UniqueString[getLength()]; for(int i = 0; i < getLength(); i++) { aUniqueString[i] = getUniqueString(i); } ausShallowClone = aUniqueString; return ausShallowClone; } /**Get a full (deep) copy of the internally-held array of UniqueStrings.
**/ public final synchronized UniqueString[] getAOUSClone() { if(isNull()) { return null; } UniqueString[] ausClone = new UniqueString[getLength()]; for(int i = 0; i < getLength(); i++) { ausClone[i] = getUniqueString(i).getUSClone(); } return ausClone; } /**Get a UniqueStringPAS representing the string within each UniqueString.
@returngetUniqueStringPAS(new PARString())
**/
public final UniqueStringPAS getUniqueStringPAS() {
return getUniqueStringPAS(new PARString());
}
/**
Get a UniqueStringPAS representing the string within each UniqueString. See UniqueString.getString.
@return(new UniqueStringPAS(getAOUSShallowClone(), par_string))
**/
public final UniqueStringPAS getUniqueStringPAS(PARString par_string) {
return (new UniqueStringPAS(getAOUSShallowClone(), par_string));
}
/**
Get a full (deep) copy ofthis UniqueStringAP.
@return(UniqueStringAP)clone()
**/
public final UniqueStringAP getUSAPClone() {
try {
return (UniqueStringAP)clone();
} catch(CloneNotSupportedException cnsx) {
throwAX("getUSAPClone [SHOULD NEVER HAPPEN!]: " + cnsx.toString());
}
//Never reached. Required for compile.
return null;
}
/**
Get a full (deep) copy ofthis UniqueStringAP as an Object.
@return(new UniqueStringAP(getAOUSClone()))
**/
protected Object clone() throws CloneNotSupportedException {
return (new UniqueStringAP(getAOUSClone()));
}
}