1 11 package org.eclipse.core.internal.dtree; 12 13 import org.eclipse.core.runtime.IPath; 14 15 20 public class DataTreeLookup { 21 public IPath key; 22 public boolean isPresent; 23 public Object data; 24 public boolean foundInFirstDelta; 25 private static final int POOL_SIZE = 100; 26 29 private static DataTreeLookup[] instancePool; 30 33 private static int nextFree = 0; 34 static { 35 instancePool = new DataTreeLookup[POOL_SIZE]; 36 for (int i = 0; i < POOL_SIZE; i++) { 38 instancePool[i] = new DataTreeLookup(); 39 } 40 } 41 42 45 private DataTreeLookup() { 46 super(); 47 } 48 49 52 public static DataTreeLookup newLookup(IPath nodeKey, boolean isPresent, Object data) { 53 DataTreeLookup instance; 54 synchronized (instancePool) { 55 instance = instancePool[nextFree]; 56 nextFree = ++nextFree % POOL_SIZE; 57 } 58 instance.key = nodeKey; 59 instance.isPresent = isPresent; 60 instance.data = data; 61 instance.foundInFirstDelta = false; 62 return instance; 63 } 64 65 68 public static DataTreeLookup newLookup(IPath nodeKey, boolean isPresent, Object data, boolean foundInFirstDelta) { 69 DataTreeLookup instance; 70 synchronized (instancePool) { 71 instance = instancePool[nextFree]; 72 nextFree = ++nextFree % POOL_SIZE; 73 } 74 instance.key = nodeKey; 75 instance.isPresent = isPresent; 76 instance.data = data; 77 instance.foundInFirstDelta = foundInFirstDelta; 78 return instance; 79 } 80 } 81 | Popular Tags |