public PredictionContext getChild(PredictionContext context, int invokingState) { if (!enableCache) { return context.getChild(invokingState); } PredictionContextAndInt operands = new PredictionContextAndInt(context, invokingState); PredictionContext result = childContexts.get(operands); if (result == null) { result = context.getChild(invokingState); result = getAsCached(result); childContexts.put(operands, result); } return result; }
public PredictionContext join(PredictionContext x, PredictionContext y) { if (!enableCache) { return PredictionContext.join(x, y, this); } IdentityCommutativePredictionContextOperands operands = new IdentityCommutativePredictionContextOperands(x, y); PredictionContext result = joinContexts.get(operands); if (result != null) { return result; } result = PredictionContext.join(x, y, this); result = getAsCached(result); joinContexts.put(operands, result); return result; }