The settheoryrels project has developed java classes that implement kinds of relation from mathematical set theory. They are in the package org.lacibus.settheoryrels.
The kinds of relation implemented are:
- Relations (a relation is a set of ordered pairs of objects of some class)
- Transitive relations
- Reflexive, transitive relations
- Equivalence relations (relations that are symmetric, reflexive, and transitive).
Each kind of relation has two implementations:
- Using hash sets
- Using tree sets.
These implementations have the characteristics that determining whether two items are related is a very rapid operation, but adding a pair of items to a relation or removing a pair of items from a relation is slow.
A jarfile can be downloaded from the dist directory of the repository.
For further details, see the java documentation.
There is also a package org.lacibus.settheoryrelstest containing a test program that can be run from the command line. (See its Tester class.)
The classes were originally developed in a Source Forge project, version 0.1 of which was released in 2012. There have been over 750 downloads from this project. In addition, the settheoryrels package is used in the Lacibus virtual data lake implementation, and has proved robust and problem-free. It is now stable, and released at Version 1.0.