1 package com.icl.saxon; 2 import com.icl.saxon.expr.Value; 3 4 5 9 10 public class ParameterSet 11 { 12 private int[] keys = new int[10]; 13 private Value[] values = new Value[10]; 14 private int used = 0; 15 16 17 22 23 public void put (int fingerprint, Value value) { 24 for (int i=0; i<used; i++) { 25 if (keys[i]==fingerprint) { 26 values[i]=value; 27 return; 28 } 29 } 30 if (used+1 > keys.length) { 31 int[] newkeys = new int[used*2]; 32 Value[] newvalues = new Value[used*2]; 33 System.arraycopy(values, 0, newvalues, 0, used); 34 System.arraycopy(keys, 0, newkeys, 0, used); 35 values = newvalues; 36 keys = newkeys; 37 } 38 keys[used] = fingerprint; 39 values[used++] = value; 40 } 41 42 47 48 public Value get (int fingerprint) { 49 for (int i=0; i<used; i++) { 50 if (keys[i]==fingerprint) { 51 return values[i]; 52 } 53 } 54 return null; 55 } 56 57 60 61 public void clear() { 62 used = 0; 63 } 64 65 } 66 | Popular Tags |