/Users/lyon/j4p/src/ip/transforms/TransformTable.java

1    package ip.transforms; 
2     
3    public class TransformTable { 
4        private short lut[]; 
5     
6        public TransformTable(int size) { 
7            lut = new short[size]; 
8        } 
9     
10       public short[] getLut() { 
11           return lut; 
12       } 
13    
14       public void randomize() { 
15           for (int i = 0; i < lut.length; i++) 
16               lut[i] = (short) (Math.random() * 255); 
17       } 
18    
19       public void clip() { 
20           for (int i = 0; i < lut.length; i++) { 
21               if (lut[i] > 255) lut[i] = 255; 
22               if (lut[i] < 0) lut[i] = 0; 
23           } 
24       } 
25    
26       public void setLut(short _lut[]) { 
27           lut = _lut; 
28       } 
29    
30       public void print() { 
31           for (int i = 0; i < lut.length; i++) { 
32               System.out.println(i + "\t" + lut[i]); 
33           } 
34       } 
35   }