final Equation<Key, Value> notNullParamEquation(int i, boolean stable) { final Key key = new Key(method, new In(i, In.NOT_NULL_MASK), stable); final Result<Key, Value> result; if (interpreter.dereferencedParams[i]) { result = new Final<Key, Value>(Value.NotNull); } else { Set<ParamKey> calls = interpreter.parameterFlow[i]; if (calls == null || calls.isEmpty()) { result = new Final<Key, Value>(Value.Top); } else { Set<Key> keys = new HashSet<Key>(); for (ParamKey pk: calls) { keys.add(new Key(pk.method, new In(pk.i, In.NOT_NULL_MASK), pk.stable)); } result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Top, keys))); } } return new Equation<Key, Value>(key, result); }
final Equation<Key, Value> nullableResultEquation(boolean stable) { final Key key = new Key(method, NullableOut, stable); final Result<Key, Value> result; if (exception || returnValue instanceof Trackable && interpreter.dereferencedValues[((Trackable)returnValue).getOriginInsnIndex()]) { result = new Final<Key, Value>(Value.Bot); } else if (returnValue instanceof TrackableCallValue) { TrackableCallValue call = (TrackableCallValue)returnValue; Key callKey = new Key(call.method, NullableOut, call.stableCall || call.thisCall); Set<Key> keys = new SingletonSet<Key>(callKey); result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Null, keys))); } else if (returnValue instanceof TrackableNullValue) { result = new Final<Key, Value>(Value.Null); } else { result = new Final<Key, Value>(Value.Bot); } return new Equation<Key, Value>(key, result); }
final Equation<Key, Value> contractEquation(int i, Value inValue, boolean stable) { final Key key = new Key(method, new InOut(i, inValue), stable); final Result<Key, Value> result; HashSet<Key> keys = new HashSet<Key>(); for (int argI = 0; argI < conditionValue.args.size(); argI++) { BasicValue arg = conditionValue.args.get(argI); if (arg instanceof NthParamValue) { NthParamValue npv = (NthParamValue)arg; if (npv.n == i) { keys.add(new Key(conditionValue.method, new InOut(argI, inValue), conditionValue.stableCall, true)); } } } if (keys.isEmpty()) { result = new Final<Key, Value>(Value.Top); } else { result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Top, keys))); } return new Equation<Key, Value>(key, result); }
private synchronized void putOptionWithHelpId(String option, final String id, final String groupName, String hit, final String path) { if (isStopWord(option)) return; String stopWord = PorterStemmerUtil.stem(option); if (stopWord == null) return; if (isStopWord(stopWord)) return; if (!myId2Name.containsKey(id) && groupName != null) { myId2Name.put(myIdentifierTable.intern(id), myIdentifierTable.intern(groupName)); } OptionDescription description = new OptionDescription(null, myIdentifierTable.intern(id).trim(), hit != null ? myIdentifierTable.intern(hit).trim() : null, path != null ? myIdentifierTable.intern(path).trim() : null); Set<OptionDescription> configs = myStorage.get(option); if (configs == null) { configs = new SingletonSet<OptionDescription>(description); myStorage.put(new String(option), configs); } else if (configs instanceof SingletonSet){ configs = new THashSet<OptionDescription>(configs); configs.add(description); myStorage.put(new String(option), configs); } else { configs.add(description); } }
private synchronized void putOptionWithHelpId(String option, final String id, final String groupName, String hit, final String path) { if (isStopWord(option)) return; String stopWord = PorterStemmerUtil.stem(option); if (stopWord == null) return; if (isStopWord(stopWord)) return; if (!myId2Name.containsKey(id) && groupName != null) { myId2Name.put(myIdentifierTable.intern(id), myIdentifierTable.intern(groupName)); } OptionDescription description = new OptionDescription(null, myIdentifierTable.intern(id).trim(), hit != null ? myIdentifierTable.intern(hit).trim() : null, path != null ? myIdentifierTable.intern(path).trim() : null); Set<OptionDescription> configs = myStorage.get(option); if (configs == null) { configs = new SingletonSet<>(description); myStorage.put(new String(option), configs); } else if (configs instanceof SingletonSet){ configs = new THashSet<>(configs); configs.add(description); myStorage.put(new String(option), configs); } else { configs.add(description); } }
final Equation contractEquation(int i, Value inValue, boolean stable) { final Key key = new Key(method, new Direction.InOut(i, inValue), stable); final Result result; HashSet<Key> keys = new HashSet<Key>(); for (int argI = 0; argI < conditionValue.args.size(); argI++) { BasicValue arg = conditionValue.args.get(argI); if (arg instanceof CombinedData.NthParamValue) { CombinedData.NthParamValue npv = (CombinedData.NthParamValue)arg; if (npv.n == i) { keys.add(new Key(conditionValue.method, new Direction.InOut(argI, inValue), conditionValue.stableCall, true)); } } } if (keys.isEmpty()) { result = new Final(Value.Top); } else { result = new Pending(new SingletonSet<Product>(new Product(Value.Top, keys))); } return new Equation(key, result); }
final Equation notNullParamEquation(int i, boolean stable) { final Key key = new Key(method, new Direction.In(i, Direction.In.NOT_NULL_MASK), stable); final Result result; if (interpreter.dereferencedParams[i]) { result = new Final(Value.NotNull); } else { Set<CombinedData.ParamKey> calls = interpreter.parameterFlow[i]; if (calls == null || calls.isEmpty()) { result = new Final(Value.Top); } else { Set<Key> keys = new HashSet<Key>(); for (CombinedData.ParamKey pk: calls) { keys.add(new Key(pk.method, new Direction.In(pk.i, Direction.In.NOT_NULL_MASK), pk.stable)); } result = new Pending(new SingletonSet<Product>(new Product(Value.Top, keys))); } } return new Equation(key, result); }
final Equation nullableResultEquation(boolean stable) { final Key key = new Key(method, NullableOut, stable); final Result result; if (exception || returnValue instanceof CombinedData.Trackable && interpreter.dereferencedValues[((CombinedData.Trackable)returnValue).getOriginInsnIndex()]) { result = new Final(Value.Bot); } else if (returnValue instanceof CombinedData.TrackableCallValue) { CombinedData.TrackableCallValue call = (CombinedData.TrackableCallValue)returnValue; Key callKey = new Key(call.method, NullableOut, call.stableCall || call.thisCall); Set<Key> keys = new SingletonSet<Key>(callKey); result = new Pending(new SingletonSet<Product>(new Product(Value.Null, keys))); } else if (returnValue instanceof CombinedData.TrackableNullValue) { result = new Final(Value.Null); } else { result = new Final(Value.Bot); } return new Equation(key, result); }
final Equation<Key, Value> outContractEquation(boolean stable) { final Key key = new Key(method, Out, stable); final Result<Key, Value> result; if (exception) { result = new Final<Key, Value>(Value.Bot); } else if (FalseValue == returnValue) { result = new Final<Key, Value>(Value.False); } else if (TrueValue == returnValue) { result = new Final<Key, Value>(Value.True); } else if (returnValue instanceof TrackableNullValue) { result = new Final<Key, Value>(Value.Null); } else if (returnValue instanceof NotNullValue || returnValue == ThisValue) { result = new Final<Key, Value>(Value.NotNull); } else if (returnValue instanceof TrackableCallValue) { TrackableCallValue call = (TrackableCallValue)returnValue; Key callKey = new Key(call.method, Out, call.stableCall); Set<Key> keys = new SingletonSet<Key>(callKey); result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Top, keys))); } else { result = new Final<Key, Value>(Value.Top); } return new Equation<Key, Value>(key, result); }
@NotNull @Override public Set<K> keySet() { K theKey = this.theKey; if (theKey != null) { return new SingletonSet<K>(theKey); } return super.keySet(); }
@NotNull @Override public Collection<V> values() { K theKey = this.theKey; if (theKey != null) { return new SingletonSet<V>(theValue); } return super.values(); }
@NotNull @Override public Set<Map.Entry<K, V>> entrySet() { K theKey = this.theKey; if (theKey != null) { return new SingletonSet<Map.Entry<K, V>>(new AbstractMap.SimpleEntry<K, V>(theKey, theValue)); } return super.entrySet(); }
@Nonnull @Override public Set<K> keySet() { K theKey = this.theKey; if (theKey != null) { return new SingletonSet<K>(theKey); } return super.keySet(); }
@Nonnull @Override public Collection<V> values() { K theKey = this.theKey; if (theKey != null) { return new SingletonSet<V>(theValue); } return super.values(); }
@Nonnull @Override public Set<Map.Entry<K, V>> entrySet() { K theKey = this.theKey; if (theKey != null) { return new SingletonSet<Map.Entry<K, V>>(new AbstractMap.SimpleEntry<K, V>(theKey, theValue)); } return super.entrySet(); }
final Equation outContractEquation(boolean stable) { final Key key = new Key(method, Out, stable); final Result result; if (exception) { result = new Final(Value.Bot); } else if (FalseValue == returnValue) { result = new Final(Value.False); } else if (TrueValue == returnValue) { result = new Final(Value.True); } else if (returnValue instanceof CombinedData.TrackableNullValue) { result = new Final(Value.Null); } else if (returnValue instanceof AbstractValues.NotNullValue || returnValue == ThisValue) { result = new Final(Value.NotNull); } else if (returnValue instanceof CombinedData.TrackableCallValue) { CombinedData.TrackableCallValue call = (CombinedData.TrackableCallValue)returnValue; Key callKey = new Key(call.method, Out, call.stableCall); Set<Key> keys = new SingletonSet<Key>(callKey); result = new Pending(new SingletonSet<Product>(new Product(Value.Top, keys))); } else { result = new Final(Value.Top); } return new Equation(key, result); }
final Equation<Key, Value> contractEquation(int i, Value inValue, boolean stable) { final Key key = new Key(method, new InOut(i, inValue), stable); final Result<Key, Value> result; if (exception || (inValue == Value.Null && interpreter.dereferencedParams[i])) { result = new Final<Key, Value>(Value.Bot); } else if (FalseValue == returnValue) { result = new Final<Key, Value>(Value.False); } else if (TrueValue == returnValue) { result = new Final<Key, Value>(Value.True); } else if (returnValue instanceof TrackableNullValue) { result = new Final<Key, Value>(Value.Null); } else if (returnValue instanceof NotNullValue || ThisValue == returnValue) { result = new Final<Key, Value>(Value.NotNull); } else if (returnValue instanceof NthParamValue && ((NthParamValue)returnValue).n == i) { result = new Final<Key, Value>(inValue); } else if (returnValue instanceof TrackableCallValue) { TrackableCallValue call = (TrackableCallValue)returnValue; HashSet<Key> keys = new HashSet<Key>(); for (int argI = 0; argI < call.args.size(); argI++) { BasicValue arg = call.args.get(argI); if (arg instanceof NthParamValue) { NthParamValue npv = (NthParamValue)arg; if (npv.n == i) { keys.add(new Key(call.method, new InOut(argI, inValue), call.stableCall)); } } } if (ASMUtils.isReferenceType(call.getType())) { keys.add(new Key(call.method, Out, call.stableCall)); } if (keys.isEmpty()) { result = new Final<Key, Value>(Value.Top); } else { result = new Pending<Key, Value>(new SingletonSet<Product<Key, Value>>(new Product<Key, Value>(Value.Top, keys))); } } else { result = new Final<Key, Value>(Value.Top); } return new Equation<Key, Value>(key, result); }
final Equation contractEquation(int i, Value inValue, boolean stable) { final Key key = new Key(method, new Direction.InOut(i, inValue), stable); final Result result; if (exception || (inValue == Value.Null && interpreter.dereferencedParams[i])) { result = new Final(Value.Bot); } else if (FalseValue == returnValue) { result = new Final(Value.False); } else if (TrueValue == returnValue) { result = new Final(Value.True); } else if (returnValue instanceof CombinedData.TrackableNullValue) { result = new Final(Value.Null); } else if (returnValue instanceof AbstractValues.NotNullValue || ThisValue == returnValue) { result = new Final(Value.NotNull); } else if (returnValue instanceof CombinedData.NthParamValue && ((CombinedData.NthParamValue)returnValue).n == i) { result = new Final(inValue); } else if (returnValue instanceof CombinedData.TrackableCallValue) { CombinedData.TrackableCallValue call = (CombinedData.TrackableCallValue)returnValue; HashSet<Key> keys = new HashSet<Key>(); for (int argI = 0; argI < call.args.size(); argI++) { BasicValue arg = call.args.get(argI); if (arg instanceof CombinedData.NthParamValue) { CombinedData.NthParamValue npv = (CombinedData.NthParamValue)arg; if (npv.n == i) { keys.add(new Key(call.method, new Direction.InOut(argI, inValue), call.stableCall)); } } } if (ASMUtils.isReferenceType(call.getType())) { keys.add(new Key(call.method, Out, call.stableCall)); } if (keys.isEmpty()) { result = new Final(Value.Top); } else { result = new Pending(new SingletonSet<Product>(new Product(Value.Top, keys))); } } else { result = new Final(Value.Top); } return new Equation(key, result); }