Skip to content

Remove unused getSortKey from DataValue interface #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ On [Packagist](https://packagist.org/packages/data-values/javascript):
### 0.9.0 (dev)
* Removed `dataValues.TimeValue.getYear`, `getMonth`, `getDay`, `getHour`, `getMinute`, and
`getSecond`.
* Removed `dataValues.DataValue.getSortKey` from the interface and all implementations.
* Removed `globeCoordinate.GlobeCoordinate.iso6709`.
* Declared `globeCoordinate.GlobeCoordinate.getDecimal` private.

### 0.8.4 (2017-07-18)
Expand Down
10 changes: 0 additions & 10 deletions lib/globeCoordinate/globeCoordinate.GlobeCoordinate.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@
};
},

/**
* Returns a coordinate's ISO 6709 string representation.
* (see globeCoordinate.iso6709)
*
* @return {string}
*/
iso6709: function() {
return globeCoordinate.iso6709( this.getDecimal() );
},

/**
* Compares the object to another GlobeCoordinate object and returns whether both represent
* the same information.
Expand Down
11 changes: 0 additions & 11 deletions src/DataValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ $.extend( SELF.prototype, {
*/
getValue: util.abstractMember,

/**
* Returns a key that can be used for sorting the data value.
* Can be either numeric or a string.
* NOTE: this could very well be set by the API, together with the value. Since the value is
* immutable, this won't change as well and there is no need for having the logic here.
* @abstract
*
* @return {string|number}
*/
getSortKey: util.abstractMember,

/**
* Returns a simple JSON structure representing this data value.
* @abstract
Expand Down
9 changes: 0 additions & 9 deletions src/values/BoolValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ var SELF = dv.BoolValue = util.inherit( 'DvBoolValue', PARENT, function( value )
*/
_value: null,

/**
* @inheritdoc
*
* @return {number}
*/
getSortKey: function() {
return this._value ? 1 : 0;
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/DecimalValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@ var SELF = dv.DecimalValue = util.inherit( 'DvDecimalValue', PARENT, function( v
*/
_value: null,

/**
* @inheritdoc
*
* @return {string}
*/
getSortKey: function() {
return this._value;
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/GlobeCoordinateValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ var SELF
*/
_value: null,

/**
* @inheritdoc
*
* @return {string}
*/
getSortKey: function() {
return this.getValue().iso6709();
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/MonolingualTextValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ var SELF
*/
_text: null,

/**
* @inheritdoc
*
* @return string
*/
getSortKey: function() {
return this._languageCode + this._text;
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/MultilingualTextValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ var SELF
*/
_texts: null,

/**
* @inheritdoc
*
* @return {string}
*/
getSortKey: function() {
return this._texts.length < 1 ? '' : this._texts[0].getSortKey();
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/NumberValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ var SELF = dv.NumberValue = util.inherit( 'DvNumberValue', PARENT, function( val
*/
_value: null,

/**
* @inheritdoc
*
* @return {number}
*/
getSortKey: function() {
return this._value;
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/QuantityValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ var SELF
*/
_upperBound: null,

/**
* @inheritdoc
*
* @return {string}
*/
getSortKey: function() {
return this._amount.getValue();
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/StringValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ var SELF = dv.StringValue = util.inherit( 'DvStringValue', PARENT, function( val
*/
_value: null,

/**
* @inheritdoc
*
* @return {string}
*/
getSortKey: function() {
return this._value;
},

/**
* @inheritdoc
*
Expand Down
11 changes: 0 additions & 11 deletions src/values/TimeValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,6 @@ var SELF = dv.TimeValue = util.inherit( 'DvTimeValue', PARENT, function( timesta
return this._options[key];
},

/**
* @inheritdoc
*
* @return {string}
*/
getSortKey: function() {
return this.timestamp.replace( /^([+-])(\d+)/, function ( $0, sign, year ) {
return sign + pad( year, 16 );
} );
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/UnDeserializableValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@ var SELF = dv.UnDeserializableValue = util.inherit(
*/
_deserializeError: null,

/**
* @inheritdoc
*
* @return {string}
*/
getSortKey: function() {
return this.getReason();
},

/**
* @inheritdoc
*
Expand Down
9 changes: 0 additions & 9 deletions src/values/UnknownValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ var SELF = dv.UnknownValue = util.inherit( 'DvUnknownValue', PARENT, function( v
*/
_value: null,

/**
* @inheritdoc
*
* @return {number}
*/
getSortKey: function() {
return 0;
},

/**
* @inheritdoc
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define( [
QUnit.module( 'globeCoordinate.GlobeCoordinate.js' );

QUnit.test( 'Basic checks', function( assert ) {
assert.expect( 10 );
assert.expect( 9 );
var c;

assert['throws'](
Expand Down Expand Up @@ -70,12 +70,6 @@ define( [
{ latitude: 1.5, longitude: 1.5, precision: 0.1 },
'Verified getDecimal()'
);

assert.equal(
typeof c.iso6709(),
'string',
'Verified iso6709()'
);
} );

QUnit.test( 'Precision defaults to null', function( assert ) {
Expand Down Expand Up @@ -119,36 +113,6 @@ define( [
);
} );

QUnit.test( 'ISO 6709 strings', function( assert ) {
assert.expect( 12 );
var gcDefs = [
{ precision: 10, expected: '+10+010/' },
{ precision: 2, expected: '+14+012/' },
{ precision: 1, expected: '+13+012/' },
{ precision: 0.1, expected: '+1307+01207/' },
{ precision: 0.01, expected: '+130724+0120724/' },
{ precision: 1 / 60, expected: '+1307+01207/' },
{ precision: 1 / 3600, expected: '+130724+0120724/' },
{ precision: 1 / 36000, expected: '+130724.4+0120724.4/' },
{ precision: 1 / 360000, expected: '+130724.42+0120724.42/' },
{ precision: 0, expected: '+130724.42+0120724.42/' },
{ precision: null, expected: '+130724.42+0120724.42/' },
{ expected: '+130724.42+0120724.42/' }
],
c;

$.each( gcDefs, function( i, gcDef ) {
c = new globeCoordinate.GlobeCoordinate(
{ latitude: 13.12345, longitude: 12.12345, precision: gcDef.precision }
);

assert.ok(
c.iso6709() === gcDef.expected,
'Validated ISO 6709 string of data set #' + i + '.'
);
} );
} );

QUnit.test( 'Strict (in)equality', function( assert ) {
assert.expect( 169 );
var gcDefs = [
Expand Down
22 changes: 0 additions & 22 deletions tests/src/dataValues.DataValue.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,28 +131,6 @@ define( [
}
},

/**
* Tests the getSortKey method.
*
* @since 0.1
*
* @param {QUnit.assert} assert
*/
testGetSortKey: function( assert ) {
var instances = this.getInstances(),
i,
keyType;

for ( i in instances ) {
keyType = typeof instances[i].getSortKey();

assert.ok(
keyType === 'string' || keyType === 'number',
'return value is a string or number'
);
}
},

/**
* Tests whether the data value's constructor has a newFromJSON function.
*
Expand Down
Loading