initial quantum version
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / model / Schema.java
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Schema.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/model/Schema.java
new file mode 100644 (file)
index 0000000..154e15b
--- /dev/null
@@ -0,0 +1,109 @@
+package com.quantum.model;
+
+/**
+ * @author BC
+ */
+public class Schema implements Comparable {
+    
+    private String name;
+    private String displayName;
+    private boolean isDefault;
+    
+    
+    public Schema() {
+    }
+
+    public Schema(String name, String displayName, boolean isDefault) {
+        this.name = name;
+        this.displayName = displayName;
+        this.isDefault = isDefault;
+    }
+    
+    public Schema(String name) {
+        this(name, name, false);
+    }
+    
+    /**
+     * @return
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param string
+     */
+    public void setName(String string) {
+        name = string;
+    }
+
+    /**
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
+    public int compareTo(Object o) {
+        Schema that = (Schema) o;
+        if (that.isDefault() == this.isDefault()) {
+            return this.getDisplayName().compareTo(that.getDisplayName());
+        } else {
+            return that.isDefault() ? 1 : -1;
+        }
+    }
+    public boolean equals(Object obj) {
+        if (getClass() != obj.getClass()) {
+            return false;
+        } else {
+            Schema that = (Schema) obj;
+            if (this.name == null && !(that.name == null)) {
+                return false;
+            } else if (this.name != null && !this.name.equals(that.name)) {
+                return false;
+            } else if (this.displayName == null && !(that.displayName == null)) {
+                return false;
+            } else if (this.displayName == null && !this.displayName.equals(that.displayName)) {
+                return false;
+            } else {
+                return true;
+            }
+        }
+    }
+    public int hashCode() {
+        int hashCode = super.hashCode();
+        if (this.name != null) {
+            hashCode ^= this.name.hashCode();
+        }
+        if (this.displayName != null) {
+            hashCode ^= this.displayName.hashCode();
+        }
+        
+        return hashCode;
+    }
+    
+    /**
+     * @return
+     */
+    public boolean isDefault() {
+        return isDefault;
+    }
+
+    /**
+     * @param b
+     */
+    public void setDefault(boolean isDefault) {
+        this.isDefault = isDefault;
+    }
+
+    /**
+     * @return
+     */
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    /**
+     * @param string
+     */
+    public void setDisplayName(String string) {
+        displayName = string;
+    }
+
+}