| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- "use strict";
- var LeafMatchExpression = require('./LeafMatchExpression.js');
- var TextMatchExpression = module.exports = function TextMatchExpression() {
- base.call(this, 'TEXT');
- }, klass = TextMatchExpression, base = LeafMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor: {value: klass}});
- /**
- *
- * Initializes the class object.
- *
- * @param query
- * @param language
- * @returns {*}
- */
- proto.init = function init(query, language) {
- this._query = query;
- this._language = language;
- return this.initPath('_fts');
- };
- /**
- * Gets the query.
- *
- * @returns {*}
- */
- proto.getQuery = function getQuery() {
- return this._query;
- };
- /**
- * Gets the language.
- *
- * @returns {*}
- */
- proto.getLanguage = function getLanguage() {
- return this._language;
- };
- /**
- * Check if the input element matches.
- *
- * @param e
- * @returns {boolean}
- */
- proto.matchesSingleElement = function matchesSingleElement(e) {
- return true;
- };
- /**
- * Debug a string.
- *
- * @param level
- * @returns {string}
- */
- proto.debugString = function debugString(level) {
- var rtn = this._debugAddSpace(level);
- rtn += 'TEXT : query=' + ', language=' + this._language + ', tag=';
- var tagData = this.getTag();
- if (tagData !== null) {
- tagData.debugString(level);
- } else {
- rtn += 'NULL';
- }
- return rtn + '\n';
- };
- /**
- * Verifies the equivalency of two operands.
- *
- * @param other
- * @returns {boolean}
- */
- proto.equivalent = function equivalent(other) {
- if (this.matchType() !== other.matchType()) {
- return false;
- }
- if (other.getQuery() !== this._query) {
- return false;
- }
- if (other.getLanguage() !== this._language) {
- return false;
- }
- return true;
- };
- /**
- * Clone this instance into a new one.
- *
- * @returns {TextMatchExpression}
- */
- proto.shallowClone = function shallowClone() {
- var next = new TextMatchExpression();
- next.init(this._query, this._language);
- if (this.getTag()) {
- next.getTag(this.getTag().clone());
- }
- return next;
- };
|