|
| 1 | +/* |
| 2 | + * #%L |
| 3 | + * JSQLParser library |
| 4 | + * %% |
| 5 | + * Copyright (C) 2004 - 2013 JSQLParser |
| 6 | + * %% |
| 7 | + * This program is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU Lesser General Public License as |
| 9 | + * published by the Free Software Foundation, either version 2.1 of the |
| 10 | + * License, or (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Lesser Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Lesser Public |
| 18 | + * License along with this program. If not, see |
| 19 | + * <http://www.gnu.org/licenses/lgpl-2.1.html>. |
| 20 | + * #L% |
| 21 | + */ |
| 22 | +package net.sf.jsqlparser.expression; |
| 23 | + |
| 24 | +/** |
| 25 | + * |
| 26 | + * @author toben |
| 27 | + */ |
| 28 | +public class OracleHierarchicalExpression implements Expression { |
| 29 | + |
| 30 | + private Expression startExpression; |
| 31 | + private Expression connectExpression; |
| 32 | + private boolean noCycle = false; |
| 33 | + |
| 34 | + public Expression getStartExpression() { |
| 35 | + return startExpression; |
| 36 | + } |
| 37 | + |
| 38 | + public void setStartExpression(Expression startExpression) { |
| 39 | + this.startExpression = startExpression; |
| 40 | + } |
| 41 | + |
| 42 | + public Expression getConnectExpression() { |
| 43 | + return connectExpression; |
| 44 | + } |
| 45 | + |
| 46 | + public void setConnectExpression(Expression connectExpression) { |
| 47 | + this.connectExpression = connectExpression; |
| 48 | + } |
| 49 | + |
| 50 | + public boolean isNoCycle() { |
| 51 | + return noCycle; |
| 52 | + } |
| 53 | + |
| 54 | + public void setNoCycle(boolean noCycle) { |
| 55 | + this.noCycle = noCycle; |
| 56 | + } |
| 57 | + |
| 58 | + @Override |
| 59 | + public void accept(ExpressionVisitor expressionVisitor) { |
| 60 | + expressionVisitor.visit(this); |
| 61 | + } |
| 62 | + |
| 63 | + public String toString() { |
| 64 | + StringBuilder b = new StringBuilder(); |
| 65 | + if (startExpression != null) { |
| 66 | + b.append(" START WITH ").append(startExpression.toString()); |
| 67 | + } |
| 68 | + b.append(" CONNECT BY "); |
| 69 | + if (isNoCycle()) { |
| 70 | + b.append("NOCYCLE "); |
| 71 | + } |
| 72 | + b.append(connectExpression.toString()); |
| 73 | + return b.toString(); |
| 74 | + } |
| 75 | +} |
0 commit comments