code: public boolean overlaps(Location location) {
           if (location.getBeginPosition()>=getBeginPosition() && location.getBeginPosition() <= getEndPosition()) 
               return true;
           if(location.getBeginPosition() <= getBeginPosition() && location.getEndPosition()>=getBeginPosition()) 
               return true;
          else {
              return false;
          }
      }
docs: 6361..6539,6363..6649