/* 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.jdlcode; import xbn.named.NamedArray; /**
Manage a set of JDClasses. See JDClass.
Source code: JDCArray.java.
Create a JDCArray.
This JDCArray is based upon the abbreviation. However, another JDCArray is created internally, where the name is the fully qualified class name. Retrieve it with getJDCAFromFQCN. See JDClass.setNameAbbrevOrFQCN.
@param a_jdClass The array of JDClasses. Must be valid according to the super constructor. All abbreviations and fully qualified class names must be unique. @param pt_array The PTArray defining all PackageTypes existing in a_jdClass. Must be non-null, and every package type prefix must be represented in a_jdClass, and every getPart(0) must be a prefix existing in pt_array. **/ public JDCArray(JDClass[] a_jdClass, PTArray pt_array) { super(a_jdClass); if(pt_array == null) { throwAX("constructor: pt_array is null."); } String sNFPL = pt_array.getNotFoundPrefixList(); if(sNFPL != null) { throwAX("constructor: pt_array contains PackageTypes that do not exist in any JDClass in this JDCArray: " + sNFPL + "."); } for(int i = 0; i < a_jdClass.length; i++) { a_jdClass[i].setNameAbbrevOrFQCN(false); } jdcaFQCN = new JDCArray(a_jdClass); ptArray = pt_array; } /**Get the PTArray for direct manipulation.
**/ public PTArray getPTArray() { return ptArray; } /**Get the private, internal JDCArray in which the names of the JDClasses is the fully qualified class name. This is the "opposite" of this overall JDCArray, in which the names are the abbreviation.
**/ public JDCArray getJDCAFromFQCN() { return jdcaFQCN; } /**Get the JDClass representing a class.
@param s_fqClass The fully qualified class name. Must be valid according togetJDCAFromFQCN().doesExist(s_fqClass)
.
**/
public JDClass getJDCFromFQCN(String s_fqClass) {
return getJDCAFromFQCN().getJDClass(s_fqClass);
}
/**
Get the JDClass representing a class with this abbreviation.
@param s_abbreviation The abbreviation. Must be valid according togetJDCAFromFQCN().doesExist(s_abbreviation)
.
**/
public JDClass getJDClass(String s_abbreviation) {
return (JDClass)getNamed(s_abbreviation);
}
/**
Get the JDClass at the requested array index.
@param i_dx The array index. Must range zero through(getCount() - 1)
.
**/
public JDClass getJDClass(int i_dx) {
return (JDClass)getNamed(i_dx);
}
}