Sha256: c22b78b7fc6f80212c59885289a9ff7d8b0b0c7a43661117472d204fdac93ca9

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

// ==========================================================================
// Project:   SproutCore Costello - Property Observing Library
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2009 Apple Inc. All rights reserved.
// License:   Licened 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

16 entries across 16 versions & 1 rubygems

Version Path
sproutcore-1.0.1046 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1043 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1042 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1037 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1035 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1031 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1030 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1029 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1027 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1028 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1026 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1025 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1024 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1009 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1008 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js
sproutcore-1.0.1003 frameworks/sproutcore/frameworks/runtime/mixins/comparable.js