/* 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 a ListAOS.

Source code:  LPAConfig.java

@version 0.9b @author Jeff Epstein, http://sourceforge.net/projects/xbnjava. **/ public class LPAConfig extends XBNObject { private String sPrefix = null; private String sDivider = null; private String sPostfix = null; private String sIfNull = null; private String sIfEmpty = null; private boolean bMakeVisible = false; /**

Create an LPAConfig with default settings.

Equal to LPAConfig("'", "'")

**/ public LPAConfig() { this("'", "'"); } /**

Create an LPAConfig.

Equal to LPAConfig(null, s_divider, null)

**/ public LPAConfig(String s_divider) { this(null, s_divider, null); } /**

Create an LPAConfig.

Equal to LPAConfig(s_prefix, s_postfix, false)

**/ public LPAConfig(String s_prefix, String s_postfix) { this(s_prefix, s_postfix, false); } /**

Create an LPAConfig.

Equal to LPAConfig(s_prefix, s_divider, s_postfix, false)

**/ public LPAConfig(String s_prefix, String s_divider, String s_postfix) { this(s_prefix, s_divider, s_postfix, false); } /**

Create an LPAConfig.

Equal to LPAConfig(null, null, b_makeVisible)

**/ public LPAConfig(boolean b_makeVisible) { this(null, null, b_makeVisible); } /**

Create an LPAConfig.

Equal to LPAConfig(null, s_divider, null, b_makeVisible)

**/ public LPAConfig(String s_divider, boolean b_makeVisible) { this(null, s_divider, null, b_makeVisible); } /**

Create an LPAConfig.

Equal to LPAConfig(s_prefix, ", ", s_postfix, b_makeVisible)

**/ public LPAConfig(String s_prefix, String s_postfix, boolean b_makeVisible) { this(s_prefix, ", ", s_postfix, b_makeVisible); } /**

Create an LPAConfig.

Equal to LPAConfig(s_prefix, s_divider, s_postfix, null, "__ZERO_ELEMENTS__", b_makeVisible)

**/ public LPAConfig(String s_prefix, String s_divider, String s_postfix, boolean b_makeVisible) { this(s_prefix, s_divider, s_postfix, null, "__ZERO_ELEMENTS__", b_makeVisible); } /**

Create an LPAConfig.

Equal to LPAConfig(s_prefix, s_divider, s_postfix, s_ifNull, "__ZERO_ELEMENTS__")

**/ public LPAConfig(String s_prefix, String s_divider, String s_postfix, String s_ifNull) { this(s_prefix, s_divider, s_postfix, s_ifNull, "__ZERO_ELEMENTS__"); } /**

Create an LPAConfig.

Equal to LPAConfig(s_prefix, s_divider, s_postfix, s_ifNull, s_ifEmpty, false)

**/ public LPAConfig(String s_prefix, String s_divider, String s_postfix, String s_ifNull, String s_ifEmpty) { this(s_prefix, s_divider, s_postfix, s_ifNull, s_ifEmpty, false); } /**

Create an LPAConfig.

Regarding s_prefix and s_postfix: If you do not want any value for the prefix or postfix, set it to null. You could set it to empty string, but null is quicker (with null, you do nothing...with empty string, you actually concatenate empty string onto the returned value).

@param s_prefix What the (whole) returned string should start with. See getPrefix. @param s_divider What should go between each item. (This is the only item that) may not be null. See getDivider. @param s_postfix What the (whole) returned string should end with. See getPostfix. @param s_ifNull If the array of objects to list is null (as a whole), this is the string returned. See getIfNull. @param s_ifEmpty If the array of objects to list has no elements, this is the string returned. See getIfEmpty. @param b_makeVisible If true, then all items are made visible before being listed. See doMakeVisible. **/ public LPAConfig(String s_prefix, String s_divider, String s_postfix, String s_ifNull, String s_ifEmpty, boolean b_makeVisible) { throwAXIfNull(s_divider, "s_divider", sCNSTR); sPrefix = s_prefix; sDivider = s_divider; sPostfix = s_postfix; sIfNull = s_ifNull; sIfEmpty = s_ifEmpty; bMakeVisible = b_makeVisible; } /**

Get the string that should precede the entire list.

@return s_prefix Exactly as provided to the constructor. **/ public final String getPrefix() { return sPrefix; } /**

Get the string that should go between each item in the list.

@return s_divider Exactly as provided to the constructor. **/ public final String getDivider() { return sDivider; } /**

Get the string that should follow the entire list.

@return s_postfix Exactly as provided to the constructor. **/ public final String getPostfix() { return sPostfix; } /**

Get the string that should be returned in the case that the object-to-be-listed, as a whole, is null.

@return s_ifNull Exactly as provided to the constructor. **/ public final String getIfNull() { return sIfNull; } /**

Get the string that should be returned in the case that the object-to-be-listed has zero elements.

@return s_ifEmpty Exactly as provided to the constructor. **/ public final String getIfEmpty() { return sIfEmpty; } /**

Get the string that should precede the entire list.

@return b_makeVisible Exactly as provided to the constructor. **/ public final boolean doMakeVisible() { return bMakeVisible; } }