类 Partition
- java.lang.Object
-
- cc.chungkwong.mathocr.common.Partition
-
public class Partition extends Object
A data structure representing partition of objects
-
-
构造器详细资料
-
Partition
public Partition(Linkable work)
Construct a Partition without any set- 参数:
work- indicating addition work when linking two sets
-
Partition
public Partition(Linkable work, int n)
Construct a Partition with some sets- 参数:
work- indicating addition work when linking two setsn- number of set containing exactly one element at frist
-
-
方法详细资料
-
makeSet
public void makeSet()
Make a new set containing exactly one element
-
findRoot
public int findRoot(int n)
Find the root of the set containing a element- 参数:
n- the index of the element- 返回:
- root
-
union
public void union(int m, int n)Combine two sets- 参数:
m- an element contained in the first setn- an element contained in the second set
-
isRoot
public boolean isRoot(int n)
Check if a element is root- 参数:
n- the index the element- 返回:
-
-