1 19 20 package jxl.format; 21 22 23 27 public class Pattern 28 { 29 32 private int value; 33 34 37 private String string; 38 39 42 private static Pattern[] patterns = new Pattern[0]; 43 44 50 protected Pattern(int val, String s) 51 { 52 value = val; 53 string = s; 54 55 Pattern[] oldcols = patterns; 56 patterns = new Pattern[oldcols.length + 1]; 57 System.arraycopy(oldcols, 0, patterns, 0, oldcols.length); 58 patterns[oldcols.length] = this; 59 } 60 61 67 public int getValue() 68 { 69 return value; 70 } 71 72 77 public String getDescription() 78 { 79 return string; 80 } 81 82 88 public static Pattern getPattern(int val) 89 { 90 for (int i = 0 ; i < patterns.length ; i++) 91 { 92 if (patterns[i].getValue() == val) 93 { 94 return patterns[i]; 95 } 96 } 97 98 return NONE; 99 } 100 101 public final static Pattern NONE = new Pattern(0x0, "None"); 102 public final static Pattern SOLID = new Pattern(0x1, "Solid"); 103 104 public final static Pattern GRAY_50 = new Pattern(0x2, "Gray 50%"); 105 public final static Pattern GRAY_75 = new Pattern(0x3, "Gray 75%"); 106 public final static Pattern GRAY_25 = new Pattern(0x4, "Gray 25%"); 107 108 public final static Pattern PATTERN1 = new Pattern(0x5, "Pattern 1"); 109 public final static Pattern PATTERN2 = new Pattern(0x6, "Pattern 2"); 110 public final static Pattern PATTERN3 = new Pattern(0x7, "Pattern 3"); 111 public final static Pattern PATTERN4 = new Pattern(0x8, "Pattern 4"); 112 public final static Pattern PATTERN5 = new Pattern(0x9, "Pattern 5"); 113 public final static Pattern PATTERN6 = new Pattern(0xa, "Pattern 6"); 114 public final static Pattern PATTERN7 = new Pattern(0xb, "Pattern 7"); 115 public final static Pattern PATTERN8 = new Pattern(0xc, "Pattern 8"); 116 public final static Pattern PATTERN9 = new Pattern(0xd, "Pattern 9"); 117 public final static Pattern PATTERN10 = new Pattern(0xe, "Pattern 10"); 118 public final static Pattern PATTERN11 = new Pattern(0xf, "Pattern 11"); 119 public final static Pattern PATTERN12 = new Pattern(0x10, "Pattern 12"); 120 public final static Pattern PATTERN13 = new Pattern(0x11, "Pattern 13"); 121 public final static Pattern PATTERN14 = new Pattern(0x12, "Pattern 14"); 122 } 123 124 125 126 127 128 129 130 131 132 133 134 | Popular Tags |