From 637e84d9b7b365e50ccd959f704def51b638b66e Mon Sep 17 00:00:00 2001 From: Adam Wardynski <award@.(B-4.4.46a)> Date: Tue, 16 Nov 2010 18:10:58 +0100 Subject: [PATCH] PositionRef is not a Value anymore. --- libwccl/ops/equals.h | 54 ---------------------------------- libwccl/values/positionref.cpp | 1 - libwccl/values/positionref.h | 3 +- 3 files changed, 1 insertion(+), 57 deletions(-) diff --git a/libwccl/ops/equals.h b/libwccl/ops/equals.h index 74311bb..7864afd 100644 --- a/libwccl/ops/equals.h +++ b/libwccl/ops/equals.h @@ -112,60 +112,6 @@ protected: } }; -/** - * Predicate that checks for equality of PositionRefs, given sentence context - */ -template <> -class Equals<PositionRef> : public Predicate { -public: - typedef boost::shared_ptr<Function<PositionRef> > ArgFunctionPtr; - - Equals(const ArgFunctionPtr& arg1_expr, const ArgFunctionPtr& arg2_expr) - : arg1_expr_(arg1_expr), arg2_expr_(arg2_expr) - { - BOOST_ASSERT(arg1_expr_); - BOOST_ASSERT(arg2_expr_); - } - - virtual std::string to_string(const Corpus2::Tagset& tagset) const { - return BinaryFunctionFormatter::to_string(tagset, *this, *arg1_expr_, *arg2_expr_); - } - - virtual std::string to_raw_string() const { - return BinaryFunctionFormatter::to_raw_string(*this, *arg1_expr_, *arg2_expr_); - } - - virtual const std::string raw_operator_name() const { - return "equals"; - } - -protected: - const ArgFunctionPtr arg1_expr_; - const ArgFunctionPtr arg2_expr_; - - typedef FunctionBase::BaseRetValPtr BaseRetValPtr; - - /** - * Take values of arguments from expressions and return True if they are equal, - * False otherwise. - */ - virtual BaseRetValPtr apply_internal(const SentenceContext& context) const { - boost::shared_ptr<PositionRef> arg1 = this->arg1_expr_->apply(context); - boost::shared_ptr<PositionRef> arg2 = this->arg2_expr_->apply(context); - if(arg1->equals(*arg2)) { - return Predicate::True->apply(context); - } else { - //in the given context both position refs can still point nowhere - //even if they have different underlying value - int abs_pos1 = context.get_abs_position(*arg1); - int abs_pos2 = context.get_abs_position(*arg2); - if(!context.is_inside(abs_pos1) && !context.is_inside(abs_pos2)) { - return Predicate::True->apply(context); - } - } - return Predicate::False->apply(context); - } -}; } /* end ns Wccl */ #endif // LIBWCCL_OPS_EQUALS_H diff --git a/libwccl/values/positionref.cpp b/libwccl/values/positionref.cpp index 5b79088..f0c24c0 100644 --- a/libwccl/values/positionref.cpp +++ b/libwccl/values/positionref.cpp @@ -3,7 +3,6 @@ namespace Wccl { -const char* PositionRef::type_name = "PositionRef"; std::string PositionRef::to_raw_string() const { diff --git a/libwccl/values/positionref.h b/libwccl/values/positionref.h index 4b0ffb6..d710278 100644 --- a/libwccl/values/positionref.h +++ b/libwccl/values/positionref.h @@ -6,10 +6,9 @@ namespace Wccl { -class PositionRef : public Value +class PositionRef { public: - WCCL_VALUE_PREAMBLE explicit PositionRef(const boost::shared_ptr<Position>& base, int offset = 0) -- GitLab