PageRenderTime 18ms CodeModel.GetById 9ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/src/org/ooc/frontend/model/Import.java

http://github.com/nddrylliog/ooc
Java | 62 lines | 46 code | 16 blank | 0 comment | 2 complexity | 3c3efbd8fcf119fca308fc1869844565 MD5 | raw file
 1package org.ooc.frontend.model;
 2
 3import java.io.IOException;
 4
 5import org.ooc.frontend.Visitor;
 6import org.ooc.frontend.model.tokens.Token;
 7import org.ooc.frontend.parser.ModuleParser;
 8
 9public class Import extends Node {
10
11	protected String path;
12	protected Module module;
13
14	public Import(String path, Token defaultToken) {
15		super(defaultToken);
16		this.path = path;
17	}
18	
19	public String getFullName() {
20		return path.replace("/", ".");
21	}
22	
23	public String getPath() {
24		return path;
25	}
26	
27	public void setPath(String path) {
28		this.path = path;
29	}
30	
31	public Module getModule() {
32		if(module == null) {
33			return ModuleParser.cache.get(path + ".ooc");
34		}
35		return module;
36	}
37	
38	public void setModule(Module module) {
39		this.module = module;
40	}
41	
42	public void accept(Visitor visitor) throws IOException {
43		visitor.visit(this);
44	}
45	
46	public boolean hasChildren() {
47		return false;
48	}
49	
50	public void acceptChildren(Visitor visitor) throws IOException {}
51	
52	@Override
53	public boolean replace(Node oldie, Node kiddo) {
54		return false;
55	}
56
57	@Override
58	public String toString() {
59		return super.toString()+" : "+path;
60	}
61	
62}