package Ext_Tools; import java.util.*; /** * * Task of this class
* represents a FROM-Clause which contains one TableElement or a comma separatet * list of TableElements */ public class TableClause { private Vector TElems; public TableClause(TableElement NewElem) { TElems = new Vector(); TElems.add(NewElem); } public TableClause addElement(TableElement NewElem) { TElems.add(NewElem); return this; } /** * * Task of this method
* checks whether any of the stored TableElements has got the passed qualifier or can be set * with it. * @param quali * @return true if a TableElement could be set with the qualifier or had had it before */ public boolean CheckOrAddQuali(String quali) { boolean result = false; Iterator it; TableElement CurrentElement; it = this.TElems.iterator(); while (it.hasNext() && !result) { CurrentElement = it.next(); result = CurrentElement.checkQuali(quali); } return result; } public String OneElement() { String result = ""; if (this.TElems.size() == 1) result = this.TElems.get(0).getNickname(); return result; } /** * * Task of this method
* outputs the TableClause in form of a string * @return */ public String getTableList() { String result=""; boolean inSquareBrackets = false; Iterator it; if (this.TElems.size() > 1){ inSquareBrackets=true; result = "["; } it = this.TElems.iterator(); result+=it.next().getTElement(); while (it.hasNext()) result+=", " + it.next().getTElement(); if (inSquareBrackets) result += "]"; return result; } }