               -1
             else
               0
+        
         @_populated = true
   
     @method 'destroyAll', ->

  
    @method 'populate', ->
      unless @_populated
        candidates = @_model._byUuid
        cardinality = 1
        for condition in @_conditions
          if condition.index && condition.index.cardinality() > cardinality
            candidates = condition.index.find condition.value
            cardinality = condition.index.cardinality()        
      
        for uuid of candidates
          if candidates.hasOwnProperty uuid
            candidate = candidates[uuid]
            if candidate.matches @_conditions
              @add candidate

        if @_order
          order = @_order
          @_array.sort (a, b) ->

    @method 'order', (order) ->
      @fork ->
        @_order = order
    
    @method 'index', ->
      unless @_index
        @_index = @_model.master()
        
        if @_model._indexes
          cardinality = 0
          for condition in @_conditions
            if condition.type == 'equals'
              if index = @_model._indexes[condition.attribute]
                if index.cardinality() > cardinality
                  @_index = index.get condition.value
                  cardinality = index.cardinality()
      @_index

    @method 'addBindings', ->
      @index().bind 'itemAdded',   this, 'targetItemAdded'
      @index().bind 'itemRemoved', this, 'targetItemRemoved'
      @_bindingsAdded = true
  
    @method 'removeBindings', ->
      @index().unbindAll(this)
      @_bindingsAdded = false
  
    @method 'bind', (trigger, receiver, selector) ->
