View Javadoc

1   /*
2    * Copyright (C) 2007 Alf Mikula
3    * 
4    * This file is part of PromoteGo.
5    *
6    * PromoteGo is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU General Public License as published by
8    * the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * PromoteGo is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with PromoteGo.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.promotego.viewbeans;
20  
21  import org.promotego.beans.Address;
22  import org.promotego.beans.Location;
23  import org.promotego.beans.LocationType;
24  import org.promotego.beans.User;
25  
26  public class LocationViewBean implements Comparable<LocationViewBean>
27  {
28      private Location location;
29      private double distance;
30      
31      public double getDistance()
32      {
33          return distance;
34      }
35      
36      public void setDistance(double distance)
37      {
38          this.distance = distance;
39      }
40  
41      public Location getLocation()
42      {
43          return location;
44      }
45  
46      public void setLocation(Location location)
47      {
48          this.location = location;
49      }
50  
51      public Address getAddress()
52      {
53          return location.getAddress();
54      }
55  
56      public Long getId()
57      {
58          return location.getId();
59      }
60  
61      public String getName()
62      {
63          return location.getName();
64      }
65  
66      public User getOwner()
67      {
68          return location.getOwner();
69      }
70  
71      public LocationType getType()
72      {
73          return location.getType();
74      }
75  
76      public int compareTo(LocationViewBean o)
77      {
78          return (int)Math.signum(getDistance() - o.getDistance());
79      }
80  }