Adapted some codes in the Allen's Interval Reasoning package.