-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There is now a difference between local and global DistanceAttribute …
…and ScoreAttributes.
- Loading branch information
1 parent
e7696b6
commit d00cbf4
Showing
10 changed files
with
66 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 22 additions & 5 deletions
27
...src/main/kotlin/org/vitrivr/engine/core/model/retrievable/attributes/DistanceAttribute.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,33 @@ | ||
package org.vitrivr.engine.core.model.retrievable.attributes | ||
|
||
import org.vitrivr.engine.core.model.descriptor.Descriptor | ||
import org.vitrivr.engine.core.model.descriptor.DescriptorId | ||
import org.vitrivr.engine.core.model.retrievable.Retrievable | ||
import kotlin.math.min | ||
|
||
/** | ||
* A [MergingRetrievableAttribute] that contains a distance value. | ||
* A [DistanceAttribute] that contains a distance value. | ||
* | ||
* @author Luca Rossetto | ||
* @version 1.1.0 | ||
*/ | ||
data class DistanceAttribute(val distance: Float, val descriptorId: DescriptorId? = null) : MergingRetrievableAttribute { | ||
override fun merge(other: MergingRetrievableAttribute): DistanceAttribute = DistanceAttribute( | ||
min(this.distance, (other as? DistanceAttribute)?.distance ?: Float.POSITIVE_INFINITY) | ||
) | ||
sealed interface DistanceAttribute: RetrievableAttribute { | ||
/** The distance value associated with this [DistanceAttribute]. */ | ||
val distance: Float | ||
|
||
/** | ||
* A global [DistanceAttribute]. | ||
* | ||
* It is used to store a global distance value for a [Retrievable]. | ||
*/ | ||
data class Global(override val distance: Float): DistanceAttribute, MergingRetrievableAttribute { | ||
override fun merge(other: MergingRetrievableAttribute) = Global( | ||
min(this.distance, (other as? DistanceAttribute)?.distance ?: Float.POSITIVE_INFINITY) | ||
) | ||
} | ||
|
||
/** | ||
* A local [DistanceAttribute]. It is used to store a local distance value specific for a [Descriptor]. | ||
*/ | ||
data class Local(override val distance: Float, val descriptorId: DescriptorId): DistanceAttribute | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters