1 19 20 25 26 27 package soot.tagkit; 28 29 import soot.*; 30 31 public class ColorTag implements Tag 32 { 33 34 private int red; 35 36 private int green; 37 38 private int blue; 39 41 private boolean foreground = false; 42 private String analysisType = "Unknown"; 43 44 public static final int RED = 0; 45 public static final int GREEN = 1; 46 public static final int YELLOW = 2; 47 public static final int BLUE = 3; 48 public static final int ORANGE = 4; 49 public static final int PURPLE = 5; 50 51 public ColorTag(int r, int g, int b, boolean fg) 52 { 53 red = r; 54 green = g; 55 blue = b; 56 foreground = fg; 57 } 58 59 public ColorTag(int r, int g, int b) 60 { 61 this(r, g, b, false); 62 } 63 64 public ColorTag(int r, int g, int b, String type){ 65 this(r, g, b, false, type); 66 } 67 68 public ColorTag(int r, int g, int b, boolean fg, String type){ 69 this(r, g, b, false); 70 analysisType = type; 71 } 72 73 public ColorTag(int color, String type){ 74 this(color, false, type); 75 } 76 77 public ColorTag(int color, boolean fg, String type){ 78 this(color, fg); 79 analysisType = type; 80 } 81 82 public ColorTag(int color){ 83 this(color, false); 84 } 85 86 public ColorTag(int color, boolean fg){ 87 switch (color) { 89 case RED: { 90 red = 255; 91 green = 0; 92 blue = 0; 93 break; 94 } 95 case GREEN: { 96 red = 45; 97 green = 255; 98 blue = 84; 99 break; 100 } 101 case YELLOW: { 102 red = 255; 103 green = 248; 104 blue = 35; 105 break; 106 } 107 case BLUE: { 108 red = 174; 109 green = 210; 110 blue = 255; 111 break; 112 } 113 case ORANGE: { 114 red = 255; 115 green = 163; 116 blue = 0; 117 break; 118 } 119 case PURPLE: { 120 red = 159; 121 green = 34; 122 blue = 193; 123 break; 124 } 125 default: { 126 red = 220; 127 green = 220; 128 blue = 220; 129 break; 130 } 131 } 132 foreground = fg; 133 } 134 135 public String getAnalysisType(){ 136 return analysisType; 137 } 138 139 public int getRed(){ 140 return red; 141 } 142 143 public int getGreen(){ 144 return green; 145 } 146 147 public int getBlue(){ 148 return blue; 149 } 150 151 public boolean isForeground(){ 152 return foreground; 153 } 154 155 public String getName() 156 { 157 return "ColorTag"; 158 } 159 160 public byte[] getValue() 161 { 162 byte[] v = new byte[2]; 163 return v; 164 } 165 166 public String toString() 167 { 168 return ""+red+" "+green+" "+blue; 169 } 170 171 } 172 | Popular Tags |