Skip to content

Commit

Permalink
Clarify .adjacent in doc
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Sep 19, 2020
1 parent b6e0931 commit c890f2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ False
```

- `i.adjacent(other)` tests if the two intervals are adjacent.
Two intervals are adjacent if their intersection is empty, and their union is an atomic interval.
Two intervals are adjacent if their intersection is empty, and their union is an atomic interval (or,
in other words, if one interval fills the *gaps* of the other).
```python
>>> P.closed(0, 1).adjacent(P.openclosed(1, 2))
True
Expand Down
2 changes: 2 additions & 0 deletions portion/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ def adjacent(self, other):
Test if given interval is adjacent.
An interval is adjacent if there is no intersection, and their union is an atomic interval.
For atomic intervals, this corresponds to the usual definition of adjacency but for
non-atomic intervals, it has stronger requirements.
:param other: an interval.
:return: True if intervals are adjacent, False otherwise.
Expand Down

0 comments on commit c890f2f

Please sign in to comment.