Compare values of this field in two records
@param {Lava.data.Record} record_a
@param {Lava.data.Record} record_b
@returns {boolean} True, in case the value of this field in `record_a` is less than value in `record_b`
777815
function(record_a, record_b) {

		return this._properties_by_guid[record_a.guid][this._name] < this._properties_by_guid[record_b.guid][this._name];

	}
949303
def assert_records_equal_nonvolatile(first, second, volatile_fields, indent=0):
  
  if isinstance(first, dict) and isinstance(second, dict):
    if set(first) != set(second):
      logging.error('%sMismatching keys:', ' ' * indent)
      logging.error('%s  %s', ' ' * indent, list(first.keys()))
      logging.error('%s  %s', ' ' * indent, list(second.keys()))
      assert set(first) == set(second)
    for key in first:
      if key in volatile_fields:
        continue
      try:
        assert_records_equal_nonvolatile(first[key], second[key],
                                         volatile_fields, indent + 2)
      except AssertionError:
        logging.error('%sKey: %s ^', ' ' * indent, key)
        raise
  elif hasattr(first, '_asdict') and hasattr(second, '_asdict'):
    # Compare namedtuples as dicts so we get more useful output.
    assert_records_equal_nonvolatile(first._asdict(), second._asdict(),
                                     volatile_fields, indent)
  elif hasattr(first, '__iter__') and hasattr(second, '__iter__'):
    for idx, (fir, sec) in enumerate(itertools.izip(first, second)):
      try:
        assert_records_equal_nonvolatile(fir, sec, volatile_fields, indent + 2)
      except AssertionError:
        logging.error('%sIndex: %s ^', ' ' * indent, idx)
        raise
  elif (isinstance(first, records.RecordClass) and
        isinstance(second, records.RecordClass)):
    assert_records_equal_nonvolatile(
        {slot: getattr(first, slot) for slot in first.__slots__},
        {slot: getattr(second, slot) for slot in second.__slots__},
        volatile_fields, indent)
  elif first != second:
    logging.error('%sRaw: "%s" != "%s"', ' ' * indent, first, second)
    assert first == second
1118988
public boolean isBaseDatabase(Record record)
    {
        BaseDatabase database = record.getTable().getDatabase();
        boolean isBaseDB = true;
        int counter = (int)record.getCounterField().getValue();
        String startingID = database.getProperty(BaseDatabase.STARTING_ID);
        String endingID = database.getProperty(BaseDatabase.ENDING_ID);
        if (startingID != null)
            if (counter < Integer.parseInt(Converter.stripNonNumber(startingID)))
                isBaseDB = false;
        if (endingID != null)
            if (counter > Integer.parseInt(Converter.stripNonNumber(endingID)))
                isBaseDB = false;
        return isBaseDB;
    }
419593
def diff_record(self, record):
        """"""
        rec = self.get_record(record._record_type, record.host)
        if rec is not None and record is not None:
            return {'removed': tuple(set(rec.results) - set(record.results)),
                    'added': tuple(set(record.results) - set(rec.recults))}
        else:
            return False
641553
def filter_record(self, record):
        
        if len(record) >= self.max_length:
            return record[:self.max_length]
        else:
            return record
919743
function vers_compare(a, b) {
  a = a.split('.');
  b = b.split('.');
  for (var i = 0; i < 3; i++) {
    var d = parseInt(a[i] || '0') - parseInt(b[i] || '0');
    if (d != 0) {
      return d;
    }
  }
  return 0; // Equal
}
1032762
def _setCurrentRecord(self, item, record):
        
        try:
            is_record = item.record() == record
        except:
            is_record = False
        
        if is_record:
            self.setCurrentItem(item)
            return True
        
        for c in range(item.childCount()):
            if self._setCurrentRecord(item.child(c), record):
                return True
        
        return False
693854
function _compareWith (criteria) {
    return function (a, b) {
        var len = criteria.length;
        var criterion = criteria[0];
        var result = criterion.compare(a.value, b.value);

        for (var i = 1; result === 0 && i < len; i++) {
            criterion = criteria[i];
            result = criterion.compare(a.value, b.value);
        }

        if (result === 0) {
            result = a.index - b.index;
        }

        return criterion.isDescending ? -result : result;
    };
}
712719
private boolean isInRecord(String[] strClassNames, int iClassIndex, String strRecordClass)
    {
        boolean bIsInRecord = false;
        for (int i = 0; i <= iClassIndex; i++)
        {
            if (strClassNames[i].equalsIgnoreCase(strRecordClass))
                bIsInRecord = true;   // True, it IS in the record
        }
        return bIsInRecord;    // It is in the record?
    }
1319401
function(record, foreign_key) {

		if (foreign_key in this._collections_by_foreign_id) {

			this._collections_by_foreign_id[foreign_key].push(record);

		} else {

			this._collections_by_foreign_id[foreign_key] = [record];

		}

	}
2733
def match_records(records)
      conditions = self.conditions
      records.select { |record| conditions.matches?(record) }
    end
569606
public boolean matches(SAMRecord record) {
    int myEnd = end == 0 ? Integer.MAX_VALUE : end;
    switch (readPositionConstraint) {
      case OVERLAPPING:
        return CoordMath.overlaps(start, myEnd, 
            record.getAlignmentStart(), record.getAlignmentEnd());
      case CONTAINED:
        return CoordMath.encloses(start, myEnd,
            record.getAlignmentStart(), record.getAlignmentEnd());
      case START_AT:
        return start == record.getAlignmentStart();
    }
    return false;
  }
711141
function isEqual(a, b) {
      var k, checked;

      // Strict equals
      if (a === b) {
        return true;
      }

      // Compare null
      if (a === null || b === null) {
        return a === b;
      }

      // Compare number, boolean, string, undefined
      if (typeof a !== "object" || typeof b !== "object") {
        return a === b;
      }

      // Compare arrays
      if (Tools.isArray(b)) {
        if (a.length !== b.length) {
          return false;
        }

        k = a.length;
        while (k--) {
          if (!isEqual(a[k], b[k])) {
            return false;
          }
        }
      }

      // Shallow compare nodes
      if (isNode(a) || isNode(b)) {
        return a === b;
      }

      // Compare objects
      checked = {};
      for (k in b) {
        if (!isEqual(a[k], b[k])) {
          return false;
        }

        checked[k] = true;
      }

      for (k in a) {
        if (!checked[k] && !isEqual(a[k], b[k])) {
          return false;
        }
      }

      return true;
    }
276719
function ensureFieldHasChanged (obj1, obj2) {
  return isNullsy(obj1) || isNullsy(obj2)
    ? () => false
    : field => obj1[field] !== obj2[field];
}
782619
function compareObjects(schema, version1, version2) {

      var changes = [];

      _.each(version1, function(val, key) {
        var change;
        var field = getField(schema, key, val);
        if (!field) {
          // Current schema can't describe this field
          return;
        }
        if (!_.has(version2, key)) {
          change = { action: 'remove', key: key, field: field, old: version1[key] };
        } else if (!_.isEqual(version2[key], version1[key])) {
          change = { action: 'change', key: key, field: field, old: version1[key], current: version2[key] };
        }
        if (change) {
          change.changes = compareField(field, change.old, change.current);
          changes.push(change);
        }
      });

      _.each(version2, function(val, key) {
        var change;
        var field = getField(schema, key, val);
        if (!field) {
          // Current schema can't describe this field
          return;
        }
        if (!_.has(version1, key)) {
          change = { action: 'add', key: key, field: field, current: val };
          change.changes = compareField(field, change.old, change.current);
          changes.push(change);
        }
      });

      return changes;

      function compareField(field, old, current) {

        if (current && (!old)) {
          old = synth(field.type, current);
        } else if (old && (!current)) {
          current = synth(field.type, old);
        }

        if (field.type === 'array') {

          return compareArrays(schemaIdentifier, schemaDecoratorGenerator(field.schema), old, current);

        } else if ((field.type === 'area') || (field.type === 'singleton')) {

          return compareAreas(old, current);

        } else if (field.type === 'joinByArray') {

          return compareArrays(joinByArrayIdentifier, joinByArrayDecoratorGenerator(field.withType), old, current);

        } else if (field.type === 'joinByOne') {

          return compareArrays(joinByArrayIdentifier, joinByArrayDecoratorGenerator(field.withType), old ? [ old ] : [], current ? [ current ] : []);

        } else {

          // Take advantage of Apostrophe's support for boiling fields
          // down to search text to generate a basis for a text diff.
          // If a special "diffable" function is available use it;
          // that allows us to compare things that don't make
          // good search text but are human readable, like URLs. -Tom

          var oldLines = [];
          var oldText = '';
          var currentLines = [];
          var currentText = '';
          var fieldType = self.apos.schemas.getFieldType(field.type);
          var diffable = fieldType.diffable;
          if (diffable) {
            oldText = diffable(old);
            currentText = diffable(current);
          } else {
            var indexer = fieldType.index;
            if (indexer) {
              indexer(old, field, oldLines);
              indexer(current, field, currentLines);
              oldText = _.filter(_.pluck(oldLines, 'text'), function(line) {
                return line !== undefined;
              }).join("\n");
              currentText = _.filter(_.pluck(currentLines, 'text'), function(line) {
                return line !== undefined;
              }).join("\n");
            }
          }

          var diff = [];
          if (oldText !== undefined && currentText !== undefined) {
            diff = jsDiff.diffSentences(oldText, currentText, { ignoreWhitespace: true });
          }

          var changes = _.map(_.filter(diff, function(diffChange) {
            return diffChange.added || diffChange.removed;
          }), function(diffChange) {
            // Convert a jsDiff change object to an
            // apos versions change object
            if (diffChange.removed) {
              return {
                action: 'remove',
                text: diffChange.value,
                field: {
                  type: 'string',
                  label: 'Content'
                }
              };
            } else {
              return {
                action: 'add',
                text: diffChange.value,
                field: {
                  type: 'string',
                  label: 'Content'
                }
              };
            }
          });
          return changes;
        }

        // If "old" or "current" doesn't exist, make sure
        // we compare the other one to a reasonable value.
        // This is currently only an issue for areas, arrays and objects.
        // TODO: should probably be something we ask schemas to
        // generate for us so it's extensible. -Tom

        function synth(type, existing) {
          var value;
          if (existing && (existing.type === 'area')) {
            value = { type: 'area', items: [] };
          } else if (Array.isArray(existing)) {
            value = [];
          } else if (typeof (existing) === 'object') {
            value = {};
          }
          return value;
        }

      }
    }
802624
def min( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
      min = {}
      hasValues = false
      iterateRecords(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options){|record|
         fieldNames.each{|field|
            value = record[field]
            if value
               baseFieldType = lookupBaseFieldTypeByName(field)
               case baseFieldType
                  when "int32","int64","bool" 
                     value = record[field].to_i
                  when "float"   
                     value = record[field].to_f
               end
            end
            if min[field].nil? or  (value and value < min[field])
               min[field] = value
               hasValues = true
            end
         }
      }
      min = nil if not hasValues
      min
   end
314958
function (a, b) {
        var done = this._done,
            indexOfA,
            comparedWith;
        indexOfA = done.indexOf(a);
        while (-1 < indexOfA) {
            comparedWith = this._getPair(done, indexOfA);
            if (comparedWith === b) {
                return false; // Already compared
            }
            indexOfA = done.indexOf(a, indexOfA + 1);
        }
        return true;
    }