package Ext_Tools; /** * * Task of this class
* It represents a Table Reference. In Secondo this can only be a relationname with an * optional qualifier name following */ public class TableElement { private String Name; private String NickName; public TableElement(String name, String nickname) { this.Name = name; this.NickName = nickname.trim(); } /** * * Task of this constructor
* In case the qualifier is part of the name * @param name */ public TableElement(String name) { int PosColon; PosColon = name.indexOf(" as "); if (PosColon==-1) { this.Name = name; this.NickName = ""; } else { this.Name = name.substring(0, PosColon-1); this.NickName = name.substring(PosColon+5); } } /** * * Task of this method
* checks whether the tableElement contains the passed qualifier or contains no * qualifier an the name of the TableElement equals it. * @param quali * @return true if the TableElement contains the qualifier */ public boolean checkQuali(String quali) { boolean result = false; if (this.NickName != "") { if (this.NickName.equalsIgnoreCase(quali)) result = true; } else if (this.Name.equalsIgnoreCase(quali)) { result = true; this.NickName = quali; // e.g. tentest as tentest } return result; } /** * * Task of this method
* returns the TableElement in form of a string * @return */ public String getTElement() { String result = this.Name; if (this.NickName != "") result += " as " + this.NickName; return result; } public String getNickname() { return this.NickName; } }