The Contract Automata Library supports the Contract Automata formalism and their operations, and can be easily extended to support similar automata-based formalisms.
Currently, synchronous Communicating Machines are also supported by the library.
This library is a by-product of scientific research on behavioural types/contracts, and implements results published in international conferences and journals.
Using the library it is possible to create new automata, import/export them, and to perform operations on them, as for example computing a composition of contracts, or computing a refinement of a composition satisfying some property (expressed as an automaton or an invariant).

Contract automata are a dialect of Finite State Automata, with special labels and tailored composition and synthesis operations.
Contract automata are composable: a composition of contracts is again a contract automaton.
Contract automata support as operation the synthesis of the most permissive controller from Supervisory Control Theory for Discrete Event Systems.
Contract automata are used to express behavioural contracts, which are used to specify (behavioural) services interfaces, for computing a composition of contracts and synthesise a composition enjoying well-behaving properties, specified as invariants or as automata.

Contract automata formalise behavioural service contracts in terms of service offer actions and service request actions that need to match to achieve agreement among a composition of contracts.
Modalities are used to indicate when an action must be matched (necessary) and when it can be withdrawn (permitted) in the synthesised coordination.
Contract automata can be configured using a product line, where each product (or configuration) predicate on which actions are required and which are forbidden.

For more info and references on publications about Contract Automata (conferences proceedings and journals) check https://contractautomataproject.github.io/ContractAutomataLib/

Packages 
Package Description
io.github.contractautomata.catlib.automaton
The automaton package contains the class implementing an automaton.
Each Automaton has a set of transitions, a set of states, an initial state and a set of final states.
To be composable, an Automaton implements the interface Ranked.
io.github.contractautomata.catlib.automaton.label
The label package groups classes related to labels of automata.
Label is the super class having a content that is a tuple of a generic type.
io.github.contractautomata.catlib.automaton.label.action
The action package groups the classes implementing actions of labels.
Action is the super class from which the other actions are inheriting.
In Contract Automata, an action can be either an OfferAction, a RequestAction or an IdleAction (i.e., nil action).
Actions are matchable and a request action matches an offer action (and vice-versa) if both have the same label.
Actions can have an Address, in this case implementing the interface AddressedAction.
io.github.contractautomata.catlib.automaton.state
The state package groups the classes implementing states of automata.
AbstractState is the (abstract) super class, where a state can be initial or final and has a label.
A BasicState implements an AbstractState of a single participant, it has rank 1 and the label of the
state cannot have further inner components.
A State implements an AbstractState with a rank: it is a list of basic states.
Class diagram of this package:
the class diagram
io.github.contractautomata.catlib.automaton.transition
The transition package groups the transitions of an automaton.
Transition is the super class, it has a source and target states and a label.
ModalTransition extends Transition to include modalities.
Modalities of Contract Automata are permicodeed and necessary.
A necessary transition has a label that must be match in a composition whilst a permicodeed transition can be withdrawn.
Necessary transitions can be further distinguished between urgent and lazy, where urgent is the classic
notion of uncontrollability, whereas lazy is a novel notion introduced in contract automata.
Lazy transitions can be either controllable or uncontrollable, according to a given predicate evaluated
on the whole automaton to which this transition belongs to.
Class diagram of this package:
the class diagram
io.github.contractautomata.catlib.converters
The converters package contains the classes for I/O operations (import/export).
io.github.contractautomata.catlib.family
The family package groups together the functionalities that extend
contract automata to product lines.
Featured Modal Contract Automata (FMCA) is the name of this extension.
io.github.contractautomata.catlib.family.converters
The family.converters package groups the I/O operations of import/export
of a product line.
io.github.contractautomata.catlib.operations
This package groups the various operations that can be performed on automata.
io.github.contractautomata.catlib.operations.interfaces
This package groups auxiliary interfaces not primitively available in the JDK.
Class diagram of this package:
the class diagram
io.github.contractautomata.catlib.requirements
This package groups the invariant requirements that can be enforced in a contract automaton.