/// <summary> /// This method should only be called in a context where you know that your entity is relevant both before and after /// </summary> private bool ValuesChanged(int[] propertyIds, [email protected]_PropertySchemaType propertySchemaType) { if (propertySchemaType == COMPLETE_ALL_TOKENS) { // In the case of indexes were all entries must have all indexed tokens, one of the properties must have changed for us to generate a change. foreach (int propertyId in propertyIds) { if (_knownProperties.get(propertyId).type == Changed) { return(true); } } return(false); } else { // In the case of indexes were we index incomplete index entries, we need to update as long as _anything_ happened to one of the indexed properties. foreach (int propertyId in propertyIds) { PropertyValueType type = _knownProperties.get(propertyId).type; if (type != UnChanged && type != NoValue) { return(true); } } return(false); } }
private bool HasPropsAfter(int[] propertyIds, [email protected]_PropertySchemaType propertySchemaType) { bool found = false; foreach (int propertyId in propertyIds) { PropertyValue propertyValue = _knownProperties.getIfAbsent(propertyId, () => _noValue); if (!propertyValue.HasAfter()) { if (propertySchemaType == COMPLETE_ALL_TOKENS) { return(false); } } else { found = true; } } return(found); }
public NodeInUseWithCorrectLabelsCheck(long[] expectedEntityTokenIds, [email protected]_PropertySchemaType propertySchemaType, bool checkStoreToIndex) { this._propertySchemaType = propertySchemaType; this._checkStoreToIndex = checkStoreToIndex; this._indexLabels = SortAndDeduplicate(expectedEntityTokenIds); }
/// <summary> /// Removes the <seealso cref="SchemaDescriptor"/> from this multi-set. </summary> /// <param name="schemaDescriptor"> the <seealso cref="SchemaDescriptor"/> to remove. </param> /// <returns> {@code true} if this multi-set ended up empty after removing this descriptor. </returns> internal virtual bool Remove(T schemaDescriptor) { // Remove from the optimized path Descriptors.remove(schemaDescriptor); int[] propertyKeyIds = SortedPropertyKeyIds(schemaDescriptor.schema()); [email protected]_PropertySchemaType propertySchemaType = schemaDescriptor.schema().propertySchemaType(); if (propertySchemaType == COMPLETE_ALL_TOKENS) { int firstPropertyKeyId = propertyKeyIds[0]; PropertySet firstPropertySet = Next.get(firstPropertyKeyId); if (firstPropertySet != null && firstPropertySet.Remove(schemaDescriptor, propertyKeyIds, 0)) { Next.remove(firstPropertyKeyId); } } else if (propertySchemaType == PARTIAL_ANY_TOKEN) { foreach (int propertyKeyId in propertyKeyIds) { PropertySet propertySet = Next.get(propertyKeyId); if (propertySet != null && propertySet.Remove(schemaDescriptor, new int[] { propertyKeyId }, 0)) { Next.remove(propertyKeyId); } } } else { throw new System.NotSupportedException("Unknown property schema type " + propertySchemaType); } // Remove from the fall-back path foreach (int keyId in propertyKeyIds) { ISet <T> byProperty = ByAnyProperty.get(keyId); if (byProperty != null) { byProperty.remove(schemaDescriptor); if (byProperty.Count == 0) { ByAnyProperty.remove(keyId); } } } return(Descriptors.Count == 0 && Next.Empty); }
internal virtual void Add(T schemaDescriptor) { // Add optimized path for when property list is fully known Descriptors.Add(schemaDescriptor); int[] propertyKeyIds = SortedPropertyKeyIds(schemaDescriptor.schema()); [email protected]_PropertySchemaType propertySchemaType = schemaDescriptor.schema().propertySchemaType(); if (propertySchemaType == COMPLETE_ALL_TOKENS) { // Just add the first token id to the top level set //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: Next.getIfAbsentPut(propertyKeyIds[0], PropertySet::new).add(schemaDescriptor, propertyKeyIds, 0); } else if (propertySchemaType == PARTIAL_ANY_TOKEN) { // The internal data structure is built and optimized for when all property key tokens are required to match // a particular descriptor. However to support the partial type, where any property key may match // we will have to add such descriptors to all property key sets and pretend that each is the only one. foreach (int propertyKeyId in propertyKeyIds) { //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: Next.getIfAbsentPut(propertyKeyId, PropertySet::new).add(schemaDescriptor, new int[] { propertyKeyId }, 0); } } else { throw new System.NotSupportedException("Unknown property schema type " + propertySchemaType); } // Add fall-back path for when property list is only partly known foreach (int keyId in propertyKeyIds) { //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: ByAnyProperty.getIfAbsentPut(keyId, HashSet <object>::new).add(schemaDescriptor); } }
internal IndexCheck(StoreIndexDescriptor indexRule) { this._indexRule = indexRule; SchemaDescriptor schema = indexRule.Schema(); int[] entityTokenIntIds = Schema.EntityTokenIds; long[] entityTokenLongIds = new long[entityTokenIntIds.Length]; for (int i = 0; i < entityTokenIntIds.Length; i++) { entityTokenLongIds[i] = entityTokenIntIds[i]; } [email protected]_PropertySchemaType propertySchemaType = Schema.propertySchemaType(); _entityType = Schema.entityType(); if (_entityType == EntityType.NODE) { _nodeChecker = new NodeInUseWithCorrectLabelsCheck <IndexEntry, Org.Neo4j.Consistency.report.ConsistencyReport_IndexConsistencyReport>(entityTokenLongIds, propertySchemaType, false); } if (_entityType == EntityType.RELATIONSHIP) { _relationshipChecker = new RelationshipInUseWithCorrectRelationshipTypeCheck <IndexEntry, Org.Neo4j.Consistency.report.ConsistencyReport_IndexConsistencyReport>(entityTokenLongIds); } }