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 java.util.Date;
22  
23  import org.promotego.beans.Location;
24  import org.promotego.beans.OfferedGame;
25  import org.promotego.beans.User;
26  
27  public class OfferedGameViewBean implements Comparable<OfferedGameViewBean>
28  {
29      private OfferedGame m_offeredGame;
30      private double m_distance;
31      
32      public double getDistance()
33      {
34          return m_distance;
35      }
36      
37      public void setDistance(double distance)
38      {
39          m_distance = distance;
40      }
41      
42      public float getDuration()
43      {
44          return m_offeredGame.getDuration();
45      }
46      
47      public OfferedGame getOfferedGame()
48      {
49          return m_offeredGame;
50      }
51      
52      public Location getLocation()
53      {
54          return m_offeredGame.getLocation();
55      }
56  
57      public User getOfferer()
58      {
59          return m_offeredGame.getOfferer();
60      }
61  
62      public Date getStartTime()
63      {
64          return m_offeredGame.getStartTime();
65      }
66  
67      public void setOfferedGame(OfferedGame offeredGame)
68      {
69          m_offeredGame = offeredGame;
70      }
71      
72      public Long getId()
73      {
74          return m_offeredGame.getId();
75      }
76  
77      public int compareTo(OfferedGameViewBean otherBean)
78      {
79          return (int)Math.signum(getDistance() - otherBean.getDistance());
80      }
81  }