1 package com.quantum.model;
6 public class Schema implements Comparable, Displayable {
9 private String displayName;
10 private boolean isDefault;
11 private boolean exists = true;
16 public Schema(String name, String displayName, boolean isDefault) {
18 this.displayName = displayName;
19 this.isDefault = isDefault;
22 public Schema(String name) {
23 this(name, name, false);
29 public String getName() {
36 public void setName(String name) {
41 * @see java.lang.Comparable#compareTo(java.lang.Object)
43 public int compareTo(Object o) {
44 Schema that = (Schema) o;
45 if (that.isDefault() == this.isDefault()) {
46 return this.getDisplayName().compareTo(that.getDisplayName());
48 return that.isDefault() ? 1 : -1;
51 public boolean equals(Object obj) {
52 if (getClass() != obj.getClass()) {
55 Schema that = (Schema) obj;
56 if (this.name == null && !(that.name == null)) {
58 } else if (this.name != null && !this.name.equals(that.name)) {
60 } else if (this.displayName == null && !(that.displayName == null)) {
62 } else if (this.displayName == null && !this.displayName.equals(that.displayName)) {
69 public int hashCode() {
71 if (this.name != null) {
72 hashCode ^= this.name.hashCode();
74 if (this.displayName != null) {
75 hashCode ^= this.displayName.hashCode();
84 public boolean isDefault() {
85 return this.isDefault;
91 public void setDefault(boolean isDefault) {
92 this.isDefault = isDefault;
98 public String getDisplayName() {
99 return this.displayName;
105 public void setDisplayName(String displayName) {
106 this.displayName = displayName;
109 public boolean exists() {
113 void setExists(boolean exists) {
114 this.exists = exists;
117 public String toString() {
118 return this.displayName == null ? this.name : this.displayName;