Sets up the underlying filters accordingly
(self, pr)
| 711 | self.mySelector = self._chooseSelector(parseResults) |
| 712 | |
| 713 | def _chooseSelector(self, pr): |
| 714 | """ |
| 715 | Sets up the underlying filters accordingly |
| 716 | """ |
| 717 | if "only_dir" in pr: |
| 718 | vec = self._getVector(pr) |
| 719 | return DirectionSelector(vec) |
| 720 | |
| 721 | elif "type_op" in pr: |
| 722 | return TypeSelector(pr.cq_type) |
| 723 | |
| 724 | elif "dir_op" in pr: |
| 725 | vec = self._getVector(pr) |
| 726 | minmax = self.operatorMinMax[pr.dir_op] |
| 727 | |
| 728 | if "index" in pr: |
| 729 | return DirectionNthSelector( |
| 730 | vec, int("".join(pr.index.asList())), minmax |
| 731 | ) |
| 732 | else: |
| 733 | return DirectionMinMaxSelector(vec, minmax) |
| 734 | |
| 735 | elif "center_nth_op" in pr: |
| 736 | vec = self._getVector(pr) |
| 737 | minmax = self.operatorMinMax[pr.center_nth_op] |
| 738 | |
| 739 | if "index" in pr: |
| 740 | return CenterNthSelector(vec, int("".join(pr.index.asList())), minmax) |
| 741 | else: |
| 742 | return CenterNthSelector(vec, -1, minmax) |
| 743 | |
| 744 | elif "other_op" in pr: |
| 745 | vec = self._getVector(pr) |
| 746 | return self.operator[pr.other_op](vec) |
| 747 | |
| 748 | else: |
| 749 | args = self.namedViews[pr.named_view] |
| 750 | return DirectionMinMaxSelector(*args) |
| 751 | |
| 752 | def _getVector(self, pr): |
| 753 | """ |
no test coverage detected