Skip to content

Commit

Permalink
Merge pull request #99 from JetBrains/adopt-orientdb-less-entity-iter…
Browse files Browse the repository at this point in the history
…able-base

Switched a little to interface
  • Loading branch information
leostryuk authored Sep 4, 2024
2 parents 89454d0 + fcab02d commit 76cbbf3
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ package com.jetbrains.teamsys.dnq.database

import jetbrains.exodus.database.TransientEntity
import jetbrains.exodus.database.TransientEntityStore
import jetbrains.exodus.entitystore.*
import jetbrains.exodus.entitystore.Entity
import jetbrains.exodus.entitystore.EntityIterable
import jetbrains.exodus.entitystore.EntityIterator
import jetbrains.exodus.entitystore.StoreTransaction
import jetbrains.exodus.entitystore.iterate.EntityIterableBase
import jetbrains.exodus.entitystore.util.unsupported

Expand All @@ -32,7 +35,7 @@ open class PersistentEntityIterableWrapper(
wrappedIterable: EntityIterable) :
EntityIterableWrapper,
EntityIterableBase(
(wrappedIterable as? EntityIterableBase)?.source
(wrappedIterable as? EntityIterable)?.unwrap()
.takeIf { it !== EMPTY }
?.transaction) {

Expand All @@ -58,28 +61,28 @@ open class PersistentEntityIterableWrapper(
public override fun getHandleImpl() = unsupported()

override fun intersect(right: EntityIterable): EntityIterable {
right as? EntityIterableBase ?: throwUnsupported()
return wrappedIterable.intersect(right.source)
right as? EntityIterable ?: throwUnsupported()
return wrappedIterable.intersect(right.unwrap())
}

override fun intersectSavingOrder(right: EntityIterable): EntityIterable {
right as? EntityIterableBase ?: throwUnsupported()
return wrappedIterable.intersectSavingOrder(right.source)
right as? EntityIterable ?: throwUnsupported()
return wrappedIterable.intersectSavingOrder(right.unwrap())
}

override fun union(right: EntityIterable): EntityIterable {
right as? EntityIterableBase ?: throwUnsupported()
return wrappedIterable.union(right.source)
right as? EntityIterable ?: throwUnsupported()
return wrappedIterable.union(right.unwrap())
}

override fun minus(right: EntityIterable): EntityIterable {
right as? EntityIterableBase ?: throwUnsupported()
return wrappedIterable.minus(right.source)
right as? EntityIterable ?: throwUnsupported()
return wrappedIterable.minus(right.unwrap())
}

override fun concat(right: EntityIterable): EntityIterable {
right as? EntityIterableBase ?: throwUnsupported()
return wrappedIterable.concat(right.source)
right as? EntityIterable ?: throwUnsupported()
return wrappedIterable.concat(right.unwrap())
}

override fun take(number: Int): EntityIterable {
Expand Down

0 comments on commit 76cbbf3

Please sign in to comment.