-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGModule.java
More file actions
65 lines (62 loc) · 1.78 KB
/
Copy pathGModule.java
File metadata and controls
65 lines (62 loc) · 1.78 KB
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
package gridlabd;
import java.util.Hashtable;
/**
* The base representation of a GridLAB-D MODULE struct. Should be incorporated into Java
* GridLAB-D modules, whether with composition or (preferably) inheritence.
* @author Matthew Hauer <[email protected]>
*/
public class GModule{
protected String name;
protected long addr;
protected Hashtable<String, GClass> ctable = new Hashtable<String, GClass>();
public long GetFirstClassAddr(){
if(ctable.isEmpty())
return 0;
return ctable.elements().nextElement().GetClassAddr();
}
public GModule(long a, String n){
addr = a;
name = new String(n);
}
public int AddClass(GClass gc){
if(!ctable.containsKey(gc.GetClassname())){
ctable.put(new String(gc.GetClassname()), gc);
return 1;
}
GridlabD.error("Module "+name+" already contains class "+gc.GetClassname());
return 0;
}
public long GetAddr(){return addr;}
public String GetName(){return new String(name);}
/* the module has been allocated in C already, we just need to fill it in on this side */
public final static GModule init(long mod_addr, String mod_name, int argc, String[] argv){
GModule mod = new GModule(mod_addr, mod_name);
return mod;
}
public final static int do_kill(){
// if anything needs to be deleted or freed, this is a good time to do it
return 0;
}
public static int check(){
return 0;
}
public static int import_file(String filename){
return 0;
}
public static int export_file(String filename){
return 0;
}
public static int setvar(String varname, String value){
return 0;
}
public static int module_test(int argc, String[] argv){
return 0;
}
public static int cmdargs(int argc, String[] argv){
return 0;
}
/* returns a string to fprintf into the C-side stub */
public String kmldump(long object_addr){
return "";
}
}