KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > tagkit > KeyTag


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2004 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 package soot.tagkit;
21
22 public class KeyTag implements Tag {
23
24     private int red;
25     private int green;
26     private int blue;
27     private String JavaDoc key;
28     private String JavaDoc analysisType;
29     
30     /*public KeyTag(int r, int g, int b, String k){
31         this(r, g, b, k, "Unknown");
32     }*/

33
34     public KeyTag(int r, int g, int b, String JavaDoc k, String JavaDoc type){
35         red = r;
36         green = g;
37         blue = b;
38         key = k;
39         analysisType = type;
40     }
41
42     public KeyTag(int color, String JavaDoc k, String JavaDoc type){
43         this(color, k);
44         analysisType = type;
45     }
46
47     public KeyTag(int color, String JavaDoc k){
48         switch(color){
49             case ColorTag.RED: {
50                 red = 255;
51                 green = 0;
52                 blue = 0;
53                 break;
54             }
55             case ColorTag.GREEN: {
56                 red = 45;
57                 green = 255;
58                 blue = 84;
59                 break;
60             }
61             case ColorTag.YELLOW: {
62                 red = 255;
63                 green = 248;
64                 blue = 35;
65                 break;
66             }
67             case ColorTag.BLUE: {
68                 red = 174;
69                 green = 210;
70                 blue = 255;
71                 break;
72             }
73             case ColorTag.ORANGE: {
74                 red = 255;
75                 green = 163;
76                 blue = 0;
77                 break;
78             }
79             case ColorTag.PURPLE: {
80                 red = 159;
81                 green = 34;
82                 blue = 193;
83                 break;
84             }
85             default: {
86                 red = 220;
87                 green = 220;
88                 blue = 220;
89                 break;
90             }
91                      
92         }
93         key = k;
94     }
95
96     public int red(){
97         return red;
98     }
99
100     public int green(){
101         return green;
102     }
103
104     public int blue() {
105         return blue;
106     }
107
108     public String JavaDoc key(){
109         return key;
110     }
111
112     public String JavaDoc analysisType(){
113         return analysisType;
114     }
115     
116     public String JavaDoc getName(){
117         return "KeyTag";
118     }
119
120     public byte[] getValue() {
121         byte[] v = new byte[4];
122         return v;
123     }
124     
125 }
126
Popular Tags