Compare ImageLists
 Compare each image in turn until the result of a comparison
 is not 0. If all comparisons return 0, then
   return if A.scene != B.scene
   return A.length <=> B.length
968899
def [](*args)
      a = @images[*args]
      if a.respond_to?(:each)
        ilist = self.class.new
        a.each { |image| ilist << image }
        a = ilist
      end
      a
    end
1266739
def index_lists_equal(a: List[Index], b: List[Index]) -> bool:
    
    n = len(a)
    if len(b) != n:
        return False
    for i in range(n):
        if not indexes_equal(a[i], b[i]):
            log.debug("Mismatch: {!r} != {!r}", a[i], b[i])
            return False
    return True
909967
public int compareTo(Piece other) {
    // return true for the same pieces, otherwise sort by time seen, then by index;
    if (this.equals(other)) {
      return 0;
    } else if (this.seen == other.seen) {
      return new Integer(this.index).compareTo(other.index);
    } else if (this.seen < other.seen) {
      return -1;
    } else {
      return 1;
    }
  }
1341607
function _comparer (a, b) {
    var result = 0;

    if (typeof a !== typeof b) {
        a = String(a);
        b = String(b);
    }

    if (!areSVZ(a, b)) {
        // eslint-disable-next-line no-self-compare
        result = a > b || a !== a ? 1 : -1;
    }

    return result;
}
877246
@Override
	public boolean next() {
		if (currentScan != null) {
			if (currentScan == s1)
				hasMore1 = s1.next();
			else if (currentScan == s2)
				hasMore2 = s2.next();
		}

		if (!hasMore1 && !hasMore2)
			return false;
		else if (hasMore1 && hasMore2) {
			// update currentScan
			currentScan = comp.compare(s1, s2) < 0 ? s1 : s2;
		} else if (hasMore1)
			currentScan = s1;
		else if (hasMore2)
			currentScan = s2;
		return true;
	}
399216
public int compare(Attribute a, Attribute b) {
        int result = a.getId().toString().compareTo(b.getId().toString());

        if (result == 0) {
            result = a.getType().toString().compareTo(b.getType().toString());
        } else {
            return result;
        }

        if (result == 0) {
            result = a.getValue().encode().compareTo(b.getValue().encode());
        } else {
            return result;
        }

        if (result == 0
                && (a.getIssueInstant() != null || b.getIssueInstant() != null)) {
            if (a.getIssueInstant() == null && b.getIssueInstant() == null) {
                result = 0;
            } else if (a.getIssueInstant() != null
                    && b.getIssueInstant() == null) {
                result = 1;
            } else if (a.getIssueInstant() == null
                    && b.getIssueInstant() != null) {
                result = -1;
            } else {
                result =
                        a.getIssueInstant().encode().compareTo(b
                                .getIssueInstant().encode());
            }
        }

        return result;
    }
101729
def percentSame(image1, image2):
        '''
        
        '''

        # If the images differ in size, return 0% same.
        size_x1, size_y1 = image1.size
        size_x2, size_y2 = image2.size
        if (size_x1 != size_x2 or
                    size_y1 != size_y2):
            return 0

        # Images are the same size
        # Return the percent of pixels that are equal.
        numPixelsSame = 0
        numPixelsTotal = size_x1 * size_y1
        image1Pixels = image1.load()
        image2Pixels = image2.load()

        # Loop over all pixels, comparing pixel in image1 to image2
        for x in range(size_x1):
            for y in range(size_y1):
                if image1Pixels[x, y] == image2Pixels[x, y]:
                    numPixelsSame += 1

        return numPixelsSame / float(numPixelsTotal)
319676
@Override public int compareTo(Program that) {

      int cmp = Integer.compare(depth, that.depth);
      if (cmp == 0)
      {
         return Integer.compare(length, that.length);
      } else {
         return cmp;
      }
   }
416918
public static <T1 extends Comparable<T1>, T2 extends Comparable<T2>> int compare(T1 a1, T1 b1, T2 a2, T2 b2) {
        int res = N.compare(a1, b1);

        return res == 0 ? N.compare(a2, b2) : res;
    }
265670
@Override
    public int compare(IAtomContainer a, IAtomContainer b) {

        Point2d p1 = center(a);
        Point2d p2 = center(b);

        if (p1.x > p2.x) return +1;
        if (p1.x < p2.x) return -1;
        if (p1.y > p2.y) return +1;
        if (p1.y < p2.y) return -1;

        return 0;

    }
348444
function(a, b)
	{
		if ((a == null && b != null) || (a != null && b == null) ||
			(a != null && b != null && a.length != b.length))
		{
			return false;
		}
		else if (a != null && b != null)
		{
			for (var i = 0; i < a.length; i++)
			{
				if (a[i] == b[i] || (a[i] != null && !a[i].equals(b[i])))
				{
					return false;
				}
			}
		}
		
		return true;
	}
345893
def _compare(self, other, method):
        """"""
        # This needs to be updated to take uncertainty into account:
        if isinstance(other, abc_mapping_primitives.Coordinate):
            if self.get_dimensions() != other.get_dimensions():
                return False
            other_values = other.get_values()
            for index in range(self._dimensions):
                if not method(self._values[index], other_values[index]):
                    return False
            return True
        return NotImplemented
1055144
def compare(self, first, second):
        
        if first.lower() == second.lower():
            return True
        else:
            return False
22970
def compare_singularity_images(image_paths1, image_paths2=None):
    '''
    '''
    repeat = False
    if image_paths2 is None:
        image_paths2 = image_paths1
        repeat = True

    if not isinstance(image_paths1,list):
        image_paths1 = [image_paths1]

    if not isinstance(image_paths2,list):
        image_paths2 = [image_paths2]

    dfs = pandas.DataFrame(index=image_paths1,columns=image_paths2)

    comparisons_done = []
    for image1 in image_paths1:
        fileobj1,tar1 = get_image_tar(image1)

        members1 = [x.name for x in tar1]
        for image2 in image_paths2:
            comparison_id = [image1,image2]
            comparison_id.sort()
            comparison_id = "".join(comparison_id)
            if comparison_id not in comparisons_done:
                if image1 == image2:
                    sim = 1.0
                else:
                    fileobj2,tar2 = get_image_tar(image2)
                    members2 = [x.name for x in tar2]
                    c = compare_lists(members1, members2)
                    sim = information_coefficient(c['total1'],c['total2'],c['intersect'])
                    delete_image_tar(fileobj2, tar2)
                        
                dfs.loc[image1,image2] = sim
                if repeat:
                    dfs.loc[image2,image1] = sim
                comparisons_done.append(comparison_id)
        delete_image_tar(fileobj1, tar1)
    return dfs
925401
@SuppressWarnings("ObjectEquality")
    public int compareTo(int offset, int length, Slice that, int otherOffset, int otherLength)
    {
        return compareTo(offset, length, that.base, otherOffset, otherLength);
    }
1325126
@Override
    public int compareTo(Enhancement o) {
        if (this.equals(o))
            return 0;

        if (this.confidence > o.getConfidence())
            return -1;
        else if (this.confidence < o.getConfidence())
            return 1;
        else
            return 0;
    }
1296061
private int compareStarts(Interval<T> other){
		if (start == null && other.start == null)
			return 0;
		if (start == null)
			return -1;
		if (other.start == null)
			return 1;
		int compare = start.compareTo(other.start);
		if (compare != 0)
			return compare;
		if (isStartInclusive ^ other.isStartInclusive)
			return isStartInclusive ? -1 : 1;
		return 0;
	}