/// <summary> /// Checks IItems to see if they have equal local ids /// </summary> /// <param name="item1">The item1.</param> /// <param name="item2">The item2.</param> /// <param name="localIdentityTagNames">The local identity tag names.</param> /// <returns></returns> internal static bool EqualsLocalId(IItem item1, IItem item2, List <string> localIdentityTagNames) { try { byte[] tag1, tag2; foreach (string tagName in localIdentityTagNames) { item1.TryGetTagValue(tagName, out tag1); item2.TryGetTagValue(tagName, out tag2); if (tag1 == null || tag2 == null) { throw new Exception("Tag required for local identity not found on the IndexItem"); } if (!ByteArrayComparerUtil.CompareByteArrays(tag1, tag2)) { return(false); } } return(true); } catch (Exception ex) { throw new Exception("Unexptected error while comparing local id.", ex); } }
/// <summary> /// Applies the Condition on the specified item value. /// </summary> /// <param name="itemValue">The item value.</param> /// <returns></returns> internal bool Process(byte[] itemValue) { bool retVal = false; BaseComparer itemComparer = new BaseComparer(false, null, new List <SortOrder>(1) { new SortOrder(DataType, SortBy.ASC) }); switch (Operation) { case Operation.Equals: retVal = (ByteArrayComparerUtil.CompareByteArrays(Value, itemValue)) ? true : false; break; case Operation.NotEquals: retVal = (!ByteArrayComparerUtil.CompareByteArrays(Value, itemValue)) ? true : false; break; case Operation.GreaterThan: retVal = (itemComparer.Compare(Value, itemValue) < 0) ? true : false; break; case Operation.GreaterThanEquals: retVal = (itemComparer.Compare(Value, itemValue) <= 0) ? true : false; break; case Operation.LessThan: retVal = (itemComparer.Compare(Value, itemValue) > 0) ? true : false; break; case Operation.LessThanEquals: retVal = (itemComparer.Compare(Value, itemValue) >= 0) ? true : false; break; case Operation.BitwiseComplement: case Operation.BitwiseAND: case Operation.BitwiseOR: case Operation.BitwiseXOR: case Operation.BitwiseShiftLeft: case Operation.BitwiseShiftRight: retVal = CheckBitwiseCondition(itemValue); break; } return(retVal); }
public override bool Equals(byte[] x, byte[] y) { return(ByteArrayComparerUtil.CompareByteArrays(x, y)); }