Convert elements and partitions to properties

bzip2
Graham 5 years ago
parent c0836e11f6
commit 7a0f94dbde
  1. 5
      util/src/main/java/dev/openrs2/util/collect/DisjointSet.kt
  2. 4
      util/src/main/java/dev/openrs2/util/collect/ForestDisjointSet.java

@ -3,9 +3,10 @@ package dev.openrs2.util.collect
interface DisjointSet<T> : Iterable<DisjointSet.Partition<T>> { interface DisjointSet<T> : Iterable<DisjointSet.Partition<T>> {
interface Partition<T> : Iterable<T> interface Partition<T> : Iterable<T>
val elements: Int
val partitions: Int
fun add(x: T): Partition<T> fun add(x: T): Partition<T>
operator fun get(x: T): Partition<T>? operator fun get(x: T): Partition<T>?
fun union(x: Partition<T>, y: Partition<T>) fun union(x: Partition<T>, y: Partition<T>)
fun elements(): Int
fun partitions(): Int
} }

@ -154,12 +154,12 @@ public final class ForestDisjointSet<T> implements DisjointSet<T> {
} }
@Override @Override
public int elements() { public int getElements() {
return elements; return elements;
} }
@Override @Override
public int partitions() { public int getPartitions() {
return partitions; return partitions;
} }

Loading…
Cancel
Save