com.prowidesoftware.swift.utils
Class AckMessageComparator

java.lang.Object
  extended by com.prowidesoftware.swift.utils.AckMessageComparator
All Implemented Interfaces:
java.util.Comparator<SwiftMessage>

public class AckMessageComparator
extends java.lang.Object
implements java.util.Comparator<SwiftMessage>

A message comparator that compares all values from block 1 2 3 and 4. This comparator compares all values in given blocks except session and sequence number (in block1), NOTE: This comparator is useful to find a message 'almost equal' to another one and is not intended to sort messages, since it does not provide ordering information of any kind. NOTE: when both blocks being compared are null they are considered equals, even when they're actually empty

Version:
$Id: AckMessageComparator.java,v 1.1.1.1 2013/04/10 17:04:50 mgriffa Exp $
Author:
www.prowidesoftware.com

Constructor Summary
AckMessageComparator()
           
 
Method Summary
 boolean addTagnameToIgnore(java.lang.String o)
           
 int compare(SwiftMessage m1, SwiftMessage m2)
           
 boolean compareB1(SwiftBlock1 b1, SwiftBlock1 b2)
          Return true if o1 and o2 are equals in all values except session and sequence number and false in any other case (incluing one of them null) If both parameters (o1 and o2) are null it returns false, since there is nothing to compare.
 boolean compareB2(SwiftBlock2 o1, SwiftBlock2 o2)
          Compares all elements of block2 both blocks null will return true
 boolean compareTagListBlock(SwiftTagListBlock o1, SwiftTagListBlock o2)
          Compare all tags in taglist from both given blocks.
 java.util.List<java.lang.String> getTagnamesToIgnore()
           
 boolean isIgnoreEolsInMultiline()
           
 void setIgnoreEolsInMultiline(boolean ignoreEolsInMultiline)
           
 void setTagnamesToIgnore(java.util.List<java.lang.String> tagnamesToIgnore)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

AckMessageComparator

public AckMessageComparator()
Method Detail

compare

public int compare(SwiftMessage m1,
                   SwiftMessage m2)
Specified by:
compare in interface java.util.Comparator<SwiftMessage>

compareB2

public boolean compareB2(SwiftBlock2 o1,
                         SwiftBlock2 o2)
Compares all elements of block2 both blocks null will return true

Parameters:
o1 -
o2 -
Returns:
true if both blocks are null or equal (from ACK point of view) or false in any other case

compareTagListBlock

public boolean compareTagListBlock(SwiftTagListBlock o1,
                                   SwiftTagListBlock o2)
Compare all tags in taglist from both given blocks. Tag.equals is used for comparison. NOTE if both are null this method returns true

Parameters:
o1 - first block to compare
o2 - second block to compare
Returns:
true if both blocks are equal (from ACK point of view) and false in any other case

compareB1

public boolean compareB1(SwiftBlock1 b1,
                         SwiftBlock1 b2)
Return true if o1 and o2 are equals in all values except session and sequence number and false in any other case (incluing one of them null) If both parameters (o1 and o2) are null it returns false, since there is nothing to compare.

Parameters:
b1 - block to compare
b2 - block to compare
Returns:
true if b1 equals b2 (except mentioned fields) and none is null false in any other case

isIgnoreEolsInMultiline

public boolean isIgnoreEolsInMultiline()
Returns:
boolean value of ignoreEolsInMultiline property

setIgnoreEolsInMultiline

public void setIgnoreEolsInMultiline(boolean ignoreEolsInMultiline)
Parameters:
ignoreEolsInMultiline -

getTagnamesToIgnore

public java.util.List<java.lang.String> getTagnamesToIgnore()
Returns:
tags to ignore list

setTagnamesToIgnore

public void setTagnamesToIgnore(java.util.List<java.lang.String> tagnamesToIgnore)
Parameters:
tagnamesToIgnore -

addTagnameToIgnore

public boolean addTagnameToIgnore(java.lang.String o)
Parameters:
o - tag to add
Returns:
true if tag was added