Sha256: 8955d7961f9a4e062379ba940080e3ffc13e983063b667cbfd9806e9b006e98f

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 KB

Contents

// ==========================================================================
// Project:   SproutCore Costello - Property Observing Library
// Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2010 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

/**
  @namespace
  
  Implements some standard methods for comparing objects. Add this mixin to
  any class you create that can compare its instances.
  
  You should implement the compare() method.
  
  @since SproutCore 1.0
*/
SC.Comparable = {
  
  /**
    walk like a duck. Indicates that the object can be compared.
    
    @type Boolean
  */
  isComparable: YES,
  
  /**
    Override to return the result of the comparison of the two parameters. The
    compare method should return
      -1 if a < b
       0 if a == b
       1 if a > b
    
    Default implementation raises
    an exception.
    
    @param a {Object} the first object to compare
    @param b {Object} the second object to compare
    @returns {Integer} the result of the comparison
  */
  compare: function(a, b) {
    throw "%@.compare() is not implemented".fmt(this.toString());
  }
  
};

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js