/* Ċ Ġ* ĠCopyright Ġ 2 0 1 7 Ġ- Ġ 2 0 1 8 ĠMichael ĠR app Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ċ Ġ* Ġin Ġcompliance Ġwith Ġthe ĠLicense . ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ġdistributed Ġunder Ġthe ĠLicense Ċ Ġ* Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ċ Ġ* Ġor Ġimplied . ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ġlimitations Ġunder Ċ Ġ* Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġde . mr app . ap ri ori Ċ Ċ import Ġorg . mockito . Mockito . do Return Ċ import Ġorg . mockito . Mockito . mock Ċ import Ġkotlin . test . Test Ċ import Ġkotlin . test . assertEquals Ċ Ċ /** Ċ Ġ* ĠTests Ġthe Ġfunctionality Ġof Ġthe Ġclass Ġ[ T ie Breaker ]. Ċ Ġ* Ċ Ġ* Ġ@ author ĠMichael ĠR app Ċ Ġ*/ Ċ class ĠT ie Breaker Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Default T ie Breaker For Item Sets () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Item Sets () ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing For Item Sets Prefer Small () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġitem Set 1 . add ( Named Item (" a ")) ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġitem Set 2 . add ( Named Item (" b ")) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Item Sets (). prefer Small () ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġitem Set 1 . add ( Named Item (" c ")) ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġitem Set 2 . add ( Named Item (" d ")) ĊĠĠĠĠĠĠĠ Ġitem Set 2 . add ( Named Item (" e ")) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing For Item Sets Prefer Large () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġitem Set 1 . add ( Named Item (" a ")) ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġitem Set 2 . add ( Named Item (" b ")) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Item Sets (). prefer Large () ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġitem Set 1 . add ( Named Item (" c ")) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġitem Set 2 . add ( Named Item (" d ")) ĊĠĠĠĠĠĠĠ Ġitem Set 2 . add ( Named Item (" e ")) ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Custom T ie Break ing For Item Sets () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Item Sets (). custom ( Comparator Ġ{ Ġ_, Ġ_ Ġ-> Ġ 1 Ġ}) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Multiple T ie Break ing Str ategies For Item Sets () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġitem Set 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġcomparator 1 Ġ= ĠComparator < Item Set <* >> Ġ{ Ġ_, Ġ_ Ġ-> Ġ 0 Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġcomparator 2 Ġ= ĠComparator < Item Set <* >> Ġ{ Ġ_, Ġ_ Ġ-> Ġ- 1 Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Item Sets (). custom ( comparator 1 ). custom ( comparator 2 ) ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( item Set 1 , Ġitem Set 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Default T ie Breaker For Association Rules () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), ĠItem Set < Named Item >(), Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), ĠItem Set < Named Item >(), Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules () ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing For Association Rules By Operator () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), ĠItem Set < Named Item >(), Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), ĠItem Set < Named Item >(), Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġoperator Ġ= Ġmock ( Operator :: class . java ) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). by Operator ( operator ) ĊĠĠĠĠĠĠĠ Ġdo Return ( 1 . 0 , Ġ 0 . 0 ). ` when `( operator ). evaluate ( Mock Util . any ()) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġdo Return ( 0 . 5 , Ġ 0 . 5 ). ` when `( operator ). evaluate ( Mock Util . any ()) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġdo Return ( 0 . 0 , Ġ 1 . 0 ). ` when `( operator ). evaluate ( Mock Util . any ()) ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing For Association Rules Prefer Simple () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbody 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġhead 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġbody 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġbody 2 . add ( Named Item (" a ")) ĊĠĠĠĠĠĠĠ Ġval Ġhead 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġhead 2 . add ( Named Item (" b ")) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 1 , Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 2 , Ġhead 2 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). prefer Simple () ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 1 , Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 1 , Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 2 , Ġhead 2 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 1 , Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing For Association Rules Prefer Complex () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbody 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġhead 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġbody 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġbody 2 . add ( Named Item (" a ")) ĊĠĠĠĠĠĠĠ Ġval Ġhead 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġhead 2 . add ( Named Item (" b ")) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 1 , Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 2 , Ġhead 2 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). prefer Complex () ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 1 , Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 1 , Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 2 , Ġhead 2 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 1 , Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing Prefer Simple Body () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbody 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġbody 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġbody 2 . add ( Named Item (" a ")) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 1 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 2 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). prefer Simple Body () ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 1 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 1 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 2 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 1 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing For Association Rules Prefer Complex Body () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbody 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġbody 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġbody 2 . add ( Named Item (" a ")) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 1 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 2 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). prefer Complex Body () ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 1 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 1 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( body 2 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( body 1 , ĠItem Set (), Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing For Association Rules Prefer Simple Head () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġhead 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġhead 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġhead 2 . add ( Named Item (" a ")) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 2 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). prefer Simple Head () ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 2 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest T ie Break ing For Association Rules Prefer Complex Head () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġhead 1 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġval Ġhead 2 Ġ= ĠItem Set < Named Item >() ĊĠĠĠĠĠĠĠ Ġhead 2 . add ( Named Item (" a ")) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġvar Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 2 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). prefer Complex Head () ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠĠĠĠĠ Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 2 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), Ġhead 1 , Ġ 0 . 5 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Custom T ie Break ing For Association Rules () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), ĠItem Set < Named Item >(), Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), ĠItem Set < Named Item >(), Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġcomparator Ġ= ĠComparator < Association Rule <* >> Ġ{ Ġ_, Ġ_ Ġ-> Ġ 1 Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). custom ( comparator ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Multiple T ie Break ing Str ategies For Association Rules () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġassociation Rule 1 Ġ= ĠAssociation Rule ( Item Set (), ĠItem Set < Named Item >(), Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġassociation Rule 2 Ġ= ĠAssociation Rule ( Item Set (), ĠItem Set < Named Item >(), Ġ 0 . 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġcomparator 1 Ġ= ĠComparator < Association Rule <* >> Ġ{ Ġ_, Ġ_ Ġ-> Ġ 0 Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġcomparator 2 Ġ= ĠComparator < Association Rule <* >> Ġ{ Ġ_, Ġ_ Ġ-> Ġ- 1 Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġtie Breaker Ġ= ĠT ie Breaker . for Association Rules (). custom ( comparator 1 ). custom ( comparator 2 ) ĊĠĠĠĠĠĠĠ ĠassertEquals (- 1 , Ġtie Breaker . compare ( association Rule 1 , Ġassociation Rule 2 ). to Long ()) ĊĠĠĠ Ġ} Ċ Ċ } Ċ