001    /*
002     =================== DO NOT EDIT THIS FILE ====================
003     Generated by Modello 1.4.1 on 2012-01-20 18:09:18,
004     any modifications will be overwritten.
005     ==============================================================
006     */
007    
008    package org.apache.maven.model;
009    
010    /**
011     * Definition of include or exclude patterns.
012     * 
013     * @version $Revision$ $Date$
014     */
015    @SuppressWarnings( "all" )
016    public class PatternSet
017        implements java.io.Serializable, java.lang.Cloneable, org.apache.maven.model.InputLocationTracker
018    {
019    
020          //--------------------------/
021         //- Class/Member Variables -/
022        //--------------------------/
023    
024        /**
025         * Field includes.
026         */
027        private java.util.List<String> includes;
028    
029        /**
030         * Field excludes.
031         */
032        private java.util.List<String> excludes;
033    
034        /**
035         * Field locations.
036         */
037        private java.util.Map<Object, InputLocation> locations;
038    
039    
040          //-----------/
041         //- Methods -/
042        //-----------/
043    
044        /**
045         * Method addExclude.
046         * 
047         * @param string
048         */
049        public void addExclude( String string )
050        {
051            getExcludes().add( string );
052        } //-- void addExclude( String )
053    
054        /**
055         * Method addInclude.
056         * 
057         * @param string
058         */
059        public void addInclude( String string )
060        {
061            getIncludes().add( string );
062        } //-- void addInclude( String )
063    
064        /**
065         * Method clone.
066         * 
067         * @return PatternSet
068         */
069        public PatternSet clone()
070        {
071            try
072            {
073                PatternSet copy = (PatternSet) super.clone();
074    
075                if ( this.includes != null )
076                {
077                    copy.includes = new java.util.ArrayList<String>();
078                    copy.includes.addAll( this.includes );
079                }
080    
081                if ( this.excludes != null )
082                {
083                    copy.excludes = new java.util.ArrayList<String>();
084                    copy.excludes.addAll( this.excludes );
085                }
086    
087                if ( copy.locations != null )
088                {
089                    copy.locations = new java.util.LinkedHashMap( copy.locations );
090                }
091    
092                return copy;
093            }
094            catch ( java.lang.Exception ex )
095            {
096                throw (java.lang.RuntimeException) new java.lang.UnsupportedOperationException( getClass().getName()
097                    + " does not support clone()" ).initCause( ex );
098            }
099        } //-- PatternSet clone()
100    
101        /**
102         * Method getExcludes.
103         * 
104         * @return List
105         */
106        public java.util.List<String> getExcludes()
107        {
108            if ( this.excludes == null )
109            {
110                this.excludes = new java.util.ArrayList<String>();
111            }
112    
113            return this.excludes;
114        } //-- java.util.List<String> getExcludes()
115    
116        /**
117         * Method getIncludes.
118         * 
119         * @return List
120         */
121        public java.util.List<String> getIncludes()
122        {
123            if ( this.includes == null )
124            {
125                this.includes = new java.util.ArrayList<String>();
126            }
127    
128            return this.includes;
129        } //-- java.util.List<String> getIncludes()
130    
131        /**
132         * 
133         * 
134         * @param key
135         * @return InputLocation
136         */
137        public InputLocation getLocation( Object key )
138        {
139            return ( locations != null ) ? locations.get( key ) : null;
140        } //-- InputLocation getLocation( Object )
141    
142        /**
143         * Method removeExclude.
144         * 
145         * @param string
146         */
147        public void removeExclude( String string )
148        {
149            getExcludes().remove( string );
150        } //-- void removeExclude( String )
151    
152        /**
153         * Method removeInclude.
154         * 
155         * @param string
156         */
157        public void removeInclude( String string )
158        {
159            getIncludes().remove( string );
160        } //-- void removeInclude( String )
161    
162        /**
163         * Set a list of patterns to exclude, e.g.
164         * <code>**&#47;*.xml</code>
165         * 
166         * @param excludes
167         */
168        public void setExcludes( java.util.List<String> excludes )
169        {
170            this.excludes = excludes;
171        } //-- void setExcludes( java.util.List )
172    
173        /**
174         * Set a list of patterns to include, e.g.
175         * <code>**&#47;*.xml</code>.
176         * 
177         * @param includes
178         */
179        public void setIncludes( java.util.List<String> includes )
180        {
181            this.includes = includes;
182        } //-- void setIncludes( java.util.List )
183    
184        /**
185         * 
186         * 
187         * @param key
188         * @param location
189         */
190        public void setLocation( Object key, InputLocation location )
191        {
192            if ( location != null )
193            {
194                if ( this.locations == null )
195                {
196                    this.locations = new java.util.LinkedHashMap<Object, InputLocation>();
197                }
198                this.locations.put( key, location );
199            }
200        } //-- void setLocation( Object, InputLocation )
201    
202        
203                
204        /**
205         * @see java.lang.Object#toString()
206         */
207        public String toString()
208        {
209            StringBuilder sb = new StringBuilder( 128 );
210    
211            sb.append("PatternSet [includes: {");
212            for (java.util.Iterator i = getIncludes().iterator(); i.hasNext(); )
213            {
214                String str = (String) i.next();
215                sb.append(str).append(", ");
216            }
217            if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
218    
219            sb.append("}, excludes: {");
220            for (java.util.Iterator i = getExcludes().iterator(); i.hasNext(); )
221            {
222                String str = (String) i.next();
223                sb.append(str).append(", ");
224            }
225            if (sb.substring(sb.length() - 2).equals(", ")) sb.delete(sb.length() - 2, sb.length());
226    
227            sb.append("}]");
228            return sb.toString();
229        }
230                
231              
232    }