~piastucki/bzr-eclipse/history-view-enhancements

« back to all changes in this revision

Viewing changes to org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/BzrBranch.java

  • Committer: Guillermo Gonzalez
  • Date: 2007-03-14 12:15:50 UTC
  • Revision ID: guillo.gonzo@gmail.com-20070314121550-tltk3b6f3zblf0dh
Initial commit with the new code layout.
Now starts the real work

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.vcs.bazaar.eclipse.internal.core;
 
2
 
 
3
import java.net.URI;
 
4
 
 
5
import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
 
6
 
 
7
/**
 
8
 * @author Isaac Devine
 
9
 *         <p>
 
10
 *         This is a class to help implementors of IDarcsRepository
 
11
 *         </p>
 
12
 */
 
13
public abstract class BzrBranch implements IBzrBranch {
 
14
 
 
15
  private String name;
 
16
  private URI location;
 
17
 
 
18
  public BzrBranch( final String name, final URI location ) {
 
19
    this.name = name;
 
20
    this.location = location;
 
21
  }
 
22
 
 
23
  public String getName() {
 
24
    return name;
 
25
  }
 
26
 
 
27
  public URI getLocation() {
 
28
    return location;
 
29
  }
 
30
 
 
31
  public boolean isLocal() {
 
32
    return false;
 
33
  }
 
34
 
 
35
  // TDOD: implement getChanges if necessary
 
36
//  public IBzrChanges getChanges() {
 
37
//    return new BzrChanges( this );
 
38
//  }
 
39
 
 
40
  @Override
 
41
  public boolean equals( final Object otherRepo ) {
 
42
    // make sure wrong types
 
43
    // aren't typecasted.
 
44
    if( !( otherRepo instanceof IBzrBranch ) ) {
 
45
      return false;
 
46
    }
 
47
    return ( ( IBzrBranch )otherRepo ).getLocation().equals(
 
48
        getLocation() );
 
49
  }
 
50
 
 
51
  public int compareTo( final Object otherRepo ) {
 
52
    int result;
 
53
    if( otherRepo instanceof IBzrBranch ) {
 
54
      IBzrBranch otherBzrRepo = ( IBzrBranch )otherRepo;
 
55
      result = ( otherBzrRepo ).getLocation().compareTo( getLocation() );
 
56
    } else {
 
57
      result = ( ( Comparable )otherRepo ).compareTo( this );
 
58
    }
 
59
    return result;
 
60
  }
 
61
}