OSDN Git Service

change kgram format
[stigmata/stigmata-plugins.git] / wsp / src / main / java / jp / sourceforge / stigmata / birthmarks / wsp / WSPOpcode.java
1 package jp.sourceforge.stigmata.birthmarks.wsp;\r
2 \r
3 import jp.sourceforge.stigmata.cflib.Opcode;\r
4 \r
5 /**\r
6  *\r
7  *\r
8  * @author Haruaki Tamada\r
9  */\r
10 public class WSPOpcode extends Opcode {\r
11     private static final long serialVersionUID = 31469629831901737L;\r
12 \r
13     private int weight;\r
14 \r
15     public WSPOpcode(int opcode, String name, int argumentCount,\r
16                      int act, Category category) {\r
17         super(opcode, name, argumentCount, act, category);\r
18     }\r
19 \r
20     public WSPOpcode(int opcode, String name, int argumentCount,\r
21                      int act, String category) {\r
22         super(opcode, name, argumentCount, act, category);\r
23     }\r
24 \r
25     public WSPOpcode(Opcode opcode) {\r
26         super(opcode);\r
27     }\r
28 \r
29     public WSPOpcode(int opcode, String name, int argumentCount,\r
30                      int act, Category category, int weight){\r
31         this(opcode, name, argumentCount, act, category);\r
32 \r
33         setWeight(weight);\r
34     }\r
35 \r
36     public WSPOpcode(Opcode opcode, int weight){\r
37         super(opcode);\r
38 \r
39         setWeight(weight);\r
40     }\r
41 \r
42     public void setWeight(int weight){\r
43         this.weight = weight;\r
44     }\r
45 \r
46     public int getWeight(){\r
47         return weight;\r
48     }\r
49 \r
50     @Override\r
51     public String toString(){\r
52         return String.format(\r
53             "%d:%s:%d:%f(%s)", getOpcode(), getName(),\r
54             getWeight(), getAct(), getCategory()\r
55         );\r
56     }\r
57 }\r