Use extends, super and proper constructor comments for format/filter/

This commit is contained in:
ahocevar
2018-07-17 18:36:26 +02:00
parent 414d1556a7
commit fd962caa1c
21 changed files with 155 additions and 229 deletions

View File

@@ -1,27 +1,24 @@
/**
* @module ol/format/filter/And
*/
import {inherits} from '../../util.js';
import LogicalNary from '../filter/LogicalNary.js';
/**
* @classdesc
* Represents a logical `<And>` operator between two or more filter conditions.
*
* @constructor
* @abstract
* @param {...module:ol/format/filter/Filter} conditions Conditions.
* @extends {module:ol/format/filter/LogicalNary}
*/
class And {
class And extends LogicalNary {
/**
* @param {...module:ol/format/filter/Filter} conditions Conditions.
*/
constructor(conditions) {
const params = ['And'].concat(Array.prototype.slice.call(arguments));
LogicalNary.apply(this, params);
super(...params);
}
}
inherits(And, LogicalNary);
export default And;

View File

@@ -1,7 +1,6 @@
/**
* @module ol/format/filter/Bbox
*/
import {inherits} from '../../util.js';
import Filter from '../filter/Filter.js';
/**
@@ -9,19 +8,19 @@ import Filter from '../filter/Filter.js';
* Represents a `<BBOX>` operator to test whether a geometry-valued property
* intersects a fixed bounding box
*
* @constructor
* @param {!string} geometryName Geometry name to use.
* @param {!module:ol/extent~Extent} extent Extent.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @extends {module:ol/format/filter/Filter}
* @api
*/
class Bbox {
class Bbox extends Filter {
/**
* @param {!string} geometryName Geometry name to use.
* @param {!module:ol/extent~Extent} extent Extent.
* @param {string=} opt_srsName SRS name. No srsName attribute will be set
* on geometries when this is not provided.
*/
constructor(geometryName, extent, opt_srsName) {
Filter.call(this, 'BBOX');
super('BBOX');
/**
* @type {!string}
@@ -41,6 +40,4 @@ class Bbox {
}
inherits(Bbox, Filter);
export default Bbox;

View File

@@ -1,7 +1,6 @@
/**
* @module ol/format/filter/Comparison
*/
import {inherits} from '../../util.js';
import Filter from '../filter/Filter.js';
/**
@@ -9,17 +8,17 @@ import Filter from '../filter/Filter.js';
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature property comparison filters.
*
* @constructor
* @abstract
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} propertyName Name of the context property to compare.
* @extends {module:ol/format/filter/Filter}
*/
class Comparison {
class Comparison extends Filter {
/**
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} propertyName Name of the context property to compare.
*/
constructor(tagName, propertyName) {
Filter.call(this, tagName);
super(tagName);
/**
* @type {!string}
@@ -29,6 +28,4 @@ class Comparison {
}
inherits(Comparison, Filter);
export default Comparison;

View File

@@ -1,7 +1,6 @@
/**
* @module ol/format/filter/ComparisonBinary
*/
import {inherits} from '../../util.js';
import Comparison from '../filter/Comparison.js';
/**
@@ -9,19 +8,19 @@ import Comparison from '../filter/Comparison.js';
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature property binary comparison filters.
*
* @constructor
* @abstract
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @extends {module:ol/format/filter/Comparison}
*/
class ComparisonBinary {
class ComparisonBinary extends Comparison {
/**
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
*/
constructor(tagName, propertyName, expression, opt_matchCase) {
Comparison.call(this, tagName, propertyName);
super(tagName, propertyName);
/**
* @type {!(string|number)}
@@ -36,6 +35,4 @@ class ComparisonBinary {
}
inherits(ComparisonBinary, Comparison);
export default ComparisonBinary;

View File

@@ -1,32 +1,28 @@
/**
* @module ol/format/filter/Contains
*/
import {inherits} from '../../util.js';
import Spatial from '../filter/Spatial.js';
/**
* @classdesc
* Represents a `<Contains>` operator to test whether a geometry-valued property
* contains a given geometry.
*
* @constructor
* @param {!string} geometryName Geometry name to use.
* @param {!module:ol/geom/Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @extends {module:ol/format/filter/Spatial}
* @api
*/
class Contains {
class Contains extends Spatial {
/**
* @param {!string} geometryName Geometry name to use.
* @param {!module:ol/geom/Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @api
*/
constructor(geometryName, geometry, opt_srsName) {
Spatial.call(this, 'Contains', geometryName, geometry, opt_srsName);
super('Contains', geometryName, geometry, opt_srsName);
}
}
inherits(Contains, Spatial);
export default Contains;

View File

@@ -1,24 +1,22 @@
/**
* @module ol/format/filter/During
*/
import {inherits} from '../../util.js';
import Comparison from '../filter/Comparison.js';
/**
* @classdesc
* Represents a `<During>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} begin The begin date in ISO-8601 format.
* @param {!string} end The end date in ISO-8601 format.
* @extends {module:ol/format/filter/Comparison}
* @api
*/
class During {
class During extends Comparison {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} begin The begin date in ISO-8601 format.
* @param {!string} end The end date in ISO-8601 format.
* @api
*/
constructor(propertyName, begin, end) {
Comparison.call(this, 'During', propertyName);
super('During', propertyName);
/**
* @type {!string}
@@ -33,6 +31,4 @@ class During {
}
inherits(During, Comparison);
export default During;

View File

@@ -1,28 +1,24 @@
/**
* @module ol/format/filter/EqualTo
*/
import {inherits} from '../../util.js';
import ComparisonBinary from '../filter/ComparisonBinary.js';
/**
* @classdesc
* Represents a `<PropertyIsEqualTo>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @extends {module:ol/format/filter/ComparisonBinary}
* @api
*/
class EqualTo {
class EqualTo extends ComparisonBinary {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @api
*/
constructor(propertyName, expression, opt_matchCase) {
ComparisonBinary.call(this, 'PropertyIsEqualTo', propertyName, expression, opt_matchCase);
super('PropertyIsEqualTo', propertyName, expression, opt_matchCase);
}
}
inherits(EqualTo, ComparisonBinary);
export default EqualTo;

View File

@@ -8,12 +8,13 @@
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature filters.
*
* @constructor
* @abstract
* @param {!string} tagName The XML tag name for this filter.
* @struct
*/
class Filter {
/**
* @param {!string} tagName The XML tag name for this filter.
*/
constructor(tagName) {
/**

View File

@@ -1,27 +1,23 @@
/**
* @module ol/format/filter/GreaterThan
*/
import {inherits} from '../../util.js';
import ComparisonBinary from '../filter/ComparisonBinary.js';
/**
* @classdesc
* Represents a `<PropertyIsGreaterThan>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @extends {module:ol/format/filter/ComparisonBinary}
* @api
*/
class GreaterThan {
class GreaterThan extends ComparisonBinary {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @api
*/
constructor(propertyName, expression) {
ComparisonBinary.call(this, 'PropertyIsGreaterThan', propertyName, expression);
super('PropertyIsGreaterThan', propertyName, expression);
}
}
inherits(GreaterThan, ComparisonBinary);
export default GreaterThan;

View File

@@ -1,27 +1,23 @@
/**
* @module ol/format/filter/GreaterThanOrEqualTo
*/
import {inherits} from '../../util.js';
import ComparisonBinary from '../filter/ComparisonBinary.js';
/**
* @classdesc
* Represents a `<PropertyIsGreaterThanOrEqualTo>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @extends {module:ol/format/filter/ComparisonBinary}
* @api
*/
class GreaterThanOrEqualTo {
class GreaterThanOrEqualTo extends ComparisonBinary {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @api
*/
constructor(propertyName, expression) {
ComparisonBinary.call(this, 'PropertyIsGreaterThanOrEqualTo', propertyName, expression);
super('PropertyIsGreaterThanOrEqualTo', propertyName, expression);
}
}
inherits(GreaterThanOrEqualTo, ComparisonBinary);
export default GreaterThanOrEqualTo;

View File

@@ -1,31 +1,25 @@
/**
* @module ol/format/filter/Intersects
*/
import {inherits} from '../../util.js';
import Spatial from '../filter/Spatial.js';
/**
* @classdesc
* Represents a `<Intersects>` operator to test whether a geometry-valued property
* intersects a given geometry.
*
* @constructor
* @param {!string} geometryName Geometry name to use.
* @param {!module:ol/geom/Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @extends {module:ol/format/filter/Spatial}
* @api
*/
class Intersects {
class Intersects extends Spatial {
/**
* @param {!string} geometryName Geometry name to use.
* @param {!module:ol/geom/Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
*/
constructor(geometryName, geometry, opt_srsName) {
Spatial.call(this, 'Intersects', geometryName, geometry, opt_srsName);
super('Intersects', geometryName, geometry, opt_srsName);
}
}
inherits(Intersects, Spatial);
export default Intersects;

View File

@@ -1,24 +1,22 @@
/**
* @module ol/format/filter/IsBetween
*/
import {inherits} from '../../util.js';
import Comparison from '../filter/Comparison.js';
/**
* @classdesc
* Represents a `<PropertyIsBetween>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} lowerBoundary The lower bound of the range.
* @param {!number} upperBoundary The upper bound of the range.
* @extends {module:ol/format/filter/Comparison}
* @api
*/
class IsBetween {
class IsBetween extends Comparison {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} lowerBoundary The lower bound of the range.
* @param {!number} upperBoundary The upper bound of the range.
* @api
*/
constructor(propertyName, lowerBoundary, upperBoundary) {
Comparison.call(this, 'PropertyIsBetween', propertyName);
super('PropertyIsBetween', propertyName);
/**
* @type {!number}
@@ -33,6 +31,4 @@ class IsBetween {
}
}
inherits(IsBetween, Comparison);
export default IsBetween;

View File

@@ -1,30 +1,29 @@
/**
* @module ol/format/filter/IsLike
*/
import {inherits} from '../../util.js';
import Comparison from '../filter/Comparison.js';
/**
* @classdesc
* Represents a `<PropertyIsLike>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} pattern Text pattern.
* @param {string=} opt_wildCard Pattern character which matches any sequence of
* zero or more string characters. Default is '*'.
* @param {string=} opt_singleChar pattern character which matches any single
* string character. Default is '.'.
* @param {string=} opt_escapeChar Escape character which can be used to escape
* the pattern characters. Default is '!'.
* @param {boolean=} opt_matchCase Case-sensitive?
* @extends {module:ol/format/filter/Comparison}
* @api
*/
class IsLike {
class IsLike extends Comparison {
/**
* [constructor description]
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} pattern Text pattern.
* @param {string=} opt_wildCard Pattern character which matches any sequence of
* zero or more string characters. Default is '*'.
* @param {string=} opt_singleChar pattern character which matches any single
* string character. Default is '.'.
* @param {string=} opt_escapeChar Escape character which can be used to escape
* the pattern characters. Default is '!'.
* @param {boolean=} opt_matchCase Case-sensitive?
* @api
*/
constructor(propertyName, pattern, opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
Comparison.call(this, 'PropertyIsLike', propertyName);
super('PropertyIsLike', propertyName);
/**
* @type {!string}
@@ -54,6 +53,4 @@ class IsLike {
}
}
inherits(IsLike, Comparison);
export default IsLike;

View File

@@ -1,27 +1,22 @@
/**
* @module ol/format/filter/IsNull
*/
import {inherits} from '../../util.js';
import Comparison from '../filter/Comparison.js';
/**
* @classdesc
* Represents a `<PropertyIsNull>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @extends {module:ol/format/filter/Comparison}
* @api
*/
class IsNull {
class IsNull extends Comparison {
/**
* @param {!string} propertyName Name of the context property to compare.
* @api
*/
constructor(propertyName) {
Comparison.call(this, 'PropertyIsNull', propertyName);
super('PropertyIsNull', propertyName);
}
}
inherits(IsNull, Comparison);
export default IsNull;

View File

@@ -1,27 +1,23 @@
/**
* @module ol/format/filter/LessThan
*/
import {inherits} from '../../util.js';
import ComparisonBinary from '../filter/ComparisonBinary.js';
/**
* @classdesc
* Represents a `<PropertyIsLessThan>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @extends {module:ol/format/filter/ComparisonBinary}
* @api
*/
class LessThan {
class LessThan extends ComparisonBinary {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @api
*/
constructor(propertyName, expression) {
ComparisonBinary.call(this, 'PropertyIsLessThan', propertyName, expression);
super('PropertyIsLessThan', propertyName, expression);
}
}
inherits(LessThan, ComparisonBinary);
export default LessThan;

View File

@@ -1,27 +1,23 @@
/**
* @module ol/format/filter/LessThanOrEqualTo
*/
import {inherits} from '../../util.js';
import ComparisonBinary from '../filter/ComparisonBinary.js';
/**
* @classdesc
* Represents a `<PropertyIsLessThanOrEqualTo>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @extends {module:ol/format/filter/ComparisonBinary}
* @api
*/
class LessThanOrEqualTo {
class LessThanOrEqualTo extends ComparisonBinary {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!number} expression The value to compare.
* @api
*/
constructor(propertyName, expression) {
ComparisonBinary.call(this, 'PropertyIsLessThanOrEqualTo', propertyName, expression);
super('PropertyIsLessThanOrEqualTo', propertyName, expression);
}
}
inherits(LessThanOrEqualTo, ComparisonBinary);
export default LessThanOrEqualTo;

View File

@@ -1,7 +1,6 @@
/**
* @module ol/format/filter/LogicalNary
*/
import {inherits} from '../../util.js';
import {assert} from '../../asserts.js';
import Filter from '../filter/Filter.js';
@@ -10,17 +9,17 @@ import Filter from '../filter/Filter.js';
* Abstract class; normally only used for creating subclasses and not instantiated in apps.
* Base class for WFS GetFeature n-ary logical filters.
*
* @constructor
* @abstract
* @param {!string} tagName The XML tag name for this filter.
* @param {...module:ol/format/filter/Filter} conditions Conditions.
* @extends {module:ol/format/filter/Filter}
*/
class LogicalNary {
class LogicalNary extends Filter {
/**
* @param {!string} tagName The XML tag name for this filter.
* @param {...module:ol/format/filter/Filter} conditions Conditions.
*/
constructor(tagName, conditions) {
Filter.call(this, tagName);
super(tagName);
/**
* @type {Array.<module:ol/format/filter/Filter>}
@@ -31,6 +30,4 @@ class LogicalNary {
}
inherits(LogicalNary, Filter);
export default LogicalNary;

View File

@@ -1,23 +1,21 @@
/**
* @module ol/format/filter/Not
*/
import {inherits} from '../../util.js';
import Filter from '../filter/Filter.js';
/**
* @classdesc
* Represents a logical `<Not>` operator for a filter condition.
*
* @constructor
* @param {!module:ol/format/filter/Filter} condition Filter condition.
* @extends {module:ol/format/filter/Filter}
* @api
*/
class Not {
class Not extends Filter {
/**
* @param {!module:ol/format/filter/Filter} condition Filter condition.
* @api
*/
constructor(condition) {
Filter.call(this, 'Not');
super('Not');
/**
* @type {!module:ol/format/filter/Filter}
@@ -28,5 +26,4 @@ class Not {
}
inherits(Not, Filter);
export default Not;

View File

@@ -1,28 +1,24 @@
/**
* @module ol/format/filter/NotEqualTo
*/
import {inherits} from '../../util.js';
import ComparisonBinary from '../filter/ComparisonBinary.js';
/**
* @classdesc
* Represents a `<PropertyIsNotEqualTo>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @extends {module:ol/format/filter/ComparisonBinary}
* @api
*/
class NotEqualTo {
class NotEqualTo extends ComparisonBinary {
/**
* @param {!string} propertyName Name of the context property to compare.
* @param {!(string|number)} expression The value to compare.
* @param {boolean=} opt_matchCase Case-sensitive?
* @api
*/
constructor(propertyName, expression, opt_matchCase) {
ComparisonBinary.call(this, 'PropertyIsNotEqualTo', propertyName, expression, opt_matchCase);
super('PropertyIsNotEqualTo', propertyName, expression, opt_matchCase);
}
}
inherits(NotEqualTo, ComparisonBinary);
export default NotEqualTo;

View File

@@ -1,27 +1,23 @@
/**
* @module ol/format/filter/Or
*/
import {inherits} from '../../util.js';
import LogicalNary from '../filter/LogicalNary.js';
/**
* @classdesc
* Represents a logical `<Or>` operator between two ore more filter conditions.
*
* @constructor
* @param {...module:ol/format/filter/Filter} conditions Conditions.
* @extends {module:ol/format/filter/LogicalNary}
* @api
*/
class Or {
class Or extends LogicalNary {
/**
* @param {...module:ol/format/filter/Filter} conditions Conditions.
* @api
*/
constructor(conditions) {
const params = ['Or'].concat(Array.prototype.slice.call(arguments));
LogicalNary.apply(this, params);
super(...params);
}
}
inherits(Or, LogicalNary);
export default Or;

View File

@@ -1,7 +1,6 @@
/**
* @module ol/format/filter/Spatial
*/
import {inherits} from '../../util.js';
import Filter from '../filter/Filter.js';
/**
@@ -10,20 +9,20 @@ import Filter from '../filter/Filter.js';
* Represents a spatial operator to test whether a geometry-valued property
* relates to a given geometry.
*
* @constructor
* @abstract
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} geometryName Geometry name to use.
* @param {!module:ol/geom/Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
* @extends {module:ol/format/filter/Filter}
*/
class Spatial {
class Spatial extends Filter {
/**
* @param {!string} tagName The XML tag name for this filter.
* @param {!string} geometryName Geometry name to use.
* @param {!module:ol/geom/Geometry} geometry Geometry.
* @param {string=} opt_srsName SRS name. No srsName attribute will be
* set on geometries when this is not provided.
*/
constructor(tagName, geometryName, geometry, opt_srsName) {
Filter.call(this, tagName);
super(tagName);
/**
* @type {!string}
@@ -43,6 +42,4 @@ class Spatial {
}
inherits(Spatial, Filter);
export default Spatial;