Checks if two views have the same members observing order. E.g. {A,B,C} and {B,A,C} returns false,
{A,C,B} and {A,C,B} returns true
774263
public static boolean sameMembersOrdered(View v1, View v2) {
        return Arrays.equals(v1.getMembersRaw(), v2.getMembersRaw());
    }
506297
def _valid_comparison(time_a, time_b, event_a, event_b):
    """"""
    if time_a == time_b:
        # Ties are only informative if exactly one event happened
        return event_a != event_b
    if event_a and event_b:
        return True
    if event_a and time_a < time_b:
        return True
    if event_b and time_b < time_a:
        return True
    return False
1314818
public static boolean arrayEquals(
      Object leftBase, long leftOffset, Object rightBase, long rightOffset, final long length) {
    int i = 0;

    // check if stars align and we can get both offsets to be aligned
    if ((leftOffset % 8) == (rightOffset % 8)) {
      while ((leftOffset + i) % 8 != 0 && i < length) {
        if (Platform.getByte(leftBase, leftOffset + i) !=
            Platform.getByte(rightBase, rightOffset + i)) {
              return false;
        }
        i += 1;
      }
    }
    // for architectures that support unaligned accesses, chew it up 8 bytes at a time
    if (unaligned || (((leftOffset + i) % 8 == 0) && ((rightOffset + i) % 8 == 0))) {
      while (i <= length - 8) {
        if (Platform.getLong(leftBase, leftOffset + i) !=
            Platform.getLong(rightBase, rightOffset + i)) {
              return false;
        }
        i += 8;
      }
    }
    // this will finish off the unaligned comparisons, or do the entire aligned
    // comparison whichever is needed.
    while (i < length) {
      if (Platform.getByte(leftBase, leftOffset + i) !=
          Platform.getByte(rightBase, rightOffset + i)) {
            return false;
      }
      i += 1;
    }
    return true;
  }
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
413871
def is_equal(self, other):
        
        def check_qgs_map_layers(layer_a, layer_b, if_property):
            """Internal function to check two layers

            :param layer_a: Layer A
            :type layer_a: QgsMapLayer
            :param layer_b: Layer B
            :type layer_b: QgsMapLayer

            :param if_property: Property currently checked
            :type if_property: basestring

            :return: Tuple with bool and error message if needed
            :rtype: (bool, basestring)
            """
            if byteify(layer_a.keywords) != byteify(
                    layer_b.keywords):
                message = (
                    'Keyword Layer is not equal is %s' % if_property)
                return False, message
            if isinstance(layer_a, QgsVectorLayer):
                fields_a = [f.name() for f in layer_a.fields()]
                fields_b = [f.name() for f in layer_b.fields()]
                if fields_a != fields_b:
                    message = (
                        'Layer fields is not equal for %s' %
                        if_property)
                    return False, message
                if (layer_a.featureCount()
                        != layer_b.featureCount()):
                    message = (
                        'Feature count is not equal for %s' %
                        if_property)
                    return False, message
            return True, None

        properties = [
            'debug_mode',
            'crs',
            'analysis_extent',
            'datastore',
            'name',
            'start_datetime',
            'end_datetime',
            'duration',
            'hazard',
            'aggregation',
            'exposures',

            # Output layers on new IF object will have a different provenance
            # data with the one from original IF.

            # 'aggregation_summary',
            # 'analysis_impacted',
            # 'impact_functions'
        ]
        for if_property in properties:
            try:
                property_a = getattr(self, if_property)
                property_b = getattr(other, if_property)
                if not isinstance(property_a, type(property_b)):
                    message = (
                        'Different type of property %s.\nA: %s\nB: %s' % (
                            if_property, type(property_a), type(property_b)))
                    return False, message
                if isinstance(property_a, QgsMapLayer):
                    status, message = check_qgs_map_layers(
                        property_a, property_b, if_property)
                    if not status:
                        return status, message
                elif isinstance(property_a, QgsGeometry):
                    if not property_a.equals(property_b):
                        string_a = property_a.asWkt()
                        string_b = property_b.asWkt()
                        message = (
                            '[Non Layer] The not equal property is %s.\n'
                            'A: %s\nB: %s' % (if_property, string_a, string_b))
                        return False, message
                elif isinstance(property_a, DataStore):
                    if property_a.uri_path != property_b.uri_path:
                        string_a = property_a.uri_path
                        string_b = property_b.uri_path
                        message = (
                            '[Non Layer] The not equal property is %s.\n'
                            'A: %s\nB: %s' % (if_property, string_a, string_b))
                        return False, message
                elif (isinstance(property_a, tuple)
                      or isinstance(property_a, list)):
                    if len(property_a) == len(property_b) == 0:
                        continue
                    elif len(property_a) and \
                            isinstance(property_a[0], QgsMapLayer):
                        for layer_a, layer_b in zip(property_a, property_b):
                            status, message = check_qgs_map_layers(
                                layer_a, layer_b, if_property)
                            if not status:
                                return status, message
                    elif len(property_a) and \
                            isinstance(property_a[0], ImpactFunction):
                        # Need to check if it's necessary
                        pass
                    else:
                        message = (
                            '[Non Layer] The not equal property is %s.\n'
                            'A: %s\nB: %s' % (
                                if_property, property_a, property_b))
                        return False, message
                else:
                    if property_a != property_b:
                        string_a = property_a
                        string_b = property_b
                        message = (
                            '[Non Layer] The not equal property is %s.\n'
                            'A: %s\nB: %s' % (if_property, string_a, string_b))
                        return False, message
            except AttributeError as e:
                message = (
                    'Property %s is not found. The exception is %s' % (
                        if_property, e))
                return False, message
            except IndexError as e:
                if if_property == 'impact':
                    continue
                else:
                    message = (
                        'Property %s is out of index. The exception is %s' % (
                            if_property, e))
                    return False, message
            except Exception as e:
                message = (
                    'Error on %s with error message %s' % (if_property, e))
                return False, message

        return True, ''
392513
private boolean checkHaworthAlignment(Point2d[] points) {
        
        for (int i = 0; i < points.length; i++) {
            Point2d curr = points[i];
            Point2d next = points[(i+1) % points.length];
            
            double deltaY = curr.y - next.y;
            
            if (Math.abs(deltaY) < CARDINALITY_THRESHOLD)
                return true;
        }
        
        return false;
    }
110492
public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) {
        if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) {
            for (int i = 0; i <= a.numCols; i++) {
                if( a.col_idx[i] != b.col_idx[i] )
                    return false;
            }
            for (int i = 0; i < a.nz_length; i++) {
                if( a.nz_rows[i] != b.nz_rows[i] )
                    return false;
            }
            return true;
        }
        return false;
    }
83989
private static boolean relationCompare_(int[] matrix, String scl) {
		for (int i = 0; i < 9; i++) {
			switch (scl.charAt(i)) {
			case 'T':
				assert (matrix[i] != -2);
				if (matrix[i] == -1)
					return false;
				break;

			case 'F':
				assert (matrix[i] != -2);
				if (matrix[i] != -1)
					return false;
				break;

			case '0':
				assert (matrix[i] != -2);
				if (matrix[i] != 0)
					return false;
				break;

			case '1':
				assert (matrix[i] != -2);
				if (matrix[i] != 1)
					return false;
				break;

			case '2':
				assert (matrix[i] != -2);
				if (matrix[i] != 2)
					return false;
				break;

			default:
				break;
			}
		}

		return true;
	}
1101551
def _buffer_list_equal(a, b):
    
    if len(a) != len(b):
        return False
    if a == b:
        return True
    for ia, ib in zip(a, b):
        # Check byte equality, since bytes are what is actually synced
        # NOTE: Simple ia != ib does not always work as intended, as
        # e.g. memoryview(np.frombuffer(ia, dtype='float32')) !=
        # memoryview(np.frombuffer(b)), since the format info differs.
        if PY3:
            # compare without copying
            if memoryview(ia).cast('B') != memoryview(ib).cast('B'):
                return False
        else:
            # python 2 doesn't have memoryview.cast, so we may have to copy
            if isinstance(ia, memoryview) and ia.format != 'B':
                ia = ia.tobytes()
            if isinstance(ib, memoryview) and ib.format != 'B':
                ib = ib.tobytes()
            if ia != ib:
                return False
    return True
1093655
def are_equal_elements(a_el, b_el):
    
    if a_el.tagName != b_el.tagName:
        return False
    if sorted(a_el.attributes.items()) != sorted(b_el.attributes.items()):
        return False
    if len(a_el.childNodes) != len(b_el.childNodes):
        return False
    for a_child_el, b_child_el in zip(a_el.childNodes, b_el.childNodes):
        if a_child_el.nodeType != b_child_el.nodeType:
            return False
        if (
            a_child_el.nodeType == a_child_el.TEXT_NODE
            and a_child_el.data != b_child_el.data
        ):
            return False
        if a_child_el.nodeType == a_child_el.ELEMENT_NODE and not are_equal_elements(
            a_child_el, b_child_el
        ):
            return False
    return True
94666
def orders_after_any(self, other, *, visited=None):
        
        if not other:
            return False
        if visited is None:
            visited = set()
        elif self in visited:
            return False
        visited.add(self)
        for item in self.PATCHED_ORDER_AFTER:
            if item in visited:
                continue
            if item in other:
                return True
            if item.orders_after_any(other, visited=visited):
                return True
        return False
268956
public static boolean bufEquals(byte onearray[], byte twoarray[]) {
        if (onearray == twoarray)
            return true;
        boolean ret = (onearray.length == twoarray.length);
        if (!ret) {
            return ret;
        }
        for (int idx = 0; idx < onearray.length; idx++) {
            if (onearray[idx] != twoarray[idx]) {
                return false;
            }
        }
        return true;
    }
1360858
def _rule_compare(rule1, rule2):
    '''
    
    '''

    commonkeys = set(rule1.keys()).intersection(rule2.keys())
    for key in commonkeys:
        if rule1[key] != rule2[key]:
            return False
    return True
309197
private int compareView(ViewRef<?> viewA, 
                          ViewRef<?> viewB,
                          Class<?> type)
  {
    int cmp = viewB.priority() - viewA.priority();
    
    if (cmp != 0) {
      return cmp;
    }
    
    cmp = typeDepth(viewA.type(), type) - typeDepth(viewB.type(), type);

    if (cmp != 0) {
      return cmp;
    }
    
    // equivalent views are sorted by name to ensure consistency
    
    String nameA = viewA.resolver().getClass().getName();
    String nameB = viewB.resolver().getClass().getName();
    
    return nameA.compareTo(nameB); 
  }
342904
def _consistent(self):
        """"""
        if len(self.__order) != sum(len(values) for values in self.__index.values()):
            return False
        import copy
        tmp = copy.copy(self.__order)
        for key, values in self.__index.items():
            for value in values:
                if value.name != key:
                    return False
                if value in tmp:
                    tmp.remove(value)
                else:
                    return False
                if isinstance(value, CP2KSection):
                    if not value._consistent():
                        return False
        return True
155306
private static boolean multiPointRelateEnvelope_(MultiPoint multipoint_a,
			Envelope envelope_b, double tolerance, int relation,
			ProgressTracker progress_tracker) {
		switch (relation) {
		case Relation.disjoint:
			return multiPointDisjointEnvelope_(multipoint_a, envelope_b,
					tolerance, progress_tracker);

		case Relation.within:
			return multiPointWithinEnvelope_(multipoint_a, envelope_b,
					tolerance, progress_tracker);

		case Relation.contains:
			return multiPointContainsEnvelope_(multipoint_a, envelope_b,
					tolerance, progress_tracker);

		case Relation.equals:
			return multiPointEqualsEnvelope_(multipoint_a, envelope_b,
					tolerance, progress_tracker);

		case Relation.touches:
			return multiPointTouchesEnvelope_(multipoint_a, envelope_b,
					tolerance, progress_tracker);

		case Relation.crosses:
			return multiPointCrossesEnvelope_(multipoint_a, envelope_b,
					tolerance, progress_tracker);

		default:
			break; // warning fix
		}

		return false;
	}
999687
public boolean hasCommonOrder() {
        Order lastOrder = null;
        for (OrderEntry oe : list) {
            if (lastOrder==null) lastOrder=oe.order;
            else if (lastOrder!=oe.order) return false;
        }
        return true;
    }