Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F8525261
PassaggiSorter.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
930 B
Referenced Files
None
Subscribers
None
PassaggiSorter.java
View Options
package
it.reyboz.bustorino.util
;
import
java.util.Comparator
;
import
it.reyboz.bustorino.backend.Passaggio
;
/**
* Sorter of passaggi, giving the arrival times that are in real time first
*/
public
class
PassaggiSorter
implements
Comparator
<
Passaggio
>
{
@Override
public
int
compare
(
Passaggio
p1
,
Passaggio
p2
)
{
if
(
p1
.
isInRealTime
){
if
(
p2
.
isInRealTime
){
//compare times
return
p1
.
getMinutesDiff
(
p2
);
}
else
{
return
-
2
;
}
}
else
{
if
(
p2
.
isInRealTime
){
// other should come first
return
2
;
}
else
return
p1
.
getMinutesDiff
(
p2
);
}
}
@Override
public
boolean
equals
(
Object
o
)
{
boolean
equal
=
this
.
equals
(
o
);
if
(
equal
)
return
true
;
else
{
return
o
instanceof
PassaggiSorter
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sun, Feb 15, 02:11 (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1494099
Default Alt Text
PassaggiSorter.java (930 B)
Attached To
Mode
R4 Libre BusTO
Attached
Detach File
Event Timeline
Log In to Comment