[31] | 1 | package vnsim.socialNet; |
---|
| 2 | |
---|
| 3 | import java.util.ArrayList; |
---|
| 4 | import vnsim.map.object.Point; |
---|
| 5 | import vnsim.vehicular.simulator.Location; |
---|
| 6 | |
---|
| 7 | public class CellInformation { |
---|
| 8 | int numberOfHosts; |
---|
| 9 | Point pointMax, pointMin; |
---|
| 10 | boolean okToUse; |
---|
| 11 | ArrayList<Point> validPoints; |
---|
| 12 | ArrayList<Location> validLocations; |
---|
| 13 | int priorityEntry; |
---|
| 14 | int priorityExit; |
---|
| 15 | |
---|
| 16 | public CellInformation(){ |
---|
| 17 | numberOfHosts = 0; |
---|
| 18 | okToUse = false; |
---|
| 19 | pointMin = new Point((double) 180, (double) 90); |
---|
| 20 | pointMax = new Point((double) -180, (double) -90); |
---|
| 21 | validPoints = new ArrayList<Point>(); |
---|
| 22 | validLocations = new ArrayList<Location>(); |
---|
| 23 | priorityEntry = 10; |
---|
| 24 | priorityExit = 10; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | public void setPriorityEntry(int p){ |
---|
| 28 | priorityEntry = p; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | public void setPriorityExit(int p){ |
---|
| 32 | priorityExit = p; |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | public void setMaxPoint(double lon, double lat){ |
---|
| 36 | pointMax.setLatitude(lat); |
---|
| 37 | pointMax.setLongitude(lon); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | public void setMinPoint(double lon, double lat){ |
---|
| 41 | pointMin.setLatitude(lat); |
---|
| 42 | pointMin.setLongitude(lon); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | public void addValidPoint(Point p){ |
---|
| 46 | validPoints.add(p); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | public Point getValidPoint(int i){ |
---|
| 50 | return validPoints.get(i); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | public void addValidLocation(int road,int point){ |
---|
| 54 | validLocations.add(new Location(road,point)); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | public Location getValidLocation(int i){ |
---|
| 58 | return validLocations.get(i); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | public int getNoPoints(){ |
---|
| 63 | if(validPoints.size()<validLocations.size()) |
---|
| 64 | return validPoints.size(); |
---|
| 65 | return validLocations.size(); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | public void setHosts(int val){ |
---|
| 69 | numberOfHosts = val; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | public void incHosts(){ |
---|
| 73 | numberOfHosts = numberOfHosts + 1; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | public void enable(){ |
---|
| 77 | this.okToUse = true; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | public void disable(){ |
---|
| 81 | this.okToUse = false; |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | public boolean isAvailable(){ |
---|
| 85 | return okToUse; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | } |
---|