parent
d133e8ed76
commit
0c0d10f72a
@ -0,0 +1,54 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RideMapHelper {
|
||||
|
||||
public Map<Long,Ride> rideMap;
|
||||
|
||||
|
||||
RideMapHelper(Map<Long,Ride> rideMap){
|
||||
this.rideMap = rideMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean containsMore(int i, State state){
|
||||
long availableRides = 0L;
|
||||
for (Map.Entry<Long,Ride> entry : rideMap.entrySet()){
|
||||
if (entry.getValue().getState() == state){
|
||||
availableRides++;
|
||||
}
|
||||
if (availableRides > i){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean containsLess(int i, State state){
|
||||
long availableRides = 0L;
|
||||
for (Map.Entry<Long,Ride> entry : rideMap.entrySet()){
|
||||
if (entry.getValue().getState() == state){
|
||||
availableRides++;
|
||||
}
|
||||
if (availableRides < i){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public Ride pickAvailable(){
|
||||
for (Map.Entry<Long,Ride> entry : rideMap.entrySet()){
|
||||
if (entry.getValue().getState() == State.AVAILABLE){
|
||||
return entry.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
public enum State {
|
||||
AVAILABLE, BOOKED, LOADED
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
public class MockSet {
|
||||
PublicMock publicMock;
|
||||
UserMock userMock;
|
||||
BridgeMock bridgeMock;
|
||||
ClientMock clientMock;
|
||||
AppMock appMock;
|
||||
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Loading…
Reference in new issue