Skip to content

Commit

Permalink
Merge pull request #234 from JetBrains/graph-store-fix-multiple-entit…
Browse files Browse the repository at this point in the history
…ies-iterable

Fixed contains in multple entitites iterable
  • Loading branch information
leostryuk authored Dec 20, 2024
2 parents 3d90504 + 19261d4 commit cb3aeb1
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package jetbrains.exodus.entitystore.orientdb.iterate.link

import jetbrains.exodus.entitystore.Entity
import jetbrains.exodus.entitystore.EntityIterable
import jetbrains.exodus.entitystore.orientdb.OEntityId
import jetbrains.exodus.entitystore.orientdb.OStoreTransaction
import jetbrains.exodus.entitystore.orientdb.iterate.OEntityIterableBase
Expand All @@ -26,4 +27,32 @@ class OMultipleEntitiesIterable(tx: OStoreTransaction, val entities: List<Entity
override fun query(): OSelect {
return ORecordIdSelect(entities.map { (it.id as OEntityId).asOId() })
}

override fun contains(entity: Entity): Boolean {
return entities.contains(entity)
}

override fun count(): Long {
return entities.size.toLong()
}

override fun getRoughCount(): Long {
return entities.size.toLong()
}

override fun getRoughSize(): Long {
return entities.size.toLong()
}

override fun size(): Long {
return entities.size.toLong()
}

override fun skip(number: Int): EntityIterable {
return OMultipleEntitiesIterable(transaction as OStoreTransaction, entities.drop(number) )
}

override fun take(number: Int): EntityIterable {
return OMultipleEntitiesIterable(transaction as OStoreTransaction, entities.take(number) )
}
}

0 comments on commit cb3aeb1

Please sign in to comment.