allen-0.1.0.0
MaintainerArchaversine
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Allen.Relation

Description

This module provides functions for working with relations. Note that almost all exposed functions only work with relation bitsets. This is done mainly to optimize the speed in calculations involving relations.

The RelationBits type is a synonym for a 16 bit unsigned integer. Note that since Allen's interval algebra only defines 13 relations, the remaining 3 bits are unused. So the bit representation of every possible relation looks like this:

0b0001111111111111

Modifying the extra 3 bits will not affect the result of any calculations. To view in exact detail how a Relation converted to a bit representation, see the toBits function.

Synopsis

Documentation

converse :: RelationBits -> RelationBits Source #

Return the converse of a Relation bitset.

testRelation :: Relation -> IntervalID -> IntervalID -> Allen Bool Source #

Return if a relation exists between two intervals.

testRelationSet :: [Relation] -> IntervalID -> IntervalID -> Allen Bool Source #

Return if all relations in a set exist between two intervals.

IF the set of relations between interval a and interval b is full, then the function will always return True.

testRelationBits :: RelationBits -> IntervalID -> IntervalID -> Allen Bool Source #

Return if all relations in a set exist between two intervals.

If the set of relations between interval a and interval b is full, then the function will always return True.

composeSingle :: Relation -> Relation -> RelationBits Source #

Compose two relations.

Composition table available at https://www.ics.uci.edu/~alspaugh/cls/shr/allen.html.

compose :: RelationBits -> RelationBits -> RelationBits Source #

Compose two sets of relations.

Composition table available at https://www.ics.uci.edu/~alspaugh/cls/shr/allen.html.

bitsFromString :: String -> RelationBits Source #

Given a string, return the bit representation of the set of relations. Valid characters: pmoFDseSdfoMP.

You may also use full to represent all relations, or concur to represent all relations excluding Precedes and PrecededBy.

Example:

let x = bitsFromString "pms"    -- [Precedes, Meets, StartedBy]
    y = bitsFromString "full"   -- [Precedes .. PrecededBy]
    z = bitsFromString "concur" -- [Overlaps .. OverlappedBy]