001    /**
002     * Copyright 2003-2004 The Apache Software Foundation
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package net.dpml.cli;
017    
018    import java.util.Comparator;
019    import java.util.Set;
020    
021    /**
022     * An Option representing a choice or group of Options in the form "-a|-b|-c".
023     */
024    public interface Group extends Option 
025    {
026        /**
027         * Appends usage information to the specified StringBuffer
028         * 
029         * @param buffer the buffer to append to
030         * @param helpSettings a set of display settings @see DisplaySetting
031         * @param comp a comparator used to sort the Options
032         * @param separator the String used to separate member Options 
033         */
034        void appendUsage(
035            final StringBuffer buffer,
036            final Set helpSettings,
037            final Comparator comp,
038            final String separator );
039    
040        /**
041         * Indicates whether group members must be present for the CommandLine to be
042         * valid.
043         *
044         * @see #getMinimum()
045         * @see #getMaximum()
046         * @return true iff the CommandLine will be invalid without at least one 
047         *         member option
048         */
049        boolean isRequired();
050    
051        /**
052         * Retrieves the minimum number of members required for a valid Group
053         *
054         * @return the minimum number of members
055         */
056        int getMinimum();
057    
058        /**
059         * Retrieves the maximum number of members acceptable for a valid Group
060         *
061         * @return the maximum number of members
062         */
063        int getMaximum();
064    }