Fix Android sync regression as a result of https://codereview.chromium.org/1144543009
[chromium-blink-merge.git] / third_party / document_image_extractor / src / document_feature.js
blob7c0b6fb1a752bf099629293559bc07e06153f01e
1 // Copyright 2015  The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 goog.provide('image.collections.extension.domextractor.DocumentFeature');
7 goog.scope(function() {
11 /**
12  * This is a base class for all document features (e.g. title, snippet, image).
13  * @param {number} relevance Relevance of this feature to the document.
14  * @constructor
15  */
16 image.collections.extension.domextractor.DocumentFeature = function(relevance) {
17   /** @private {number} */
18   this.relevance_ = relevance;
20 var DocumentFeature = image.collections.extension.domextractor.DocumentFeature;
23 /**
24  * Returns the feature relevance.
25  * @return {number}
26  */
27 DocumentFeature.prototype.getRelevance = function() {
28   return this.relevance_;
32 /**
33  * Compares two document features by their relevance.
34  * @param {!DocumentFeature} feature1
35  * @param {!DocumentFeature} feature2
36  * @return {number}
37  */
38 DocumentFeature.compare = function(feature1, feature2) {
39   if (feature1 == feature2) {
40     return 0;
41   }
42   return feature1.getRelevance() - feature2.getRelevance();
44 });  // goog.scope