Road.java 1.43 KB
Newer Older
Juon Kawakami's avatar
init  
Juon Kawakami committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package firesimulator.world;

import org.apache.log4j.Logger;

/**
 * @author tn
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class Road extends Edge {
    private static final Logger LOG = Logger.getLogger(Road.class);

    int width;
    int block;
    int linesToHead;
    int linesToTail;
    StreetNode head;
    StreetNode tail;
	
    public Road(int id) {
        super(id);
        head=null;
        tail=null;
    }
	
    public void initialize(World world){
        head=((StreetNode)world.getObject(getHeadID()));
        tail=((StreetNode)world.getObject(getTailID()));
        if(head==null||tail==null){
            LOG.fatal("Error: head or tail of an streetnode did not exist. exiting");
            System.exit(1);
        }
    }
	
    public void setHead(StreetNode node){
        head=node;
    }
	
    public void setTail(StreetNode node){
        tail=node;
    }
	
    public StreetNode getHead(){
        return head;
    }
	
    public StreetNode getTail(){
        return tail;
    }
	
    public String getType(){
        return "ROAD";
    }
	
    public void setWidth(int width){
        this.width=width;
    }
	
    public void setBlock(int block){
        this.block=block;
    }
	
    public void setLinesToHead(int lines){
        linesToHead=lines;
    }
	
    public void setLinesToTail(int lines){
        linesToTail=lines;
    }
}