diff --git a/libwccl/ops/match/matchoperator.cpp b/libwccl/ops/match/matchoperator.cpp index f18a8e2d091b37e33941e524f195a55cfc762d22..af296365a79341fd0808f35cc20e5bd1597da44f 100644 --- a/libwccl/ops/match/matchoperator.cpp +++ b/libwccl/ops/match/matchoperator.cpp @@ -4,11 +4,9 @@ namespace Wccl { -const char* MatchOperator::IterationPosVarName = "$_"; - -boost::shared_ptr<MatchVector> MatchOperator::execute( +boost::shared_ptr<Match> MatchOperator::apply( boost::shared_ptr<Position> iter_pos, - const ActionExecContext &context) const + const FunExecContext& context) const { boost::shared_ptr<MatchVector> matches(new MatchVector()); int orig_iter_pos = iter_pos->get_value(); diff --git a/libwccl/ops/match/matchoperator.h b/libwccl/ops/match/matchoperator.h index 348b4164d0098d815a84fac5e9df7a0577b1a041..ff679ca481ddd26014a1a8122937ba211312fb91 100644 --- a/libwccl/ops/match/matchoperator.h +++ b/libwccl/ops/match/matchoperator.h @@ -12,8 +12,6 @@ namespace Wccl { class MatchOperator : public Expression { public: - static const char* IterationPosVarName; - MatchOperator(const std::vector< boost::shared_ptr<const MatchCondition> >& conditions) : _conditions(conditions) { } @@ -30,6 +28,20 @@ public: */ std::string to_string(const Corpus2::Tagset& tagset) const; + /** + * Applies the operator to the given context. + * @returns Vector of matches corresponding to match conditions, + * if all conditions were met. In such case position $_ points one position + * ahead of matched tokens. + * Empty MatchVector is returned if any of the conditions was not met. + * In such case Position $_ is advanced by 1. + * @param iter_pos Pointer to the variable $_ from context's Variables + * @param context Execution context - current sentence and Variables to operate on + */ + boost::shared_ptr<Match> apply( + boost::shared_ptr<Position> iter_pos, + const FunExecContext& context) const; + protected: /** * Writes string representation of the operator to @@ -39,19 +51,6 @@ protected: */ std::ostream& write_to(std::ostream& ostream) const; - /** - * Executes the operator on given context. - * @returns Vector of matches corresponding to match conditions, - * if all conditions were met. In such case position $_ is advanced past matched tokens. - * Empty MatchVector is returned if any of conditions was not met. - * In such case Position $_ is advanced by 1. - * @param iter_pos Pointer to the variable $_ from context's Variables - * @param context Execution context - current sentence and Variables to operate on - */ - boost::shared_ptr<MatchVector> execute( - boost::shared_ptr<Position> iter_pos, - const ActionExecContext &context) const; - private: const std::vector<boost::shared_ptr<const MatchCondition> > _conditions; };