/** * Determine if there are any monitors watching any field in the specified type. */ boolean hasFieldMonitor(ObjType objType) { assert Thread.holdsLock(this); // Do quick check, if possible if (this.monitorMap == null) return false; final int objTypeStorageId = objType.storageId; if (this.hasFieldMonitorCache != null) { final long minKey = this.buildHasFieldMonitorCacheKey(objTypeStorageId, 0); if (objTypeStorageId == Integer.MAX_VALUE) return this.hasFieldMonitorCache.ceiling(minKey) != null; final long maxKey = this.buildHasFieldMonitorCacheKey(objTypeStorageId + 1, 0); return !this.hasFieldMonitorCache.subSet(minKey, maxKey).isEmpty(); } // Do slow check for (int fieldStorageId : NavigableSets.intersection(objType.fields.navigableKeySet(), this.monitorMap.navigableKeySet())) { if (this.monitorMap.get(fieldStorageId).stream().anyMatch(new MonitoredPredicate(objTypeStorageId, fieldStorageId))) return true; } return false; }
((ArrayList<NavigableSet<ObjId>>)result .computeIfAbsent(fieldStorageId, i -> new ArrayList<NavigableSet<ObjId>>(versionList.size()))) .add(NavigableSets.intersection(schemaVersionRefs, referrers)); } else
@Override @SuppressWarnings("unchecked") public Value and(ParseSession session, Value that) { // Handle boolean final Object thisValue = this.checkNotNull(session, "`and'"); final Object thatValue = that.checkNotNull(session, "`and'"); if (thisValue instanceof Boolean && thatValue instanceof Boolean) return new ConstValue((Boolean)thisValue & (Boolean)thatValue); // Handle NavigableSet with equal comparators XXX might not have compatible elements if (thisValue instanceof NavigableSet && thatValue instanceof NavigableSet && (((NavigableSet<?>)thisValue).comparator() != null ? ((NavigableSet<?>)thisValue).comparator().equals(((NavigableSet<?>)thatValue).comparator()) : ((NavigableSet<?>)thatValue).comparator() == null)) return new ConstValue(NavigableSets.intersection((NavigableSet<Object>)thisValue, (NavigableSet<Object>)thatValue)); // Handle Set if (thisValue instanceof Set && thatValue instanceof Set) return new ConstValue(Sets.intersection((Set<Object>)thisValue, (Set<Object>)thatValue)); // Handle numeric final Number lnum = AbstractValue.promoteNumeric(session, thisValue, "`and'", thatValue); final Number rnum = AbstractValue.promoteNumeric(session, thatValue, "`and'", thisValue); if (!(lnum instanceof Integer) && !(lnum instanceof Long) && !(lnum instanceof BigInteger)) throw new EvalException("invalid `and' operation on " + AbstractValue.describeType(lnum)); if (lnum instanceof BigInteger) return new ConstValue(((BigInteger)lnum).and((BigInteger)rnum)); if (lnum instanceof Long) return new ConstValue((Long)lnum & (Long)rnum); return new ConstValue((Integer)lnum & (Integer)rnum); }