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() {
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.
16 image.collections.extension.domextractor.DocumentFeature = function(relevance) {
17 /** @private {number} */
18 this.relevance_ = relevance;
20 var DocumentFeature = image.collections.extension.domextractor.DocumentFeature;
24 * Returns the feature relevance.
27 DocumentFeature.prototype.getRelevance = function() {
28 return this.relevance_;
33 * Compares two document features by their relevance.
34 * @param {!DocumentFeature} feature1
35 * @param {!DocumentFeature} feature2
38 DocumentFeature.compare = function(feature1, feature2) {
39 if (feature1 == feature2) {
42 return feature1.getRelevance() - feature2.getRelevance();