1 2 12 package com.versant.core.jdbc.sql.exp; 13 14 import com.versant.core.jdbc.sql.SqlDriver; 15 16 19 public class BinaryExp extends SqlExp { 20 21 public BinaryExp(SqlExp left, SqlExp right) { 22 super(left); 23 left.next = right; 24 right.next = null; 25 } 26 27 public BinaryExp() { 28 } 29 30 public SqlExp createInstance() { 31 return new BinaryExp(); 32 } 33 34 37 public int createAlias(int index) { 38 return childList.next.createAlias(childList.createAlias(index)); 39 } 40 41 45 public void replaceSelectExpRef(SelectExp old, SelectExp nw) { 46 childList.replaceSelectExpRef(old, nw); 47 childList.next.replaceSelectExpRef(old, nw); 48 } 49 50 54 public SqlExp normalize(SqlDriver driver, SelectExp sel, boolean convertExists) { 55 SqlExp r = childList.normalize(driver, sel, convertExists); 56 if (r != null) { 57 r.next = childList.next; 58 childList = r; 59 } 60 r = childList.next.normalize(driver, sel, convertExists); 61 if (r != null) { 62 childList.next = r; 63 } 64 return null; 65 } 66 67 74 public SelectExp getSingleSelectExp(SelectExp exclude) { 75 SelectExp a = childList.getSingleSelectExp(exclude); 76 SelectExp b = childList.next.getSingleSelectExp(exclude); 77 if (b == null || b == exclude) return a; 78 if (a == null || a == exclude) return b; 79 return a == b ? a : null; 80 } 81 82 } 83 | Popular Tags |