Project Report: fawkez

Packagesummary org.jcoderz.phoenix.sqlparser

org.jcoderz.phoenix.sqlparser.CreateSequenceStatement

LineHitsNoteSource
1  /*
2   * $Id: CreateSequenceStatement.java 1011 2008-06-16 17:57:36Z amandel $
3   *
4   * Copyright 2006, The jCoderZ.org Project. All rights reserved.
5   *
6   * Redistribution and use in source and binary forms, with or without
7   * modification, are permitted provided that the following conditions are
8   * met:
9   *
10   *    * Redistributions of source code must retain the above copyright
11   *      notice, this list of conditions and the following disclaimer.
12   *    * Redistributions in binary form must reproduce the above
13   *      copyright notice, this list of conditions and the following
14   *      disclaimer in the documentation and/or other materials
15   *      provided with the distribution.
16   *    * Neither the name of the jCoderZ.org Project nor the names of
17   *      its contributors may be used to endorse or promote products
18   *      derived from this software without specific prior written
19   *      permission.
20   *
21   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
22   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24   * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS
25   * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28   * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32   */
33  package org.jcoderz.phoenix.sqlparser;
34  
35  /**
36   * @author Albrecht Messner
37   */
38  public class CreateSequenceStatement
39        extends SqlStatement
40  {
41     private static final int DEFAULT_SEQUENCE_CACHE = 20;
42     
43     private final String mName;
44  
45100    private long mIncrementBy = 1;
46     private Long mStartWith;
47     
48     private Long mMaxValue;
49100    private boolean mNoMaxValue = true;
50     
51     private Long mMinValue;
52100    private boolean mNoMinValue = true;
53     
54100    private boolean mCycle = false;
55100    private long mCache = DEFAULT_SEQUENCE_CACHE;
56100    private boolean mOrder = false;
57     
58 (1)   public CreateSequenceStatement (String name)
59100    {
60100       mName = name;
61100    }
62  
63     /** {@inheritDoc} */
64     public String toString ()
65     {
66100(2)      final StringBuffer sbuf = new StringBuffer();
67100(3)      sbuf.append("[CREATE SEQUENCE Statement: ");
68100       sbuf.append("name = ").append(getName());
69100       sbuf.append(", increment by = ").append(getIncrementBy());
70100       if (getStartWith() != null)
71        {
72100          sbuf.append(", start with = ").append(getStartWith());
73        }
74100       if (getMaxValue() != null)
75        {
760          sbuf.append(", max value = ").append(getMaxValue());
77        }
78100       sbuf.append(", no maxvalue = ").append(mNoMaxValue);
79100       if (getMinValue() != null)
80        {
810          sbuf.append(", min value = ").append(getMinValue());
82        }
83100       sbuf.append(", no minvalue = ").append(mNoMinValue);
84100       sbuf.append(", cycle = ").append(mCycle);
85100       sbuf.append(", cache = ").append(mCache);
86100       sbuf.append(", order = ").append(mOrder);
87100       sbuf.append(']');
88100       return sbuf.toString();
89     }
90  
91     /**
92      * @return Returns the name.
93      */
94     public String getName ()
95     {
96100       return mName;
97     }
98     /**
99      * @return Returns the cache.
100      */
101     public long getCache ()
102     {
1030       return mCache;
104     }
105     /**
106      * @param cache The cache to set.
107      */
108     public void setCache (long cache)
109     {
110100       mCache = cache;
111100    }
112     /**
113      * @return Returns the cycle.
114      */
115     public boolean isCycle ()
116     {
1170       return mCycle;
118     }
119     /**
120      * @param cycle The cycle to set.
121      */
122     public void setCycle (boolean cycle)
123     {
124100       mCycle = cycle;
125100    }
126     /**
127      * @return Returns the incrementBy.
128      */
129     public long getIncrementBy ()
130     {
131100       return mIncrementBy;
132     }
133     /**
134      * @param incrementBy The incrementBy to set.
135      */
136     public void setIncrementBy (long incrementBy)
137     {
138100       mIncrementBy = incrementBy;
139100    }
140     /**
141      * @return Returns the maxValue.
142      */
143     public Long getMaxValue ()
144     {
145100       return mMaxValue;
146     }
147     /**
148      * @param maxValue The maxValue to set.
149      */
150     public void setMaxValue (Long maxValue)
151     {
1520       mMaxValue = maxValue;
1530    }
154     /**
155      * @return Returns the minValue.
156      */
157     public Long getMinValue ()
158     {
159100       return mMinValue;
160     }
161     /**
162      * @param minValue The minValue to set.
163      */
164     public void setMinValue (Long minValue)
165     {
1660       mMinValue = minValue;
1670    }
168     /**
169      * @return Returns the noMaxValue.
170      */
171     public boolean isNoMaxValue ()
172     {
1730       return mNoMaxValue;
174     }
175     /**
176      * @param noMaxValue The noMaxValue to set.
177      */
178     public void setNoMaxValue (boolean noMaxValue)
179     {
1800       mNoMaxValue = noMaxValue;
1810    }
182     /**
183      * @return Returns the noMinValue.
184      */
185     public boolean isNoMinValue ()
186     {
1870       return mNoMinValue;
188     }
189     /**
190      * @param noMinValue The noMinValue to set.
191      */
192     public void setNoMinValue (boolean noMinValue)
193     {
1940       mNoMinValue = noMinValue;
1950    }
196     /**
197      * @return Returns the order.
198      */
199     public boolean isOrder ()
200     {
2010       return mOrder;
202     }
203     /**
204      * @param order The order to set.
205      */
206     public void setOrder (boolean order)
207     {
208100       mOrder = order;
209100    }
210     /**
211      * @return Returns the startWith.
212      */
213     public Long getStartWith ()
214     {
215100       return mStartWith;
216     }
217  
218     /**
219      * @param startWith The startWith to set.
220      */
221     public void setStartWith (Long startWith)
222     {
223100       mStartWith = startWith;
224100    }
225  }

Findings in this File

c (1) 58 : 4 Missing a Javadoc comment.
i (2) 66 : 26 StringBuffer constructor is initialized with size 16, but has at least 115 characters appended.
i (3) 67 : 18 StringBuffer.append is called 2 consecutive times with literal Strings. Use a single append with a single String.