Exemplo n.º 1
0
 public boolean equals(final Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (!(obj instanceof Marker)) {
     return false;
   }
   final Marker other = (Marker) obj;
   return this.name.equals(other.getName());
 }
Exemplo n.º 2
0
 public boolean contains(final String name) {
   if (name == null) {
     throw new IllegalArgumentException("Other cannot be null");
   }
   if (this.name.equals(name)) {
     return true;
   }
   if (this.hasReferences()) {
     for (int i = 0; i < this.refereceList.size(); ++i) {
       final Marker ref = this.refereceList.get(i);
       if (ref.contains(name)) {
         return true;
       }
     }
   }
   return false;
 }
Exemplo n.º 3
0
 public String toString() {
   if (!this.hasReferences()) {
     return this.getName();
   }
   final Iterator it = this.iterator();
   final StringBuffer sb = new StringBuffer(this.getName());
   sb.append(' ').append(BasicMarker.OPEN);
   while (it.hasNext()) {
     final Marker reference = it.next();
     sb.append(reference.getName());
     if (it.hasNext()) {
       sb.append(BasicMarker.SEP);
     }
   }
   sb.append(BasicMarker.CLOSE);
   return sb.toString();
 }
Exemplo n.º 4
0
 public synchronized boolean remove(final Marker referenceToRemove) {
   if (this.refereceList == null) {
     return false;
   }
   for (int size = this.refereceList.size(), i = 0; i < size; ++i) {
     final Marker m = this.refereceList.get(i);
     if (referenceToRemove.equals(m)) {
       this.refereceList.remove(i);
       return true;
     }
   }
   return false;
 }
Exemplo n.º 5
0
 public synchronized void add(final Marker reference) {
   if (reference == null) {
     throw new IllegalArgumentException("A null value cannot be added to a Marker as reference.");
   }
   if (this.contains(reference)) {
     return;
   }
   if (reference.contains(this)) {
     return;
   }
   if (this.refereceList == null) {
     this.refereceList = new Vector();
   }
   this.refereceList.add(reference);
 }