mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 00:38:46 +02:00
ef4c5eb65e
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
46 lines
957 B
Java
46 lines
957 B
Java
package com.twitter.ann.hnsw;
|
|
|
|
import java.util.Objects;
|
|
import java.util.Optional;
|
|
|
|
class HnswMeta<T> {
|
|
private final int maxLevel;
|
|
private final Optional<T> entryPoint;
|
|
|
|
HnswMeta(int maxLevel, Optional<T> entryPoint) {
|
|
this.maxLevel = maxLevel;
|
|
this.entryPoint = entryPoint;
|
|
}
|
|
|
|
public int getMaxLevel() {
|
|
return maxLevel;
|
|
}
|
|
|
|
public Optional<T> getEntryPoint() {
|
|
return entryPoint;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (o == null || getClass() != o.getClass()) {
|
|
return false;
|
|
}
|
|
HnswMeta<?> hnswMeta = (HnswMeta<?>) o;
|
|
return maxLevel == hnswMeta.maxLevel
|
|
&& Objects.equals(entryPoint, hnswMeta.entryPoint);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(maxLevel, entryPoint);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "HnswMeta{maxLevel=" + maxLevel + ", entryPoint=" + entryPoint + '}';
|
|
}
|
|
}
|