source: proiecte/ptvs/src/vnsim/socialNet/NodeInformation.java @ 31

Last change on this file since 31 was 31, checked in by (none), 14 years ago
File size: 1.4 KB
Line 
1package vnsim.socialNet;
2
3import java.util.ArrayList;
4import vnsim.map.object.Point;
5import vnsim.map.object.Road;
6import vnsim.vehicular.simulator.Location;
7
8public class NodeInformation {
9        int nodeId;
10        ArrayList<Integer> adjacency = new ArrayList<Integer>();
11        double interaction[];
12        int nrHosts;
13       
14        int cellX;
15        int cellY;
16       
17        Point start;
18        Location startLoc;
19       
20        public NodeInformation(int id, int nrHosts){
21                nodeId = id;
22                this.nrHosts = nrHosts;
23                interaction = new double[nrHosts];
24                for(int i=0;i<nrHosts;i++){
25                        interaction[i] = 0;
26                }
27        }
28       
29        public void setIneraction(int id, double val){
30                interaction[id] = val;
31        }
32       
33        public double getIneraction(int id){
34                return interaction[id];
35        }
36       
37        public int getAdjacency(int id){
38
39                return adjacency.get(id).intValue();
40        }
41       
42        public void setAdjacency(int id, int val){
43                adjacency.set(id, val);
44        }
45       
46        public void generateAdjacency(){
47       
48                for (int i=0; i<nrHosts; i++) 
49                                if (interaction[i]>GlobalNetwork.THESHOLD)
50                                        adjacency.add(new Integer(1));   
51                                else
52                                        adjacency.add(new Integer(0)); 
53
54        }
55       
56        public void deleteLink(int id){
57                interaction[id]=0;
58        }
59               
60        public void addStartPoint(Point p){
61                start = p;
62        }
63       
64        public void addStartLocation(Location l){
65                startLoc = l;
66        }
67       
68        public Location getLocation(){
69                return startLoc;
70        }
71       
72        public Point getPoint(){
73                return start;
74        }
75}
Note: See TracBrowser for help on using the repository browser.