root/trunk/src/java/org/jcoderz/phoenix/sqlparser/CreateSequenceStatement.java

Revision 1011, 5.4 kB (checked in by amandel, 4 years ago)

Aligned svn keyword settings.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
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 */
33package org.jcoderz.phoenix.sqlparser;
34
35/**
36 * @author Albrecht Messner
37 */
38public class CreateSequenceStatement
39      extends SqlStatement
40{
41   private static final int DEFAULT_SEQUENCE_CACHE = 20; 
42   
43   private final String mName;
44
45   private long mIncrementBy = 1;
46   private Long mStartWith;
47   
48   private Long mMaxValue;
49   private boolean mNoMaxValue = true;
50   
51   private Long mMinValue;
52   private boolean mNoMinValue = true;
53   
54   private boolean mCycle = false;
55   private long mCache = DEFAULT_SEQUENCE_CACHE;
56   private boolean mOrder = false;
57   
58   public CreateSequenceStatement (String name)
59   {
60      mName = name;
61   }
62
63   /** {@inheritDoc} */
64   public String toString ()
65   {
66      final StringBuffer sbuf = new StringBuffer();
67      sbuf.append("[CREATE SEQUENCE Statement: ");
68      sbuf.append("name = ").append(getName());
69      sbuf.append(", increment by = ").append(getIncrementBy());
70      if (getStartWith() != null)
71      {
72         sbuf.append(", start with = ").append(getStartWith());
73      }
74      if (getMaxValue() != null)
75      {
76         sbuf.append(", max value = ").append(getMaxValue());
77      }
78      sbuf.append(", no maxvalue = ").append(mNoMaxValue);
79      if (getMinValue() != null)
80      {
81         sbuf.append(", min value = ").append(getMinValue());
82      }
83      sbuf.append(", no minvalue = ").append(mNoMinValue);
84      sbuf.append(", cycle = ").append(mCycle);
85      sbuf.append(", cache = ").append(mCache);
86      sbuf.append(", order = ").append(mOrder);
87      sbuf.append(']');
88      return sbuf.toString();
89   }
90
91   /**
92    * @return Returns the name.
93    */
94   public String getName ()
95   {
96      return mName;
97   }
98   /**
99    * @return Returns the cache.
100    */
101   public long getCache ()
102   {
103      return mCache;
104   }
105   /**
106    * @param cache The cache to set.
107    */
108   public void setCache (long cache)
109   {
110      mCache = cache;
111   }
112   /**
113    * @return Returns the cycle.
114    */
115   public boolean isCycle ()
116   {
117      return mCycle;
118   }
119   /**
120    * @param cycle The cycle to set.
121    */
122   public void setCycle (boolean cycle)
123   {
124      mCycle = cycle;
125   }
126   /**
127    * @return Returns the incrementBy.
128    */
129   public long getIncrementBy ()
130   {
131      return mIncrementBy;
132   }
133   /**
134    * @param incrementBy The incrementBy to set.
135    */
136   public void setIncrementBy (long incrementBy)
137   {
138      mIncrementBy = incrementBy;
139   }
140   /**
141    * @return Returns the maxValue.
142    */
143   public Long getMaxValue ()
144   {
145      return mMaxValue;
146   }
147   /**
148    * @param maxValue The maxValue to set.
149    */
150   public void setMaxValue (Long maxValue)
151   {
152      mMaxValue = maxValue;
153   }
154   /**
155    * @return Returns the minValue.
156    */
157   public Long getMinValue ()
158   {
159      return mMinValue;
160   }
161   /**
162    * @param minValue The minValue to set.
163    */
164   public void setMinValue (Long minValue)
165   {
166      mMinValue = minValue;
167   }
168   /**
169    * @return Returns the noMaxValue.
170    */
171   public boolean isNoMaxValue ()
172   {
173      return mNoMaxValue;
174   }
175   /**
176    * @param noMaxValue The noMaxValue to set.
177    */
178   public void setNoMaxValue (boolean noMaxValue)
179   {
180      mNoMaxValue = noMaxValue;
181   }
182   /**
183    * @return Returns the noMinValue.
184    */
185   public boolean isNoMinValue ()
186   {
187      return mNoMinValue;
188   }
189   /**
190    * @param noMinValue The noMinValue to set.
191    */
192   public void setNoMinValue (boolean noMinValue)
193   {
194      mNoMinValue = noMinValue;
195   }
196   /**
197    * @return Returns the order.
198    */
199   public boolean isOrder ()
200   {
201      return mOrder;
202   }
203   /**
204    * @param order The order to set.
205    */
206   public void setOrder (boolean order)
207   {
208      mOrder = order;
209   }
210   /**
211    * @return Returns the startWith.
212    */
213   public Long getStartWith ()
214   {
215      return mStartWith;
216   }
217
218   /**
219    * @param startWith The startWith to set.
220    */
221   public void setStartWith (Long startWith)
222   {
223      mStartWith = startWith;
224   }
225}
Note: See TracBrowser for help on using the browser.