Release ZERO.0.1 of package RefereeToolbox

RefereeToolbox is a java package implementing combination operators for fusing evidences. It is downloadable from: http://refereefunction.fredericdambreville.com/releases RefereeToolbox is based on an interpretation of the fusion rules by means of Re…

Authors: Frederic Dambreville

Release ZER O.0.1 of pac kage RefereeT o olb o x F rédéric Dam breville h ttp://email.fredericdam brevill e.com Octob er 3, 2018 1 Description R efer e e T o olb ox is a jav a package implemen ting combination op erators for fusing evidences. It is downloadable from: h ttp://r e fer eef unction.fredericda m breville.com/releases RefereeT o olbox is based o n an in terpreta tio n of the fusion rules by means of Referee F unctions (refer to 2 ) . This appr o ac h implies a disso ciation b et ween the definition of the combination and its actual implementation, which is common to all referee-bas e d combinations. As a result, Refer eeT oolb ox is desig ned with the aim to b e g eneric and evolutiv e. It is comp osed of three distinct cla s ses of ob jects: • A class for the lo g ical representation of the information; this class is generic and incre- men tal; are yet implemented structures a s: – Pow erset, – F ree B oolean a lgebra, – Sup erpowerset, – O pen/closed hyperp o werset, – · · · − → make yours! • A class for defining the r ef eree functions; this c la ss is generic and incremental; are yet defined refer ee functions for: – Dempster- S hafer combination, – Disjunctive combination, – Dub ois&Prade combination, – P CR6 co m bination, – P CR# combination, – · · · − → make yours! • A class defining the Basic Belief Assignment, and related pro cesses; this class is generic and incr emen tal; tw o r ef ere e - based approa c hes are implemented for computing combi- nations: – An exact approach as sociated with a relaxation of the focal elements, s o as to handle the combinatorics, 1 – A sampling-ba sed approa ch. The generic implemen tation of RefereeT oolb o x mak es p ossible to comb ine these three classes and their instances without restriction. 2 What is a referee function? F or an introduction to the theory of referee function, please refer to [3]. 2.1 Basic Belief Assignmen t Let G Θ be a c omplete distributive lattic e . A b asic b elief assignment [1, 2] is a mapping m from elements of G Θ onto [0 , 1] such that: X X ∈ G Θ m ( X ) = 1 and m ( ∅ ) = 0 . (1) 2.2 Referee function Definition. A referee function over G Θ for s sources o f infor m ation and with context γ is a mapping X, Y 1: s 7→ F ( X | Y 1: s ; γ ) defined on prop ositions X , Y 1: s ∈ G Θ , which satisfies for any X , Y 1: s ∈ G Θ : F ( X | Y 1: s ; γ ) ≥ 0 and X X ∈ G Θ F ( X | Y 1: s ; γ ) = 1 , A referee function for s so urces of information is a lso called a s -ary referee function. The quantit y F ( X | Y 1: s ; γ ) is c alled a c onditional arbitr ament b et ween Y 1: s in fav or of X . No tice that X is not necessar y one of the prop ositions Y 1: s ; typically , it could b e a combination of them. The ca se X = ∅ is called the r eje ct i on c ase . F usion rule. Let b e given s ba s ic belief assignments (bba) m 1: s and a s -ary refer e e function F with con text m 1: s . Then, the fused bba m 1 ⊕ · · · ⊕ m s [ F ] ∆ = ⊕ [ m 1: s | F ] based on the referee F is constr ucted as follows: ⊕ [ m 1: s | F ] ( X ) = I [ X 6 = ∅ ] 1 − z X Y 1: s ∈ G Θ F ( X | Y 1: s ; m 1: s ) s Y i =1 m i ( Y i ) , where z = X Y 1: s ∈ G Θ F ( ∅| Y 1: s ; m 1: s ) s Y i =1 m i ( Y i ) , I [ X 6 = ∅ ] = 1 if X 6 = ∅ , and I [ X 6 = ∅ ] = 0 if X = ∅ . (2) The v alue z is called the r eje ction r ate . 2.3 Examples of r eferee functions Dempster-shafer rule. Let be g iven s so urces of information characterized by their bbas m 1: s . The fused bba m DST obtained from m 1: s b y means of Dempster-S hafer fusio n rule [1, 2] 2 is defined b y:      m DST ( ∅ ) = 0 , m DST ( X ) = m c ( X ) 1 − m c ( ∅ ) for any X ∈ G Θ \ {∅} , where m c ( · ) c o rresp onds to the co njunctiv e co nsensus: m c ( X ) , X Y 1 ∩···∩ Y s = X Y 1 , ··· ,Y s ∈ G Θ s Y i =1 m i ( Y i ) . Definition by referee function. The definition of a referee function for Dempster-Shafer is immediate: m DST = ⊕ [ m 1: s | F DST ] , where F DST ( X | Y 1: s ; m 1: s ) = I " X = s \ k =1 Y k # . References [1] Dempster A.P ., Upp er and L ower pr ob abilities induc e d by a multivalue d mapping , Annals of Ma thematical Statistics, vol. 8 3, pp. 3 25–3 39, 1 967. [2] Sha fer G., A mathematic al t he ory of evidenc e , P rinceton Universit y P ress, 19 7 6. [3] F rédéric Dambreville, Cha p. 6: D efinition of evidenc e fusion rules b ase d on r efer e e func- tions , in Smaranda che F. & Dezert J., Editors , A pplic ations and Ad vanc es on DSmT for Information F usion (Col le cte d W orks) , V ol. 3, American Research Pr ess, 2009 . 3 3 Co de Source Co de: Arra yBo olean.jav a 1 / ∗ 2 ∗ A r r a y B o o l e a n . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ B o o l e a n a l g e b r a . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / / w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ I m p l e m e n t a t i o n o f a B o o l e a n s t r u c t u r e b y m e a n s o f a n a r r a y o f { @ c o d e l o n g } . 30 ∗ The A N D a n d O R o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { @ c o d e & } a n d { @ c o d e ← ֓ | } 31 ∗ w o r k i n g o n { @ c o d e l o n g } . 32 ∗ < i > z e r o i s d e f i n e d b y z e r o i n g a l l b i t s . < i >o n e i s d e f i n e d b y s e t t i n g t o 33 ∗ 1 a l l a c t i v e b i t s ; t h e r i g h t b i t s o f t h e { @ c o d e l o n g } v e c t o r may b e i n a c t i v e , 34 ∗ d e p e n d i n g o n t h e s i z e o f t h e L a t t i c e . 35 ∗ The c o m p l e m e n t / c o c o m p l e m e n t o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { @ c o d e ~ ← ֓ } 36 ∗ w o r k i n g on { @ c o d e l o n g } ; e x c e e d i n g b i t s a r e m a s k e d by a A N D w i t h < i >o n e . 37 ∗ 38 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 39 ∗ 40 ∗ 41 ∗ 42 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 43 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 44 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 47 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 48 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 49 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 50 ∗ < B R > 51 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 52 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 53 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 54 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 55 ∗ < B R > 56 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 57 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 58 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 59 ∗ < / t a b l e > < B R > 60 ∗ 61 ∗ / 62 p u b l i c c l a s s A r r a y B o o l e a n < L e x t e n d s A r r a y B o o l e a n < L > > 63 e x t e n d s A r r a y L a t t i c e < L > i m p l e m e n t s C o m p l e m e n t e d L a t t i c e < L > { 64 4 65 66 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 67 / / p u b l i c p a r t 68 / / / / / / / / / / / / / / / 69 70 / ∗ ∗ 71 ∗ C o m p u t e t h e < b > c o m p l e m e n t o f < i >a P r o p o s i t i o n a n d s t o r e t h e r e s u l t ← ֓ w i t h i n 72 ∗ < i > t h i s . 73 ∗ Th e c o m p l e m e n t / c o c o m p l e m e n t o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { ← ֓ @ c o d e ~ } 74 ∗ w o r k i n g o n { @ c o d e l o n g } ; e x c e e d i n g b i t s a r e m a s k e d by a A N D w i t h < i > o n e < / i ← ֓ > . 75 ∗ Th e c o m p l e m e n t an d c o c o m p l e m e n t a r e t h e s a m e f o r { @ l i n k A r r a y B o o l e a n } 76 ∗ < B R > < B R > 77 ∗ < b >D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k C o m p l e m e n t e d L a t t i c e } : < / b > < B R > 78 ∗ { @ i n h e r i t D o c } 79 ∗ 80 ∗ / 81 p u b l i c L c o m p l e m e n t ( L a P r o p o s i t i o n ) { 82 l o n g [ ] r i g h t m e m = a P r o p o s i t i o n . _ m e m o r y ; 83 i n t i ; 84 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) _ m e m o r y [ i ] = ~ r i g h t m e m [ i ] ; 85 _ m e m o r y [ s i z e _ m e m _ 1 ]&= h i g h e s t _ l o n g _ o n e ; 86 r e t u r n ( L ) t h i s ; 87 } 88 89 / ∗ ∗ 90 ∗ C o m p u t e t h e < b > c o m p l e m e n t o f < i >a P r o p o s i t i o n a n d s t o r e t h e r e s u l t ← ֓ w i t h i n 91 ∗ < i > t h i s . 92 ∗ Th e c o m p l e m e n t / c o c o m p l e m e n t o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { ← ֓ @ c o d e ~ } 93 ∗ w o r k i n g o n { @ c o d e l o n g } ; e x c e e d i n g b i t s a r e m a s k e d by a A N D w i t h < i > o n e < / i ← ֓ > . 94 ∗ Th e c o m p l e m e n t an d c o c o m p l e m e n t a r e t h e s a m e f o r { @ l i n k A r r a y B o o l e a n } 95 ∗ < B R > < B R > 96 ∗ < b >D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k C o m p l e m e n t e d L a t t i c e } : < / b > < B R > 97 ∗ { @ i n h e r i t D o c } 98 ∗ 99 ∗ / 100 p u b l i c L c o m p l e m e n t ( ) { 101 i n t i ; 102 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) _ m e m o r y [ i ] = ~ _ m e m o r y [ i ] ; 103 _ m e m o r y [ s i z e _ m e m _ 1 ]&= h i g h e s t _ l o n g _ o n e ; 104 r e t u r n ( L ) t h i s ; 105 } 106 107 / ∗ ∗ 108 ∗ Co m p u t e t h e c o m p l e m e n t o f < i >a P r o p o s i t i o n a n d s t o r e t h e r e s u l t ← ֓ w i t h i n 109 ∗ < i > t h i s . 110 ∗ T he c o m p l e m e n t / c o c o m p l e m e n t o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { ← ֓ @ c o d e ~ } 111 ∗ w o r k i n g o n { @ c o d e l o n g } ; e x c e e d i n g b i t s a r e m a s k e d by a A N D w i t h < i >o n e < / i ← ֓ > . 112 ∗ T he c o m p l e m e n t an d c o c o m p l e m e n t a r e t h e s a m e f o r { @ l i n k A r r a y B o o l e a n } 113 ∗ < B R > < B R > 114 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k C o m p l e m e n t e d L a t t i c e } : < / b > < B R > 115 ∗ { @ i n h e r i t D o c } 116 ∗ 117 ∗ / 118 p u b l i c L c o c o m p l e m e n t ( L a P r o p o s i t i o n ) { 119 r e t u r n c o m p l e m e n t ( a P r o p o s i t i o n ) ; 120 } 121 122 / ∗ ∗ 123 ∗ Co m p u t e t h e c o m p l e m e n t o f < i >a P r o p o s i t i o n a n d s t o r e t h e r e s u l t ← ֓ w i t h i n 124 ∗ < i > t h i s . 125 ∗ T he c o m p l e m e n t / c o c o m p l e m e n t o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { ← ֓ @ c o d e ~ } 126 ∗ w o r k i n g o n { @ c o d e l o n g } ; e x c e e d i n g b i t s a r e m a s k e d by a A N D w i t h < i >o n e < / i ← ֓ > . 5 127 ∗ T he c o m p l e m e n t an d c o c o m p l e m e n t a r e t h e s a m e f o r { @ l i n k A r r a y B o o l e a n } 128 ∗ < B R > < B R > 129 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k C o m p l e m e n t e d L a t t i c e } : < / b > < B R > 130 ∗ { @ i n h e r i t D o c } 131 ∗ 132 ∗ / 133 p u b l i c L c o c o m p l e m e n t ( ) { 134 r e t u r n c o m p l e m e n t ( ) ; 135 } 136 137 } 6 Source Co de: Arra yLa ttice.jav a 1 / ∗ 2 ∗ A r r a y L a t t i c e . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ L a t t i c e . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ I m p l e m e n t a t i o n o f a L a t t i c e s t r u c t u r e b y m e a n s o f a n a r r a y o f { @ c o d e l o n g } . 30 ∗ The A N D a n d O R o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { @ c o d e & } a n d { @ c o d e ← ֓ | } 31 ∗ w o r k i n g o n { @ c o d e l o n g } . 32 ∗ < i > z e r o i s d e f i n e d b y z e r o i n g a l l b i t s . < i >o n e i s d e f i n e d b y s e t t i n g t o 33 ∗ 1 a l l a c t i v e b i t s ; t h e r i g h t b i t s o f t h e { @ c o d e l o n g } v e c t o r may b e i n a c t i v e , 34 ∗ d e p e n d i n g o n t h e s i z e o f t h e L a t t i c e . 35 ∗ 36 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 37 ∗ 38 ∗ 39 ∗ 40 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 41 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 42 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 43 ∗ < B R > 44 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 45 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 46 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 47 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 48 ∗ < B R > 49 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 50 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 51 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 52 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 53 ∗ < B R > 54 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 55 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 56 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 57 ∗ < / t a b l e > < B R > 58 ∗ 59 ∗ / 60 p u b l i c c l a s s A r r a y L a t t i c e < L e x t e n d s A r r a y L a t t i c e < L > > 61 e x t e n d s L a t t i c e C o m m o n < L > { 62 63 p r o t e c t e d l o n g [ ] _ m e m o r y = n u l l ; 64 65 p r o t e c t e d i n t s i z e _ m e m _ 1 = − 1 ; / / u n d e f i n e d , b y d e f a u l t 66 p r o t e c t e d l o n g h i g h e s t _ l o n g _ o n e ; 67 68 69 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 70 / / p u b l i c p a r t 7 71 / / / / / / / / / / / / / / / 72 73 / ∗ ∗ 74 ∗ R e t u r n a r e p r e s e n t a t i o n o f t h e s t a t e o f < i > t h i s p r i n t e d a s a S t r i n g . S t a t e s 75 ∗ o f t h i s c l a s s a r e p r i n t e d a s t h e c o n c a t e n a t i o n o f t h e H e x a d e c i m a l ← ֓ r e p r e s e n t a t i o n 76 ∗ o f t h e < i >l o n g a r r a y . 77 ∗ 78 ∗ / 79 @ O v e r r i d e 80 p u b l i c S t r i n g s t a t e ( ) { 81 S t r i n g t h e S t a t e = " " ; 82 S t r i n g t m p ; 83 i n t i ; 84 f o r ( i = s i z e _ m e m _ 1 ; i > =0; i − − ) { 85 t m p = L o n g . t o H e x S t r i n g ( _ m e m o r y [ i ] ) ; 86 t h e S t a t e + = " x " + " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " . s u b s t r i n g ( 0 , 16 − t m p . l e n g t h ( ) ) + t m p ; 87 } 88 r e t u r n t h e S t a t e ; 89 } 90 91 / ∗ ∗ 92 ∗ S e t < i > t h i s t o z e r o , t h e n e u t r a l e l e m e n t f o r 93 ∗ { @ l i n k L a t t i c e #o r ( j a v a . l a n g . O b j e c t , j a v a . l a n g . O b j e c t ) } . 94 ∗ N . B . I t i s n e c e s s a r y t o c a l l { @ l i n k L a t t i c e # s i z e } o r 95 ∗ { @ l i n k L a t t i c e # s i z e ( j a v a . l a n g . O b j e c t ) } b e f o r e a n y f i r s t u s e o f t h i s 96 ∗ m e t h o d . 97 ∗ 98 ∗ / 99 @ O v e r r i d e 100 p u b l i c L z e r o ( ) { 101 i n t i ; 102 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) _ m e m o r y [ i ] = 0 ; 103 r e t u r n ( L ) t h i s ; 104 } 105 106 / ∗ ∗ 107 ∗ S e t < i > t h i s t o o n e , t h e n e u t r a l e l e m e n t f o r 108 ∗ { @ l i n k L a t t i c e # a n d ( j a v a . l a n g . O b j e c t , j a v a . l a n g . O b j e c t ) } . 109 ∗ N . B . I t i s n e c e s s a r y t o c a l l { @ l i n k L a t t i c e # s i z e } o r 110 ∗ { @ l i n k L a t t i c e # s i z e ( j a v a . l a n g . O b j e c t ) } b e f o r e a n y f i r s t u s e o f t h i s m e t h o d . 111 ∗ 112 ∗ / 113 @ O v e r r i d e 114 p u b l i c L o n e ( ) { 115 i n t i ; 116 f o r ( i = 0 ; i < s i z e _ m e m _ 1 ; i ++ ) _ m e m o r y [ i ] = 0 x F F F F F F F F F F F F F F F F L ; 117 _ m e m o r y [ i ] = h i g h e s t _ l o n g _ o n e ; 118 r e t u r n ( L ) t h i s ; 119 } 120 121 / ∗ ∗ 122 ∗ C o m p u t e t h e A N D o f < i > l e f t a n d < i > r i g h t a n d s t o r e t h e r e s u l t w i t h i n < i > ← ֓ t h i s . 123 ∗ 124 ∗ / 125 @ O v e r r i d e 126 p u b l i c L a n d ( L l e f t , L r i g h t ) { 127 l o n g [ ] l e f t m e m = l e f t . _ m e m o r y ; 128 l o n g [ ] r i g h t m e m = r i g h t . _ m e m o r y ; 129 i n t i ; 130 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) _ m e m o r y [ i ] = l e f t m e m [ i ] & r i g h t m e m [ i ] ; 131 r e t u r n ( L ) t h i s ; 132 } 133 134 / ∗ ∗ 135 ∗ C o m p u t e t h e O R o f < i > l e f t a n d < i >r i g h t a n d s t o r e t h e r e s u l t w i t h i n < i > ← ֓ t h i s . 136 ∗ 137 ∗ / 138 @ O v e r r i d e 139 p u b l i c L o r ( L l e f t , L r i g h t ) { 140 l o n g [ ] l e f t m e m = l e f t . _ m e m o r y ; 141 l o n g [ ] r i g h t m e m = r i g h t . _ m e m o r y ; 8 142 i n t i ; 143 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) _ m e m o r y [ i ] = l e f t m e m [ i ] | r i g h t m e m [ i ] ; 144 r e t u r n ( L ) t h i s ; 145 } 146 147 / ∗ ∗ 148 ∗ A n s w e r < i >t r u e i f t h e p r o p o s i t i o n s t o r e d w i t h i n < i > t h i s i n t e r s e c t s t h e 149 ∗ p r o p o s i t i o n c o n t a i n e d w i t h i n a P r o p o s i t i o n ( < i > i . e . < / i > t h e i n t e r s e c t i o n 150 ∗ o f b o t h p r o p o s i t i o n s i s n o t < i > z e r o ) . A n s w e r < i > f a l s e o t h e r w i s e . 151 ∗ 152 ∗ / 153 @ O v e r r i d e 154 p u b l i c b o o l e a n i n t e r s e c t s ( L a P r o p o s i t i o n ) { 155 l o n g [ ] r i g h t m e m = a P r o p o s i t i o n . _ m e m o r y ; 156 i n t i ; 157 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) { 158 i f ( ( _ m e m o r y [ i ] & r i g h t m e m [ i ] ) ! = 0 ) r e t u r n t r u e ; 159 } 160 r e t u r n f a l s e ; 161 } 162 163 / ∗ ∗ 164 ∗ A n s w e r < i >t r u e i f t h e p r o p o s i t i o n s t o r e d w i t h i n < i > t h i s c o n t a i n s t h e 165 ∗ p r o p o s i t i o n c o n t a i n e d w i t h i n a P r o p o s i t i o n . An s w e r < i > f a l s e o t h e r w i s e ← ֓ . 166 ∗ 167 ∗ / 168 @ O v e r r i d e 169 p u b l i c b o o l e a n c o n t a i n s ( L a P r o p o s i t i o n ) { 170 l o n g [ ] r i g h t m e m = a P r o p o s i t i o n . _ m e m o r y ; 171 i n t i ; 172 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) { 173 i f ( ( _ m e m o r y [ i ] & r i g h t m e m [ i ] ) ! = r i g h t m e m [ i ] ) r e t u r n f a l s e ; 174 } 175 r e t u r n t r u e ; 176 } 177 178 / ∗ ∗ 179 ∗ C o m p a r e < i > t h i s t o < i >a P r o p o s i t i o n a n d a n s w e r n e g a t i v e i n t e g e r , z e r o , 180 ∗ p o s i t i v e i n t e g e r a s < i >t h i s i s l e s s t h a n , e q u a l t o , o r g r e a t e r t h a n 181 ∗ < i >a P r o p o s i t i o n . 182 ∗ T h i s c o m p a r i s o n i s r e l a t e d t o a t o t a l o r d e r i n g o f t h e p r o p o s i t i o n ; < em > i t i s ← ֓ n o t 183 ∗ r e l a t e d t o t h e p a r t i a l o r d e r i m p l i e d b y t h e l o g i c a l o p e r a t o r s A N D a n d O R . < / em > 184 ∗ 185 ∗ / 186 @ O v e r r i d e 187 p u b l i c i n t c o m p a r e T o ( L a P r o p o s i t i o n ) { 188 l o n g [ ] r i g h t m e m = a P r o p o s i t i o n . _ m e m o r y ; 189 i n t i ; 190 l o n g d e l t a ; 191 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) { 192 d e l t a = _ m e m o r y [ i ] − r i g h t m e m [ i ] ; 193 i f ( d e l t a >0 ) r e t u r n 1 ; 194 i f ( d e l t a <0 ) r e t u r n − 1 ; 195 } 196 r e t u r n 0 ; 197 } 198 199 / ∗ ∗ 200 ∗ R e s i z e < i > t h i s a t t h e s a m e s i z e t h a n < i >i n p u t . 201 ∗ 202 ∗ / 203 @ O v e r r i d e 204 p u b l i c L s i z e ( L i n p u t ) { 205 s i z e _ m e m _ 1 = i n p u t . s i z e _ m e m _ 1 ; 206 h i g h e s t _ l o n g _ o n e = i n p u t . h i g h e s t _ l o n g _ o n e ; 207 _ m e m o r y = ne w l o n g [ s i z e _ m e m _ 1 + 1 ] ; 208 r e t u r n ( L ) t h i s ; 209 } 210 211 212 / ∗ ∗ 213 ∗ D o an e x a c t c o p y o f i n p u t i n t o < i > t h i s . 9 214 ∗ 215 ∗ / 216 @ O v e r r i d e 217 p u b l i c L d u p l i c a t e ( L i n p u t ) { 218 s i z e ( i n p u t ) ; 219 i n t i ; 220 f o r ( i = 0 ; i < = s i z e _ m e m _ 1 ; i ++ ) _ m e m o r y [ i ] = i n p u t . _ m e m o r y [ i ] ; 221 r e t u r n ( L ) t h i s ; 222 } 223 224 } 10 Source Co de: Assignment.ja v a 1 / ∗ 2 ∗ A s s i g n m e n t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; C l a s s e n c o d i n g a n 3 ∗ a s s i g n m e n t o f a b a s i c b e l i e f t o a p r o p o s i t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ C o n t a i n e r i n s t r u m e n t a l t o a l l c l a s s e s i m p l e m e n t i n g { @ l i n k m i n A s s i g n m e n t } a n d 30 ∗ t o c l a s s R e f e r e e F u n c t i o n D e f a u l t an d i t s s u b c l a s s e s ; 31 ∗ a s t r u c t u r e e n c o d i n g a n a s s i g n m e n t o f a b a s i c b e l i e f t o a p r o p o s i t i o n . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c c l a s s A s s i g n m e n t < P r o p > { 58 / ∗ ∗ 59 ∗ T h i s s u b f i e l d s t o r e s t h e p r o p o s i t i o n o f t h e a s s i g n m e n t t y p e d { @ l i n k A s s i g n m e n t ← ֓ } . 60 ∗ 61 ∗ / 62 p u b l i c P r o p a t t r i b u t e ; 63 / ∗ ∗ 64 ∗ T h i s s u b f i e l d s t o r e s t h e v a l u e o f t h e a s s i g n m e n t . 65 ∗ 66 ∗ / 67 p u b l i c D o u b l e v a l u e ; 68 } 11 Source Co de: BasicBeliefAssig nm en t.ja v a 1 / ∗ 2 ∗ B a s i c B e l i e f A s s i g n m e n t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r 3 ∗ B a s i c B e l i e f A s s i g m e n t s . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ C o n t a i n s t h e m i n i m a l d e c l a r a t i o n f o r c l a s s e s m a n a g i n g b e l i e f a s s i g n m e n t 32 ∗ s t r u c t u r e s , b e l i e f a s s i g n m e n t p r o c e s s e s a n d f u s e r s . 33 ∗ T h i s i n t e r f a c e i s i m p l e m e n t e d b y a l l t h e t h e s e c l a s s e s . 34 ∗ 35 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 36 ∗ 37 ∗ 38 ∗ 39 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 40 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 41 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 42 ∗ < B R > 43 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 44 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 45 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 46 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 47 ∗ < B R > 48 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 49 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 50 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 51 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 52 ∗ < B R > 53 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 54 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 55 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 56 ∗ < / t a b l e > < B R > 57 ∗ 58 ∗ / 59 p u b l i c i n t e r f a c e B a s i c B e l i e f A s s i g n m e n t < P r o p e x t e n d s L a t t i c e < P r o p > , 60 B e x t e n d s B a s i c B e l i e f A s s i g n m e n t < P r o p , B > > 61 e x t e n d s m i n A s s i g n m e n t < P r o p > , C l o n e a b l e { 62 63 / ∗ ∗ 64 ∗ C l e a r t h e a s s i g n m e n t s s t o r e d w i t h i n { @ l i n k B a s i c B e l i e f A s s i g n m e n t } , a n d 65 ∗ s t o r e ne w a s s i g n m e n t s f r o m t h e c o l l e c t i o n o f a s s i g n m e n t , < i >a n A s s i g n m e n t T a b . 66 ∗ 67 ∗ / 68 b o o l e a n l o a d ( C o l l e c t i o n < A s s i g n m e n t < P r o p > > a n A s s i g n m e n t T a b ) ; 69 70 / ∗ ∗ 12 71 ∗ Do an e x a c t c o p y o f i n p u t i n t o < i > t h i s . 72 ∗ 73 ∗ / 74 B d u p l i c a t e ( B i n p u t ) ; / / m ak e t h i s a d u p l i c a t e o f i n p u t 75 76 / ∗ ∗ 77 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 78 ∗ t h e C l a s s o f < i > t h i s ) . 79 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 80 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 81 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 82 ∗ 83 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 84 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 85 ∗ 86 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 87 ∗ { @ c o d e @ O v e r r i d e } 88 ∗ 89 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 90 ∗ < / f o n t > 91 ∗ 92 ∗ / 93 B i n s t a n c e ( ) ; 94 95 / ∗ ∗ 96 ∗ C r e a t e a c l o n e o f < i > t h i s . 97 ∗ 98 ∗ / 99 B c l o n e ( ) ; 100 101 / ∗ ∗ 102 ∗ Make a m i x o f t h e b a s i c b e l i e f a s s i g n m e n t s s t o r e d w i t h i n t h e e n t r y , < i >b b a I n 103 ∗ a c c o r d i n g t o t h e i r r e s p e c t i v e w e i g h t < i >w e i g h t . T h i s m i x i s s t o r e d i n t o < i > ← ֓ t h i s . 104 ∗ 105 ∗ / 106 B m i x ( A r r a y L i s t < B > b b a I n , d o u b l e [ ] w e i g h t ) ; 107 108 / ∗ ∗ 109 ∗ C a l l e d e a c h t i m e a c h a n g e i s d o n e t o < i > t h i s . T h i s i s u s e f u l l f o r p r o c e s s e s ← ֓ w h i c h n e e d an 110 ∗ i n i t i a l i z a t i o n a f t e r e a c h c h a n g e o f t h e a s s i g n m e n t s . T y p i c a l l y , t h e 111 ∗ s a m p l i n g m e t h o d s r e q u i r e an a c t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t # ← ֓ u p d a t e _ n o t i f i c a t i o n ( ) } 112 ∗ i n o r d e r t o d e c i d e f o r a n e w c o m p u t a t i o n o f t h e s a m p l i n g t a b l e s , w h i c h a r e m a de 113 ∗ n e c e s s a r y by a c h a n g e o f t h e a s s i g n m e n t s . 114 ∗ 115 ∗ / 116 v o i d u p d a t e _ n o t i f i c a t i o n ( ) ; / / 117 118 / ∗ ∗ 119 ∗ R e t u r n a r e p r e s e n t a t i o n o f t h e s t a t e o f < i > t h i s p r i n t e d a s 120 ∗ a S t r i n g . T y p i c a l l y , t h i s s t a t e i s t h e l i s t o f a l l s t o r e d a s s i g n m e n t s ( ← ֓ p r o p o s i t i o n 121 ∗ a n d v a l u e ) . D e p e n d i n g o n t h e p a r a m e t e r < i >c h o i x i n e n t r y , t h e ← ֓ r e p r e s e n t a t i o n 122 ∗ i s m o d i f i e d a s f o l l l o w s : < b r> 123 ∗ < i >c h o i x == 0 − − N o t h i n g i s p r i n t e d . 124 ∗ 125 ∗ < i >c h o i x == 1 < / i > − − A s s i g n m e n t s a r e p r i n t e d i n i n c r e a s i n g o r d e r o f t h e i r 126 ∗ p r o p o s i t i o n s , 127 ∗ 128 ∗ < i >c h o i x == 2 < / i > − − A s s i g n m e n t s a r e p r i n t e d i n d e c r e a s i n g o r d e r o f t h e i r 129 ∗ v a l u e , 130 ∗ 131 ∗ < i >c h o i x == 3 < / i > − − Do b o t h p r i n t i n t h a t o r d e r . 132 ∗ 133 ∗ 134 ∗ / 135 S t r i n g s t a t e ( i n t c h o i x ) ; / / a s t r i n g r e p r e s e n t i n g t h e s t a t e o f t h e B B A 136 137 / ∗ ∗ 138 ∗ Re m ov e a l l a s s i g n m e n t s f r o m < i > t h i s . Th e c l a s s i n s t a n c e i s c l e a r e d . 13 139 ∗ 140 ∗ / 141 v o i d c l e a r ( ) ; 142 143 / ∗ ∗ 144 ∗ A dd a n a s s i g n m e n t c h a r a c t e r i z e d b y a p r o p o s i t i o n < i > a P r o p o s i t i o n a n d a ← ֓ v a l u e 145 ∗ < i >a n A s s i g n m e n t V a l u e t o < i > t h i s . 146 ∗ I f a n a s s i g n m e n t a l r e a d y e x i s t s f o r a P r o p o s i t i o n , s a y w i t h v a l u e < i > ← ֓ t h e O l d V a l u e , 147 ∗ t h e n t h e n e w a s s i g n e m e n t o f a P r o p o s i t i o n i s s t o r e d w i t h v a l u e 148 ∗ < i >t h e O l d V a l u e +a n A s s i g n m e n t V a l u e . 149 ∗ 150 ∗ / 151 b o o l e a n a d d ( P r o p a P r o p o s i t i o n , d o u b l e a n A s s i g n m e n t V a l u e ) ; 152 153 / ∗ ∗ 154 ∗ D o e x a c t l y a s { @ l i n k B a s i c B e l i e f A s s i g n m e n t # ad d ( R e f e r e e T o o l b o x . L a t t i c e , d o u b l e ) ← ֓ } 155 ∗ b u t t a k e s a n e n t r y o f t y p e { @ l i n k A s s i g n m e n t } , w h i c h i s a c t u a l l y 156 ∗ e q u i v a l e n t . 157 ∗ 158 ∗ / 159 b o o l e a n a d d ( A s s i g n m e n t < P r o p > a n A s s i g n m e n t ) ; 160 161 / ∗ ∗ 162 ∗ A dd a l l a s s i g n m e n t s o f c o l l e c t i o n < i >a s s i g n T a b t o < i > t h i s . 163 ∗ T h i s m e t h o d i s e q u i v a l e n t t o a p p l y i n g 164 ∗ { @ l i n k B a s i c B e l i e f A s s i g n m e n t # a d d ( R e f e r e e T o o l b o x . A s s i g n m e n t ) } 165 ∗ t o e a c h a s s i g n m e n t o f c o l l e c t i o n < i >a s s i g n T a b . 166 ∗ 167 ∗ / 168 b o o l e a n a d d A l l ( C o l l e c t i o n < A s s i g n m e n t < P r o p > > a s s i g n T a b ) ; 169 170 / ∗ ∗ 171 ∗ Re m ov e t h e a s s i g n m e n t r e l a t e d t o p r o p o s i t i o n < i > a P r o p o s i t i o n , i f t h e r e i s 172 ∗ s u c h a s s i g n m e n t s t o r e d w i t h i n < i > t h i s . 173 ∗ R e t u r n t h e v a l u e a s s i g n e d t o t h e p r o p o s i t i o n . 174 ∗ 175 ∗ / 176 d o u b l e r e m o v e ( P r o p a P r o p o s i t i o n ) ; 177 } 14 Source Co de: BBA Common.jav a 1 / ∗ 2 ∗ B B A C o mm o n . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; B a s i c a l i m p l e m e n t a t i o n o f 3 ∗ t h e B a s i c B e l i e f A s s i g m e n t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ B a s i c a l i m p l e m e n t a t i o n o f t h e B a s i c B e l i e f A s s i g m e n t s t r u c t u r e . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c c l a s s B B A C o m m o n < P r o p e x t e n d s L a t t i c e < P r o p > , 58 B e x t e n d s B B A C o m m o n < P r o p , B > > 59 i m p l e m e n t s B a s i c B e l i e f A s s i g n m e n t < P r o p , ← ֓ B > { 60 61 62 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 63 / / p u b l i c p a r t 64 / / / / / / / / / / / / / / / 65 66 / ∗ ∗ 67 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 68 ∗ r e p o r t a n d a c o d e e x i t . 69 ∗ < B R > < B R > 15 70 ∗ < b >D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 71 ∗ { @ i n h e r i t D o c } 72 ∗ / 73 p u b l i c B d u p l i c a t e ( B i n p u t ) { 74 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 75 " . d u p l i c a t e ( B ) i s n o t i m p l e m e n t e d ! " ) ; 76 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t c l o n e ( ) i n y o u r c l a s s w i t h @ O v e r r i d e " ← ֓ ) ; 77 S y s t e m . e x i t ( 0 ) ; 78 r e t u r n n u l l ; 79 } 80 81 @ O v e r r i d e 82 p u b l i c B c l o n e ( ) { 83 r e t u r n i n s t a n c e ( ) . d u p l i c a t e ( ( B ) t h i s ) ; 84 } 85 86 / ∗ ∗ 87 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 88 ∗ r e p o r t a n d a c o d e e x i t . 89 ∗ < B R > < B R > 90 ∗ < b >D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 91 ∗ { @ i n h e r i t D o c } 92 ∗ / 93 p u b l i c B i n s t a n c e ( ) { 94 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 95 " . c l o n e ( ) i s n o t i m p l e m e n t e d ! " ) ; 96 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t c l o n e ( ) i n y o u r c l a s s w i t h @ O v e r r i d e " ← ֓ ) ; 97 S y s t e m . e x i t ( 0 ) ; 98 r e t u r n n u l l ; 99 } 100 101 / ∗ ∗ 102 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d p r o d u c e s t h e ← ֓ S t r i n g 103 ∗ { @ c o d e "U N D E F I N E D " } . 104 ∗ < B R > < B R > 105 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 106 ∗ { @ i n h e r i t D o c } 107 ∗ / 108 p u b l i c S t r i n g s t a t e ( i n t c h o i x ) { 109 r e t u r n " U N D E F I N E D " ; 110 } 111 112 / ∗ ∗ 113 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 114 ∗ r e p o r t a n d a c o d e e x i t . 115 ∗ < B R > < B R > 116 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 117 ∗ { @ i n h e r i t D o c } 118 ∗ / 119 p u b l i c A r r a y L i s t < A s s i g n m e n t < P r o p > > t o A r r a y ( ) { 120 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 121 " . t o A r r a y ( ) i s n o t i m p l e m e n t e d ! " ) ; 122 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t t o A r r a y ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 123 S y s t e m . e x i t ( 0 ) ; 124 r e t u r n n u l l ; 125 } 126 127 p u b l i c b o o l e a n l o a d ( C o l l e c t i o n < A s s i g n m e n t < P r o p > > a n A s s i g n m e n t T a b ) { 128 c l e a r ( ) ; 129 a d d A l l ( a n A s s i g n m e n t T a b ) ; 130 r e t u r n t r u e ; 131 } 132 133 / ∗ ∗ 134 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 135 ∗ r e p o r t a n d a c o d e e x i t . 136 ∗ < B R > < B R > 16 137 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 138 ∗ { @ i n h e r i t D o c } 139 ∗ / 140 p u b l i c v o i d c l e a r ( ) { 141 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 142 " . c l e a r ( ) i s n o t i m p l e m e n t e d ! " ) ; 143 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t c l e a r ( ) i n y o u r c l a s s w i t h @ O v e r r i d e " ← ֓ ) ; 144 S y s t e m . e x i t ( 0 ) ; 145 } 146 147 / ∗ ∗ 148 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 149 ∗ r e p o r t a n d a c o d e e x i t . 150 ∗ < B R > < B R > 151 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 152 ∗ { @ i n h e r i t D o c } 153 ∗ / 154 p u b l i c b o o l e a n a d d ( P r o p a P r o p o s i t i o n , d o u b l e a n A s s i g n m e n t V a l u e ) { 155 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 156 " . a d d ( ) i s n o t i m p l e m e n t e d ! " ) ; 157 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t ad d ( ) i n y o u r c l a s s w i t h @ O v e r r i d e " ) ; 158 S y s t e m . e x i t ( 0 ) ; 159 r e t u r n t r u e ; 160 } 161 162 p u b l i c b o o l e a n a d d ( A s s i g n m e n t < P r o p > a n A s s i g n m e n t ) { 163 r e t u r n a d d ( a n A s s i g n m e n t . a t t r i b u t e , a n A s s i g n m e n t . v a l u e ) ; 164 } 165 166 p u b l i c b o o l e a n a d d A l l ( C o l l e c t i o n < A s s i g n m e n t < P r o p > > a s s i g n T a b ) { 167 / / b b a T r e e ; 168 b o o l e a n t e s t = t r u e ; 169 f o r ( I t e r a t o r < A s s i g n m e n t < P r o p > > i t = a s s i g n T a b . i t e r a t o r ( ) ; 170 i t . h a s N e x t ( ) ; ) { 171 t e s t = t e s t & & a d d ( i t . n e x t ( ) ) ; 172 } 173 r e t u r n t e s t ; 174 } 175 176 / ∗ ∗ 177 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 178 ∗ r e p o r t a n d a c o d e e x i t . 179 ∗ < B R > < B R > 180 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 181 ∗ { @ i n h e r i t D o c } 182 ∗ / 183 p u b l i c A s s i g n m e n t < P r o p > f i n d P r o p o s i t i o n ( A s s i g n m e n t < P r o p > a n A s s i g n m e n t ) { 184 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 185 " . f i n d P r o p o s i t i o n ( A s s i g n m e n t < P r o p >) i s n o t i m p l e m e n t e d ! " ) ; 186 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t f i n d P r o p o s i t i o n ( A s s i g n m e n t < P r o p >) " + 187 " i n y o u r c l a s s w i t h @ O v e r r i d e " ) ; 188 S y s t e m . e x i t ( 0 ) ; 189 r e t u r n n u l l ; 190 } 191 192 p u b l i c A s s i g n m e n t < P r o p > f i n d P r o p o s i t i o n ( P r o p a P r o p o s i t i o n ) { 193 A s s i g n m e n t < P r o p > s e a r c h A s s i g n = n e w A s s i g n m e n t < P r o p > ( ) ; 194 s e a r c h A s s i g n . a t t r i b u t e = a P r o p o s i t i o n ; 195 r e t u r n f i n d P r o p o s i t i o n ( s e a r c h A s s i g n ) ; 196 } 197 198 p u b l i c d o u b l e m ( P r o p a P r o p o s i t i o n ) { 199 200 A s s i g n m e n t < P r o p > f o u n d P a i r = f i n d P r o p o s i t i o n ( a P r o p o s i t i o n ) ; 201 i f ( f o u n d P a i r ! = n u l l ) { 202 r e t u r n f o u n d P a i r . v a l u e ; 203 } 204 r e t u r n 0 . ; 205 } 206 207 / ∗ ∗ 17 208 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 209 ∗ r e p o r t a n d a c o d e e x i t . 210 ∗ < B R > < B R > 211 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 212 ∗ { @ i n h e r i t D o c } 213 ∗ / 214 p u b l i c d o u b l e B e l ( P r o p a P r o p o s i t i o n ) { 215 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 216 " . B e l ( P r o p ) i s n o t i m p l e m e n t e d ! " ) ; 217 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t B e l ( P r o p ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 218 S y s t e m . e x i t ( 0 ) ; 219 r e t u r n − 1 ; 220 } 221 222 / ∗ ∗ 223 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 224 ∗ r e p o r t a n d a c o d e e x i t . 225 ∗ < B R > < B R > 226 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 227 ∗ { @ i n h e r i t D o c } 228 ∗ / 229 p u b l i c d o u b l e P l ( P r o p a P r o p o s i t i o n ) { 230 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 231 " . P l ( P r o p ) i s n o t i m p l e m e n t e d ! " ) ; 232 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t P l ( P r o p ) i n y o u r c l a s s w i t h @ O v e r r i d e ← ֓ " ) ; 233 S y s t e m . e x i t ( 0 ) ; 234 r e t u r n − 1 ; 235 } 236 237 / ∗ ∗ 238 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 239 ∗ r e p o r t a n d a c o d e e x i t . 240 ∗ < B R > < B R > 241 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 242 ∗ { @ i n h e r i t D o c } 243 ∗ / 244 p u b l i c d o u b l e r e m o v e ( P r o p a P r o p o s i t i o n ) { 245 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 246 " . r e m o v e ( P r o p ) i s n o t i m p l e m e n t e d ! " ) ; 247 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t r e m o v e ( P r o p ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 248 S y s t e m . e x i t ( 0 ) ; 249 r e t u r n − 1 . ; 250 } 251 252 / ∗ ∗ 253 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k B B A C o m m o n } a n d g e n e r a t e s an ← ֓ e r r o r 254 ∗ r e p o r t a n d a c o d e e x i t . 255 ∗ < B R > < B R > 256 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k B a s i c B e l i e f A s s i g n m e n t } : < / b > < B R > 257 ∗ { @ i n h e r i t D o c } 258 ∗ / 259 p u b l i c B m i x ( A r r a y L i s t < B > b b a I n , d o u b l e [ ] w e i g h t ) { 260 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 261 " . m i x ( A r r a y L i s t < B> , d o u b l e [ ] ) i s n o t i m p l e m e n t e d ! " ) ; 262 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t m i x ( A r r a y L i s t < B > , d o u b l e [ ] ) i n y o u r " ← ֓ + 263 " c l a s s w i t h @ O v e r r i d e " ) ; 264 S y s t e m . e x i t ( 0 ) ; 265 r e t u r n n u l l ; 266 } 267 268 p u b l i c v o i d u p d a t e _ n o t i f i c a t i o n ( ) { / / c a l l e d e a c h t i m e a c h a n g e i s d o n e 269 } 270 271 } 18 Source Co de: BBAF user.ja v a 1 / ∗ 2 ∗ B B A F u s e r . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r t h e f u s i o n o f 3 ∗ B a s i c B e l i e f A s s i g m e n t s . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ M e t h o d s f o r f u s i n g B a s i c B e l i e f A s s i g n m e n t s . T h i s i n t e r f a c e c o n c e r n s d i r e c t 32 ∗ r u l e i m p l e m e n t a t i o n s . I t d o e s n o t c o n c e r n r e f e r e e − b a s e d f u s e r s , f o r w h i c h t h e r e 33 ∗ a r e d e d i c a t e d i n t e r f a c e s { @ l i n k B B A R e f e r e e F u s e r } , { @ l i n k S a m p l e d B B A R e f e r e e F u s e r ← ֓ } . 34 ∗ 35 ∗ @ s e e B B A R e f e r e e F u s e r 36 ∗ @ s e e S a m p l e d B B A R e f e r e e F u s e r 37 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 38 ∗ 39 ∗ 40 ∗ 41 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 42 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 43 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 46 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 47 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 48 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 49 ∗ < B R > 50 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 51 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 52 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 53 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 54 ∗ < B R > 55 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 56 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 57 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 58 ∗ < / t a b l e > < B R > 59 ∗ 60 ∗ / 61 p u b l i c i n t e r f a c e B B A F u s e r < P r o p e x t e n d s L a t t i c e < P r o p > , B e x t e n d s B B A F u s e r < P r o p , B > > 62 e x t e n d s B a s i c B e l i e f A s s i g n m e n t < P r o p , B > { 63 64 / ∗ ∗ 65 ∗ C om p u t e t h e c o m b i n a t i o n ( f u s i o n ) o f b a s i c b e l i e f a s s i g n m e n t s < i > l e f t a n d 66 ∗ < i > r i g h t a n d s t o r e t h e r e s u l t w i t h i n < i > t h i s . 67 ∗ 68 ∗ / 69 B f u s e ( B l e f t , B r i g h t ) ; 70 19 71 / ∗ ∗ 72 ∗ C om p u t e t h e c o m b i n a t i o n ( f u s i o n ) o f t h e b a s i c b e l i e f a s s i g n m e n t s w i t h i n a r r a y 73 ∗ < i >b b a I n a n d s t o r e t h e r e s u l t w i t h i n < i >t h i s . 74 ∗ 75 ∗ / 76 B f u s e ( A r r a y L i s t < B > b b a I n ) ; 77 78 / ∗ ∗ 79 ∗ R e t u r n t h e c o n f l i c t o f t h e l a s t c o m b i n a t i o n . 80 ∗ 81 ∗ / 82 B c o n f l i c t ( ) ; 83 84 } 20 Source Co de: BBARefereeF user.ja v a 1 / ∗ 2 ∗ B B A R e f e r e e F u s e r . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r f u s e r 3 ∗ b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ M e t h o d s f o r f u s i n g B a s i c B e l i e f A s s i g n m e n t s b y t h e m e a n s o f r e f e r e e f u n c t i o n s 32 ∗ a n d o n t h e b a s i s o f a n e x a c t c o m p u t a t i o n . T h i s i n t e r f a c e d o e s n o t c o n c e r n ← ֓ d i r e c t 33 ∗ r u l e i m p l e m e n t a t i o n s , { @ l i n k B BA F u se r } , o r i m p l e m e n t a t i o n s b a s e d on r e f e r e e 34 ∗ s a m p l i n g , { @ l i n k S a m p l e d B B A R e f e r e e F u s e r } . 35 ∗ 36 ∗ @ s e e BB A F u s e r 37 ∗ @ s e e S a m p l e d B B A R e f e r e e F u s e r 38 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 39 ∗ 40 ∗ 41 ∗ 42 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 43 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 44 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 47 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 48 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 49 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 50 ∗ < B R > 51 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 52 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 53 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 54 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 55 ∗ < B R > 56 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 57 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 58 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 59 ∗ < / t a b l e > < B R > 60 ∗ 61 ∗ / 62 p u b l i c i n t e r f a c e B B A R e f e r e e F u s e r < P r o p e x t e n d s L a t t i c e < P r o p > , B e x t e n d s ← ֓ B B A R e f e r e e F u s e r < P r o p , B > > 63 e x t e n d s B a s i c B e l i e f A s s i g n m e n t < P r o p , B > { 64 65 / ∗ ∗ 66 ∗ C om p u t e t h e c o m b i n a t i o n ( f u s i o n ) o f b a s i c b e l i e f a s s i g n m e n t s < i > l e f t a n d 67 ∗ < i > r i g h t b y m e a n s o f t h e r e f e r e e f u n c t i o n t h e R e f e r e e F u n c t i o n a n d 68 ∗ s t o r e t h e r e s u l t w i t h i n < i > t h i s . 69 ∗ 21 70 ∗ / 71 B f u s e ( B l e f t , B r i g h t , R e f e r e e F u n c t i o n D e f a u l t < P r o p > t h e R e f e r e e F u n c t i o n ) ; 72 73 / ∗ ∗ 74 ∗ C om p u t e t h e c o m b i n a t i o n ( f u s i o n ) o f b a s i c b e l i e f a s s i g n m e n t s w i t h i n a r r a y 75 ∗ < i >b b a I n b y m e a n s o f t h e r e f e r e e f u n c t i o n t h e R e f e r e e F u n c t i o n a n d 76 ∗ s t o r e t h e r e s u l t w i t h i n < i > t h i s . 77 ∗ 78 ∗ / 79 B f u s e ( A r r a y L i s t < B > b b a I n , R e f e r e e F u n c t i o n D e f a u l t < P r o p > t h e R e f e r e e F u n c t i o n ) ; 80 81 / ∗ ∗ 82 ∗ R e t u r n t h e c o n f l i c t o f t h e l a s t c o m b i n a t i o n . 83 ∗ 84 ∗ / 85 d o u b l e c o n f l i c t ( ) ; 86 87 } 22 Source Co de: Closedh yp erp o werset.ja v a 1 / ∗ 2 ∗ C l o s e d h y p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n 3 ∗ o f c l o s e d h y p e r p o w e r s e t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ I m p l e m e n t a t i o n o f a c l o s e d h y p e r p o w e r s e t s t r u c t u r e . A c l o s e d h y p e r p o w e r s e t i s 30 ∗ a n h y p e r p o w e r s e t d e f i n e d o n t h e b a s i s o f a s u p e r p o w e r s e t : i t i s g e n e r a t e d 31 ∗ f r o m t h e a t o m i c p r o p o s i t i o n s o f t h e s u p e r p o w e r s e t b u t w i t h o u t t h e u s e o f 32 ∗ t h e c o m p l e m e n t o p e r a t o r o f t h e s u p e r p o w e r s e t . 33 ∗ < B R > < B R > 34 ∗ The c l o s e d h y p e r p o w e r s e t i m p l i e s a c l o s e d w o r l d h y p o t h e s i s , t h a t i s : 35 ∗ < B R > < B R > 36 ∗ < i > < b > O R 0 = < i < s i z e F r a m e a t o m i c ( i ) = = o n e 37 ∗ < B R > < B R > 38 ∗ A l t h o u g h g e n e r a t e d w i t h o u t t h e c o m p l e m e n t o f t h e s u p e r p o w e r s e t , t h e c l o s e d 39 ∗ h y p e r p o w e r s e t a c t u a l l y h a s p r o p e r c o m p l e m e n t a n d c o c o m p l e m e n t o p e r a t o r s . 40 ∗ The c o m p l e m e n t a n d c o c o m p l e m e n t a r e d i s t i n c t o p e r a t o r s f o r t h e c l o s e d ← ֓ h y p e r p o w e r s e t . 41 ∗ 42 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 43 ∗ 44 ∗ 45 ∗ 46 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 47 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 48 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 49 ∗ < B R > 50 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 51 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 52 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 53 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 54 ∗ < B R > 55 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 56 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 57 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 58 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 59 ∗ < B R > 60 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 61 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 62 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 63 ∗ < / t a b l e > < B R > 64 ∗ 65 ∗ / 66 p u b l i c c l a s s C l o s e d h y p e r p o w e r s e t < L e x t e n d s C l o s e d h y p e r p o w e r s e t < L > > e x t e n d s ← ֓ S u p e r p o w e r s e t < L > { 67 p r o t e c t e d L t h e Z e r o = n u l l ; 68 p r o t e c t e d L t h e O n e = n u l l ; 69 23 70 / ∗ ∗ 71 ∗ C o m p u t e t h e < b > c o m p l e m e n t o f < i >a P r o p o s i t i o n a n d s t o r e t h e r e s u l t 72 ∗ w i t h i n t h i s . 73 ∗ Th e c o m p l e m e n t o p e r a t o r f o r t h e c l o s e d h y p e r p o w e r s e t i s d e f i n e d b y : 74 ∗ < B R > < B R > 75 ∗ < i > c o m p l e m e n t ( z e r o ) = o n e 76 ∗ < B R > 77 ∗ < i > c o m p l e m e n t (X ) = z e r o i f < i > X ! = z e r o 78 ∗ 79 ∗ / 80 @ O v e r r i d e 81 p u b l i c L c o m p l e m e n t ( L a P r o p o s i t i o n ) { 82 i f ( t h e Z e r o = = n u l l ) { 83 t h e Z e r o = i n s t a n c e N s i z e ( ) . z e r o ( ) ; 84 t h e O n e = i n s t a n c e N s i z e ( ) . o n e ( ) ; 85 } 86 i f ( a P r o p o s i t i o n . c o m p a r e T o ( t h e Z e r o ) ==0) o n e ( ) ; 87 e l s e z e r o ( ) ; 88 r e t u r n ( L ) t h i s ; 89 } 90 91 / ∗ ∗ 92 ∗ C o m p u t e t h e < b > c o m p l e m e n t o f < i > t h i s a n d s t o r e t h e r e s u l t w i t h i n 93 ∗ < i > t h i s . 94 ∗ Th e c o m p l e m e n t o p e r a t o r f o r t h e c l o s e d h y p e r p o w e r s e t i s d e f i n e d b y : 95 ∗ < B R > < B R > 96 ∗ < i > c o m p l e m e n t ( z e r o ) = o n e 97 ∗ < B R > 98 ∗ < i > c o m p l e m e n t (X ) = z e r o i f < i > X ! = z e r o 99 ∗ 100 ∗ / 101 @ O v e r r i d e 102 p u b l i c L c o m p l e m e n t ( ) { 103 i f ( t h e Z e r o = = n u l l ) { 104 t h e Z e r o = i n s t a n c e N s i z e ( ) . z e r o ( ) ; 105 t h e O n e = i n s t a n c e N s i z e ( ) . o n e ( ) ; 106 } 107 i f ( c o m p a r e T o ( t h e Z e r o ) ==0) o n e ( ) ; 108 e l s e z e r o ( ) ; 109 r e t u r n ( L ) t h i s ; 110 } 111 112 / ∗ ∗ 113 ∗ Co m p u t e t h e c o c o m p l e m e n t o f < i > a P r o p o s i t i o n a n d s t o r e t h e r e s u l t 114 ∗ w i t h i n < i > t h i s . 115 ∗ T he c o c o m p l e m e n t o p e r a t o r f o r t h e c l o s e d h y p e r p o w e r s e t i s d e f i n e d b y : 116 ∗ < B R > < B R > 117 ∗ < i > c o c o m p l e m e n t ( X ) = O R Z A N D X ! = Z Z< / i > 118 ∗ 119 ∗ / 120 @ O v e r r i d e 121 p u b l i c L c o c o m p l e m e n t ( L a P r o p o s i t i o n ) { 122 i f ( t h e Z e r o = = n u l l ) { 123 t h e Z e r o = i n s t a n c e N s i z e ( ) . z e r o ( ) ; 124 t h e O n e = i n s t a n c e N s i z e ( ) . o n e ( ) ; 125 } 126 L t m p P r o p o s i t i o n = i n s t a n c e N s i z e ( ) ; 127 L f i n a l P r o p o s i t i o n = i n s t a n c e N s i z e ( ) ; 128 f i n a l P r o p o s i t i o n . z e r o ( ) ; 129 i n t i ; 130 f o r ( i = 0 ; i < s i z e ( − 1 ) ; i ++ ) { 131 t m p P r o p o s i t i o n . a t o m i c ( i ) ; 132 i f ( ! a P r o p o s i t i o n . c o n t a i n s ( t m p P r o p o s i t i o n ) ) 133 f i n a l P r o p o s i t i o n . o r ( f i n a l P r o p o s i t i o n , t m p P r o p o s i t i o n ) ; 134 } 135 r e t u r n d u p l i c a t e ( f i n a l P r o p o s i t i o n ) ; 136 } 137 138 / ∗ ∗ 139 ∗ Co m p u t e t h e c o c o m p l e m e n t o f < i > t h i s a n d s t o r e t h e r e s u l t 140 ∗ w i t h i n < i > t h i s . 141 ∗ T he c o c o m p l e m e n t o p e r a t o r f o r t h e c l o s e d h y p e r p o w e r s e t i s d e f i n e d b y : 142 ∗ < B R > < B R > 143 ∗ < i > c o c o m p l e m e n t ( X ) = O R Z A N D X ! = Z Z< / i > 24 144 ∗ 145 ∗ / 146 @ O v e r r i d e 147 p u b l i c L c o c o m p l e m e n t ( ) { 148 i f ( t h e Z e r o = = n u l l ) { 149 t h e Z e r o = i n s t a n c e N s i z e ( ) . z e r o ( ) ; 150 t h e O n e = i n s t a n c e N s i z e ( ) . o n e ( ) ; 151 } 152 L t m p P r o p o s i t i o n = i n s t a n c e N s i z e ( ) ; 153 L f i n a l P r o p o s i t i o n = i n s t a n c e N s i z e ( ) ; 154 f i n a l P r o p o s i t i o n . z e r o ( ) ; 155 i n t i ; 156 f o r ( i = 0 ; i < s i z e ( − 1 ) ; i ++ ) { 157 t m p P r o p o s i t i o n . a t o m i c ( i ) ; 158 i f ( ! c o n t a i n s ( t m p P r o p o s i t i o n ) ) 159 f i n a l P r o p o s i t i o n . o r ( f i n a l P r o p o s i t i o n , t m p P r o p o s i t i o n ) ; 160 } 161 r e t u r n d u p l i c a t e ( f i n a l P r o p o s i t i o n ) ; 162 } 163 164 } 25 Source Co de: ComplementedLa ttice.jav a 1 / ∗ 2 ∗ C o m p l e m e n t e d L a t t i c e . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e 3 ∗ f o r c o m p l e m e n t e d L a t t i c e . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ C o n t a i n s t h e m e t h o d s f o r a c l a s s i m p l e m e n t i n g a L a t t i c e s t r u c t u r e w i t h a 30 ∗ c o m p l e m e n t o r a p s e u d o − c o m p l e m e n t o p e r a t o r . 31 ∗ B o o l e a n a l g e b r a , p o w e r s e t , a s w e l l a s H e y t i n g a l g e b r a o r c l o s e d / o p e n ← ֓ H y p e r p o w e r s e t s 32 ∗ a r e e x a m p l e s o f c o m p l e m e n t e d l a t t i c e s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c i n t e r f a c e C o m p l e m e n t e d L a t t i c e < L > e x t e n d s L a t t i c e < L > { 59 60 / ∗ ∗ 61 ∗ C om p u t e t h e c o m p l e m e n t o f < i > a P r o p o s i t i o n a n d s t o r e t h e r e s u l t ← ֓ w i t h i n 62 ∗ < i > t h i s . 63 ∗ < B R > < B R > 64 ∗ < b > D e f i n i t i o n . < / b> Th e c o m p l e m e n t o f a p r o p o s i t i o n < i > X < / i > o f a l a t t i c e < i > L < / ← ֓ i > 65 ∗ i s : < i > c om p (X ) = O R Y : Y A N D X = z e r o Y 66 ∗ < B R > < B R > 67 ∗ < b > T h e o r e m 1 . < / b > I f t h e l a t t i c e i s a b o o l e a n a l g e b r a , t h e n c o m p l e m e n t a n d ← ֓ c o c o m p l e m e n t 26 68 ∗ a r e i d e n t i c a l , com p (X ) =c o c o m p ( X ) 69 ∗ < B R > 70 ∗ < b > T h e o r e m 2 . < / b > < i >c o c o m p ( X ) c o n t a i n s < i > c om p ( X ) 71 ∗ 72 ∗ @ s e e C o m p l e m e n t e d L a t t i c e # c o c o m p l e m e n t ( j a v a . l a n g . O b j e c t ) 73 ∗ / 74 L c o m p l e m e n t ( L a P r o p o s i t i o n ) ; 75 76 / ∗ ∗ 77 ∗ C om p u t e t h e c o m p l e m e n t o f < i > t h i s a n d s t o r e t h e r e s u l t w i t h i n 78 ∗ < i > t h i s . 79 ∗ < B R > < B R > 80 ∗ < b > D e f i n i t i o n . < / b> Th e c o m p l e m e n t o f a p r o p o s i t i o n < i > X < / i > o f a l a t t i c e < i > L < / ← ֓ i > 81 ∗ i s : < i > c om p (X ) = O R Y : Y A N D X = z e r o Y 82 ∗ < B R > < B R > 83 ∗ < b > T h e o r e m 1 . < / b > I f t h e l a t t i c e i s a b o o l e a n a l g e b r a , t h e n c o m p l e m e n t a n d ← ֓ c o c o m p l e m e n t 84 ∗ a r e i d e n t i c a l , com p (X ) =c o c o m p ( X ) 85 ∗ < B R > 86 ∗ < b > T h e o r e m 2 . < / b > < i >c o c o m p ( X ) c o n t a i n s < i > c om p ( X ) 87 ∗ 88 ∗ @ s e e C o m p l e m e n t e d L a t t i c e # c o c o m p l e m e n t ( ) 89 ∗ / 90 L c o m p l e m e n t ( ) ; 91 92 / ∗ ∗ 93 ∗ C om p u t e t h e c o c o m p l e m e n t o f < i > a P r o p o s i t i o n a n d s t o r e t h e r e s u l t 94 ∗ w i t h i n < i > t h i s . 95 ∗ 96 ∗ < B R > < B R > 97 ∗ < b > D e f i n i t i o n . < / b> Th e c o c o m p l e m e n t o f a p r o p o s i t i o n < i > X o f a l a t t i c e < i > L ← ֓ 98 ∗ i s : < i > c o c o m p ( X ) = A N D < s u b> Z : Z O R X = o n e Z 99 ∗ < B R > < B R > 100 ∗ Th e o r e m 1 . < / b > I f t h e l a t t i c e i s a b o o l e a n a l g e b r a , t h e n c o m p l e m e n t a n d ← ֓ c o c o m p l e m e n t 101 ∗ a r e i d e n t i c a l , com p ( X ) =c o c o m p ( X ) 102 ∗ < B R > 103 ∗ Th e o r e m 2 . < / b > < i >c o c o m p ( X ) c o n t a i n s < i > com p (X ) 104 ∗ 105 ∗ @ s e e C o m p l e m e n t e d L a t t i c e #c o m p l e m e n t ( j a v a . l a n g . O b j e c t ) 106 ∗ / 107 L c o c o m p l e m e n t ( L a P r o p o s i t i o n ) ; 108 109 / ∗ ∗ 110 ∗ C o m p u t e t h e c o c o m p l e m e n t o f < i > t h i s a n d s t o r e t h e r e s u l t 111 ∗ w i t h i n < i > t h i s . 112 ∗ 113 ∗ < B R > < B R > 114 ∗ D e f i n i t i o n . < / b > T he c o c o m p l e m e n t o f a p r o p o s i t i o n < i > X < / i > o f a l a t t i c e < i > L ← ֓ 115 ∗ i s : c o c o m p ( X ) = < b > A N D Z : Z O R X = o n e < / s u b > Z 116 ∗ < B R > < B R > 117 ∗ Th e o r e m 1 . < / b > I f t h e l a t t i c e i s a b o o l e a n a l g e b r a , t h e n c o m p l e m e n t a n d ← ֓ c o c o m p l e m e n t 118 ∗ a r e i d e n t i c a l , com p ( X ) =c o c o m p ( X ) 119 ∗ < B R > 120 ∗ Th e o r e m 2 . < / b > < i >c o c o m p ( X ) c o n t a i n s < i > com p (X ) 121 ∗ 122 ∗ @ s e e C o m p l e m e n t e d L a t t i c e #c o m p l e m e n t ( ) 123 ∗ / 124 L c o c o m p l e m e n t ( ) ; 125 } 27 Source Co de: finalClosedh yp erp o werset.ja v a 1 / ∗ 2 ∗ f i n a l C l o s e d h y p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f c l o s e d h y p e r p o w e r s e t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ F i n a l i m p l e m e n t a t i o n o f c l a s s { @ l i n k C l o s e d h y p e r p o w e r s e t } . T h i s c l a s s i s n o t ← ֓ g e n e r i c , a n d 30 ∗ t h u s , a l l o w s a n d n e e d s i n s t a n t i a t i o n . Th e m e t h o d { @ l i n k ← ֓ f i n a l C l o s e d h y p e r p o w e r s e t #i n s t a n c e ( ) } 31 ∗ i s i m p l e m e n t e d . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c f i n a l c l a s s f i n a l C l o s e d h y p e r p o w e r s e t e x t e n d s C l o s e d h y p e r p o w e r s e t < ← ֓ f i n a l C l o s e d h y p e r p o w e r s e t > { 58 59 60 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 61 / / p u b l i c p a r t 62 / / / / / / / / / / / / / / / 63 64 / ∗ ∗ 65 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 66 ∗ t h e C l a s s o f < i > t h i s ) . 67 ∗ N . B . { @ l i n k L a t t i c e # i n s t a n c e ( ) } c a n n o t b e d e f i n e d 68 ∗ f o r g e n e r i c c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e 28 69 ∗ d e f i n e d w i t h t h e n o n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 70 ∗ 71 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 72 ∗ d e f i n i t i o n o f { @ l i n k L a t t i c e # i n s t a n c e ( ) } i s a s f o l l o w s : 73 ∗ 74 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 75 ∗ { @ c o d e @ O v e r r i d e } 76 ∗ 77 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 78 ∗ < / f o n t > 79 ∗ 80 ∗ / 81 @ O v e r r i d e 82 p u b l i c f i n a l C l o s e d h y p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n ne w ← ֓ f i n a l C l o s e d h y p e r p o w e r s e t ( ) ; } 83 } 29 Source Co de: finalF reeb o ole an.jav a 1 / ∗ 2 ∗ f i n a l F r e e b o o l e a n . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ f r e e B o o l e a n a l g e b r a . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ F i n a l i m p l e m e n t a t i o n o f c l a s s { @ l i n k F r e e b o o l e a n } . T h i s c l a s s i s n o t g e n e r i c , ← ֓ a n d 30 ∗ t h u s , a l l o w s a n d n e e d s i n s t a n t i a t i o n . Th e m e t h o d { @ l i n k f i n a l F r e e b o o l e a n # ← ֓ i n s t a n c e ( ) } 31 ∗ i s i m p l e m e n t e d . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c f i n a l c l a s s f i n a l F r e e b o o l e a n e x t e n d s F r e e b o o l e a n < f i n a l F r e e b o o l e a n > { 58 59 60 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 61 / / p u b l i c p a r t 62 / / / / / / / / / / / / / / / 63 64 / ∗ ∗ 65 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 66 ∗ t h e C l a s s o f < i > t h i s ) . 67 ∗ N . B . { @ l i n k L a t t i c e # i n s t a n c e ( ) } c a n n o t b e d e f i n e d 68 ∗ f o r g e n e r i c c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e 69 ∗ d e f i n e d w i t h t h e n o n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 30 70 ∗ 71 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 72 ∗ d e f i n i t i o n o f { @ l i n k L a t t i c e # i n s t a n c e ( ) } i s a s f o l l o w s : 73 ∗ 74 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 75 ∗ { @ c o d e @ O v e r r i d e } 76 ∗ 77 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 78 ∗ < / f o n t > 79 ∗ 80 ∗ / 81 @ O v e r r i d e 82 p u b l i c f i n a l F r e e b o o l e a n i n s t a n c e ( ) { r e t u r n n e w f i n a l F r e e b o o l e a n ( ) ; } 83 } 31 Source Co de: finalOp enh yp erp o werset.ja v a 1 / ∗ 2 ∗ f i n a l O p e n h y p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f o p e n h y p e r p o w e r s e t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ F i n a l i m p l e m e n t a t i o n o f c l a s s { @ l i n k O p e n h y p e r p o w e r s e t } . T h i s c l a s s i s n o t ← ֓ g e n e r i c , a n d 30 ∗ t h u s , a l l o w s a n d n e e d s i n s t a n t i a t i o n . Th e m e t h o d { @ l i n k f i n a l O p e n h y p e r p o w e r s e t # ← ֓ i n s t a n c e ( ) } 31 ∗ i s i m p l e m e n t e d . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c f i n a l c l a s s f i n a l O p e n h y p e r p o w e r s e t e x t e n d s O p e n h y p e r p o w e r s e t < ← ֓ f i n a l O p e n h y p e r p o w e r s e t > { 58 59 60 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 61 / / p u b l i c p a r t 62 / / / / / / / / / / / / / / / 63 64 / ∗ ∗ 65 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 66 ∗ t h e C l a s s o f < i > t h i s ) . 67 ∗ N . B . { @ l i n k L a t t i c e # i n s t a n c e ( ) } c a n n o t b e d e f i n e d 68 ∗ f o r g e n e r i c c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e 32 69 ∗ d e f i n e d w i t h t h e n o n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 70 ∗ 71 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 72 ∗ d e f i n i t i o n o f { @ l i n k L a t t i c e # i n s t a n c e ( ) } i s a s f o l l o w s : 73 ∗ 74 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 75 ∗ { @ c o d e @ O v e r r i d e } 76 ∗ 77 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 78 ∗ < / f o n t > 79 ∗ 80 ∗ / 81 @ O v e r r i d e 82 p u b l i c f i n a l O p e n h y p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n ne w f i n a l O p e n h y p e r p o w e r s e t ( ) ← ֓ ; } 83 } 33 Source Co de: finalP ow erset.ja v a 1 / ∗ 2 ∗ f i n a l P o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ p o w e r s e t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ F i n a l i m p l e m e n t a t i o n o f c l a s s { @ l i n k P o w e r s e t } . T h i s c l a s s i s n o t g e n e r i c , a n d 30 ∗ t h u s , a l l o w s a n d n e e d s i n s t a n t i a t i o n . Th e m e t h o d { @ l i n k f i n a l P o w e r s e t#i n s t a n c e ← ֓ ( ) } 31 ∗ i s i m p l e m e n t e d . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c f i n a l c l a s s f i n a l P o w e r s e t e x t e n d s P o w e r s e t < f i n a l P o w e r s e t > { 58 59 60 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 61 / / p u b l i c p a r t 62 / / / / / / / / / / / / / / / 63 64 / ∗ ∗ 65 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 66 ∗ t h e C l a s s o f < i > t h i s ) . 67 ∗ N . B . { @ l i n k L a t t i c e # i n s t a n c e ( ) } c a n n o t b e d e f i n e d 68 ∗ f o r g e n e r i c c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e 69 ∗ d e f i n e d w i t h t h e n o n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 70 ∗ 34 71 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 72 ∗ d e f i n i t i o n o f { @ l i n k L a t t i c e # i n s t a n c e ( ) } i s a s f o l l o w s : 73 ∗ 74 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 75 ∗ { @ c o d e @ O v e r r i d e } 76 ∗ 77 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 78 ∗ < / f o n t > 79 ∗ 80 ∗ / 81 @ O v e r r i d e 82 p u b l i c f i n a l P o w e r s e t i n s t a n c e ( ) { r e t u r n ne w f i n a l P o w e r s e t ( ) ; } 83 } 35 Source Co de: finalRefereeF userR TS_Closedh yp erp o werset.ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e F u s e r R T S _ C l o s e d h y p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e 3 ∗ R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e F u s e r R T S } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l C l o s e d h y p e r p o w e r s e t } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e F u s e r R T S _ C l o s e d h y p e r p o w e r s e t # ← ֓ i n s t a n c e ( ) } i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e F u s e r R T S _ C l o s e d h y p e r p o w e r s e t e x t e n d s R e f e r e e F u s e r R T S < ← ֓ f i n a l C l o s e d h y p e r p o w e r s e t , 59 f i n a l R e f e r e e F u s e r R T S _ C l o s e d h y p e r p o w e r s e t ← ֓ > { 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 67 ∗ t h e C l a s s o f < i > t h i s ) . 68 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 36 69 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 70 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 71 ∗ 72 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 73 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 74 ∗ 75 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 76 ∗ { @ c o d e @ O v e r r i d e } 77 ∗ 78 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 79 ∗ < / f o n t > 80 ∗ 81 ∗ / 82 @ O v e r r i d e 83 p u b l i c f i n a l R e f e r e e F u s e r R T S _ C l o s e d h y p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n n ew ← ֓ f i n a l R e f e r e e F u s e r R T S _ C l o s e d h y p e r p o w e r s e t ( ) ; } 84 85 } 37 Source Co de: finalRefereeF userR TS_F reeb o ole an.ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e F u s e r R T S _ F r e e b o o l e a n . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f f u s e r b a s e d on r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e F u s e r R T S } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l F r e e b o o l e a n } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e F u s e r R T S _ F r e e b o o l e a n # i n s t a n c e ( ) } i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e F u s e r R T S _ F r e e b o o l e a n e x t e n d s R e f e r e e F u s e r R T S < ← ֓ f i n a l F r e e b o o l e a n , 59 f i n a l R e f e r e e F u s e r R T S _ F r e e b o o l e a n ← ֓ > { 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 67 ∗ t h e C l a s s o f < i > t h i s ) . 68 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 69 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 38 70 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 71 ∗ 72 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 73 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 74 ∗ 75 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 76 ∗ { @ c o d e @ O v e r r i d e } 77 ∗ 78 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 79 ∗ < / f o n t > 80 ∗ 81 ∗ / 82 @ O v e r r i d e 83 p u b l i c f i n a l R e f e r e e F u s e r R T S _ F r e e b o o l e a n i n s t a n c e ( ) { r e t u r n ne w ← ֓ f i n a l R e f e r e e F u s e r R T S _ F r e e b o o l e a n ( ) ; } 84 } 39 Source Co de: finalRefereeF userR TS_Op enh yp erp o werset.ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e F u s e r R T S _ O p e n h y p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e 3 ∗ R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e F u s e r R T S } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l O p e n h y p e r p o w e r s e t } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e F u s e r R T S _ O p e n h y p e r p o w e r s e t #i n s t a n c e ← ֓ ( ) } i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e F u s e r R T S _ O p e n h y p e r p o w e r s e t e x t e n d s R e f e r e e F u s e r R T S < ← ֓ f i n a l O p e n h y p e r p o w e r s e t , 59 f i n a l R e f e r e e F u s e r R T S _ O p e n h y p e r p o w e r s e t ← ֓ > { 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 67 ∗ t h e C l a s s o f < i > t h i s ) . 68 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 40 69 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 70 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 71 ∗ 72 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 73 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 74 ∗ 75 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 76 ∗ { @ c o d e @ O v e r r i d e } 77 ∗ 78 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 79 ∗ < / f o n t > 80 ∗ 81 ∗ / 82 @ O v e r r i d e 83 p u b l i c f i n a l R e f e r e e F u s e r R T S _ O p e n h y p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n ne w ← ֓ f i n a l R e f e r e e F u s e r R T S _ O p e n h y p e r p o w e r s e t ( ) ; } 84 } 41 Source Co de: finalRefereeF userR TS_P o w erset.jav a 1 / ∗ 2 ∗ f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f f u s e r b a s e d on r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e F u s e r R T S } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l P o w e r s e t } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t # i n s t a n c e ( ) } i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t e x t e n d s R e f e r e e F u s e r R T S < f i n a l P o w e r s e t , 59 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t ← ֓ > { 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 67 ∗ t h e C l a s s o f < i > t h i s ) . 68 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 69 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 70 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 42 71 ∗ 72 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 73 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 74 ∗ 75 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 76 ∗ { @ c o d e @ O v e r r i d e } 77 ∗ 78 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 79 ∗ < / f o n t > 80 ∗ 81 ∗ / 82 @ O v e r r i d e 83 p u b l i c f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t i n s t a n c e ( ) { r e t u r n ne w ← ֓ f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t ( ) ; } 84 } 43 Source Co de: finalRefereeF userR TS_Sup erp ow erset.ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e F u s e r R T S _ S u p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f f u s e r b a s e d on r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e F u s e r R T S } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l S u p e r p o w e r s e t } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e F u s e r R T S _ S u p e r p o w e r s e t #i n s t a n c e ( ) } ← ֓ i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e F u s e r R T S _ S u p e r p o w e r s e t e x t e n d s R e f e r e e F u s e r R T S < ← ֓ f i n a l S u p e r p o w e r s e t , 59 f i n a l R e f e r e e F u s e r R T S _ S u p e r p o w e r s e t ← ֓ > { 60 61 62 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 63 / / p u b l i c p a r t 64 / / / / / / / / / / / / / / / 65 66 / ∗ ∗ 67 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 68 ∗ t h e C l a s s o f < i > t h i s ) . 44 69 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 70 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 71 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 72 ∗ 73 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 74 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 75 ∗ 76 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 77 ∗ { @ c o d e @ O v e r r i d e } 78 ∗ 79 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 80 ∗ < / f o n t > 81 ∗ 82 ∗ / 83 @ O v e r r i d e 84 p u b l i c f i n a l R e f e r e e F u s e r R T S _ S u p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n ne w ← ֓ f i n a l R e f e r e e F u s e r R T S _ S u p e r p o w e r s e t ( ) ; } 85 } 45 Source Co de: finalRefereeSampler_Closedhyperp o w erset. ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e S a m p l e r _ C l o s e d h y p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e 3 ∗ R e f e r e e T o o l b o x ; I m p l e m e n t s a m p l e d f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e S a m p l e r } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l C l o s e d h y p e r p o w e r s e t } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e S a m p l e r _ C l o s e d h y p e r p o w e r s e t #i n s t a n c e ← ֓ ( ) } i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e S a m p l e r _ C l o s e d h y p e r p o w e r s e t e x t e n d s R e f e r e e S a m p l e r < ← ֓ f i n a l C l o s e d h y p e r p o w e r s e t , 59 f i n a l R e f e r e e S a m p l e r _ C l o s e d h y p e r p o w e r s e t ← ֓ >{ 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 67 ∗ t h e C l a s s o f < i > t h i s ) . 68 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 46 69 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 70 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 71 ∗ 72 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 73 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 74 ∗ 75 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 76 ∗ { @ c o d e @ O v e r r i d e } 77 ∗ 78 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 79 ∗ < / f o n t > 80 ∗ 81 ∗ / 82 @ O v e r r i d e 83 p u b l i c f i n a l R e f e r e e S a m p l e r _ C l o s e d h y p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n n ew ← ֓ f i n a l R e f e r e e S a m p l e r _ C l o s e d h y p e r p o w e r s e t ( ) ; } 84 85 } 47 Source Co de: fina lR efereeSampler_F reeb o olean.ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e S a m p l e r _ F r e e b o o l e a n . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t s a m p l e d f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e S a m p l e r } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l F r e e b o o l e a n } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e S a m p l e r _ F r e e b o o l e a n #i n s t a n c e ( ) } i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e S a m p l e r _ F r e e b o o l e a n e x t e n d s R e f e r e e S a m p l e r < ← ֓ f i n a l F r e e b o o l e a n , 59 f i n a l R e f e r e e S a m p l e r _ F r e e b o o l e a n > ← ֓ { 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 67 ∗ t h e C l a s s o f < i > t h i s ) . 68 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 69 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 48 70 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 71 ∗ 72 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 73 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 74 ∗ 75 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 76 ∗ { @ c o d e @ O v e r r i d e } 77 ∗ 78 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 79 ∗ < / f o n t > 80 ∗ 81 ∗ / 82 @ O v e r r i d e 83 p u b l i c f i n a l R e f e r e e S a m p l e r _ F r e e b o o l e a n i n s t a n c e ( ) { r e t u r n ne w ← ֓ f i n a l R e f e r e e S a m p l e r _ F r e e b o o l e a n ( ) ; } 84 } 49 Source Co de: fina lR efereeSampler_Op e nh yp erp ow erset.ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e S a m p l e r _ O p e n h y p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e 3 ∗ R e f e r e e T o o l b o x ; I m p l e m e n t s a m p l e d f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e S a m p l e r } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l O p e n h y p e r p o w e r s e t } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e S a m p l e r _ O p e n h y p e r p o w e r s e t#i n s t a n c e ( ) ← ֓ } i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e S a m p l e r _ O p e n h y p e r p o w e r s e t e x t e n d s R e f e r e e S a m p l e r < ← ֓ f i n a l O p e n h y p e r p o w e r s e t , 59 f i n a l R e f e r e e S a m p l e r _ O p e n h y p e r p o w e r s e t ← ֓ >{ 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 67 ∗ t h e C l a s s o f < i > t h i s ) . 68 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 50 69 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 70 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 71 ∗ 72 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 73 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 74 ∗ 75 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 76 ∗ { @ c o d e @ O v e r r i d e } 77 ∗ 78 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 79 ∗ < / f o n t > 80 ∗ 81 ∗ / 82 @ O v e r r i d e 83 p u b l i c f i n a l R e f e r e e S a m p l e r _ O p e n h y p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n ne w ← ֓ f i n a l R e f e r e e S a m p l e r _ O p e n h y p e r p o w e r s e t ( ) ; } 84 85 } 51 Source Co de: finalRefereeSampler_P ow erset.ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e S a m p l e r _ P o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t s a m p l e d f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e S a m p l e r } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l P o w e r s e t } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e S a m p l e r _ P o w e r s e t #i n s t a n c e ( ) } i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e S a m p l e r _ P o w e r s e t e x t e n d s R e f e r e e S a m p l e r < f i n a l P o w e r s e t , 59 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t >{ 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 67 ∗ t h e C l a s s o f < i > t h i s ) . 68 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 69 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 70 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 71 ∗ 52 72 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 73 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 74 ∗ 75 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 76 ∗ { @ c o d e @ O v e r r i d e } 77 ∗ 78 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 79 ∗ < / f o n t > 80 ∗ 81 ∗ / 82 @ O v e r r i d e 83 p u b l i c f i n a l R e f e r e e S a m p l e r _ P o w e r s e t i n s t a n c e ( ) { r e t u r n n ew ← ֓ f i n a l R e f e r e e S a m p l e r _ P o w e r s e t ( ) ; } 84 85 } 53 Source Co de: finalRefereeSampler_Sup erp ow erset.ja v a 1 / ∗ 2 ∗ f i n a l R e f e r e e S a m p l e r _ S u p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t s a m p l e d f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A f i n a l i n s t a n c e o f { @ l i n k R e f e r e e S a m p l e r } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l S u p e r p o w e r s e t } . 31 ∗ An i n s t a n c i a t i o n m e t h o d { @ l i n k f i n a l R e f e r e e S a m p l e r _ S u p e r p o w e r s e t #i n s t a n c e ( ) } ← ֓ i s 32 ∗ i m p l e m e n t e d f o r t h i s n o n g e n e r i c c l a s s . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s f i n a l R e f e r e e S a m p l e r _ S u p e r p o w e r s e t e x t e n d s R e f e r e e S a m p l e r < ← ֓ f i n a l S u p e r p o w e r s e t , 59 f i n a l R e f e r e e S a m p l e r _ S u p e r p o w e r s e t ← ֓ >{ 60 61 62 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 63 / / p u b l i c p a r t 64 / / / / / / / / / / / / / / / 65 66 / ∗ ∗ 67 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 68 ∗ t h e C l a s s o f < i > t h i s ) . 54 69 ∗ N . B . { @ l i n k B a s i c B e l i e f A s s i g n m e n t # i n s t a n c e ( ) } c a n n o t b e d e f i n e d f o r g e n e r i c 70 ∗ c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e d e f i n e d w i t h 71 ∗ t h e no n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 72 ∗ 73 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 74 ∗ d e f i n i t i o n o f { @ l i n k B a s i c B e l i e f A s s i g n m e n t #i n s t a n c e ( ) } i s a s f o l l o w s : 75 ∗ 76 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 77 ∗ { @ c o d e @ O v e r r i d e } 78 ∗ 79 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 80 ∗ < / f o n t > 81 ∗ 82 ∗ / 83 @ O v e r r i d e 84 p u b l i c f i n a l R e f e r e e S a m p l e r _ S u p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n ne w ← ֓ f i n a l R e f e r e e S a m p l e r _ S u p e r p o w e r s e t ( ) ; } 85 86 } 55 Source Co de: fina lSup erp ow erset.ja v a 1 / ∗ 2 ∗ f i n a l S u p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n 3 ∗ o f s u p e r p o w e r s e t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ F i n a l i m p l e m e n t a t i o n o f c l a s s { @ l i n k S u p e r p o w e r s e t } . T h i s c l a s s i s n o t g e n e r i c ← ֓ , a n d 30 ∗ t h u s , a l l o w s a n d n e e d s i n s t a n t i a t i o n . Th e m e t h o d { @ l i n k f i n a l S u p e r p o w e r s e t # ← ֓ i n s t a n c e ( ) } 31 ∗ i s i m p l e m e n t e d . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c f i n a l c l a s s f i n a l S u p e r p o w e r s e t e x t e n d s S u p e r p o w e r s e t < f i n a l S u p e r p o w e r s e t > { 58 59 60 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 61 / / p u b l i c p a r t 62 / / / / / / / / / / / / / / / 63 64 / ∗ ∗ 65 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 66 ∗ t h e C l a s s o f < i > t h i s ) . 67 ∗ N . B . { @ l i n k L a t t i c e # i n s t a n c e ( ) } c a n n o t b e d e f i n e d 68 ∗ f o r g e n e r i c c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e 69 ∗ d e f i n e d w i t h t h e n o n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 56 70 ∗ 71 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 72 ∗ d e f i n i t i o n o f { @ l i n k L a t t i c e # i n s t a n c e ( ) } i s a s f o l l o w s : 73 ∗ 74 ∗ < f o n t c o l o r =" #0 04 48 8" > < c o d e > 75 ∗ { @ c o d e @ O v e r r i d e } 76 ∗ 77 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 78 ∗ < / f o n t > 79 ∗ 80 ∗ / 81 @ O v e r r i d e 82 p u b l i c f i n a l S u p e r p o w e r s e t i n s t a n c e ( ) { r e t u r n ne w f i n a l S u p e r p o w e r s e t ( ) ; } 83 } 57 Source Co de: F reeb o ol e an.ja v a 1 / ∗ 2 ∗ F r e e b o o l e a n . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f F r e e 3 ∗ B o o l e a n a l g e b r a . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ I m p l e m e n t a t i o n o f a F r e e B o o l e a n s t r u c t u r e b y m e a n s o f a n a r r a y o f { @ c o d e l o n g ← ֓ } . 30 ∗ S t r u c t u r a l m e t h o d s a r e r e d e f i n e d , { @ l i n k F r e e b o o l e a n # s i z e ( i n t ) } a n d 31 ∗ { @ l i n k F r e e b o o l e a n # s i z e ( R e f e r e e T o o l b o x . F r e e b o o l e a n ) } , 32 ∗ a n d t h e a t o m i c a r e d e f i n e d { @ l i n k F r e e b o o l e a n #a t o m i c ( i n t ) } . 33 ∗ The A N D a n d O R o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { @ c o d e & } a n d { @ c o d e ← ֓ | } 34 ∗ w o r k i n g o n { @ c o d e l o n g } . 35 ∗ < i > z e r o i s d e f i n e d b y z e r o i n g a l l b i t s . < i >o n e i s d e f i n e d b y s e t t i n g t o 36 ∗ 1 a l l a c t i v e b i t s ; t h e r i g h t b i t s o f t h e { @ c o d e l o n g } v e c t o r may b e i n a c t i v e , 37 ∗ d e p e n d i n g o n t h e s i z e o f t h e L a t t i c e . 38 ∗ The c o m p l e m e n t / c o c o m p l e m e n t o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { @ c o d e ~ ← ֓ } 39 ∗ w o r k i n g on { @ c o d e l o n g } ; e x c e e d i n g b i t s a r e m a s k e d by a A N D w i t h < i >o n e . 40 ∗ 41 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 42 ∗ 43 ∗ 44 ∗ 45 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 46 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 47 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 48 ∗ < B R > 49 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 50 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 51 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 52 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 53 ∗ < B R > 54 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 55 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 56 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 57 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 58 ∗ < B R > 59 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 60 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 61 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 62 ∗ < / t a b l e > < B R > 63 ∗ 64 ∗ / 65 p u b l i c c l a s s F r e e b o o l e a n < L e x t e n d s F r e e b o o l e a n < L > > e x t e n d s A r r a y B o o l e a n < L > 66 i m p l e m e n t s G e n e r a t e d L a t t i c e < L > { 67 68 58 69 p r o t e c t e d s t a t i c i n t s i z e M a x = 1 6 ; 70 71 p r o t e c t e d i n t s i z e F r a m e = − 1 ; / / u n d e f i n e d b y d e f a u l t 72 p r o t e c t e d i n t s i z e S e t = − 1; 73 74 75 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 76 / / p u b l i c p a r t 77 / / / / / / / / / / / / / / / 78 79 / ∗ ∗ 80 ∗ R e t u r n t h e i < S UP >t h < / i > a t o m i c p r o p o s i t i o n . 81 ∗ F o r c l a s s { @ l i n k F r e e b o o l e a n } , t h e < i >i < SUP >t h < /S U P > < / i > a t o m i c p r o p o s i t i o n 82 ∗ i s c o n s t i t u t e d b y a l l < i >j < SU P >t h < / i > b i t s t o r e d i n t h e 83 ∗ < i >l o n g a r r a y s u c h t h a t { @ l i t e r a l j & ( 1 < < i ) } i s n o n n u l . 84 ∗ < B R > < B R > 85 ∗ r e t u r n < i > n u l l i f i i s o u t o f b o u n d s . 86 ∗ / 87 p u b l i c L a t o m i c ( i n t i ) { 88 i f ( ( i > = s i z e F r a m e ) | | ( i < 0 ) ) { 89 r e t u r n n u l l ; 90 } 91 i n t j , i n d e x ; 92 s w i t c h ( i ) { 93 c a s e 0 : f o r ( i n d e x = 0 ; i n d e x < = s i z e _ m e m _ 1 ; i n d e x ++ ) 94 _ m e m o r y [ i n d e x ] = 0 x a a a a a a a a a a a a a a a a l ; b r e a k ; 95 c a s e 1 : f o r ( i n d e x = 0 ; i n d e x < = s i z e _ m e m _ 1 ; i n d e x ++ ) 96 _ m e m o r y [ i n d e x ] = 0 x c c c c c c c c c c c c c c c c l ; b r e a k ; 97 c a s e 2 : f o r ( i n d e x = 0 ; i n d e x < = s i z e _ m e m _ 1 ; i n d e x ++ ) 98 _ m e m o r y [ i n d e x ] = 0 x f 0 f 0 f 0 f 0 f 0 f 0 f 0 f 0 l ; b r e a k ; 99 c a s e 3 : f o r ( i n d e x = 0 ; i n d e x < = s i z e _ m e m _ 1 ; i n d e x ++ ) 100 _ m e m o r y [ i n d e x ] = 0 x f f 0 0 f f 0 0 f f 0 0 f f 0 0 l ; b r e a k ; 101 c a s e 4 : f o r ( i n d e x = 0 ; i n d e x < = s i z e _ m e m _ 1 ; i n d e x ++ ) 102 _ m e m o r y [ i n d e x ] = 0 x f f f f 0 0 0 0 f f f f 0 0 0 0 l ; b r e a k ; 103 c a s e 5 : f o r ( i n d e x = 0 ; i n d e x < = s i z e _ m e m _ 1 ; i n d e x ++ ) 104 _ m e m o r y [ i n d e x ] = 0 x f f f f f f f f 0 0 0 0 0 0 0 0 l ; b r e a k ; 105 d e f a u l t : j =1 < <( i − 6 ) ; 106 f o r ( i n d e x = 0 ; i n d e x < = s i z e _ m e m _ 1 ; i n d e x ++ ) { 107 i f ( ( i n d e x & j ) ! = 0 ) _ m e m o r y [ i n d e x ] = 0 x f f f f f f f f f f f f f f f f l ; 108 e l s e _ m e m o r y [ i n d e x ] = 0 x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 l ; 109 } 110 b r e a k ; 111 } 112 i f ( s i z e F r a m e < 6 ) _ m e m o r y [ 0 ] & = h i g h e s t _ l o n g _ o n e ; 113 r e t u r n ( L ) t h i s ; 114 } 115 116 / ∗ ∗ 117 ∗ S e t o r r e t u r n t h e s i z e o f < i > t h i s . 118 ∗ D i f f e n r e n t c a s e s a r e c o n s i d e r e d : 119 ∗ < b r > 120 ∗ < i >n e w S i z e <0 < / i > − − Th e s i z e o f < i >t h i s i s k e p t u n c h a n g e d , a n d t h i s s i z e 121 ∗ i s r e t u r n e d by t h e me t h o d . 122 ∗ 123 ∗ < i >n e w S i z e >= 0 − − I f < i >n e w S i z e i s a v a l i d n e w s i z e , t h e n t h e s i z e o f 124 ∗ < i > t h i s i s c h a n g e d t o < i >n e w S i z e , a n d t h i s s i z e i s r e t u r n e d by t h e ← ֓ m e t h o d . 125 ∗ < b r > 126 ∗ V a l i d n ew s i z e i s s u c h t h a t < i > 0 < = n e w S i z e< = s i z e M a x . B y d e f a u l t , 127 ∗ < i >{ @ l i n k F r e e b o o l e a n #s i z e M a x }=16 . 128 ∗ 129 ∗ F o r c l a s s { @ l i n k F r e e b o o l e a n } , n e w S i z e i s s t o r e d i n p r o t e c t e d v a r i a b l e 130 ∗ < i >s i z e F r a m e a n d i s e q u a l s t o t h e n u m b e r o f a t o m i c p r o p o s i t i o n s ( p o s s i b l y ← ֓ 0 ) . 131 ∗ Th e n u m b e r o f a c t i v a t e d b i t s s t o r e d i n t h e < i >l o n g a r r a y i s e q u a l t o < i >2 132 ∗ n e w S i z e < / s u p > . 133 ∗ < b r > 134 ∗ 135 ∗ N . B . 1 . By d e f a u l t , t h i s m e t h o d i s n o t i m p l e m e n t e d b y { @ l i n k L a t t i c e } d i r e c t l y ← ֓ , 136 ∗ b u t by i t s s u b c l a s s e s . 137 ∗ 138 ∗ N . B . 2 . T he s i z e i s n o t n e c e s s a r i l l y t h e c a r d i n a l o f t h e l a t t i c e , b u t ma y b e 139 ∗ i n s t e a d t h e n u m b e r o f a t o m i c p r o p o s i t i o n s o f t h e l a t t i c e . 59 140 ∗ 141 ∗ / 142 @ O v e r r i d e 143 p u b l i c i n t s i z e ( i n t n e w S i z e ) { // i f n e w S i z e i s p o s s i b l e , t h e n c h a n g e s i z e t o ← ֓ n e w S i z e 144 i f ( ( n e w S i z e >=0) & &( n e w S i z e < = s i z e M a x ) ) { 145 s i z e F r a m e = n e w S i z e ; 146 s i z e S e t =( 1 < < s i z e F r a m e ) ; 147 s i z e _ m e m _ 1 =( s i z e S e t − 1 ) / 6 4 ; 148 h i g h e s t _ l o n g _ o n e = s i z e S e t − 64 ∗ s i z e _ m e m _ 1 ; 149 h i g h e s t _ l o n g _ o n e = ( ( ( 1 L < <( h i g h e s t _ l o n g _ o n e − 1 ) ) − 1 )<<1) + 1 ; 150 _ m e m o r y = ne w l o n g [ s i z e _ m e m _ 1 + 1 ] ; 151 } 152 r e t u r n s i z e F r a m e ; 153 } 154 155 @ O v e r r i d e 156 p u b l i c L s i z e ( L i n p u t ) { 157 s i z e ( i n p u t . s i z e ( − 1 ) ) ; 158 r e t u r n ( L ) t h i s ; 159 } 160 161 } 60 Source Co de: GeneratedLattice.ja v a 1 / ∗ 2 ∗ G e n e r a t e d L a t t i c e . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r 3 ∗ g e n e r a t e d l a t t i c e . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ C o n t a i n s m e t h o d s f o r c l a s s e s i m p l e m e n t i n g L a t t i c e s t r u c t u r e s w i t h a t o m i c 30 ∗ e l e m e n t s , { @ l i n k #a t o m i c ( i n t ) } . A t o m i c s e l e m e n t s a r e g e n e r a t i n g e l e m e n t s w i c h ← ֓ a r e 31 ∗ a d d r e s s a b l e b y m e a n s o f a n i n d e x . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 i n t e r f a c e G e n e r a t e d L a t t i c e < L > e x t e n d s L a t t i c e < L > { 58 59 / ∗ ∗ 60 ∗ S e t < i > t h i s t o t h e a t o m i c p r o p o s i t i o n o f i n d e x < i >i . 61 ∗ I n d e x < i >i r a n g e s f r o m f i r s t v a l u e < i >0 . 62 ∗ < B R > 63 ∗ N . B . I t i s n e c e s s a r y t o c a l l { @ l i n k L a t t i c e # s i z e } o r 64 ∗ { @ l i n k L a t t i c e # s i z e ( j a v a . l a n g . O b j e c t ) } b e f o r e a n y f i r s t u s e o f t h i s m e t h o d . 65 ∗ 66 ∗ / 67 L a t o m i c ( i n t i ) ; 68 69 } 61 Source Co de: Lattice.ja v a 1 / ∗ 2 ∗ L a t t i c e . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r l a t t i c e . 3 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 4 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 5 ∗ 6 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 7 ∗ 8 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 9 ∗ 10 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 11 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 12 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 13 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 14 ∗ 15 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 16 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 17 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 18 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 19 ∗ 20 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 21 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / / w w w . g n u . o r g / l i c e n s e s / > . 22 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 23 ∗ / 24 25 p a c k a g e R e f e r e e T o o l b o x ; 26 27 / ∗ ∗ 28 ∗ C o n t a i n s t h e m i n i m a l m e t h o d s f o r a c l a s s i m p l e m e n t i n g a L a t t i c e s t r u c t u r e . 29 ∗ 30 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 31 ∗ 32 ∗ 33 ∗ 34 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 35 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 36 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 37 ∗ < B R > 38 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 39 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 40 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 41 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 42 ∗ < B R > 43 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 44 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 45 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 46 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 47 ∗ < B R > 48 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 49 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 50 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 51 ∗ < / t a b l e > < B R > 52 ∗ 53 ∗ / 54 p u b l i c i n t e r f a c e L a t t i c e < L > e x t e n d s C o m p a r a b l e < L > , C l o n e a b l e { 55 56 / ∗ ∗ 57 ∗ R e t u r n a r e p r e s e n t a t i o n o f t h e s t a t e o f < i > t h i s p r i n t e d a s 58 ∗ a S t r i n g . 59 ∗ 60 ∗ / 61 S t r i n g s t a t e ( ) ; 62 63 / ∗ ∗ 64 ∗ S e t o r r e t u r n t h e s i z e o f < i > t h i s . 65 ∗ D i f f e n r e n t c a s e s a r e c o n s i d e r e d : 66 ∗ 67 ∗ < i >n e w S i z e <0 < / i > − − Th e s i z e o f < i >t h i s i s k e p t u n c h a n g e d , a n d t h i s s i z e 68 ∗ i s r e t u r n e d b y t h e m e t h o d . 69 ∗ 70 ∗ < i >n e w S i z e > =0 < / i > − − I f < i >n e w S i z e i s a v a l i d n e w s i z e , t h e n t h e s i z e o f 71 ∗ < i > t h i s i s c h a n g e d t o < i >n e w S i z e , a n d t h i s s i z e i s r e t u r n e d b y t h e ← ֓ 62 m e t h o d . 72 ∗ 73 ∗ N . B . 1 . By d e f a u l t , t h i s m e t h o d i s n o t i m p l e m e n t e d b y { @ l i n k L a t t i c e } d i r e c t l y ← ֓ , 74 ∗ b u t b y i t s s u b c l a s s e s . 75 ∗ 76 ∗ N . B . 2 . The s i z e i s n o t n e c e s s a r i l l y t h e c a r d i n a l o f t h e l a t t i c e , b u t may b e 77 ∗ i n s t e a d t h e nu m b e r o f a t o m i c p r o p o s i t i o n s o f t h e l a t t i c e . 78 ∗ 79 ∗ / 80 i n t s i z e ( i n t n e w S i z e ) ; 81 82 / ∗ ∗ 83 ∗ R e s i z e < i > t h i s a t t h e sa m e s i z e t h a n < i >i n p u t . 84 ∗ 85 ∗ / 86 L s i z e ( L i n p u t ) ; 87 88 / ∗ ∗ 89 ∗ Do an e x a c t c o p y o f i n p u t i n t o < i > t h i s . 90 ∗ 91 ∗ / 92 L d u p l i c a t e ( L i n p u t ) ; 93 94 / ∗ ∗ 95 ∗ C r e a t e an d r e t u r n a n i n s t a n c e o f < i > t h i s ( i . e . w o r k l i k e a ne w o n 96 ∗ t h e C l a s s o f < i > t h i s ) . N . B . { @ l i n k L a t t i c e #i n s t a n c e ( ) } c a n n o t b e d e f i n e d 97 ∗ f o r g e n e r i c c l a s s e s b u t i s n e c e s s a r y f o r s o m e m e t h o d s . < u > I t h a s t o b e 98 ∗ d e f i n e d w i t h t h e n o n g e n e r i c ( t y p i c a l l y f i n a l ) s u b − c l a s s e s < /u > . 99 ∗ 100 ∗ F o r a g i v e n n o n g e n e r i c s u b − c l a s s < i >m y N o n G e n e r i c S u b c l a s s , a t y p i c a l 101 ∗ d e f i n i t i o n o f { @ l i n k L a t t i c e # i n s t a n c e ( ) } i s a s f o l l o w s : 102 ∗ < b r > 103 ∗ < f o n t c o l o r = "# 00 44 88" > < c o d e > 104 ∗ { @ c o d e @ O v e r r i d e } 105 ∗ 106 ∗ p u b l i c m y N o n G e n e r i c S u b c l a s s i n s t a n c e ( ) { r e t u r n ne w m y N o n G e n e r i c S u b c l a s s ( ) ; } 107 ∗ < / f o n t > 108 ∗ 109 ∗ / 110 L i n s t a n c e ( ) ; 111 112 / ∗ ∗ 113 ∗ C r e a t e a n d r e t u r n a n i n s t a n c e o f < i > t h i s a n d r e s i z e i t a t t h e sa m e s i z e ← ֓ t h a n < i > t h i s . 114 ∗ T h i s m e t h o d i s a c t u a l l y d e f i n e d a n d ma ke a c a l l o f { @ l i n k L a t t i c e # i n s t a n c e ( ) } . 115 ∗ I t d o e s n o t n e e d t o b e d e f i n e d w i t h t h e n o n g e n e r i c s u b − c l a s s e s . 116 ∗ 117 ∗ @ s e e L a t t i c e # i n s t a n c e ( ) 118 ∗ 119 ∗ / 120 L i n s t a n c e N s i z e ( ) ; 121 122 / ∗ ∗ 123 ∗ C r e a t e a c l o n e o f < i > t h i s . 124 ∗ 125 ∗ / 126 L c l o n e ( ) ; 127 128 / ∗ ∗ 129 ∗ S e t < i > t h i s t o z e r o , t h e n e u t r a l e l e m e n t f o r 130 ∗ { @ l i n k L a t t i c e #o r ( j a v a . l a n g . O b j e c t , j a v a . l a n g . O b j e c t ) } . 131 ∗ N . B . I t i s n e c e s s a r y t o c a l l { @ l i n k L a t t i c e # s i z e } o r 132 ∗ { @ l i n k L a t t i c e # s i z e ( j a v a . l a n g . O b j e c t ) } b e f o r e a n y f i r s t u s e o f t h i s 133 ∗ m e t h o d . 134 ∗ 135 ∗ / 136 L z e r o ( ) ; 137 138 / ∗ ∗ 139 ∗ S e t < i > t h i s t o o n e , t h e n e u t r a l e l e m e n t f o r 140 ∗ { @ l i n k L a t t i c e # a n d ( j a v a . l a n g . O b j e c t , j a v a . l a n g . O b j e c t ) } . 141 ∗ N . B . I t i s n e c e s s a r y t o c a l l { @ l i n k L a t t i c e # s i z e } o r 142 ∗ { @ l i n k L a t t i c e # s i z e ( j a v a . l a n g . O b j e c t ) } b e f o r e a n y f i r s t u s e o f t h i s m e t h o d . 63 143 ∗ 144 ∗ / 145 L o n e ( ) ; 146 147 / ∗ ∗ 148 ∗ A n s w e r < i >t r u e i f t h e p r o p o s i t i o n s t o r e d w i t h i n < i > t h i s c o n t a i n s t h e 149 ∗ p r o p o s i t i o n c o n t a i n e d w i t h i n a P r o p o s i t i o n . An s w e r < i > f a l s e o t h e r w i s e ← ֓ . 150 ∗ 151 ∗ / 152 b o o l e a n c o n t a i n s ( L a P r o p o s i t i o n ) ; 153 154 / ∗ ∗ 155 ∗ A n s w e r < i >t r u e i f t h e p r o p o s i t i o n s t o r e d w i t h i n < i > t h i s i n t e r s e c t s t h e 156 ∗ p r o p o s i t i o n c o n t a i n e d w i t h i n a P r o p o s i t i o n ( < i > i . e . < / i > t h e i n t e r s e c t i o n 157 ∗ o f b o t h p r o p o s i t i o n s i s n o t < i > z e r o ) . A n s w e r < i > f a l s e o t h e r w i s e . 158 ∗ 159 ∗ / 160 b o o l e a n i n t e r s e c t s ( L a P r o p o s i t i o n ) ; 161 162 / ∗ ∗ 163 ∗ C o m p u t e t h e A N D o f < i > l e f t a n d < i > r i g h t a n d s t o r e t h e r e s u l t w i t h i n < i > ← ֓ t h i s . 164 ∗ 165 ∗ / 166 L a n d ( L l e f t , L r i g h t ) ; 167 168 / ∗ ∗ 169 ∗ C o m p u t e t h e O R o f < i > l e f t a n d < i >r i g h t a n d s t o r e t h e r e s u l t w i t h i n < i > ← ֓ t h i s . 170 ∗ 171 ∗ / 172 L o r ( L l e f t , L r i g h t ) ; 173 174 / ∗ ∗ 175 ∗ C o m p a r e < i > t h i s t o < i >a P r o p o s i t i o n a n d a n s w e r n e g a t i v e i n t e g e r , z e r o , 176 ∗ p o s i t i v e i n t e g e r a s < i >t h i s i s l e s s t h a n , e q u a l t o , o r g r e a t e r t h a n 177 ∗ < i >a P r o p o s i t i o n . 178 ∗ T h i s c o m p a r i s o n i s r e l a t e d t o a t o t a l o r d e r i n g o f t h e p r o p o s i t i o n ; < em > i t i s ← ֓ n o t 179 ∗ r e l a t e d t o t h e p a r t i a l o r d e r i m p l i e d b y t h e l o g i c a l o p e r a t o r s A N D a n d O R . < / em > 180 ∗ 181 ∗ / 182 i n t c o m p a r e T o ( L a P r o p o s i t i o n ) ; 183 } 64 Source Co de: LatticeCommon.ja v a 1 / ∗ 2 ∗ L a t t i c e C o m m o n . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; B a s i c a l i m p l e m e n t a t i o n 3 ∗ o f l a t t i c e . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ B a s i c a l i m p l e m e n t a t i o n o f t h e L a t i c e s t r u c t u r e 30 ∗ 31 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 32 ∗ 33 ∗ 34 ∗ 35 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 36 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 37 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 38 ∗ < B R > 39 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 40 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 41 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 42 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 43 ∗ < B R > 44 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 45 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 46 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 47 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 48 ∗ < B R > 49 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 50 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 51 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 52 ∗ < / t a b l e > < B R > 53 ∗ 54 ∗ / 55 p u b l i c c l a s s L a t t i c e C o m m o n < L e x t e n d s L a t t i c e C o m m o n < L > > 56 i m p l e m e n t s L a t t i c e < L > { 57 58 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 59 / / p u b l i c p a r t 60 / / / / / / / / / / / / / / / 61 62 / ∗ ∗ 63 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d p r o d u c e s 64 ∗ t h e S t r i n g { @ c o d e " U N D E F I N E D " } . 65 ∗ < B R > < B R > 66 ∗ < b >D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 67 ∗ { @ i n h e r i t D o c } 68 ∗ / 69 p u b l i c S t r i n g s t a t e ( ) { 70 r e t u r n " U N D E F I N E D " ; 71 } 65 72 73 / ∗ ∗ 74 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 75 ∗ a n e r r o r r e p o r t an d a c o d e e x i t . 76 ∗ < B R > < B R > 77 ∗ < b >D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 78 ∗ { @ i n h e r i t D o c } 79 ∗ / 80 p u b l i c L z e r o ( ) { 81 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 82 " . z e r o ( ) i s n o t i m p l e m e n t e d ! " ) ; 83 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 84 S y s t e m . e x i t ( 0 ) ; 85 r e t u r n n u l l ; 86 } 87 88 / ∗ ∗ 89 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 90 ∗ a n e r r o r r e p o r t an d a c o d e e x i t . 91 ∗ < B R > < B R > 92 ∗ < b >D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 93 ∗ { @ i n h e r i t D o c } 94 ∗ / 95 p u b l i c L o n e ( ) { 96 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 97 " . o n e ( ) i s n o t i m p l e m e n t e d ! " ) ; 98 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 99 S y s t e m . e x i t ( 0 ) ; 100 r e t u r n n u l l ; 101 } 102 103 / ∗ ∗ 104 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 105 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 106 ∗ < B R > < B R > 107 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 108 ∗ { @ i n h e r i t D o c } 109 ∗ / 110 p u b l i c L a n d ( L l e f t , L r i g h t ) { 111 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 112 " . a n d ( L , L ) i s n o t i m p l e m e n t e d ! " ) ; 113 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 114 S y s t e m . e x i t ( 0 ) ; 115 r e t u r n n u l l ; 116 } 117 118 / ∗ ∗ 119 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 120 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 121 ∗ < B R > < B R > 122 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 123 ∗ { @ i n h e r i t D o c } 124 ∗ / 125 p u b l i c L o r ( L l e f t , L r i g h t ) { 126 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 127 " . o r ( L , L ) i s n o t i m p l e m e n t e d ! " ) ; 128 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 129 S y s t e m . e x i t ( 0 ) ; 130 r e t u r n n u l l ; 131 } 132 133 / ∗ ∗ 134 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 135 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 136 ∗ < B R > < B R > 137 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 138 ∗ { @ i n h e r i t D o c } 139 ∗ / 140 p u b l i c b o o l e a n i n t e r s e c t s ( L a P r o p o s i t i o n ) { 141 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 66 142 " . i n t e r s e c t s ( L ) i s n o t i m p l e m e n t e d ! " ) ; 143 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 144 S y s t e m . e x i t ( 0 ) ; 145 r e t u r n f a l s e ; 146 } 147 148 / ∗ ∗ 149 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 150 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 151 ∗ < B R > < B R > 152 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 153 ∗ { @ i n h e r i t D o c } 154 ∗ / 155 p u b l i c b o o l e a n c o n t a i n s ( L a P r o p o s i t i o n ) { 156 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 157 " . c o n t a i n s ( L ) i s n o t i m p l e m e n t e d ! " ) ; 158 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 159 S y s t e m . e x i t ( 0 ) ; 160 r e t u r n t r u e ; 161 } 162 163 / ∗ ∗ 164 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 165 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 166 ∗ < B R > < B R > 167 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 168 ∗ { @ i n h e r i t D o c } 169 ∗ / 170 p u b l i c i n t c o m p a r e T o ( L a P r o p o s i t i o n ) { 171 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 172 " . c o m p a r e T o ( L ) i s n o t i m p l e m e n t e d ! " ) ; 173 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 174 S y s t e m . e x i t ( 0 ) ; 175 r e t u r n 0 ; 176 } 177 178 / ∗ ∗ 179 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 180 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 181 ∗ < B R > < B R > 182 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 183 ∗ { @ i n h e r i t D o c } 184 ∗ / 185 p u b l i c L s i z e ( L i n p u t ) { 186 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 187 " . s i z e ( L ) i s n o t i m p l e m e n t e d ! " ) ; 188 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 189 S y s t e m . e x i t ( 0 ) ; 190 r e t u r n n u l l ; 191 } 192 193 / ∗ ∗ 194 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 195 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 196 ∗ < B R > < B R > 197 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 198 ∗ { @ i n h e r i t D o c } 199 ∗ / 200 p u b l i c i n t s i z e ( i n t n e w S i z e ) { 201 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 202 " . s i z e ( i n t ) i s n o t i m p l e m e n t e d ! " ) ; 203 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 204 S y s t e m . e x i t ( 0 ) ; 205 r e t u r n − 1 ; 206 } 207 208 / ∗ ∗ 209 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 210 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 67 211 ∗ < B R > < B R > 212 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 213 ∗ { @ i n h e r i t D o c } 214 ∗ / 215 p u b l i c L d u p l i c a t e ( L i n p u t ) { 216 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 217 " . d u p l i c a t e ( L ) i s n o t i m p l e m e n t e d ! " ) ; 218 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 219 S y s t e m . e x i t ( 0 ) ; 220 r e t u r n n u l l ; 221 } 222 223 / ∗ ∗ 224 ∗ T h i s m e t h o d i s n o t d e f i n e d f o r c l a s s { @ l i n k L a t t i c e C o m m o n } a n d g e n e r a t e s 225 ∗ a n e r r o r r e p o r t a n d a c o d e e x i t . 226 ∗ < B R > < B R > 227 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k L a t t i c e } : < / b > < B R > 228 ∗ { @ i n h e r i t D o c } 229 ∗ / 230 p u b l i c L i n s t a n c e ( ) { 231 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 232 " . i n s t a n c e ( ) i s n o t i m p l e m e n t e d ! " ) ; 233 S y s t e m . e r r . p r i n t l n ( " P l e a s e i m p l e m e n t i n s t a n c e ( ) i n y o u r c l a s s w i t h ← ֓ @ O v e r r i d e " ) ; 234 S y s t e m . e x i t ( 0 ) ; 235 r e t u r n n u l l ; 236 } 237 238 p u b l i c L i n s t a n c e N s i z e ( ) { / / c r e a t e a n i n s t a n c e w i t h t h e sa m e s i z e 239 r e t u r n i n s t a n c e ( ) . s i z e ( ( L ) t h i s ) ; 240 } 241 242 @ O v e r r i d e 243 p u b l i c L c l o n e ( ) { 244 r e t u r n i n s t a n c e ( ) . d u p l i c a t e ( ( L ) t h i s ) ; 245 } 246 247 } 68 Source Co de: minAssi gnment.ja v a 1 / ∗ 2 ∗ m i n A s s i g n m e n t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r 3 ∗ m i n i m a l i m p l e m e n t a t i o n o f B a s i c B e l i e f A s s i g n m e n t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ C o n t a i n s t h e m i n i m a l d e c l a r a t i o n f o r c l a s s e s m a n a g i n g b e l i e f a s s i g n m e n t s . 32 ∗ T h i s i n t e r f a c e i s i m p l e m e n t e d b y a l l t h e s e c l a s s e s . 33 ∗ 34 ∗ @ s e e B a s i c B e l i e f A s s i g n m e n t 35 ∗ @ s e e R e f e r e e F u n c t i o n D e f a u l t 36 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 37 ∗ 38 ∗ 39 ∗ 40 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 41 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 42 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 43 ∗ < B R > 44 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 45 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 46 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 47 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 48 ∗ < B R > 49 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 50 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 51 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 52 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 53 ∗ < B R > 54 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 55 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 56 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 57 ∗ < / t a b l e > < B R > 58 ∗ 59 ∗ / 60 p u b l i c i n t e r f a c e m i n A s s i g n m e n t < P r o p e x t e n d s L a t t i c e < P r o p > > { 61 62 / ∗ ∗ 63 ∗ C r e a t e an a r r a y o f t h e a s s i g n m e n t s s t o r e d w i t h i n t h e c l a s s . T h e s e a s s i g n m e n t s ← ֓ n o t 64 ∗ n e c e s s a r y sum t o 1 . N o t i c e t h a t t h e a s s i g n m e n t s s h o u l d b e p o s i t i v e l y v a l u e d 65 ∗ ( f o c a l e l e m e n t s ) , a l t h o u g h < i > t h i s i s n o t a s t r i c t r e q u i r e m e n t . 66 ∗ 67 ∗ / 68 A r r a y L i s t < A s s i g n m e n t < P r o p > > t o A r r a y ( ) ; 69 70 / ∗ ∗ 69 71 ∗ G e t t h e b a s i c b e l i e f a s s i g n e d t o < i > a P r o p o s i t i o n . Ma y b e z e r o . 72 ∗ 73 ∗ / 74 d o u b l e m ( P r o p a P r o p o s i t i o n ) ; 75 76 / ∗ ∗ 77 ∗ G e t t h e b e l i e f o f < i > a P r o p o s i t i o n . A l t h o u g h n o t r e q u i r e d , i t i s a s s u m e d ← ֓ t h a t 78 ∗ t h e a s s i g n m e n t s sum t o 1 . 79 ∗ 80 ∗ / 81 d o u b l e B e l ( P r o p a P r o p o s i t i o n ) ; 82 83 / ∗ ∗ 84 ∗ G e t t h e p l a u s i b i l i t y o f < i > a P r o p o s i t i o n . A l t h o u g h n o t r e q u i r e d , i t i s ← ֓ a s s u m e d t h a t 85 ∗ t h e a s s i g n m e n t s sum t o 1 . 86 ∗ 87 ∗ / 88 d o u b l e P l ( P r o p a P r o p o s i t i o n ) ; 89 90 91 / ∗ ∗ 92 ∗ S e a r c h i f t h e r e i s a n a s s i g n m e n t s t o r e d w i t h i n t h e c l a s s , a n d w h i c h a t t r i b u t e 93 ∗ i s e q u a l t o t h e a t t r i b u t e o f a n A s s i g n m e n t . 94 ∗ R e t u r n t h e f o u n d a s s i g n m e n t , i f t h e r e i s o n e . O t h e w i s e , r e t u r n < i > n u l l . 95 ∗ 96 ∗ / 97 p u b l i c A s s i g n m e n t < P r o p > f i n d P r o p o s i t i o n ( A s s i g n m e n t < P r o p > a n A s s i g n m e n t ) ; 98 99 / ∗ ∗ 100 ∗ S e a r c h i f t h e r e i s a n a s s i g n m e n t s t o r e d w i t h i n t h e c l a s s , a n d w h i c h a t t r i b u t e 101 ∗ i s e q u a l t o t h e p r o p o s i t i o n < i > a P r o p o s i t i o n . 102 ∗ R e t u r n t h e f o u n d a s s i g n m e n t , i f t h e r e i s o n e . O t h e w i s e , r e t u r n < i > n u l l . 103 ∗ 104 ∗ / 105 p u b l i c A s s i g n m e n t < P r o p > f i n d P r o p o s i t i o n ( P r o p a P r o p o s i t i o n ) ; 106 107 } 70 Source Co de: Openhyperp o w erset. ja v a 1 / ∗ 2 ∗ O p e n h y p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n 3 ∗ o f o p e n h y p e r p o w e r s e t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ I m p l e m e n t a t i o n o f a n o p e n h y p e r p o w e r s e t s t r u c t u r e . A n o p e n h y p e r p o w e r s e t i s a n 30 ∗ h y p e r p o w e r s e t d e f i n e d on t h e b a s i s o f a f r e e b o o l e a n a l g e b r a : i t i s g e n e r a t e d 31 ∗ f r o m t h e a t o m i c p r o p o s i t i o n s o f t h e f r e e b o o l e a n a l g e b r a b u t w i t h o u t t h e u s e o f 32 ∗ t h e c o m p l e m e n t o p e r a t o r o f t h e f r e e b o o l e a n a l g e b r a . 33 ∗ < B R > < B R > 34 ∗ The o p e n h y p e r p o w e r s e t i m p l i e s a n o p e n w o r l d h y p o t h e s i s , t h a t i s : 35 ∗ < B R > < B R > 36 ∗ < i > < b > O R 0 = < i < s i z e F r a m e a t o m i c ( i ) ! = o n e 37 ∗ < B R > < B R > 38 ∗ A l t h o u g h g e n e r a t e d w i t h o u t t h e c o m p l e m e n t o f t h e f r e e B o o l e a n a l g e b r a , t h e o p e n 39 ∗ h y p e r p o w e r s e t a c t u a l l y h a s p r o p e r c o m p l e m e n t a n d c o c o m p l e m e n t o p e r a t o r s . 40 ∗ The c o m p l e m e n t a n d c o c o m p l e m e n t a r e d i s t i n c t o p e r a t o r s f o r t h e o p e n ← ֓ h y p e r p o w e r s e t . 41 ∗ 42 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 43 ∗ 44 ∗ 45 ∗ 46 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 47 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 48 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 49 ∗ < B R > 50 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 51 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 52 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 53 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 54 ∗ < B R > 55 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 56 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 57 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 58 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 59 ∗ < B R > 60 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 61 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 62 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 63 ∗ < / t a b l e > < B R > 64 ∗ 65 ∗ / 66 p u b l i c c l a s s O p e n h y p e r p o w e r s e t < L e x t e n d s O p e n h y p e r p o w e r s e t < L > > e x t e n d s F r e e b o o l e a n ← ֓ < L > { 67 p r o t e c t e d L t h e Z e r o = n u l l ; 68 p r o t e c t e d L t h e O n e = n u l l ; 69 71 70 / ∗ ∗ 71 ∗ C o m p u t e t h e < b > c o m p l e m e n t o f < i >a P r o p o s i t i o n a n d s t o r e t h e r e s u l t 72 ∗ w i t h i n t h i s . 73 ∗ Th e c o m p l e m e n t o p e r a t o r f o r t h e o p e n h y p e r p o w e r s e t i s d e f i n e d b y : 74 ∗ < B R > < B R > 75 ∗ < i > c o m p l e m e n t ( z e r o ) = o n e 76 ∗ < B R > 77 ∗ < i > c o m p l e m e n t (X ) = z e r o i f < i > X ! = z e r o 78 ∗ 79 ∗ / 80 @ O v e r r i d e 81 p u b l i c L c o m p l e m e n t ( L a P r o p o s i t i o n ) { 82 i f ( t h e Z e r o = = n u l l ) { 83 t h e Z e r o = i n s t a n c e N s i z e ( ) . z e r o ( ) ; 84 t h e O n e = i n s t a n c e N s i z e ( ) . o n e ( ) ; 85 } 86 i f ( a P r o p o s i t i o n . c o m p a r e T o ( t h e Z e r o ) ==0) o n e ( ) ; 87 e l s e z e r o ( ) ; 88 r e t u r n ( L ) t h i s ; 89 } 90 91 / ∗ ∗ 92 ∗ C o m p u t e t h e < b > c o m p l e m e n t o f < i > t h i s a n d s t o r e t h e r e s u l t w i t h i n 93 ∗ < i > t h i s . 94 ∗ Th e c o m p l e m e n t o p e r a t o r f o r t h e o p e n h y p e r p o w e r s e t i s d e f i n e d b y : 95 ∗ < B R > < B R > 96 ∗ < i > c o m p l e m e n t ( z e r o ) = o n e 97 ∗ < B R > 98 ∗ < i > c o m p l e m e n t (X ) = z e r o i f < i > X ! = z e r o 99 ∗ 100 ∗ / 101 @ O v e r r i d e 102 p u b l i c L c o m p l e m e n t ( ) { 103 i f ( t h e Z e r o = = n u l l ) { 104 t h e Z e r o = i n s t a n c e N s i z e ( ) . z e r o ( ) ; 105 t h e O n e = i n s t a n c e N s i z e ( ) . o n e ( ) ; 106 } 107 i f ( c o m p a r e T o ( t h e Z e r o ) ==0) o n e ( ) ; 108 e l s e z e r o ( ) ; 109 r e t u r n ( L ) t h i s ; 110 } 111 112 / ∗ ∗ 113 ∗ Co m p u t e t h e c o c o m p l e m e n t o f < i > a P r o p o s i t i o n a n d s t o r e t h e r e s u l t 114 ∗ w i t h i n < i > t h i s . 115 ∗ T he c o c o m p l e m e n t o p e r a t o r f o r t h e o p e n h y p e r p o w e r s e t i s d e f i n e d b y : 116 ∗ < B R > < B R > 117 ∗ < i > c o c o m p l e m e n t ( o n e ) = z e r o 118 ∗ < B R > 119 ∗ < i > c o c o m p l e m e n t ( X ) = o n e i f < i > X ! = o n e < / i > 120 ∗ 121 ∗ / 122 @ O v e r r i d e 123 p u b l i c L c o c o m p l e m e n t ( L a P r o p o s i t i o n ) { 124 i f ( t h e Z e r o = = n u l l ) { 125 t h e Z e r o = i n s t a n c e N s i z e ( ) . z e r o ( ) ; 126 t h e O n e = i n s t a n c e N s i z e ( ) . o n e ( ) ; 127 } 128 i f ( a P r o p o s i t i o n . c o m p a r e T o ( t h e O n e ) ==0) z e r o ( ) ; 129 e l s e o n e ( ) ; 130 r e t u r n ( L ) t h i s ; 131 } 132 133 / ∗ ∗ 134 ∗ Co m p u t e t h e c o c o m p l e m e n t o f < i > t h i s a n d s t o r e t h e r e s u l t 135 ∗ w i t h i n < i > t h i s . 136 ∗ T he c o c o m p l e m e n t o p e r a t o r f o r t h e o p e n h y p e r p o w e r s e t i s d e f i n e d b y : 137 ∗ < B R > < B R > 138 ∗ < i > c o c o m p l e m e n t ( o n e ) = z e r o 139 ∗ < B R > 140 ∗ < i > c o c o m p l e m e n t ( X ) = o n e i f < i > X ! = o n e < / i > 141 ∗ 142 ∗ / 143 @ O v e r r i d e 72 144 p u b l i c L c o c o m p l e m e n t ( ) { 145 i f ( t h e Z e r o = = n u l l ) { 146 t h e Z e r o = i n s t a n c e N s i z e ( ) . z e r o ( ) ; 147 t h e O n e = i n s t a n c e N s i z e ( ) . o n e ( ) ; 148 } 149 i f ( c o m p a r e T o ( t h e O n e ) ==0) z e r o ( ) ; 150 e l s e o n e ( ) ; 151 r e t u r n ( L ) t h i s ; 152 } 153 154 } 73 Source Co de: P o w erset.jav a 1 / ∗ 2 ∗ P o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f p o w e r s e t . 3 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 4 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 5 ∗ 6 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 7 ∗ 8 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 9 ∗ 10 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 11 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 12 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 13 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 14 ∗ 15 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 16 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 17 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 18 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 19 ∗ 20 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 21 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 22 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 23 ∗ / 24 25 p a c k a g e R e f e r e e T o o l b o x ; 26 27 / ∗ ∗ 28 ∗ I m p l e m e n t a t i o n o f a P o w e r s e t s t r u c t u r e b y m e a n s o f a n a r r a y o f { @ c o d e l o n g } . 29 ∗ S t r u c t u r a l m e t h o d s a r e r e d e f i n e d , { @ l i n k F r e e b o o l e a n # s i z e ( i n t ) } a n d 30 ∗ { @ l i n k F r e e b o o l e a n # s i z e ( R e f e r e e T o o l b o x . F r e e b o o l e a n ) } , 31 ∗ a n d t h e a t o m i c a r e d e f i n e d { @ l i n k F r e e b o o l e a n #a t o m i c ( i n t ) } . 32 ∗ The A N D a n d O R o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { @ c o d e & } a n d { @ c o d e ← ֓ | } 33 ∗ w o r k i n g o n { @ c o d e l o n g } . 34 ∗ < i > z e r o i s d e f i n e d b y z e r o i n g a l l b i t s . < i >o n e i s d e f i n e d b y s e t t i n g t o 35 ∗ 1 a l l a c t i v e b i t s ; t h e r i g h t b i t s o f t h e { @ c o d e l o n g } v e c t o r may b e i n a c t i v e , 36 ∗ d e p e n d i n g o n t h e s i z e o f t h e L a t t i c e . 37 ∗ The c o m p l e m e n t / c o c o m p l e m e n t o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { @ c o d e ~ ← ֓ } 38 ∗ w o r k i n g on { @ c o d e l o n g } ; e x c e e d i n g b i t s a r e m a s k e d by a A N D w i t h < i >o n e . 39 ∗ 40 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 41 ∗ 42 ∗ 43 ∗ 44 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 45 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 46 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 47 ∗ < B R > 48 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 49 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 50 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 51 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 52 ∗ < B R > 53 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 54 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 55 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 56 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 57 ∗ < B R > 58 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 59 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 60 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 61 ∗ < / t a b l e > < B R > 62 ∗ 63 ∗ / 64 p u b l i c c l a s s P o w e r s e t < L e x t e n d s P o w e r s e t < L > > e x t e n d s A r r a y B o o l e a n < L > 65 i m p l e m e n t s G e n e r a t e d L a t t i c e < L > { 66 67 p r o t e c t e d s t a t i c i n t s i z e M a x =1 << 16; 68 69 p r o t e c t e d i n t s i z e F r a m e = − 1 ; / / F r a m e o f d i s c e r n m m e n t i s u n d e f i n e d b y d e f a u l t 74 70 71 72 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 73 / / p u b l i c p a r t 74 / / / / / / / / / / / / / / / 75 76 / ∗ ∗ 77 ∗ R e t u r n t h e i < S UP >t h < / i > a t o m i c p r o p o s i t i o n . 78 ∗ F o r c l a s s { @ l i n k P o w e r s e t } , t h e < i > i < SU P >t h < / SU P > < / i > a t o m i c p r o p o s i t i o n i s 79 ∗ c o n s t i t u t e d b y t h e < i >i < SU P >t h < /S U P > < / i > b i t s t o r e d i n t h e 80 ∗ < i >l o n g a r r a y . 81 ∗ < B R > < B R > 82 ∗ r e t u r n < i > n u l l i f i i s o u t o f b o u n d s . 83 ∗ / 84 p u b l i c L a t o m i c ( i n t i ) { 85 i f ( ( i > = s i z e F r a m e ) | | ( i < 0 ) ) { 86 r e t u r n n u l l ; 87 } 88 z e r o ( ) ; 89 i n t o f f s e t = i % 6 4 ; 90 i n t i n d e x = i / 6 4 ; 91 _ m e m o r y [ i n d e x ] = ( 1 l < < o f f s e t ) ; 92 r e t u r n ( L ) t h i s ; 93 } 94 95 / ∗ ∗ 96 ∗ S e t o r r e t u r n t h e s i z e o f < i > t h i s . 97 ∗ D i f f e n r e n t c a s e s a r e c o n s i d e r e d : 98 ∗ 99 ∗ < i >n e w S i z e <0 < / i > − − Th e s i z e o f < i >t h i s i s k e p t u n c h a n g e d , a n d t h i s s i z e 100 ∗ i s r e t u r n e d by t h e me t h o d . 101 ∗ 102 ∗ < i >n e w S i z e >= 0 − − I f < i >n e w S i z e i s a v a l i d n e w s i z e , t h e n t h e s i z e o f 103 ∗ < i > t h i s i s c h a n g e d t o < i >n e w S i z e , a n d t h i s s i z e i s r e t u r n e d by t h e ← ֓ m e t h o d . 104 ∗ < b r > 105 ∗ V a l i d n ew s i z e i s s u c h t h a t < i > 1 < = n e w S i z e< = s i z e M a x . B y d e f a u l t , 106 ∗ < i >{ @ l i n k P o w e r s e t# s i z e M a x }=1 << 16 . 107 ∗ 108 ∗ F o r c l a s s { @ l i n k P o w e r s e t } , < i >n e w S i z e i s s t o r e d i n p r o t e c t e d v a r i a b l e 109 ∗ < i >s i z e F r a m e a n d i s e q u a l s t o t h e n u m b e r < e m>( h a s t o b e >1 ) o f ← ֓ a c t i v a t e d 110 ∗ b i t s s t o r e d i n t h e < i >l o n g a r r a y . 111 ∗ M o r e o v e r , e a c h a c t i v a t e d b i t c o n s t i t u t e a n a t o m i c p r o p o s i t i o n . 112 ∗ < b r > 113 ∗ 114 ∗ N . B . 1 . By d e f a u l t , t h i s m e t h o d i s n o t i m p l e m e n t e d b y { @ l i n k L a t t i c e } d i r e c t l y ← ֓ , 115 ∗ b u t by i t s s u b c l a s s e s . 116 ∗ 117 ∗ N . B . 2 . T he s i z e i s n o t n e c e s s a r i l l y t h e c a r d i n a l o f t h e l a t t i c e , b u t ma y b e 118 ∗ i n s t e a d t h e n u m b e r o f a t o m i c p r o p o s i t i o n s o f t h e l a t t i c e . 119 ∗ 120 ∗ / 121 @ O v e r r i d e 122 p u b l i c i n t s i z e ( i n t n e w S i z e ) { // i f n e w S i z e i s p o s s i b l e , t h e n c h a n g e s i z e t o ← ֓ n e w S i z e 123 i f ( ( n e w S i z e >0 )&& ( n e w S i z e < = s i z e M a x ) ) { 124 s i z e F r a m e = n e w S i z e ; 125 s i z e _ m e m _ 1 =( s i z e F r a m e − 1 ) / 6 4 ; 126 h i g h e s t _ l o n g _ o n e = s i z e F r a m e − 6 4 ∗ s i z e _ m e m _ 1 ; 127 h i g h e s t _ l o n g _ o n e = ( ( ( 1 L < <( h i g h e s t _ l o n g _ o n e − 1 ) ) − 1 )<<1) + 1 ; 128 / / 129 _ m e m o r y = ne w l o n g [ s i z e _ m e m _ 1 + 1 ] ; 130 } 131 r e t u r n s i z e F r a m e ; 132 } 133 134 @ O v e r r i d e 135 p u b l i c L s i z e ( L i n p u t ) { 136 s i z e ( i n p u t . s i z e ( − 1 ) ) ; 137 r e t u r n ( L ) t h i s ; 138 } 139 75 140 } 76 Source Co de: RefereeF unctionDefault.ja v a 1 / ∗ 2 ∗ R e f e r e e F u n c t i o n D e f a u l t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; D e f a u l t 3 ∗ i m p l e m e n t a t i o n o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ T h i s c l a s s i m p l e m e n t s t h e d e f a u l t R e f e r e e F u n c t i o n . 32 ∗ T h i s d e f a u l t R e f e r e e F u n c t i o n a c t u a l l y e n c o d e s t h e c o m b i n a t i o n r u l e o f D e m p s t e r ← ֓ − S h a f e r . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c c l a s s R e f e r e e F u n c t i o n D e f a u l t < P r o p e x t e n d s L a t t i c e < P r o p > > { 59 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 / ∗ ∗ 66 ∗ I m p l e m e n t t h e R e f e r e e F u n c t i o n o f t h e c l a s s . 67 ∗ The r e f e r e e f u n c t i o n t a k e s a s c o n t e x t : 68 ∗ < B R > < B R > 69 ∗ ( a ) The l i s t o f t h e p r o p o s i t i o n s p r o p o s e d b y e a c h s o u r c e o f i n f o r m a t i o n , 70 ∗ < B R > 77 71 ∗ ( b ) The l i s t o f b a s i c b e l i e f a s s i g n e d b y e a c h s o u r c e s t o t h e i r r e s p e c t i v e ← ֓ p r o p o s a l , 72 ∗ < B R > 73 ∗ ( c ) The l i s t o f B a s i c B e l i e f A s s i g n m m e n t o f t h e s o u r c e s . T h i s l a s t i n f o r m a t i o n , 74 ∗ w h i c h c o n s t i t u t e s a m o r e g e n e r a l a n d g l o b a l i n f o r m a t i o n o f c o n t e x t , i s r a r e l y 75 ∗ u s e d i n p r a c t i c e , b u t i s p r o v i d e d f o r t h e s a c k o f t h e g e n e r a l i t y o f t h e ← ֓ i m p l e m e n t a t i o n . 76 ∗ < B R > < B R > 77 ∗ I n f o r m a t i o n ( a ) a n d ( b ) a r e p r o v i d e d b y v a r i a b l e < i > a s s i g n I n . 78 ∗ I n f o r m a t i o n ( c ) a r e p r o v i d e d b y v a r i a b l e < i >b b a I n . 79 ∗ < B R > < B R > 80 ∗ The r e f e r e e f u n c t i o n r e t u r n s a l i s t o f a s s i g n m e n t s w h i c h sum t o 1 a n d m o d e l s a 81 ∗ p r o b a b i l i s t i c f i n a l d e c i s i o n . 82 ∗ 83 ∗ @pa ra m a s s i g n I n 84 ∗ The l i s t o f p r o p o s i t i o n s p r o p o s e d b y t h e s o u r c e s t o g e t h e r w i t h ← ֓ t h e i r 85 ∗ @pa ra m b b a I n 86 ∗ The l i s t o f B a s i c B e l i e f A s s i g n m m e n t o f t h e s o u r c e s 87 ∗ a s s i g n e d b a s i c b e l i e f 88 ∗ @ r e t u r n A l i s t o f a s s i g n m e n t s m o d e l l i n g a p r o b a b i l i s t i c d e c i s i o n 89 ∗ 90 ∗ / 91 p u b l i c A r r a y L i s t < A s s i g n m e n t < P r o p > > r e f e r e e F u n c t i o n ( A r r a y L i s t < A s s i g n m e n t < P r o p > > ← ֓ a s s i g n I n , 92 A r r a y L i s t < m i n A s s i g n m e n t < ← ֓ P r o p > > b b a I n ) { 93 i f ( a s s i g n I n = = n u l l ) { 94 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 95 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B > ) " ) ; 96 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s n u l l " ) ; 97 S y s t e m . e x i t ( 0 ) ; 98 } 99 i f ( a s s i g n I n . s i z e ( ) < 1 ) { 100 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 101 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B >) " ) ; 102 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s e m p t y " ) ; 103 S y s t e m . e x i t ( 0 ) ; 104 } 105 106 i n t i ; 107 A r r a y L i s t < A s s i g n m e n t < P r o p > > a r b i t r a m e n t = ne w A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 108 A s s i g n m e n t < P r o p > f i n a l A s s i g n m e n t = n e w A s s i g n m e n t < P r o p > ( ) ; 109 P r o p f u s e d P r o p = a s s i g n I n . g e t ( 0 ) . a t t r i b u t e . c l o n e ( ) ; 110 f i n a l A s s i g n m e n t . a t t r i b u t e = f u s e d P r o p ; 111 f i n a l A s s i g n m e n t . v a l u e = 1 . ; 112 a r b i t r a m e n t . a d d ( f i n a l A s s i g n m e n t ) ; 113 114 f o r ( i = 1 ; i < a s s i g n I n . s i z e ( ) ; i ++ ) { 115 f u s e d P r o p . a n d ( f u s e d P r o p , a s s i g n I n . g e t ( i ) . a t t r i b u t e ) ; 116 } 117 r e t u r n a r b i t r a m e n t ; 118 } 119 120 } 78 Source Co de: RefereeF unctionDempster.ja v a 1 / ∗ 2 ∗ R e f e r e e F u n c t i o n D e m p s t e r . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ T h i s c l a s s i m p l e m e n t s t h e R e f e r e e F u n c t i o n e n c o d i n g t h e c o m b i n a t i o n r u l e o f 30 ∗ D e m p s t e r − S h a f e r . 31 ∗ 32 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 33 ∗ 34 ∗ 35 ∗ 36 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 37 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 38 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 39 ∗ < B R > 40 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 41 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 42 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 43 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 46 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 47 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 48 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 49 ∗ < B R > 50 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 51 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 52 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 53 ∗ < / t a b l e > < B R > 54 ∗ 55 ∗ / 56 p u b l i c c l a s s R e f e r e e F u n c t i o n D e m p s t e r < P r o p e x t e n d s L a t t i c e < P r o p > > 57 e x t e n d s R e f e r e e F u n c t i o n D e f a u l t < P r o p > { 58 / / N o t h i n g t o d o ; D e m p s t e r i s b y d e f a u l t ! 59 } 79 Source Co de: RefereeF unctionDisjunctiv e.ja v a 1 / ∗ 2 ∗ R e f e r e e F u n c t i o n D i s j u n c t i v e . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 / ∗ ∗ 30 ∗ T h i s c l a s s i m p l e m e n t s t h e R e f e r e e F u n c t i o n e n c o d i n g t h e d i s j u n c t i v e c o m b i n a t i o n 31 ∗ r u l e . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c c l a s s R e f e r e e F u n c t i o n D i s j u n c t i v e < P r o p e x t e n d s L a t t i c e < P r o p > > 58 e x t e n d s R e f e r e e F u n c t i o n D e f a u l t < P r o p > { 59 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 @ O v e r r i d e 66 p u b l i c A r r a y L i s t < A s s i g n m e n t < P r o p > > r e f e r e e F u n c t i o n ( A r r a y L i s t < A s s i g n m e n t < P r o p > > ← ֓ a s s i g n I n , 67 A r r a y L i s t < m i n A s s i g n m e n t < P r o p > > ← ֓ b b a I n ) { 68 i f ( a s s i g n I n = = n u l l ) { 69 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 80 70 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B > ) " ) ; 71 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s n u l l " ) ; 72 S y s t e m . e x i t ( 0 ) ; 73 } 74 i f ( a s s i g n I n . s i z e ( ) < 1 ) { 75 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 76 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B > ) " ) ; 77 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s e m p t y " ) ; 78 S y s t e m . e x i t ( 0 ) ; 79 } 80 81 i n t i ; 82 A r r a y L i s t < A s s i g n m e n t < P r o p > > a r b i t r a m e n t = new A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 83 A s s i g n m e n t < P r o p > f i n a l A s s i g n m e n t = n ew A s s i g n m e n t < P r o p > ( ) ; 84 P r o p f u s e d P r o p = a s s i g n I n . g e t ( 0 ) . a t t r i b u t e . c l o n e ( ) ; 85 f i n a l A s s i g n m e n t . a t t r i b u t e = f u s e d P r o p ; 86 f i n a l A s s i g n m e n t . v a l u e = 1 . ; 87 a r b i t r a m e n t . a d d ( f i n a l A s s i g n m e n t ) ; 88 89 f o r ( i = 1 ; i < a s s i g n I n . s i z e ( ) ; i ++ ) { 90 f u s e d P r o p . o r ( f u s e d P r o p , a s s i g n I n . g e t ( i ) . a t t r i b u t e ) ; 91 } 92 r e t u r n a r b i t r a m e n t ; 93 } 94 95 } 81 Source Co de: RefereeF unctionDub oisPrade.ja v a 1 / ∗ 2 ∗ R e f e r e e F u n c t i o n D u b o i s P r a d e . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 / ∗ ∗ 30 ∗ T h i s c l a s s i m p l e m e n t s t h e R e f e r e e F u n c t i o n e n c o d i n g t h e c o m b i n a t i o n r u l e o f ← ֓ D u b o i s 31 ∗ & P r a d e . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c c l a s s R e f e r e e F u n c t i o n D u b o i s P r a d e < P r o p e x t e n d s L a t t i c e < P r o p > > 58 e x t e n d s R e f e r e e F u n c t i o n D e f a u l t < P r o p > { 59 60 61 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 62 / / p u b l i c p a r t 63 / / / / / / / / / / / / / / / 64 65 @ O v e r r i d e 66 p u b l i c A r r a y L i s t < A s s i g n m e n t < P r o p > > r e f e r e e F u n c t i o n ( A r r a y L i s t < A s s i g n m e n t < P r o p > > ← ֓ a s s i g n I n , 67 A r r a y L i s t < m i n A s s i g n m e n t < P r o p > > ← ֓ b b a I n ) { 68 i f ( a s s i g n I n = = n u l l ) { 82 69 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 70 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B > ) " ) ; 71 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s n u l l " ) ; 72 S y s t e m . e x i t ( 0 ) ; 73 } 74 i f ( a s s i g n I n . s i z e ( ) < 1 ) { 75 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 76 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B > ) " ) ; 77 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s e m p t y " ) ; 78 S y s t e m . e x i t ( 0 ) ; 79 } 80 81 i n t i ; 82 A r r a y L i s t < A s s i g n m e n t < P r o p > > a r b i t r a m e n t = new A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 83 A s s i g n m e n t < P r o p > f i n a l A s s i g n m e n t = n ew A s s i g n m e n t < P r o p > ( ) ; 84 P r o p f u s e d P r o p C o n j = a s s i g n I n . g e t ( 0 ) . a t t r i b u t e . c l o n e ( ) ; 85 P r o p f u s e d P r o p D i s j = f u s e d P r o p C o n j . i n s t a n c e N s i z e ( ) . z e r o ( ) ; 86 f i n a l A s s i g n m e n t . v a l u e = 1 . ; 87 f o r ( i = 1 ; i < a s s i g n I n . s i z e ( ) ; i ++ ) f u s e d P r o p C o n j . a n d ( f u s e d P r o p C o n j , a s s i g n I n . ← ֓ g e t ( i ) . a t t r i b u t e ) ; 88 i f ( f u s e d P r o p C o n j . c o m p a r e T o ( f u s e d P r o p D i s j ) ==0) { 89 f o r ( i = 0 ; i < a s s i g n I n . s i z e ( ) ; i ++ ) f u s e d P r o p D i s j . o r ( f u s e d P r o p D i s j , a s s i g n I n ← ֓ . g e t ( i ) . a t t r i b u t e ) ; 90 f i n a l A s s i g n m e n t . a t t r i b u t e = f u s e d P r o p D i s j ; 91 } e l s e f i n a l A s s i g n m e n t . a t t r i b u t e = f u s e d P r o p C o n j ; 92 a r b i t r a m e n t . a d d ( f i n a l A s s i g n m e n t ) ; 93 r e t u r n a r b i t r a m e n t ; 94 } 95 96 } 83 Source Co de: RefereeF unctionPCR6.ja v a 1 / ∗ 2 ∗ R e f e r e e F u n c t i o n P C R 6 . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n 3 ∗ o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 / ∗ ∗ 30 ∗ T h i s c l a s s i m p l e m e n t s t h e R e f e r e e F u n c t i o n e n c o d i n g t h e P C R 6 c o m b i n a t i o n r u l e . 31 ∗ 32 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 33 ∗ 34 ∗ 35 ∗ 36 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 37 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 38 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 39 ∗ < B R > 40 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 41 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 42 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 43 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 46 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 47 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 48 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 49 ∗ < B R > 50 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 51 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 52 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 53 ∗ < / t a b l e > < B R > 54 ∗ 55 ∗ / 56 p u b l i c c l a s s R e f e r e e F u n c t i o n P C R 6 < P r o p e x t e n d s L a t t i c e < P r o p > > 57 e x t e n d s R e f e r e e F u n c t i o n D e f a u l t < P r o p > { 58 59 60 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 61 / / p u b l i c p a r t 62 / / / / / / / / / / / / / / / 63 64 @ O v e r r i d e 65 p u b l i c A r r a y L i s t < A s s i g n m e n t < P r o p > > r e f e r e e F u n c t i o n ( A r r a y L i s t < A s s i g n m e n t < P r o p > > ← ֓ a s s i g n I n , 66 A r r a y L i s t < m i n A s s i g n m e n t < ← ֓ P r o p > > b b a I n ) { 67 i f ( a s s i g n I n = = n u l l ) { 68 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 69 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B > ) " ) ; 84 70 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s n u l l " ) ; 71 S y s t e m . e x i t ( 0 ) ; 72 } 73 i f ( a s s i g n I n . s i z e ( ) < 1 ) { 74 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 75 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B > ) " ) ; 76 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s e m p t y " ) ; 77 S y s t e m . e x i t ( 0 ) ; 78 } 79 80 i n t i ; 81 d o u b l e N o r m ; 82 A r r a y L i s t < A s s i g n m e n t < P r o p > > a r b i t r a m e n t = new A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 83 A s s i g n m e n t < P r o p > f i n a l A s s i g n m e n t ; 84 P r o p f u s e d P r o p = a s s i g n I n . g e t ( 0 ) . a t t r i b u t e . c l o n e ( ) ; 85 P r o p z e r o = f u s e d P r o p . i n s t a n c e N s i z e ( ) . z e r o ( ) ; 86 N o r m = 0 . ; 87 f o r ( i = 1 ; i < a s s i g n I n . s i z e ( ) ; i ++ ) { 88 f u s e d P r o p . a n d ( f u s e d P r o p , a s s i g n I n . g e t ( i ) . a t t r i b u t e ) ; 89 } 90 i f ( f u s e d P r o p . c o m p a r e T o ( z e r o ) ==0) { 91 f o r ( i = 0 ; i < a s s i g n I n . s i z e ( ) ; i ++ ) { 92 N o r m + = a s s i g n I n . g e t ( i ) . v a l u e ; 93 } 94 f o r ( i = 0 ; i < a s s i g n I n . s i z e ( ) ; i ++ ) { 95 f i n a l A s s i g n m e n t = ne w A s s i g n m e n t < P r o p > ( ) ; 96 f i n a l A s s i g n m e n t . v a l u e = a s s i g n I n . g e t ( i ) . v a l u e / N o r m ; 97 f i n a l A s s i g n m e n t . a t t r i b u t e = a s s i g n I n . g e t ( i ) . a t t r i b u t e . c l o n e ( ) ; 98 a r b i t r a m e n t . a d d ( f i n a l A s s i g n m e n t ) ; 99 } 100 } e l s e { 101 f i n a l A s s i g n m e n t = ne w A s s i g n m e n t < P r o p > ( ) ; 102 f i n a l A s s i g n m e n t . v a l u e = 1 . ; 103 f i n a l A s s i g n m e n t . a t t r i b u t e = f u s e d P r o p ; 104 a r b i t r a m e n t . a d d ( f i n a l A s s i g n m e n t ) ; 105 } 106 r e t u r n a r b i t r a m e n t ; 107 } 108 109 } 85 Source Co de: RefereeF unctionPCRSharp.ja v a 1 / ∗ 2 ∗ R e f e r e e F u n c t i o n P C R S h a r p . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ T h i s c l a s s i m p l e m e n t s t h e R e f e r e e F u n c t i o n e n c o d i n g t h e PC RS ha rp c o m b i n a t i o n ← ֓ r u l e . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c c l a s s R e f e r e e F u n c t i o n P C R S h a r p < P r o p e x t e n d s L a t t i c e < P r o p > > 58 e x t e n d s R e f e r e e F u n c t i o n D e f a u l t < P r o p > { 59 p r o t e c t e d i n t t h e E n t r y S i z e = − 1; 60 p r o t e c t e d P r o p t h e D e f a u l t = n u l l ; 61 p r o t e c t e d P r o p t h e Z e r o = n u l l ; 62 p r o t e c t e d P r o p t h e O n e = n u l l ; 63 p r o t e c t e d b o o l e a n [ ] t h e M a s k = n u l l ; 64 p r o t e c t e d b o o l e a n [ ] t h e R e v M a s k = n u l l ; 65 66 p r o t e c t e d d o u b l e [ ] w e i g h t T a b = n u l l ; 67 p r o t e c t e d i n t [ ] m a p T a b = n u l l ; 68 p r o t e c t e d A r r a y L i s t < P r o p > t h e P r o p o s i t i o n T a b = n u l l ; 69 70 p r o t e c t e d A r r a y L i s t < A s s i g n m e n t < P r o p > > g e t W e i g h t e d S u b s e t ( i n t s u b s e t S i z e , 86 71 A r r a y L i s t < A s s i g n m e n t < P r o p > > a s s i g n I n ) { 72 d o u b l e t h e N o r m ; 73 i n t j , k , p i v o t ; 74 b o o l e a n j u s t M o v e d ; 75 A r r a y L i s t < A s s i g n m e n t < P r o p > > t h e A s s i g n m e n t L i s t ; 76 t h e A s s i g n m e n t L i s t = n e w A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 77 A s s i g n m e n t < P r o p > c u r A s s i g n m e n t ; 78 P r o p a P r o p o s i t i o n ; 79 d o u b l e a V a l u e ; 80 81 / / i n i t 82 t h e N o r m = 0 . ; 83 p i v o t = s u b s e t S i z e ; 84 w e i g h t T a b [ p i v o t ] = 1 . ; 85 t h e P r o p o s i t i o n T a b . s e t ( p i v o t , t h e O n e ) ; 86 m a p T a b [ p i v o t ] = t h e E n t r y S i z e ; 87 j u s t M o v e d = t r u e ; 88 / / i n i t d o n e 89 90 / / l o o p 91 d o { 92 i f ( j u s t M o v e d ) { 93 j u s t M o v e d = f a l s e ; 94 f o r ( j = p i v o t ; j > 0 ; ) { 95 k = j ; 96 j −− ; 97 m a p T a b [ j ] = j ; 98 w e i g h t T a b [ j ] = w e i g h t T a b [ k ] ∗ a s s i g n I n . g e t ( j ) . v a l u e ; 99 t h e P r o p o s i t i o n T a b . s e t ( j , t h e Z e r o . i n s t a n c e N s i z e ( ) . a n d ( 100 a s s i g n I n . g e t ( j ) . a t t r i b u t e , t h e P r o p o s i t i o n T a b . g e t ( k ) ) ) ; 101 p i v o t −− ; 102 } 103 / / b u i l d a ne w a s s i g n m e n t ? 104 a P r o p o s i t i o n = t h e P r o p o s i t i o n T a b . g e t ( 0 ) ; 105 i f ( a P r o p o s i t i o n . c o m p a r e T o ( t h e Z e r o ) ! = 0 ) { 106 / / a ne w a s s i g n m e n t i s c r e a t e d f o r t h e n e x t c a s e 107 a V a l u e = w e i g h t T a b [ 0 ] ; 108 c u r A s s i g n m e n t = n e w A s s i g n m e n t < P r o p > ( ) ; 109 c u r A s s i g n m e n t . a t t r i b u t e = a P r o p o s i t i o n ; 110 c u r A s s i g n m e n t . v a l u e = a V a l u e ; 111 t h e A s s i g n m e n t L i s t . a d d ( c u r A s s i g n m e n t ) ; 112 t h e N o r m + = a V a l u e ; 113 } 114 } 115 k = p i v o t + 1 ; 116 j = m a p T a b [ p i v o t ] + 1 ; 117 i f ( j < m a p T a b [ k ] ) { 118 m a p T a b [ p i v o t ] = j ; 119 w e i g h t T a b [ p i v o t ] = w e i g h t T a b [ k ] ∗ a s s i g n I n . g e t ( j ) . v a l u e ; 120 t h e P r o p o s i t i o n T a b . s e t ( p i v o t , t h e Z e r o . i n s t a n c e N s i z e ( ) . a n d ( 121 a s s i g n I n . g e t ( j ) . a t t r i b u t e , t h e P r o p o s i t i o n T a b . g e t ( k ) ) ) ; 122 j u s t M o v e d = t r u e ; 123 } e l s e p i v o t + +; 124 125 } w h i l e ( p i v o t < s u b s e t S i z e ) ; 126 127 f o r ( j = 0 ; j < t h e A s s i g n m e n t L i s t . s i z e ( ) ; j ++ ) t h e A s s i g n m e n t L i s t . g e t ( j ) . v a l u e /= ← ֓ t h e N o r m ; 128 129 r e t u r n t h e A s s i g n m e n t L i s t ; 130 } 131 132 133 p r o t e c t e d A r r a y L i s t < A s s i g n m e n t < P r o p > > a s k W e i g h t e d S u b s e t ( i n t s u b s e t S i z e , 134 A r r a y L i s t < A s s i g n m e n t < P r o p > > a s s i g n I n ) { 135 / / T e s t t h e ma s k i n o r d e r t o d e c i d e f o r t h e c o m p u t a t i o n 136 i n t k ; 137 i f ( t h e M a s k = = n u l l ) { 138 i f ( t h e R e v M a s k = = n u l l ) r e t u r n g e t W e i g h t e d S u b s e t ( s u b s e t S i z e , a s s i g n I n ) ; 139 } e l s e { 140 i f ( ( k = ( s u b s e t S i z e − 1 ) )< t h e M a s k . l e n g t h ) 141 i f ( t h e M a s k [ k ] ) r e t u r n g e t W e i g h t e d S u b s e t ( s u b s e t S i z e , a s s i g n I n ) ; 142 } 143 i f ( t h e R e v M a s k ! = n u l l ) { 87 144 i f ( ( k = ( t h e E n t r y S i z e − s u b s e t S i z e ) )< t h e R e v M a s k . l e n g t h ) 145 i f ( t h e R e v M a s k [ k ] ) r e t u r n g e t W e i g h t e d S u b s e t ( s u b s e t S i z e , a s s i g n I n ← ֓ ) ; 146 } 147 r e t u r n ne w A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 148 } 149 150 151 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 152 / / p u b l i c p a r t 153 / / / / / / / / / / / / / / / 154 155 / ∗ ∗ 156 ∗ S e t t h e d e f a u l t a n s w e r t o p r o p o s i t i o n < i >a D e f a u l t . 157 ∗ Th e d e f a u l t a n s w e r i s r e t u r n e d b y t h e P CR Sh ar p r e f e r e e f u n c t i o n , w h e n n o ← ֓ c o n s e n s u s 158 ∗ h a v e b e e n f o u n d am on g t h e a c c e p t a b l e s u b s e t c o m b i n a t i o n o f s o u r c e s . 159 ∗ < B R > < B R > 160 ∗ Th e d e f a u l t a n s w e r i s i n i t i a l i z e d t o < i >n u l l a t t h e c l a s s c o n s t r u c t i o n , 161 ∗ w h i c h i s a u t o m a t i c a l l y h a n d l e d a s a < i >z e r o . 162 ∗ 163 ∗ / 164 p u b l i c v o i d s e t D e f a u l t A n s w e r ( P r o p a D e f a u l t ) { 165 i f ( a D e f a u l t = = n u l l ) { 166 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 167 " . s e t D e f a u l t A n s w e r ( P r o p ) " ) ; 168 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a D e f a u l t i s n u l l " ) ; 169 S y s t e m . e x i t ( 0 ) ; 170 } 171 t h e D e f a u l t = a D e f a u l t . c l o n e ( ) ; 172 } 173 174 / ∗ ∗ 175 ∗ S e t a m a s k a n d a r e v e r s e ma s k w h i c h w i l l s e l e c t t h e s i z e s o f s u b s e t c o m b i n a t i o n 176 ∗ ( o f t h e s o u r c e s e n t r i e s ) w h i c h a r e t a k e n i n t o c o n s i d e r a t i o n . 177 ∗ T h e s e p a r a m e t e r s w o r k a s f o l l o w s : 178 ∗ < b r > 179 ∗ I f < i > a M a sk=n u l l a n d < i >aRe v M as k = n u l l \ , , t h e n a l l s u b s e t c o m b i n a t i o n s ← ֓ a r e 180 ∗ m a n a g e d ( t h i s i s a d a n g e r o u s c h o i c e , w h e n t h e r e a r e many s o u r c e s ) . 181 ∗ < b r >O t h e r w i s e : 182 ∗ 183 ∗ I f < i > a M a sk=n u l l , t h e n < i > a M a s k i s n o t c o n s i d e r e d f o r m a s k i n g . 184 ∗ 185 ∗ I f < i > a Re v M a sk=n u l l , t h e n < i > a R e v M a s k i s n o t c o n s i d e r e d f o r m a s k i n g . 186 ∗ < b r > 187 ∗ a M a s k d e f i n e d t h e c l e a r a n c e w h e r e i t i s < i >t r u e f r o m ( m i n i m a l ) s u b s e t s i z e 188 ∗ 1 u p w a r d 189 ∗ 190 ∗ a R e v M a s k d e f i n e d t h e c l e a r a n c e w h e r e i t i s < i >t r u e f r o m ( m a x i m a l ) s u b s e t 191 ∗ s i z e < i >t h e E n t r y S i z e d o w n w a r d 192 ∗ 193 ∗ / 194 p u b l i c v o i d s e t M a s k ( b o o l e a n [ ] a M a s k , b o o l e a n [ ] a R e v M a s k ) { 195 / / N B : n u l l Ma sk m e a n s t h a t t h e m a s k i s n o t c o n s i d e r e d 196 / / n u l l & n u l l m a s k s m e a n s t h a t t h e r e i s n o m a s k i n g 197 / / aM a s k = > d e f i n e c l e a r a n c e f r o m ( m i n i m a l ) s e t s i z e 1 u p w a r d 198 / / aR e v M a s k = > d e f i n e c l e a r a n c e f r o m ( m a x i m a l ) s e t s i z e t h e E n t r y S i z e ← ֓ d o wn w a r d 199 i n t i ; 200 t h e M a s k = ne w b o o l e a n [ a M a s k . l e n g t h ] ; 201 t h e R e v M a s k = new b o o l e a n [ a R e v M a s k . l e n g t h ] ; 202 f o r ( i = 0 ; i < t h e M a s k . l e n g t h ; i ++ ) t h e M a s k [ i ] = a M a s k [ i ] ; 203 f o r ( i = 0 ; i < t h e R e v M a s k . l e n g t h ; i ++ ) t h e R e v M a s k [ i ] = a R e v M a s k [ i ] ; 204 } 205 206 @ O v e r r i d e 207 p u b l i c A r r a y L i s t < A s s i g n m e n t < P r o p > > r e f e r e e F u n c t i o n ( A r r a y L i s t < A s s i g n m e n t < P r o p > > ← ֓ a s s i g n I n , 208 A r r a y L i s t < m i n A s s i g n m e n t < P r o p ← ֓ > > b b a I n ) { 209 i f ( a s s i g n I n = = n u l l ) { 210 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 211 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B >) " ) ; 88 212 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s n u l l " ) ; 213 S y s t e m . e x i t ( 0 ) ; 214 } 215 i n t i ; 216 i = a s s i g n I n . s i z e ( ) ; 217 i f ( i < 1) { 218 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 219 " . r e f e r e e F u n c t i o n ( A r r a y L i s t >, A r r a y L i s t < B >) " ) ; 220 S y s t e m . e r r . p r i n t l n ( " E r r o r : : a s s i g n I n i s e m p t y " ) ; 221 S y s t e m . e x i t ( 0 ) ; 222 } 223 i f ( t h e E n t r y S i z e ! = i ) { 224 t h e E n t r y S i z e = i ; 225 w e i g h t T a b = ne w d o u b l e [ t h e E n t r y S i z e + 1 ] ; 226 m a p T a b = ne w i n t [ t h e E n t r y S i z e + 1 ] ; 227 t h e P r o p o s i t i o n T a b = n e w A r r a y L i s t < P r o p > ( ) ; 228 f o r ( i = 0 ; i < = t h e E n t r y S i z e ; i ++) { 229 t h e P r o p o s i t i o n T a b . a d d ( n u l l ) ; 230 } 231 } 232 i f ( t h e Z e r o = = n u l l ) { 233 t h e Z e r o = a s s i g n I n . g e t ( 0 ) . a t t r i b u t e . i n s t a n c e N s i z e ( ) . z e r o ( ) ; 234 t h e O n e = t h e Z e r o . i n s t a n c e N s i z e ( ) . o n e ( ) ; 235 } 236 i f ( t h e D e f a u l t = = n u l l ) t h e D e f a u l t = t h e Z e r o ; 237 A r r a y L i s t < A s s i g n m e n t < P r o p > > a r b i t r a m e n t = n u l l ; 238 f o r ( i = t h e E n t r y S i z e ; i > 0 ; i − − ) { 239 a r b i t r a m e n t = a s k W e i g h t e d S u b s e t ( i , a s s i g n I n ) ; 240 i f ( a r b i t r a m e n t . s i z e ( ) > 0 ) r e t u r n a r b i t r a m e n t ; 241 } 242 A s s i g n m e n t < P r o p > f i n a l A s s i g n m e n t = n e w A s s i g n m e n t < P r o p > ( ) ; 243 f i n a l A s s i g n m e n t . a t t r i b u t e = t h e D e f a u l t . c l o n e ( ) ; 244 f i n a l A s s i g n m e n t . v a l u e = 1 . ; 245 / / N B : i n i t i a l i z a t i o n o f a r b i t r a m e n t i s d o n e i n t h e l o o p 246 a r b i t r a m e n t . a d d ( f i n a l A s s i g n m e n t ) ; 247 r e t u r n a r b i t r a m e n t ; 248 } 249 250 } 89 Source Co de: RefereeF userR TS.ja v a 1 / ∗ 2 ∗ R e f e r e e F u s e r R T S . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ f u s e r b y m e a n s o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ R e l a x e d e x t e n s i o n o f { @ l i n k T r e e S e t R e f e r e e F u s e r } . 30 ∗ 31 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 32 ∗ 33 ∗ 34 ∗ 35 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 36 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 37 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 38 ∗ < B R > 39 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 40 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 41 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 42 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 43 ∗ < B R > 44 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 45 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 46 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 47 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 48 ∗ < B R > 49 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 50 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 51 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 52 ∗ < / t a b l e > < B R > 53 ∗ 54 ∗ / 55 p u b l i c c l a s s R e f e r e e F u s e r R T S < P r o p e x t e n d s L a t t i c e < P r o p > , 56 B e x t e n d s R e f e r e e F u s e r R T S < P r o p , B > > 57 e x t e n d s T r e e S e t R e f e r e e F u s e r < P r o p , B > 58 i m p l e m e n t s R e l a x e d B B A < P r o p , B > { 59 60 @ O v e r r i d e 61 p r o t e c t e d b o o l e a n r e l a x e d ( ) { r e t u r n t r u e ; } 62 63 64 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 65 / / p u b l i c p a r t 66 / / / / / / / / / / / / / / / 67 68 / ∗ ∗ 69 ∗ R e l a x < i > t h i s s o t h a t i t c o n t a i n s n o m o r e t h a n < i > m a x M e m a s s i g n m e n t s . 70 ∗ 71 ∗ / 90 72 @ O v e r r i d e 73 p u b l i c b o o l e a n r e l a x ( i n t m a x M e m ) { r e t u r n s u p e r . r e l a x ( m a x M e m ) ; } 74 75 / ∗ ∗ 76 ∗ R e l a x < i > t h i s s o t h a t i t c o n t a i n s n o m o r e t h a n { @ l i n k Re l a x e d B B A #m a x S i z e ( ← ֓ i n t ) } 77 ∗ a s s i g n m e n t s . 78 ∗ 79 ∗ / 80 @ O v e r r i d e 81 p u b l i c b o o l e a n r e l a x ( ) { r e t u r n s u p e r . r e l a x ( ) ; } 82 83 / ∗ ∗ 84 ∗ S e t o r r e t u r n t h e d e f a u l t maxim um n u m b e r o f a s s i g n m e n t s s t o r e d i n < i > t h i s , 85 ∗ d e p e n d i n g o n p a r a m e t e r < i >n e w S i z e . 86 ∗ I f < i >n e w S i z e >0 , t h e n s e t t h e d e f a u l t maxi mum n u m b e r o f a s s i g n m e n t s t o < i > ← ֓ n e w S i z e . 87 ∗ I n a n y c a s e , r e t u r n t h e a c t u a l v a l u e o f t h e d e f a u l t max imum n u m b e r . 88 ∗ < B R > < B R > 89 ∗ N . B . I t i s n o t p o s s i b l e t o e x c e e d t h i s n u m b e r o f a s s i g n m e n t s , e x c e p t f o r ← ֓ t e m p o r a r y 90 ∗ c o m p u t e d a s s i g n m e n t s . 91 ∗ 92 ∗ / 93 @ O v e r r i d e 94 p u b l i c i n t m a x S i z e ( i n t n e w S i z e ) { r e t u r n s u p e r . m a x S i z e ( n e w S i z e ) ; } 95 } 91 Source Co de: RefereeSampler. jav a 1 / ∗ 2 ∗ R e f e r e e S a m p l e r . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ s a m p l i n g − b a s e d f u s e r b y m e a n s o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ T h i s c l a s s i m p l e m e n t s a g e n e r i c c o m b i n a t i o n o f B a s i c B e l i e f A s s i g n m e n t s b y t h e 32 ∗ m e a n s o f r e f e r e e f u n c t i o n s a n d o n t h e b a s i s o f a p a r t i c l e a p p r o x i m a t i o n . T h i s 33 ∗ c l a s s d o e s n o t h a n d l e d i r e c t r u l e i m p l e m e n t a t i o n s , { @ l i n k BBA F u se r } , o r e x a c t 34 ∗ r e f e r e e − b a s e d f u s i o n { @ l i n k B B A R e f e r e e F u s e r } . 35 ∗ 36 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 37 ∗ 38 ∗ 39 ∗ 40 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 41 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 42 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 43 ∗ < B R > 44 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 45 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 46 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 47 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 48 ∗ < B R > 49 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 50 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 51 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 52 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 53 ∗ < B R > 54 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 55 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 56 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 57 ∗ < / t a b l e > < B R > 58 ∗ 59 ∗ / 60 p u b l i c c l a s s R e f e r e e S a m p l e r < P r o p e x t e n d s L a t t i c e < P r o p > , 61 s B e x t e n d s R e f e r e e S a m p l e r < P r o p , s B > > 62 e x t e n d s T r e e S e t B B A < P r o p , s B > 63 i m p l e m e n t s S a m p l e d B B A R e f e r e e F u s e r < P r o p ← ֓ , s B > { 64 65 p r o t e c t e d P r o p t h e Z e r o = n u l l ; 66 67 p r o t e c t e d R e f e r e e F u n c t i o n D e f a u l t < P r o p > t h e R e f e r e e F u n c t i o n ; 68 69 p r o t e c t e d s t a t i c R a n d o m r n g = n e w R a n d o m ( ) ; 70 92 71 p r o t e c t e d b o o l e a n _ _ u p d a t e d = t r u e ; 72 73 p r o t e c t e d d o u b l e [ ] c u m u l a t i v e D i s t r i b u t i o n _ S a m p l e r = n u l l ; / / c u m u l a t i v e ← ֓ d i s t r i b b u t i o n i s u s e d 74 / / f o r s a m p l i n g 75 p r o t e c t e d d o u b l e [ ] c u m u l a t i v e D i s t r i b u t i o n _ M i x e r = n u l l ; / / c u m u l a t i v e ← ֓ d i s t r i b b u t i o n i s u s e d 76 / / f o r s a m p l i n g 77 78 p r o t e c t e d A r r a y L i s t < A s s i g n m e n t < P r o p > > m a p p e d A t t r i b u t e ; 79 80 p r o t e c t e d A r r a y L i s t < A s s i g n m e n t < P r o p > > a n s w e r e d A t t r i b u t e ; 81 82 p r o t e c t e d i n t [ ] j u m p T a b l e _ S a m p l e r = n u l l ; / / u s e d f o r e n s u r i n g f a s t s a m p l i n g 83 84 p r o t e c t e d i n t [ ] j u m p T a b l e _ M i x e r = n u l l ; / / u s e d f o r e n s u r i n g f a s t s a m p l i n g 85 86 p r o t e c t e d A r r a y L i s t < m i n A s s i g n m e n t < P r o p > > B B A S o u r c e s = ne w A r r a y L i s t < ← ֓ m i n A s s i g n m e n t < P r o p >> () ; 87 88 p r o t e c t e d A r r a y L i s t < s B > f u s e r S o u r c e s ; 89 90 p r o t e c t e d A r r a y L i s t < s B > m i x e r S o u r c e s ; 91 92 93 p r o t e c t e d b o o l e a n s e t T a b l e s _ s a m p l e r ( ) { 94 I t e r a t o r i t e r = b b a T r e e V A . i t e r a t o r ( ) ; 95 i n t s i z e = b b a T r e e V A . s i z e ( ) ; 96 c u m u l a t i v e D i s t r i b u t i o n _ S a m p l e r = new d o u b l e [ s i z e ] ; 97 j u m p T a b l e _ S a m p l e r = new i n t [ s i z e ] ; 98 m a p p e d A t t r i b u t e = ne w A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 99 A s s i g n m e n t < P r o p > a s s i g n m e n t ; 100 i n t i ; / / t r u e v a r i a b l e 101 i n t k ; / / u n i f o r m v a r i a b l e 102 d o u b l e C u m u l = 0 . ; / / F o r c o m p u t i n g l a w c u m u l a t i v e s 103 d o u b l e u S t e p = 1 . / s i z e ; / / u n i f o r m s t e p 104 105 f o r ( i = 0 ; i t e r . h a s N e x t ( ) ; i ++ ) { / / c o m p u t e t h e c u m u l a t i v e o f i n D i s t 106 a s s i g n m e n t =( A s s i g n m e n t < P r o p >) i t e r . n e x t ( ) ; 107 m a p p e d A t t r i b u t e . a d d ( a s s i g n m e n t ) ; 108 C u m u l + = a s s i g n m e n t . v a l u e ; 109 c u m u l a t i v e D i s t r i b u t i o n _ S a m p l e r [ i ] = C u m u l ; 110 } 111 f o r ( i = 0 ; i < s i z e ; i ++ ) c u m u l a t i v e D i s t r i b u t i o n _ S a m p l e r [ i ] / = C u m u l ; / / ← ֓ n o r m a l i z e i t 112 j u m p T a b l e _ S a m p l e r [ 0 ] = ( i = 0 ) ; 113 C u m u l = u S t e p ; 114 f o r ( k = 1 ; k < s i z e ; k ++ ) { 115 w h i l e ( c u m u l a t i v e D i s t r i b u t i o n _ S a m p l e r [ i ]<= C u m u l ) i ++; 116 j u m p T a b l e _ S a m p l e r [ k ] = i ; 117 C u m u l + = u S t e p ; 118 } 119 r e t u r n t r u e ; 120 } 121 122 p r o t e c t e d b o o l e a n s e t T a b l e s _ m i x e r ( d o u b l e [ ] i n D i s t ) { 123 i n t i ; / / t r u e v a r i a b l e 124 i n t k ; / / u n i f o r m v a r i a b l e 125 d o u b l e C u m u l = 0 . ; / / F o r c o m p u t i n g l a w c u m u l a t i v e s 126 d o u b l e u S t e p = 1 . / i n D i s t . l e n g t h ; / / u n i f o r m s t e p 127 c u m u l a t i v e D i s t r i b u t i o n _ M i x e r = n e w d o u b l e [ i n D i s t . l e n g t h ] ; 128 j u m p T a b l e _ M i x e r = new i n t [ i n D i s t . l e n g t h ] ; 129 f o r ( i = 0 ; i < i n D i s t . l e n g t h ; i ++) { / / c o m p u t e t h e c u m u l a t i v e o f i n D i s t 130 C u m u l + = i n D i s t [ i ] ; 131 c u m u l a t i v e D i s t r i b u t i o n _ M i x e r [ i ] = C u m u l ; 132 } 133 f o r ( i = 0 ; i < i n D i s t . l e n g t h ; i ++) 134 c u m u l a t i v e D i s t r i b u t i o n _ M i x e r [ i ] / = C u m u l ; / / n o r m a l i z e i t 135 j u m p T a b l e _ M i x e r [ 0 ] = ( i = 0 ) ; 136 C u m u l = u S t e p ; 137 f o r ( k = 1 ; k < i n D i s t . l e n g t h ; k ++ ) { 138 w h i l e ( c u m u l a t i v e D i s t r i b u t i o n _ M i x e r [ i ]<= C u m u l ) i ++; 139 j u m p T a b l e _ M i x e r [ k ] = i ; 140 C u m u l + = u S t e p ; 93 141 } 142 r e t u r n t r u e ; 143 } 144 145 p r o t e c t e d i n t d r a w T a b l e _ s a m p l e r ( ) { 146 i f ( _ _ u p d a t e d ) i f ( ! s e t T a b l e s _ s a m p l e r ( ) ) r e t u r n − 1 ; 147 d o u b l e x = r n g . n e x t D o u b l e ( ) ; 148 i n t i = j u m p T a b l e _ S a m p l e r [ ( i n t ) ( j u m p T a b l e _ S a m p l e r . l e n g t h ∗ x ) ] ; 149 w h i l e ( x > = c u m u l a t i v e D i s t r i b u t i o n _ S a m p l e r [ i ] ) i ++; 150 r e t u r n i ; 151 } 152 153 p r o t e c t e d i n t d r a w T a b l e _ m i x e r ( ) { 154 d o u b l e x = r n g . n e x t D o u b l e ( ) ; 155 i n t i = j u m p T a b l e _ M i x e r [ ( i n t ) ( j u m p T a b l e _ M i x e r . l e n g t h ∗ x ) ] ; 156 w h i l e ( x > = c u m u l a t i v e D i s t r i b u t i o n _ M i x e r [ i ] ) i ++; 157 r e t u r n i ; 158 } 159 160 161 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 162 / / p u b l i c p a r t 163 / / / / / / / / / / / / / / / 164 165 @ O v e r r i d e 166 p u b l i c v o i d u p d a t e _ n o t i f i c a t i o n ( ) { / / c a l l e d e a c h t i m e a c h a n g e i s d o n e 167 s u p e r . u p d a t e _ n o t i f i c a t i o n ( ) ; 168 _ _ u p d a t e d = t r u e ; 169 } 170 171 p u b l i c d o u b l e l e a r n F r o m ( A r r a y L i s t < A s s i g n m e n t < P r o p > > w e i g h t e d S a m p l e s ) { 172 i n t i , n b S a m p l e s ; 173 d o u b l e n o r m a l i z e r , a V a l u e , Z ; 174 P r o p a P r o p o s i t i o n ; 175 A s s i g n m e n t < P r o p > a n A s s i g n m e n t ; 176 n b S a m p l e s = w e i g h t e d S a m p l e s . s i z e ( ) ; 177 Z = ( n o r m a l i z e r = 0 . ) ; 178 179 f o r ( i = 0 ; i < n b S a m p l e s ; i ++ ) { 180 a n A s s i g n m e n t = w e i g h t e d S a m p l e s . g e t ( i ) ; 181 a V a l u e = a n A s s i g n m e n t . v a l u e ; 182 i f ( a V a l u e <=0) { 183 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 184 " . l e a r n F r o m ( A r r a y L i s t >) " ) ; 185 S y s t e m . e r r . p r i n t l n ( " N e g a t i v e w e i g h t e n c o u n t e r e d " ) ; 186 S y s t e m . e x i t ( 0 ) ; 187 } 188 a P r o p o s i t i o n = a n A s s i g n m e n t . a t t r i b u t e ; 189 i f ( t h e Z e r o = = n u l l ) t h e Z e r o = a P r o p o s i t i o n . i n s t a n c e N s i z e ( ) . z e r o ( ) ; 190 i f ( a P r o p o s i t i o n . c o m p a r e T o ( t h e Z e r o ) ==0) Z + = a V a l u e ; 191 e l s e n o r m a l i z e r + = a V a l u e ; 192 } 193 c l e a r ( ) ; 194 f o r ( i = 0 ; i < n b S a m p l e s ; i ++ ) { 195 a n A s s i g n m e n t = w e i g h t e d S a m p l e s . g e t ( i ) ; 196 a V a l u e = a n A s s i g n m e n t . v a l u e / n o r m a l i z e r ; 197 a P r o p o s i t i o n = a n A s s i g n m e n t . a t t r i b u t e ; 198 i f ( a P r o p o s i t i o n . c o m p a r e T o ( t h e Z e r o ) ! = 0 ) a d d ( a P r o p o s i t i o n , a V a l u e ) ; 199 } 200 r e t u r n Z / ( Z + n o r m a l i z e r ) ; / / r e t u r n t h e p e r c e n t a g e o f r e j e c t 201 } 202 203 p u b l i c A s s i g n m e n t < P r o p > m a k e S a m p l e ( ) { 204 A s s i g n m e n t < P r o p > a s s i g n m e n t = ne w A s s i g n m e n t < P r o p > ( ) ; 205 a s s i g n m e n t . v a l u e = 1 . ; 206 a s s i g n m e n t . a t t r i b u t e = m a p p e d A t t r i b u t e . g e t ( d r a w T a b l e _ s a m p l e r ( ) ) . a t t r i b u t e ; 207 r e t u r n a s s i g n m e n t ; 208 } 209 210 p u b l i c b o o l e a n s e t F u s e r ( s B l e f t , s B r i g h t , 211 R e f e r e e F u n c t i o n D e f a u l t < P r o p > t h e R e f e r e e F u n c t i o n ) { 212 A r r a y L i s t < s B > b b a T a b = ne w A r r a y L i s t < s B > ( ) ; 213 b b a T a b . a d d ( l e f t ) ; 214 b b a T a b . a d d ( r i g h t ) ; 94 215 r e t u r n s e t F u s e r ( b b a T a b , t h e R e f e r e e F u n c t i o n ) ; 216 } 217 218 p u b l i c b o o l e a n s e t F u s e r ( A r r a y L i s t < s B > b b a I n , 219 R e f e r e e F u n c t i o n D e f a u l t < P r o p > a R e f e r e e F u n c t i o n ) { 220 i n t i ; 221 t h e R e f e r e e F u n c t i o n = a R e f e r e e F u n c t i o n ; 222 f u s e r S o u r c e s = b b a I n ; 223 B B A S o u r c e s . c l e a r ( ) ; 224 f o r ( i = 0 ; i < f u s e r S o u r c e s . s i z e ( ) ; i ++ ) B B A S o u r c e s . a d d ( f u s e r S o u r c e s . g e t ( i ) ) ; 225 226 f o r ( i = 0 ; i < b b a I n . s i z e ( ) ; i ++ ) { 227 i f ( ! b b a I n . g e t ( i ) . s e t T a b l e s _ s a m p l e r ( ) ) r e t u r n f a l s e ; 228 } 229 a n s w e r e d A t t r i b u t e = new A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 230 f o r ( i = 0 ; i < b b a I n . s i z e ( ) ; i ++ ) a n s w e r e d A t t r i b u t e . a d d ( n u l l ) ; 231 r e t u r n t r u e ; 232 } 233 234 p u b l i c A s s i g n m e n t < P r o p > m a k e F u s e d S a m p l e ( ) { 235 A s s i g n m e n t < P r o p > a s s i g n m e n t = ne w A s s i g n m e n t < P r o p > ( ) ; 236 A s s i g n m e n t < P r o p > a s s i g n m e n t F r o m S o u r c e ; 237 A r r a y L i s t < A s s i g n m e n t < P r o p > > f u s e d A s s i g n m e n t ; 238 i n t i ; 239 d o u b l e c u m u l = 0 . ; 240 d o u b l e x = r n g . n e x t D o u b l e ( ) ; 241 a s s i g n m e n t . v a l u e = 1 . ; 242 f o r ( i = 0 ; i < f u s e r S o u r c e s . s i z e ( ) ; i ++ ) { 243 s B a S o u r c e = f u s e r S o u r c e s . g e t ( i ) ; 244 a s s i g n m e n t F r o m S o u r c e = a S o u r c e . m a p p e d A t t r i b u t e . g e t ( a S o u r c e . ← ֓ d r a w T a b l e _ s a m p l e r ( ) ) ; 245 a n s w e r e d A t t r i b u t e . s e t ( i , a s s i g n m e n t F r o m S o u r c e ) ; 246 } 247 f u s e d A s s i g n m e n t = t h e R e f e r e e F u n c t i o n . r e f e r e e F u n c t i o n ( a n s w e r e d A t t r i b u t e , ← ֓ B B A S o u r c e s ) ; 248 f o r ( i = 0 ; i < f u s e d A s s i g n m e n t . s i z e ( ) ; i ++ ) { 249 c u m u l + = f u s e d A s s i g n m e n t . g e t ( i ) . v a l u e ; 250 i f ( c u m u l > x ) { 251 a s s i g n m e n t . a t t r i b u t e = f u s e d A s s i g n m e n t . g e t ( i ) . a t t r i b u t e ; 252 r e t u r n a s s i g n m e n t ; 253 } 254 } 255 r e t u r n n u l l ; 256 } 257 258 p u b l i c b o o l e a n s e t M i x e r ( d o u b l e [ ] w e i g h t s , A r r a y L i s t < s B > b b a I n ) { 259 i f ( w e i g h t s . l e n g t h ! = b b a I n . s i z e ( ) ) r e t u r n f a l s e ; 260 m i x e r S o u r c e s = b b a I n ; 261 r e t u r n s e t T a b l e s _ m i x e r ( w e i g h t s ) ; 262 } 263 264 p u b l i c s B m a k e M i x e d C h o i c e ( ) { 265 i f ( c u m u l a t i v e D i s t r i b u t i o n _ M i x e r = = n u l l ) r e t u r n n u l l ; 266 i n t c h o i c e = d r a w T a b l e _ m i x e r ( ) ; 267 r e t u r n m i x e r S o u r c e s . g e t ( c h o i c e ) ; 268 } 269 } 95 Source Co de: RefereeT o ol b ox_T utorial.ja v a 1 / ∗ 2 ∗ R e f e r e e T o o l b o x _ T u t o r i a l . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; T u t o r i a l . 3 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 4 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 5 ∗ 6 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 7 ∗ 8 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 9 ∗ 10 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 11 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 12 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 13 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 14 ∗ 15 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 16 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 17 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 18 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 19 ∗ 20 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 21 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 22 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 23 ∗ / 24 25 p a c k a g e R e f e r e e T o o l b o x ; 26 27 / / j u s t e p o u r t e s t s 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ C l a s s p r o v i d i n g a t u t o r i a l f o r p a c k a g e R e f e r e e T o o l b o x . 32 ∗ 33 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 34 ∗ 35 ∗ 36 ∗ 37 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 38 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 39 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 40 ∗ < B R > 41 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 42 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 43 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 44 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 47 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 48 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 49 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 50 ∗ < B R > 51 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 52 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 53 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 54 ∗ < / t a b l e > < B R > 55 ∗ 56 ∗ / 57 p u b l i c c l a s s R e f e r e e T o o l b o x _ T u t o r i a l { 58 59 / ∗ ∗ 60 ∗ C o m p a r e d i f f e r e n t r e f e r e e f u n c t i o n s a p p l i e d w i t h R e f e r e e F u s e r a n d P o w e r s e t . 61 ∗ 62 ∗ < B R > < B R > 63 ∗ < b > D e t a i l e d c o d e d e s c r i p t i o n . < / b > < B R > 64 ∗ Th e f o l l o w i n g t y p o n o m i c c o n v e n t i o n s a r e u s e d : 65 ∗ 66 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 67 ∗ B l u e c o l o r i s u s e d f o r c o m m e n t i n g t h e f o l l o w i n g c o d e . 68 ∗ < B R > 69 ∗ c o d e f o r m a t i n g i s u s e d f o r p r i n t i n g t h e c o d e . 70 ∗ < f o n t c o l o r = " #F F 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 71 ∗ Re d c o l o r i s u s e d f o r p r i n t i n g t h e p o s s i b l e o u t p u t r e s u l t i n g o f t h e 96 72 ∗ p r e v i o u s c o d e . 73 ∗ 74 ∗ < B R > 75 ∗ < B R > < B R > 76 ∗ Co mm e nt ed c o d e : 77 ∗ < B R > < B R > 78 ∗ 79 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 80 ∗ D e c l a r a t i o n o f p r o p o s i t o n < i > A a s c l a s s < i >f i n a l P o w e r s e t a n d i t s 81 ∗ c r e a t i o n ; 82 ∗ < B R > 83 ∗ f i n a l P o w e r s e t A = ne w f i n a l P o w e r s e t ( ) ; 84 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 85 ∗ S e t t h e s i z e o f t h e p o w e r s e t t o < i >3 ; Th e n s e t < i > A t o t h e a t o m i c 86 ∗ p r o p o s i t i o n i n d i c e d b y < i >0 < / i > ; 87 ∗ < B R > 88 ∗ A . s i z e ( 3 ) ; A . a t o m i c ( 0 ) ; 89 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 90 ∗ D e c l a r a t i o n o f < i > B a s < i > f i n a l P o w e r s e t < / i > a n d i t s c r e a t i o n a n d s i z i n g 91 ∗ a s i n s t a n c e o f < i > A ; Th e n s e t B t o t h e a t o m i c p r o p o s i t i o n ← ֓ i n d i c e d 92 ∗ b y < i >1 < / i > ; 93 ∗ < B R > 94 ∗ f i n a l P o w e r s e t B = A . i n s t a n c e N s i z e ( ) ; B . a t o m i c ( 1 ) ; 95 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 96 ∗ D e c l a r a t i o n o f < i > C a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d s i z i n g 97 ∗ a s i n s t a n c e o f < i > A ; Th e n s e t C < / i > t o t h e a t o m i c p r o p o s i t i o n ← ֓ i n d i c e d 98 ∗ b y < i >2 < / i > ; 99 ∗ < B R > 100 ∗ f i n a l P o w e r s e t C = A . i n s t a n c e N s i z e ( ) ; C . a t o m i c ( 2 ) ; 101 ∗ //< B R > 102 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 103 ∗ D e c l a r a t i o n o f < i > A U B < / i > a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 104 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > A U B < / i > t o < i > A O R B ; 105 ∗ < B R > 106 ∗ f i n a l P o w e r s e t A U B = A . i n s t a n c e N s i z e ( ) ; A U B . o r ( A , B ) ; 107 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 108 ∗ D e c l a r a t i o n o f < i > B U C a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 109 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > B U C < / i > t o < i > B O R C ; 110 ∗ < B R > 111 ∗ D e c l a r a t i o n o f < i > C U A < / i > a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 112 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > C U A t o < i > C O R A ; 113 ∗ < B R > 114 ∗ f i n a l P o w e r s e t B U C = A . i n s t a n c e N s i z e ( ) ; B U C . o r ( B , C ) ; 115 ∗ f i n a l P o w e r s e t C U A = A . i n s t a n c e N s i z e ( ) ; C U A . o r ( C , A ) ; 116 ∗ //< B R > 117 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 118 ∗ D e c l a r a t i o n o f < i > z e r o a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 119 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > z e r o t o z e r o ; 120 ∗ < B R > 121 ∗ D e c l a r a t i o n o f < i >o n e a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 122 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i >o n e < / i > t o o n e ; 123 ∗ < B R > 124 ∗ f i n a l P o w e r s e t z e r o = A . i n s t a n c e N s i z e ( ) ; z e r o . z e r o ( ) ; 125 ∗ f i n a l P o w e r s e t o n e= A . i n s t a n c e N s i z e ( ) ; o n e . o n e ( ) ; 126 ∗ //< B R > 127 ∗ //< B R > 128 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 129 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 1 a s a ← ֓ D e m p s t e r 130 ∗ S h a f e r r e f e r e e f u n c t i o n o n p o w e r s e t ; 131 ∗ < B R > 132 ∗ R F D e m p s t e r _ P o w e r s e t r e f e r e e 1 = n ew R F D e m p s t e r _ P o w e r s e t ( ) ; 133 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 134 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 2 a s a ← ֓ D i s j u n c t i v e 135 ∗ r e f e r e e f u n c t i o n o n p o w e r s e t ; 136 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 3 a s a 97 137 ∗ D u b o i s & P r a d e r e f e r e e f u n c t i o n o n p o w e r s e t ; 138 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 4 a s a PC R 6 139 ∗ r e f e r e e f u n c t i o n o n p o w e r s e t ; 140 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 5 a s a P C R # 141 ∗ r e f e r e e f u n c t i o n o n p o w e r s e t ; 142 ∗ < B R > 143 ∗ R F D i s j u n c t i v e _ P o w e r s e t r e f e r e e 2 = n ew R F D i s j u n c t i v e _ P o w e r s e t ( ) ; 144 ∗ R F D u b o i s P r a d e _ P o w e r s e t r e f e r e e 3 = n e w R F D u b o i s P r a d e _ P o w e r s e t ( ) ; 145 ∗ R FP CR 6_P o we rse t r e f e r e e 4 = n e w RFP CR 6_P o we rse t ( ) ; 146 ∗ RF P CR S h a r p _ P o w e r s e t r e f e r e e 5 = ne w R F P C R S h a r p _ P o w e r s e t ( ) ; 147 ∗ //< B R > 148 ∗ //< B R > 149 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 150 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e b a s i c b e l i e f a s s i g n m e n t < i >a F u s e r 1 < / i > , a 151 ∗ b b a d e f i n e d o v e r p o w e r s e t a n d w i t h t h e c a p a b i l i t y t o h a n d l e f u s i o n b y m e a n s 152 ∗ o f r e f e r e e f u n c t i o n s ( c l a s s { @ l i n k f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t } ) ; 153 ∗ < B R > 154 ∗ f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 1 = n e w f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t ( ) ← ֓ ; 155 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 156 ∗ Add a s s i g n m e n t < i > ( A , 0 . 0 9 ) t o b b a < i >a F u s e r 1 ; 157 ∗ < B R > 158 ∗ a F u s e r 1 . a d d ( A , 0 . 0 9 ) ; 159 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 160 ∗ Add a s s i g n m e n t < i > ( B , 0 . 2 ) t o b b a < i >a F u s e r 1 < / i >;< B R > 161 ∗ Add a s s i g n m e n t < i > ( C , 0 . 0 2 ) t o bb a < i >a F u s e r 1 < / i >;< B R > 162 ∗ Add a s s i g n m e n t < i > ( A U B, 0 . 0 5 ) t o b b a < i >a F u s e r 1 < / i >;< B R > 163 ∗ Add a s s i g n m e n t < i > ( B U C, 0 . 0 3 ) t o b b a < i >a F u s e r 1 ;< B R > 164 ∗ Add a s s i g n m e n t < i > ( C U A, 0 . 1 ) t o b b a < i >a F u s e r 1 < / i > ; 165 ∗ < B R > 166 ∗ a F u s e r 1 . a d d ( B , 0 . 2 ) ; 167 ∗ a F u s e r 1 . a d d ( C , 0 . 0 2 ) ; 168 ∗ a F u s e r 1 . a d d ( A U B, 0 . 0 5 ) ; 169 ∗ a F u s e r 1 . a d d ( B U C , 0 . 0 3 ) ; 170 ∗ a F u s e r 1 . a d d ( C U A, 0 . 1 ) ; 171 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 172 ∗ Add a s s i g n m e n t < i > ( A , 0 . 1 1 ) t o b b a < i >a F u s e r 1 . T h i s a s s i g n m e n t i s 173 ∗ < i >a d d e d t o p r e v i e w s l y a d d e d a s s i g n m e n t < i >( A , 0 . 0 9 ) , r e s u l t i n g i n 174 ∗ t o t a l a s s i g n m e n t < i > ( A , 0 . 2 ) ; 175 ∗ < B R > 176 ∗ a F u s e r 1 . a d d ( A , 0 . 1 1 ) ; 177 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 178 ∗ Add a s s i g n m e n t < i > ( o n e , 0 . 4 ) t o b b a a F u s e r 1 < / i > ; 179 ∗ < B R > 180 ∗ a F u s e r 1 . a d d ( o n e , 0 . 4 ) ; 181 ∗ //< B R > 182 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 183 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e b a s i c b e l i e f a s s i g n m e n t < i >a F u s e r 2 < / i > , a 184 ∗ b b a d e f i n e d o v e r p o w e r s e t a n d w i t h t h e c a p a b i l i t y t o h a n d l e f u s i o n b y m e a n s 185 ∗ o f r e f e r e e f u n c t i o n s ( c l a s s { @ l i n k f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t } ) ; 186 ∗ < B R > 187 ∗ f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 2 = a F u s e r 1 . i n s t a n c e ( ) ; 188 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 189 ∗ Add a s s i g n m e n t < i > ( A , 0 . 1 ) t o b b a < i >a F u s e r 2 < / i >;< B R > 190 ∗ Add a s s i g n m e n t < i > ( B , 0 . 1 ) t o b b a < i >a F u s e r 2 < / i >;< B R > 191 ∗ Add a s s i g n m e n t < i > ( C , 0 . 2 ) t o b b a < i >a F u s e r 2 < / i >;< B R > 192 ∗ Add a s s i g n m e n t < i > ( A U B, 0 . 2 ) t o b b a < i >a F u s e r 2 ;< B R > 193 ∗ Add a s s i g n m e n t < i > ( B U C , 0 . 1 ) t o b b a < i >a F u s e r 2 < / i >;< BR > 194 ∗ Add a s s i g n m e n t < i > ( C U A, 0 . 1 ) t o b b a < i >a F u s e r 2 < / i >;< B R > 195 ∗ Add a s s i g n m e n t < i > ( o n e , 0 . 2 ) t o b b a a F u s e r 2 < / i > ; 196 ∗ < B R > 197 ∗ a F u s e r 2 . a d d ( A , 0 . 1 ) ; 198 ∗ a F u s e r 2 . a d d ( B , 0 . 1 ) ; 199 ∗ a F u s e r 2 . a d d ( C , 0 . 2 ) ; 200 ∗ a F u s e r 2 . a d d ( A U B , 0 . 2 ) ; 201 ∗ a F u s e r 2 . a d d ( B U C , 0 . 1 ) ; 202 ∗ a F u s e r 2 . a d d ( C U A, 0 . 1 ) ; 203 ∗ a F u s e r 2 . a d d ( o n e , 0 . 2 ) ; 204 ∗ //< B R > 205 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 206 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e b a s i c b e l i e f a s s i g n m e n t < i >a F u s e r , a 207 ∗ b b a d e f i n e d o v e r p o w e r s e t a n d w i t h t h e c a p a b i l i t y t o h a n d l e f u s i o n b y m e a n s 208 ∗ o f r e f e r e e f u n c t i o n s ( c l a s s { @ l i n k f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t } ) ; 209 ∗ < B R > 98 210 ∗ f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r = a F u s e r 1 . i n s t a n c e ( ) ; 211 ∗ //< B R > 212 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 213 ∗ D e f i n e a comm on p r i n t mod e < i >p r i n t M o d e f o r t h e b b a s t a t e . 214 ∗ T h i s v a r i a b l e , s e t t o < i >1 < / i > , i m p l i e s t h e p r i n t t o b e a c c o r d i n g t o t h e 215 ∗ p r o p o s i t i o n o r d e r ; 216 ∗ < B R > 217 ∗ i n t p r i n t M o d e =1 ;< B R > 218 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 219 ∗ P r i n t t h e t i t l e o f t h e me t h o d ; 220 ∗ < B R > 221 ∗ S y s t e m . o u t . p r i n t l n (< B R > 222 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; 223 ∗ " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \ n " + < B R > 224 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; 225 ∗ " / / R e l a x e d M e t h o d \ n " + < B R > 226 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; 227 ∗ " / / / / / / / / / / / / / / / / / / / / \ n " ) ; 228 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 229 ∗ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 230 ∗ / / R e l a x e d M e t h o d< B R > 231 ∗ / / / / / / / / / / / / / / / / / / / / 232 ∗ < B R > 233 ∗ S y s t e m . o u t . p r i n t l n ( " a F u s e r 1 " ) ; 234 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 235 ∗ a F u s e r 1 236 ∗ < B R > 237 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 238 ∗ P r i n t t h e s t a t e o f < i >a F u s e r 1 . W i th o p t i o n < i >p r i n t M o d e =1 , t h e ← ֓ p r i n t i s 239 ∗ d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 240 ∗ < B R > 241 ∗ &n b s p ; &n b s p ; 242 ∗ S y s t e m . o u t . p r i n t l n ( a F u s e r 1 . s t a t e ( p r i n t M o d e ) ) ; 243 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 244 ∗ b b a T r e e A : 245 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 246 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 2 247 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 0 5 248 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 0 2 249 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 1 250 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 3 251 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 4 252 ∗ < B R > 253 ∗ &n b s p ; &n b s p ; 254 ∗ S y s t e m . o u t . p r i n t l n ( ) ; 255 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 256 ∗ P r i n t t h e s t a t e o f < i >a F u s e r 2 . W i th o p t i o n < i >p r i n t M o d e =1 , t h e ← ֓ p r i n t i s 257 ∗ d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 258 ∗ < B R > 259 ∗ S y s t e m . o u t . p r i n t l n ( " a F u s e r 2 " ) ; 260 ∗ &n b s p ; &n b s p ; 261 ∗ S y s t e m . o u t . p r i n t l n ( a F u s e r 2 . s t a t e ( p r i n t M o d e ) ) ; 262 ∗ &n b s p ; &n b s p ; 263 ∗ S y s t e m . o u t . p r i n t l n ( ) ; 264 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 265 ∗ a F u s e r 2< B R > 266 ∗ b b a T r e e A : 267 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 1 268 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 1 269 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 2 270 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 2 271 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 1 272 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 1 273 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 2 274 ∗ < B R > 275 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 276 ∗ S e t a F u s e r a s t h e f u s i o n o f < i >a F u s e r 1 a n d < i >a F u s e r 2 , ← ֓ a c c o r d i n g 277 ∗ t o t h e r e f e r e e f u n c t i o n < i > r e f e r e e 1 . A s a r e s u l t , a D e m p s t e r S h a f e r 278 ∗ c o m b i n a t i o n i s d o n e ; 279 ∗ < B R > 280 ∗ a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 1 ) ; 99 281 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 282 ∗ P r i n t t h e s t a t e o f < i >a F u s e r . W i t h o p t i o n < i >p r i n t M o d e =1 < / i > , t h e p r i n t ← ֓ i s 283 ∗ d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 284 ∗ < B R > 285 ∗ &n b s p ; &n b s p ; 286 ∗ S y s t e m . o u t . p r i n t l n ( " a F u s e r − D e m p s t e r " ) ; 287 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ a F u s e r . c o n f l i c t ( ) + " % " ) ; 288 ∗ &n b s p ; &n b s p ; 289 ∗ S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 290 ∗ &n b s p ; &n b s p ; 291 ∗ S y s t e m . o u t . p r i n t l n ( ) ; 292 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 293 ∗ a F u s e r − D e m p s t e r< B R > 294 ∗ C o n f l i c t Z = 0 . 1 9 1 0 0 0 0 0 0 0 0 0 0 0 0 0 6 % 295 ∗ b b a T r e e A : 296 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 4 7 2 1 8 7 8 8 6 2 7 9 3 5 7 5 < B R > 297 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 2 2 1 2 6 0 8 1 5 8 2 2 0 0 2 5 < B R > 298 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 2 3 6 0 9 3 9 4 3 1 3 9 6 7 8 8 < B R > 299 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 1 6 1 9 2 8 3 0 6 5 5 1 2 9 7 9 2 < B R > 300 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 0 8 6 5 2 6 5 7 6 0 1 9 7 7 7 4 9 < B R > 301 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 6 0 5 6 8 6 0 3 2 1 3 8 4 4 2 5 < B R > 302 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 0 9 8 8 8 7 5 1 5 4 5 1 1 7 4 2 9 303 ∗ < B R > 304 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 305 ∗ S e t a F u s e r a s t h e f u s i o n o f < i >a F u s e r 1 a n d < i >a F u s e r 2 , ← ֓ a c c o r d i n g 306 ∗ t o t h e r e f e r e e f u n c t i o n < i > r e f e r e e 2 . A s a r e s u l t , a d i s j u n c t i v e 307 ∗ c o m b i n a t i o n i s d o n e ; 308 ∗ < B R > 309 ∗ a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 2 ) ; 310 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 311 ∗ P r i n t t h e s t a t e o f < i >a F u s e r . W i t h o p t i o n < i >p r i n t M o d e =1 < / i > , t h e p r i n t ← ֓ i s 312 ∗ d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 313 ∗ < B R > 314 ∗ &n b s p ; &n b s p ; 315 ∗ S y s t e m . o u t . p r i n t l n ( " a F u s e r − D i s j u n c t i v e " ) ; 316 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ a F u s e r . c o n f l i c t ( ) + " % " ) ; 317 ∗ &n b s p ; &n b s p ; 318 ∗ S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 319 ∗ &n b s p ; &n b s p ; 320 ∗ S y s t e m . o u t . p r i n t l n ( ) ; 321 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 322 ∗ a F u s e r − D i s j u n c t i v e < B R > 323 ∗ C o n f l i c t Z = 0 . 0 % 324 ∗ b b a T r e e A : 325 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 0 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 3 < B R > 326 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 0 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 3 < B R > 327 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 < B R > 328 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 0 0 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 8 < B R > 329 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 1 0 3 9 9 9 9 9 9 9 9 9 9 9 9 9 7 < B R > 330 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 7 5 9 9 9 9 9 9 9 9 9 9 9 9 9 8 < B R > 331 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 6 3 6 332 ∗ < B R > 333 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 334 ∗ S e t a F u s e r a s t h e f u s i o n o f < i >a F u s e r 1 a n d < i >a F u s e r 2 , ← ֓ a c c o r d i n g 335 ∗ t o t h e r e f e r e e f u n c t i o n < i > r e f e r e e 3 . A s a r e s u l t , a D u b o i s & P r a d e 336 ∗ c o m b i n a t i o n i s d o n e ; 337 ∗ < B R > 338 ∗ a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 3 ) ; 339 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 340 ∗ P r i n t t h e s t a t e o f < i >a F u s e r . W i t h o p t i o n < i >p r i n t M o d e =1 < / i > , t h e p r i n t ← ֓ i s 341 ∗ d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 342 ∗ < B R > 343 ∗ &n b s p ; &n b s p ; 344 ∗ S y s t e m . o u t . p r i n t l n ( " a F u s e r − D u b o i s & P r a d e " ) ; 345 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ a F u s e r . c o n f l i c t ( ) + " % " ) ; 346 ∗ &n b s p ; &n b s p ; 347 ∗ S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 348 ∗ &n b s p ; &n b s p ; 349 ∗ S y s t e m . o u t . p r i n t l n ( ) ; 100 350 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 351 ∗ a F u s e r − D u b o i s & P r a d e< B R > 352 ∗ C o n f l i c t Z = 0 . 0 % 353 ∗ b b a T r e e A : 354 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 355 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 1 7 9 0 0 0 0 0 0 0 0 0 0 0 0 0 2 < B R > 356 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 4 357 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 1 3 1 < B R > 358 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 1 1 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 < B R > 359 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 9 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 < B R > 360 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 1 4 7 361 ∗ < B R > 362 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 363 ∗ S e t a F u s e r a s t h e f u s i o n o f < i >a F u s e r 1 a n d < i >a F u s e r 2 , ← ֓ a c c o r d i n g 364 ∗ t o t h e r e f e r e e f u n c t i o n < i > r e f e r e e 4 . A s a r e s u l t , a PC R 6 c o m b i n a t i o n 365 ∗ i s d o n e ; 366 ∗ < B R > 367 ∗ a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 4 ) ; 368 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 369 ∗ P r i n t t h e s t a t e o f < i >a F u s e r . W i t h o p t i o n < i >p r i n t M o d e =1 < / i > , t h e p r i n t ← ֓ i s 370 ∗ d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 371 ∗ < B R > 372 ∗ &n b s p ; &n b s p ; 373 ∗ S y s t e m . o u t . p r i n t l n ( " a F u s e r − P C R6 " ) ; 374 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ a F u s e r . c o n f l i c t ( ) + " % " ) ; 375 ∗ &n b s p ; &n b s p ; 376 ∗ S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 377 ∗ &n b s p ; &n b s p ; 378 ∗ S y s t e m . o u t . p r i n t l n ( ) ; 379 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 380 ∗ a F u s e r − PCR 6 < B R > 381 ∗ C o n f l i c t Z = 0 . 0 % 382 ∗ b b a T r e e A : 383 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 5 7 3 0 7 6 9 2 3 0 7 6 9 2 3 < B R > 384 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 2 3 9 0 0 0 0 0 0 0 0 0 0 0 0 0 5 < B R > 385 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 0 5 6 3 6 3 6 3 6 3 6 3 6 3 6 4 < B R > 386 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 1 8 0 0 3 0 3 0 3 0 3 0 3 0 3 0 4 < B R > 387 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 0 8 1 6 6 6 6 6 6 6 6 6 6 6 6 6 8 < B R > 388 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 5 6 3 5 8 9 7 4 3 5 8 9 7 4 3 5 6 < B R > 389 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 0 8 390 ∗ < B R > 391 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 392 ∗ S e t a F u s e r a s t h e f u s i o n o f < i >a F u s e r 1 a n d < i >a F u s e r 2 , ← ֓ a c c o r d i n g 393 ∗ t o t h e r e f e r e e f u n c t i o n < i > r e f e r e e 5 . A s a r e s u l t , a P C R # c o m b i n a t i o n 394 ∗ i s d o n e ; 395 ∗ < B R > 396 ∗ a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 5 ) ; 397 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 398 ∗ P r i n t t h e s t a t e o f < i >a F u s e r . W i t h o p t i o n < i >p r i n t M o d e =1 < / i > , t h e p r i n t ← ֓ i s 399 ∗ d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 400 ∗ < B R > 401 ∗ &n b s p ; &n b s p ; 402 ∗ S y s t e m . o u t . p r i n t l n ( " a F u s e r − P C R # " ) ; 403 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ a F u s e r . c o n f l i c t ( ) + " % " ) ; 404 ∗ &n b s p ; &n b s p ; 405 ∗ S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 406 ∗ &n b s p ; &n b s p ; 407 ∗ S y s t e m . o u t . p r i n t l n ( ) ; 408 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 409 ∗ a F u s e r − P C R # < B R > 410 ∗ C o n f l i c t Z = 0 . 0 % 411 ∗ b b a T r e e A : 412 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 5 7 3 0 7 6 9 2 3 0 7 6 9 2 3 < B R > 413 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 2 3 9 0 0 0 0 0 0 0 0 0 0 0 0 0 5 < B R > 414 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 0 5 6 3 6 3 6 3 6 3 6 3 6 3 6 4 < B R > 415 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 1 8 0 0 3 0 3 0 3 0 3 0 3 0 3 0 4 < B R > 416 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 0 8 1 6 6 6 6 6 6 6 6 6 6 6 6 6 8 < B R > 417 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 5 6 3 5 8 9 7 4 3 5 8 9 7 4 3 5 6 < B R > 418 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 0 8 419 ∗ < B R > 101 420 ∗ < B R > 421 ∗ 422 ∗ 423 ∗ / 424 p u b l i c v o i d R e f e r e e F u s e r R T S _ C o m p a r i s o n ( ) { 425 f i n a l P o w e r s e t A = new f i n a l P o w e r s e t ( ) ; 426 A . s i z e ( 3 ) ; A . a t o m i c ( 0 ) ; 427 f i n a l P o w e r s e t B = A . i n s t a n c e N s i z e ( ) ; B . a t o m i c ( 1 ) ; 428 f i n a l P o w e r s e t C = A . i n s t a n c e N s i z e ( ) ; C . a t o m i c ( 2 ) ; 429 / / 430 f i n a l P o w e r s e t A U B = A . i n s t a n c e N s i z e ( ) ; A U B . o r ( A , B ) ; 431 f i n a l P o w e r s e t B U C = A . i n s t a n c e N s i z e ( ) ; B U C . o r ( B , C ) ; 432 f i n a l P o w e r s e t C U A = A . i n s t a n c e N s i z e ( ) ; C U A . o r ( C , A ) ; 433 / / 434 f i n a l P o w e r s e t z e r o = A . i n s t a n c e N s i z e ( ) ; z e r o . z e r o ( ) ; 435 f i n a l P o w e r s e t o n e = A . i n s t a n c e N s i z e ( ) ; o n e . o n e ( ) ; 436 / / 437 / / 438 R F D e m p s t e r _ P o w e r s e t r e f e r e e 1 = ne w R F D e m p s t e r _ P o w e r s e t ( ) ; 439 R F D i s j u n c t i v e _ P o w e r s e t r e f e r e e 2 = ne w R F D i s j u n c t i v e _ P o w e r s e t ( ) ; 440 R F D u b o i s P r a d e _ P o w e r s e t r e f e r e e 3 = ne w R F D u b o i s P r a d e _ P o w e r s e t ( ) ; 441 R F P C R 6 _ P o w e r s e t r e f e r e e 4 = n e w R F P C R 6 _ P o w e r s e t ( ) ; 442 R F P C R S h a r p _ P o w e r s e t r e f e r e e 5 = ne w R F P C R S h a r p _ P o w e r s e t ( ) ; 443 / / 444 / / 445 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 1 = ne w f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t ← ֓ ( ) ; 446 a F u s e r 1 . a d d ( A , 0 . 0 9 ) ; 447 a F u s e r 1 . a d d ( B , 0 . 2 ) ; 448 a F u s e r 1 . a d d ( C , 0 . 0 2 ) ; 449 a F u s e r 1 . a d d ( A U B , 0 . 0 5 ) ; 450 a F u s e r 1 . a d d ( B U C , 0 . 0 3 ) ; 451 a F u s e r 1 . a d d ( C U A , 0 . 1 ) ; 452 a F u s e r 1 . a d d ( A , 0 . 1 1 ) ; 453 a F u s e r 1 . a d d ( o n e , 0 . 4 ) ; 454 / / 455 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 2 = a F u s e r 1 . i n s t a n c e ( ) ; 456 a F u s e r 2 . a d d ( A , 0 . 1 ) ; 457 a F u s e r 2 . a d d ( B , 0 . 1 ) ; 458 a F u s e r 2 . a d d ( C , 0 . 2 ) ; 459 a F u s e r 2 . a d d ( A U B , 0 . 2 ) ; 460 a F u s e r 2 . a d d ( B U C , 0 . 1 ) ; 461 a F u s e r 2 . a d d ( C U A , 0 . 1 ) ; 462 a F u s e r 2 . a d d ( o n e , 0 . 2 ) ; 463 / / 464 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r = a F u s e r 1 . i n s t a n c e ( ) ; 465 / / 466 467 i n t p r i n t M o d e = 1 ; 468 469 S y s t e m . o u t . p r i n t l n ( 470 " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \ n " + 471 " / / R e l a x e d Me t h o d \ n " + 472 " / / / / / / / / / / / / / / / / / / / / \ n " ) ; 473 474 S y s t e m . o u t . p r i n t l n ( " a F u s e r 1 " ) ; 475 S y s t e m . o u t . p r i n t l n ( a F u s e r 1 . s t a t e ( p r i n t M o d e ) ) ; 476 S y s t e m . o u t . p r i n t l n ( ) ; 477 S y s t e m . o u t . p r i n t l n ( " a F u s e r 2 " ) ; 478 S y s t e m . o u t . p r i n t l n ( a F u s e r 2 . s t a t e ( p r i n t M o d e ) ) ; 479 S y s t e m . o u t . p r i n t l n ( ) ; 480 a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 1 ) ; 481 S y s t e m . o u t . p r i n t l n ( " a F u s e r − D e m p s t e r " ) ; 482 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 483 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 484 S y s t e m . o u t . p r i n t l n ( ) ; 485 a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 2 ) ; 486 S y s t e m . o u t . p r i n t l n ( " a F u s e r − D i s j u n c t i v e " ) ; 487 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 488 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 489 S y s t e m . o u t . p r i n t l n ( ) ; 490 a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 3 ) ; 491 S y s t e m . o u t . p r i n t l n ( " a F u s e r − D u b o i s & P r a d e " ) ; 492 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 102 493 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 494 S y s t e m . o u t . p r i n t l n ( ) ; 495 a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 4 ) ; 496 S y s t e m . o u t . p r i n t l n ( " a F u s e r − P C R 6 " ) ; 497 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 498 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 499 S y s t e m . o u t . p r i n t l n ( ) ; 500 a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , r e f e r e e 5 ) ; 501 S y s t e m . o u t . p r i n t l n ( " a F u s e r − P C R #" ) ; 502 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 503 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 504 S y s t e m . o u t . p r i n t l n ( ) ; 505 506 } 507 508 / ∗ ∗ 509 ∗ Co m p a r e d i f f e r e n t r e f e r e e f u n c t i o n s a p p l i e d w i t h R e f e r e e S a m p l e r a n d ← ֓ P o w e r s e t . 510 ∗ 511 ∗ < B R > < B R > 512 ∗ D e t a i l e d c o d e d e s c r i p t i o n . < / b > < B R > 513 ∗ T he f o l l o w i n g t y p o n o m i c c o n v e n t i o n s a r e u s e d : 514 ∗ < c o d e > 515 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 516 ∗ B l u e c o l o r i s u s e d f o r c o m m e n t i n g t h e f o l l o w i n g c o d e . 517 ∗ < B R > 518 ∗ c o d e f o r m a t i n g i s u s e d f o r p r i n t i n g t h e c o d e . 519 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 520 ∗ R ed c o l o r i s u s e d f o r p r i n t i n g t h e p o s s i b l e o u t p u t r e s u l t i n g o f t h e 521 ∗ p r e v i o u s c o d e . 522 ∗ 523 ∗ < B R > 524 ∗ < B R > < B R > 525 ∗ C om me n te d c o d e : 526 ∗ < B R > < B R > 527 ∗ < c o d e > 528 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 529 ∗ D e c l a r a t i o n o f p r o p o s i t o n < i > A a s c l a s s < i >f i n a l P o w e r s e t a n d i t s 530 ∗ c r e a t i o n ; 531 ∗ < B R > 532 ∗ f i n a l P o w e r s e t A = ne w f i n a l P o w e r s e t ( ) ; 533 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 534 ∗ S e t t h e s i z e o f t h e p o w e r s e t t o < i >3 < / i > ; Th e n s e t A t o t h e a t o m i c 535 ∗ p r o p o s i t i o n i n d i c e d b y < i >0 < / i > ; 536 ∗ < B R > 537 ∗ A . s i z e ( 3 ) ; A . a t o m i c ( 0 ) ; 538 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 539 ∗ D e c l a r a t i o n o f < i > B a s < i > f i n a l P o w e r s e t < / i > a n d i t s c r e a t i o n a n d s i z i n g 540 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > B < / i > t o t h e a t o m i c p r o p o s i t i o n ← ֓ i n d i c e d 541 ∗ b y < i >1 ; 542 ∗ < B R > 543 ∗ f i n a l P o w e r s e t B = A . i n s t a n c e N s i z e ( ) ; B . a t o m i c ( 1 ) ; 544 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 545 ∗ D e c l a r a t i o n o f < i > C a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d s i z i n g 546 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > C t o t h e a t o m i c p r o p o s i t i o n ← ֓ i n d i c e d 547 ∗ b y < i >2 ; 548 ∗ < B R > 549 ∗ f i n a l P o w e r s e t C = A . i n s t a n c e N s i z e ( ) ; C . a t o m i c ( 2 ) ; 550 ∗ //< B R > 551 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 552 ∗ D e c l a r a t i o n o f < i > A U B < / i > a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 553 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > A U B < / i > t o < i > A O R B ; 554 ∗ < B R > 555 ∗ f i n a l P o w e r s e t A U B = A . i n s t a n c e N s i z e ( ) ; A U B . o r ( A , B ) ; 556 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 557 ∗ D e c l a r a t i o n o f < i > B U C a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 558 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > B U C < / i > t o < i > B O R C ; 559 ∗ < B R > 560 ∗ D e c l a r a t i o n o f < i > C U A < / i > a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 103 561 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > C U A t o < i > C O R A ; 562 ∗ < B R > 563 ∗ f i n a l P o w e r s e t B U C = A . i n s t a n c e N s i z e ( ) ; B U C . o r ( B , C ) ; 564 ∗ f i n a l P o w e r s e t C U A = A . i n s t a n c e N s i z e ( ) ; C U A . o r ( C , A ) ; 565 ∗ //< B R > 566 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 567 ∗ D e c l a r a t i o n o f < i > z e r o a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 568 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i > z e r o t o z e r o ; 569 ∗ < B R > 570 ∗ D e c l a r a t i o n o f < i >o n e a s < i > f i n a l P o w e r s e t a n d i t s c r e a t i o n a n d ← ֓ s i z i n g 571 ∗ a s i n s t a n c e o f < i > A ; T h e n s e t < i >o n e < / i > t o o n e ; 572 ∗ < B R > 573 ∗ f i n a l P o w e r s e t z e r o = A . i n s t a n c e N s i z e ( ) ; z e r o . z e r o ( ) ; 574 ∗ f i n a l P o w e r s e t o n e= A . i n s t a n c e N s i z e ( ) ; o n e . o n e ( ) ; 575 ∗ //< B R > 576 ∗ //< B R > 577 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 578 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 1 a s a ← ֓ D e m p s t e r 579 ∗ S h a f e r r e f e r e e f u n c t i o n o n p o w e r s e t ; 580 ∗ < B R > 581 ∗ R F D e m p s t e r _ P o w e r s e t r e f e r e e 1 = n ew R F D e m p s t e r _ P o w e r s e t ( ) ; 582 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 583 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 2 a s a ← ֓ D i s j u n c t i v e 584 ∗ r e f e r e e f u n c t i o n o n p o w e r s e t ; 585 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 3 a s a 586 ∗ D u b o i s & P r a d e r e f e r e e f u n c t i o n o n p o w e r s e t ; 587 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 4 a s a PC R 6 588 ∗ r e f e r e e f u n c t i o n o n p o w e r s e t ; 589 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e r e f e r e e f u n c t i o n < i > r e f e r e e 5 a s a P C R # 590 ∗ r e f e r e e f u n c t i o n o n p o w e r s e t ; 591 ∗ < B R > 592 ∗ R F D i s j u n c t i v e _ P o w e r s e t r e f e r e e 2 = n ew R F D i s j u n c t i v e _ P o w e r s e t ( ) ; 593 ∗ R F D u b o i s P r a d e _ P o w e r s e t r e f e r e e 3 = n e w R F D u b o i s P r a d e _ P o w e r s e t ( ) ; 594 ∗ R FP CR 6_P o we rse t r e f e r e e 4 = n e w RFP CR 6_P o we rse t ( ) ; 595 ∗ RF P CR S h a r p _ P o w e r s e t r e f e r e e 5 = ne w R F P C R S h a r p _ P o w e r s e t ( ) ; 596 ∗ //< B R > 597 ∗ //< B R > 598 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 599 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e b a s i c b e l i e f a s s i g n m e n t < i >a S a m p l e r 1 , a 600 ∗ b b a d e f i n e d o v e r p o w e r s e t a n d w i t h t h e c a p a b i l i t y t o h a n d l e f u s i o n b y m e a n s 601 ∗ o f r e f e r e e s a m p l i n g ( c l a s s { @ l i n k f i n a l R e f e r e e S a m p l e r _ P o w e r s e t } ) ; 602 ∗ < B R > 603 ∗ f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r 1 = n e w f i n a l R e f e r e e S a m p l e r _ P o w e r s e t ( ) ← ֓ ; 604 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 605 ∗ Add a s s i g n m e n t < i > ( A , 0 . 0 9 ) t o b b a < i >a S a m p l e r 1 < / i > ; 606 ∗ < B R > 607 ∗ a S a m p l e r 1 . a d d ( A , 0 . 0 9 ) ; 608 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 609 ∗ Add a s s i g n m e n t < i > ( B , 0 . 2 ) t o b b a < i >a S a m p l e r 1 ;< BR > 610 ∗ Add a s s i g n m e n t < i > ( C , 0 . 0 2 ) t o bb a < i >a S a m p l e r 1 ;< B R > 611 ∗ Add a s s i g n m e n t < i > ( A U B, 0 . 0 5 ) t o b b a < i >a S a m p l e r 1 ;< B R > 612 ∗ Add a s s i g n m e n t < i > ( B U C, 0 . 0 3 ) t o b b a < i >a S a m p l e r 1 ;< B R > 613 ∗ Add a s s i g n m e n t < i > ( C U A, 0 . 1 ) t o b b a < i >a S a m p l e r 1 ; 614 ∗ < B R > 615 ∗ a S a m p l e r 1 . a d d ( B , 0 . 2 ) ; 616 ∗ a S a m p l e r 1 . a d d ( C , 0 . 0 2 ) ; 617 ∗ a S a m p l e r 1 . a d d ( A U B, 0 . 0 5 ) ; 618 ∗ a S a m p l e r 1 . a d d ( B U C, 0 . 0 3 ) ; 619 ∗ a S a m p l e r 1 . a d d ( C U A, 0 . 1 ) ; 620 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 621 ∗ Add a s s i g n m e n t < i > ( A , 0 . 1 1 ) t o b b a < i >a S a m p l e r 1 < / i > . T h i s a s s i g n m e n t i s 622 ∗ < i >a d d e d t o p r e v i e w s l y a d d e d a s s i g n m e n t < i >( A , 0 . 0 9 ) , r e s u l t i n g i n 623 ∗ t o t a l a s s i g n m e n t < i > ( A , 0 . 2 ) ; 624 ∗ < B R > 625 ∗ a S a m p l e r 1 . a d d ( A , 0 . 1 1 ) ; 626 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 627 ∗ Add a s s i g n m e n t < i > ( o n e , 0 . 4 ) t o b b a a S a m p l e r 1 ; 628 ∗ < B R > 629 ∗ a S a m p l e r 1 . a d d ( o n e , 0 . 4 ) ; 104 630 ∗ //< B R > 631 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 632 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e b a s i c b e l i e f a s s i g n m e n t < i >a S a m p l e r 2 , a 633 ∗ b b a d e f i n e d o v e r p o w e r s e t a n d w i t h t h e c a p a b i l i t y t o h a n d l e f u s i o n b y m e a n s 634 ∗ o f r e f e r e e s a m p l i n g ( c l a s s { @ l i n k f i n a l R e f e r e e S a m p l e r _ P o w e r s e t } ) ; 635 ∗ < B R > 636 ∗ f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r 2 = a S a m p l e r 1 . i n s t a n c e ( ) ; 637 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 638 ∗ Add a s s i g n m e n t < i > ( A , 0 . 1 ) t o b b a < i >a S a m p l e r 2 ;< B R > 639 ∗ Add a s s i g n m e n t < i > ( B , 0 . 1 ) t o b b a < i >a S a m p l e r 2 ;< BR > 640 ∗ Add a s s i g n m e n t < i > ( C , 0 . 2 ) t o b b a < i >a S a m p l e r 2 ;< B R > 641 ∗ Add a s s i g n m e n t < i > ( A U B, 0 . 2 ) t o b b a < i >a S a m p l e r 2 ;< B R > 642 ∗ Add a s s i g n m e n t < i > ( B U C , 0 . 1 ) t o b b a < i >a S a m p l e r 2 < / i >;< B R > 643 ∗ Add a s s i g n m e n t < i > ( C U A, 0 . 1 ) t o b b a < i >a S a m p l e r 2 ;< B R > 644 ∗ Add a s s i g n m e n t < i > ( o n e , 0 . 2 ) t o b b a a S a m p l e r 2 ; 645 ∗ < B R > 646 ∗ a S a m p l e r 2 . a d d ( A , 0 . 1 ) ; 647 ∗ a S a m p l e r 2 . a d d ( B , 0 . 1 ) ; 648 ∗ a S a m p l e r 2 . a d d ( C , 0 . 2 ) ; 649 ∗ a S a m p l e r 2 . a d d ( A U B, 0 . 2 ) ; 650 ∗ a S a m p l e r 2 . a d d ( B U C, 0 . 1 ) ; 651 ∗ a S a m p l e r 2 . a d d ( C U A, 0 . 1 ) ; 652 ∗ a S a m p l e r 2 . a d d ( o n e , 0 . 2 ) ; 653 ∗ //< B R > 654 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 655 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e b a s i c b e l i e f a s s i g n m e n t < i >a S a m p l e r , a 656 ∗ b b a d e f i n e d o v e r p o w e r s e t a n d w i t h t h e c a p a b i l i t y t o h a n d l e f u s i o n b y m e a n s 657 ∗ o f r e f e r e e s a m p l i n g ( c l a s s { @ l i n k f i n a l R e f e r e e S a m p l e r _ P o w e r s e t } ) ; 658 ∗ < B R > 659 ∗ f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r = a S a m p l e r 1 . i n s t a n c e ( ) ; 660 ∗ //< B R > 661 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 662 ∗ D e f i n e a comm on p r i n t mod e < i >p r i n t M o d e f o r t h e b b a s t a t e . 663 ∗ T h i s v a r i a b l e , s e t t o < i >1 < / i > , i m p l i e s t h e p r i n t t o b e a c c o r d i n g t o t h e 664 ∗ p r o p o s i t i o n o r d e r ; 665 ∗ < B R > 666 ∗ i n t p r i n t M o d e =1 ;< B R > 667 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 668 ∗ P r i n t t h e t i t l e o f t h e me t h o d ; 669 ∗ < B R > 670 ∗ S y s t e m . o u t . p r i n t l n (< B R > 671 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; 672 ∗ " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \ n " + < B R > 673 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; 674 ∗ " / / S a m p l i n g M e t h o d \ n " + < B R > 675 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; 676 ∗ " / / / / / / / / / / / / / / / / / / / / \ n " ) ; 677 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 678 ∗ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 679 ∗ / / S a m p l i n g Me t h od< B R > 680 ∗ / / / / / / / / / / / / / / / / / / / / 681 ∗ < B R > 682 ∗ 683 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 684 ∗ V a r i a b l e s d e c l a r a t i o n . 685 ∗ < i > n a n d < i > Z< / i > a r e i n s t r u m e n t a l a n d u s e d f o r s a m p l e i n d i c e s a n d ← ֓ c o n t r a d i c t i o n 686 ∗ d e g r e e r e p e c t i v e l y . 687 ∗ < i >Nb S a m p l e s s t o r e s t h e n u m b e r o f s a m p l e s g e n e r a t e d b y e a c h c o m p u t a t i o n ← ֓ ; 688 ∗ < B R > 689 ∗ i n t n ; 690 ∗ i n t N b S a m p l e s = 1 0 0 0 0 0 0 ; 691 ∗ d o u b l e Z ; 692 ∗ 693 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 694 ∗ D e c l a r a t i o n a n d c r e a t i o n o f t h e b a s i c b e l i e f a s s i g n m e n t < i >S a m p l e s . ← ֓ T h i s 695 ∗ b b a i s i n s t r u m e n t a l a n d u s e d f o r c o m p u t i n g t h e s a m p l e s s t a t i s t i c ← ֓ i n c r e m e n t a l l y ; 696 ∗ < B R > 697 ∗ f i n a l R e f e r e e S a m p l e r _ P o w e r s e t S a m p l e s= a S a m p l e r 1 . i n s t a n c e ( ) ; 698 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 699 ∗ P r i n t t h e s t a t e o f < i >a S a m p l e r 1 . W i t h o p t i o n p r i n t M o d e =1 < / i > , t h e ← ֓ 105 p r i n t i s 700 ∗ d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 701 ∗ < B R > 702 ∗ S y s t e m . o u t . p r i n t l n ( " a S a m p l e r 1 " ) ; 703 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( a S a m p l e r 1 . s t a t e ( p r i n t M o d e ) ) ; 704 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 705 ∗ a S a m p l e r 1 < B R > 706 ∗ b b a T r e e A : 707 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 708 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 2 709 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 0 5 710 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 0 2 711 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 1 712 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 3 713 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 4 714 ∗ < B R > 715 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( ) ; 716 ∗ 717 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 718 ∗ P r i n t t h e s t a t e o f < i >a S a m p l e r 2 . W i t h o p t i o n p r i n t M o d e =1 < / i > , t h e 719 ∗ p r i n t i s d o n e a c c o r d i n g t o t h e p r o p o s i t i o n o r d e r ; 720 ∗ < B R > 721 ∗ S y s t e m . o u t . p r i n t l n ( " a S a m p l e r 2 " ) ; 722 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( a S a m p l e r 2 . s t a t e ( p r i n t M o d e ) ) ; 723 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( ) ; 724 ∗ //< B R > 725 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 726 ∗ a S a m p l e r 2 < B R > 727 ∗ b b a T r e e A : 728 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 1 729 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 1 730 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 2 731 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 2 732 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 1 733 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 1 734 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 2 735 ∗ < B R > 736 ∗ 737 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 738 ∗ I n i t i a l i z e t h e f u s e r o f a S a m p l e r w i t h b b a e n t i e s < i > a F u s e r 1 a n d 739 ∗ < i >a F u s e r 2 , a n d w i t h t h e r e f e r e e f u n c t i o n < i > r e f e r e e 1 ( D e m p s t e r ← ֓ S h a f e r ) ; 740 ∗ < B R > 741 ∗ a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 1 ) ; 742 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 743 ∗ C l e a r t h e s a m p l e s c o n t a i n e r S a m p l e s ; 744 ∗ < B R > 745 ∗ S a m p l e s . c l e a r ( ) ; 746 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 747 ∗ B u i l d t h e s a m p l e s (< i > N b S a m p l e s < / i > t i m e s ) f u s e d b y m e a n s o f t h e f u s e r a n d 748 ∗ s t o r e t h e m w i t h i n t h e c o n t a i n e r ; 749 ∗ < B R > 750 ∗ { @ c o d e f o r ( n = 0 ; n < N b S a m p l e s ; n++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; } < ← ֓ B R > 751 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 752 ∗ L e a r n t h e b b a < i >a S a m p l e r f r o m t h e s a m p l e s < i >S a m p l e s a n d s t o r e t h e 753 ∗ p e r c e n t a g e o f c o n f l i c t s a m p l e s w i t h i n < i > Z < / i > ; 754 ∗ < B R > 755 ∗ Z =a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 756 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 757 ∗ P r i n t t h e c o n f l i c t a n d t h e s t a t e o f < i >a S a m p l e r ( t h e s e r e s u l t s a r e ← ֓ r a n d o m ) . 758 ∗ W i t h o p t i o n < i >p r i n t M o d e =1 , t h e p r i n t i s d o n e a c c o r d i n g t o t h e ← ֓ p r o p o s i t i o n 759 ∗ o r d e r ; 760 ∗ < B R > 761 ∗ S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D e m p s t e r − − " + N b S a m p l e s + " p a r t i c l e s " ) ; < ← ֓ B R > 762 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ Z+" % " ) ; 763 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 764 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( ) ; 765 ∗ &n b s p ; &n b s p ; //< B R > 766 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 767 ∗ a S a m p l e r − D e m p s t e r − − 1 0 0 0 0 0 0 p a r t i c l e s < B R > 106 768 ∗ C o n f l i c t Z = 0 . 1 9 0 5 2 3 % < B R > 769 ∗ b b a T r e e A : 770 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 4 7 4 8 4 4 8 6 8 9 7 0 9 5 3 < B R > 771 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 2 2 1 9 4 0 8 3 3 4 0 2 3 0 7 9 < B R > 772 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 2 3 3 8 4 6 0 5 1 2 1 5 7 8 5 < B R > 773 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 1 6 0 9 9 6 5 4 4 6 8 2 5 5 4 2 8 < B R > 774 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 0 8 6 7 8 8 1 3 6 0 4 3 3 9 5 9 3 < B R > 775 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 6 0 6 1 1 9 7 5 3 8 6 5 7 6 7 6 < B R > 776 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 0 9 8 7 9 3 4 1 8 4 6 6 4 9 1 3 3 < B R > 777 ∗ < B R > 778 ∗ 779 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 780 ∗ I n i t i a l i z e t h e f u s e r o f a S a m p l e r w i t h b b a e n t i e s < i > a F u s e r 1 a n d 781 ∗ < i >a F u s e r 2 , a n d w i t h t h e r e f e r e e f u n c t i o n < i > r e f e r e e 2 ( D i s j u n c t i v e ) ← ֓ ; 782 ∗ < B R > 783 ∗ a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 2 ) ; 784 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 785 ∗ C l e a r t h e s a m p l e s c o n t a i n e r S a m p l e s ; 786 ∗ < B R > 787 ∗ S a m p l e s . c l e a r ( ) ; 788 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 789 ∗ B u i l d t h e s a m p l e s (< i > N b S a m p l e s < / i > t i m e s ) f u s e d b y m e a n s o f t h e f u s e r a n d 790 ∗ s t o r e t h e m w i t h i n t h e c o n t a i n e r ; 791 ∗ < B R > 792 ∗ { @ c o d e f o r ( n = 0 ; n < N b S a m p l e s ; n++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; } < ← ֓ B R > 793 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 794 ∗ L e a r n t h e b b a < i >a S a m p l e r f r o m t h e s a m p l e s < i >S a m p l e s a n d s t o r e t h e 795 ∗ p e r c e n t a g e o f c o n f l i c t s a m p l e s w i t h i n < i > Z < / i > ; 796 ∗ < B R > 797 ∗ Z =a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 798 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 799 ∗ P r i n t t h e c o n f l i c t a n d t h e s t a t e o f < i >a S a m p l e r ( t h e s e r e s u l t s a r e ← ֓ r a n d o m ) . 800 ∗ W i t h o p t i o n < i >p r i n t M o d e =1 , t h e p r i n t i s d o n e a c c o r d i n g t o t h e ← ֓ p r o p o s i t i o n 801 ∗ o r d e r ; 802 ∗ < B R > 803 ∗ S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D i s j u n c t i v e − − " + N b S a m p l e s + " p a r t i c l e s " ) ← ֓ ; 804 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ Z+" % " ) ; 805 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 806 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( ) ; 807 ∗ &n b s p ; &n b s p ; //< B R > 808 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 809 ∗ a S a m p l e r − D i s j u n c t i v e − − 1 0 0 0 0 0 0 p a r t i c l e s < B R > 810 ∗ C o n f l i c t Z = 0 . 0 % < B R > 811 ∗ b b a T r e e A : 812 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 0 1 9 9 1 813 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 0 1 9 9 8 8 814 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 3 9 9 3 7 815 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 0 0 4 0 5 2 816 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 1 0 3 8 6 1 817 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 7 5 9 4 8 818 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 6 3 6 3 0 4 819 ∗ < B R > 820 ∗ 821 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 822 ∗ I n i t i a l i z e t h e f u s e r o f a S a m p l e r w i t h b b a e n t i e s < i > a F u s e r 1 a n d 823 ∗ < i >a F u s e r 2 , a n d w i t h t h e r e f e r e e f u n c t i o n < i > r e f e r e e 3 ( D u b o i s & ← ֓ P r a d e ) ; 824 ∗ < B R > 825 ∗ a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 3 ) ; 826 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 827 ∗ C l e a r t h e s a m p l e s c o n t a i n e r S a m p l e s ; 828 ∗ < B R > 829 ∗ S a m p l e s . c l e a r ( ) ; 830 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 831 ∗ B u i l d t h e s a m p l e s (< i > N b S a m p l e s < / i > t i m e s ) f u s e d b y m e a n s o f t h e f u s e r a n d 832 ∗ s t o r e t h e m w i t h i n t h e c o n t a i n e r ; 833 ∗ < B R > 834 ∗ { @ c o d e f o r ( n = 0 ; n < N b S a m p l e s ; n++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; } < ← ֓ B R > 107 835 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 836 ∗ L e a r n t h e b b a < i >a S a m p l e r f r o m t h e s a m p l e s < i >S a m p l e s a n d s t o r e t h e 837 ∗ p e r c e n t a g e o f c o n f l i c t s a m p l e s w i t h i n < i > Z < / i > ; 838 ∗ < B R > 839 ∗ Z =a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 840 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 841 ∗ P r i n t t h e c o n f l i c t a n d t h e s t a t e o f < i >a S a m p l e r ( t h e s e r e s u l t s a r e ← ֓ r a n d o m ) . 842 ∗ W i t h o p t i o n < i >p r i n t M o d e =1 , t h e p r i n t i s d o n e a c c o r d i n g t o t h e ← ֓ p r o p o s i t i o n 843 ∗ o r d e r ; 844 ∗ < B R > 845 ∗ S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D u b o i s & P r a d e − − " + N b S a m p l e s + " ← ֓ p a r t i c l e s " ) ; 846 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ Z+" % " ) ; 847 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 848 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( ) ; 849 ∗ &n b s p ; &n b s p ; //< B R > 850 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 851 ∗ a S a m p l e r − D u b o i s & P r a d e − − 1 0 0 0 0 0 0 p a r t i c l e s < B R > 852 ∗ C o n f l i c t Z = 0 . 0 % < B R > 853 ∗ b b a T r e e A : 854 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 0 0 4 0 9 855 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 1 7 9 8 1 4 856 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 3 9 6 0 8 857 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 1 3 0 7 8 4 858 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 1 1 1 7 0 2 859 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 9 0 5 1 1 860 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 1 4 7 1 7 2 861 ∗ < B R > 862 ∗ 863 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 864 ∗ I n i t i a l i z e t h e f u s e r o f a S a m p l e r w i t h b b a e n t i e s < i > a F u s e r 1 a n d 865 ∗ < i >a F u s e r 2 , a n d w i t h t h e r e f e r e e f u n c t i o n < i > r e f e r e e 4 ( PC R 6 ) ; 866 ∗ < B R > 867 ∗ a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 4 ) ; 868 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 869 ∗ C l e a r t h e s a m p l e s c o n t a i n e r S a m p l e s ; 870 ∗ < B R > 871 ∗ S a m p l e s . c l e a r ( ) ; 872 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 873 ∗ B u i l d t h e s a m p l e s (< i > N b S a m p l e s < / i > t i m e s ) f u s e d b y m e a n s o f t h e f u s e r a n d 874 ∗ s t o r e t h e m w i t h i n t h e c o n t a i n e r ; 875 ∗ < B R > 876 ∗ { @ c o d e f o r ( n = 0 ; n < N b S a m p l e s ; n++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; } < ← ֓ B R > 877 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 878 ∗ L e a r n t h e b b a < i >a S a m p l e r f r o m t h e s a m p l e s < i >S a m p l e s a n d s t o r e t h e 879 ∗ p e r c e n t a g e o f c o n f l i c t s a m p l e s w i t h i n < i > Z < / i > ; 880 ∗ < B R > 881 ∗ Z =a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 882 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 883 ∗ P r i n t t h e c o n f l i c t a n d t h e s t a t e o f < i >a S a m p l e r ( t h e s e r e s u l t s a r e ← ֓ r a n d o m ) . 884 ∗ W i t h o p t i o n < i >p r i n t M o d e =1 , t h e p r i n t i s d o n e a c c o r d i n g t o t h e ← ֓ p r o p o s i t i o n 885 ∗ o r d e r ; 886 ∗ < B R > 887 ∗ S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − PC R 6 − − " + N b S a m p l e s + " p a r t i c l e s " ) ; 888 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ Z+" % " ) ; 889 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 890 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( ) ; 891 ∗ &n b s p ; &n b s p ; //< B R > 892 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 893 ∗ a S a m p l e r − PC R 6 − − 1 0 0 0 0 0 0 p a r t i c l e s < B R > 894 ∗ C o n f l i c t Z = 0 . 0 % < B R > 895 ∗ b b a T r e e A : 896 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 5 7 6 1 897 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 2 3 8 2 7 5 898 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 0 5 3 9 8 899 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 1 7 9 8 6 7 900 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 0 8 1 8 1 3 901 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 5 6 7 8 4 902 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 0 8 0 2 5 3 108 903 ∗ < B R > 904 ∗ 905 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 906 ∗ I n i t i a l i z e t h e f u s e r o f a S a m p l e r w i t h b b a e n t i e s < i > a F u s e r 1 a n d 907 ∗ < i >a F u s e r 2 , a n d w i t h t h e r e f e r e e f u n c t i o n < i > r e f e r e e 4 ( P C R #) ; 908 ∗ < B R > 909 ∗ a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 5 ) ; 910 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 911 ∗ C l e a r t h e s a m p l e s c o n t a i n e r S a m p l e s ; 912 ∗ < B R > 913 ∗ S a m p l e s . c l e a r ( ) ; 914 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 915 ∗ B u i l d t h e s a m p l e s (< i > N b S a m p l e s < / i > t i m e s ) f u s e d b y m e a n s o f t h e f u s e r a n d 916 ∗ s t o r e t h e m w i t h i n t h e c o n t a i n e r ; 917 ∗ < B R > 918 ∗ { @ c o d e f o r ( n = 0 ; n < N b S a m p l e s ; n++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; } < ← ֓ B R > 919 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 920 ∗ L e a r n t h e b b a < i >a S a m p l e r f r o m t h e s a m p l e s < i >S a m p l e s a n d s t o r e t h e 921 ∗ p e r c e n t a g e o f c o n f l i c t s a m p l e s w i t h i n < i > Z < / i > ; 922 ∗ < B R > 923 ∗ Z =a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 924 ∗ < f o n t c o l o r = " # 0 0 0 0FF " s t y l e =" f o n t − f a m i l y : g e o r g i a " > 925 ∗ P r i n t t h e c o n f l i c t a n d t h e s t a t e o f < i >a S a m p l e r ( t h e s e r e s u l t s a r e ← ֓ r a n d o m ) . 926 ∗ W i t h o p t i o n < i >p r i n t M o d e =1 , t h e p r i n t i s d o n e a c c o r d i n g t o t h e ← ֓ p r o p o s i t i o n 927 ∗ o r d e r ; 928 ∗ < B R > 929 ∗ S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − P C R # − − " + N b S a m p l e s + " p a r t i c l e s " ) ; 930 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = "+ Z+" % " ) ; 931 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 932 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( ) ; 933 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 934 ∗ a S a m p l e r − P C R # − − 1 0 0 0 0 0 0 p a r t i c l e s < B R > 935 ∗ C o n f l i c t Z = 0 . 0 % < B R > 936 ∗ b b a T r e e A : 937 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 − > 0 . 2 5 7 2 8 6 938 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 − > 0 . 2 3 9 3 4 3 939 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 − > 0 . 1 0 5 1 1 5 940 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 − > 0 . 1 7 9 9 4 3 941 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 − > 0 . 0 8 1 8 6 942 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 − > 0 . 0 5 6 5 5 8 943 ∗ x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 − > 0 . 0 7 9 8 9 5 944 ∗ < B R > 945 ∗ 946 ∗ 947 ∗ 948 ∗ / 949 p u b l i c v o i d R e f e r e e S a m p l e r _ C o m p a r i s o n ( ) { 950 f i n a l P o w e r s e t A = new f i n a l P o w e r s e t ( ) ; 951 A . s i z e ( 3 ) ; A . a t o m i c ( 0 ) ; 952 f i n a l P o w e r s e t B = A . i n s t a n c e N s i z e ( ) ; B . a t o m i c ( 1 ) ; 953 f i n a l P o w e r s e t C = A . i n s t a n c e N s i z e ( ) ; C . a t o m i c ( 2 ) ; 954 / / 955 f i n a l P o w e r s e t A U B = A . i n s t a n c e N s i z e ( ) ; A U B . o r ( A , B ) ; 956 f i n a l P o w e r s e t B U C = A . i n s t a n c e N s i z e ( ) ; B U C . o r ( B , C ) ; 957 f i n a l P o w e r s e t C U A = A . i n s t a n c e N s i z e ( ) ; C U A . o r ( C , A ) ; 958 / / 959 f i n a l P o w e r s e t z e r o = A . i n s t a n c e N s i z e ( ) ; z e r o . z e r o ( ) ; 960 f i n a l P o w e r s e t o n e = A . i n s t a n c e N s i z e ( ) ; o n e . o n e ( ) ; 961 / / 962 / / 963 R F D e m p s t e r _ P o w e r s e t r e f e r e e 1 = ne w R F D e m p s t e r _ P o w e r s e t ( ) ; 964 R F D i s j u n c t i v e _ P o w e r s e t r e f e r e e 2 = ne w R F D i s j u n c t i v e _ P o w e r s e t ( ) ; 965 R F D u b o i s P r a d e _ P o w e r s e t r e f e r e e 3 = ne w R F D u b o i s P r a d e _ P o w e r s e t ( ) ; 966 R F P C R 6 _ P o w e r s e t r e f e r e e 4 = n e w R F P C R 6 _ P o w e r s e t ( ) ; 967 R F P C R S h a r p _ P o w e r s e t r e f e r e e 5 = ne w R F P C R S h a r p _ P o w e r s e t ( ) ; 968 / / 969 / / 970 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r 1 = ne w f i n a l R e f e r e e S a m p l e r _ P o w e r s e t ← ֓ ( ) ; 971 a S a m p l e r 1 . a d d ( A , 0 . 0 9 ) ; 972 a S a m p l e r 1 . a d d ( B , 0 . 2 ) ; 109 973 a S a m p l e r 1 . a d d ( C , 0 . 0 2 ) ; 974 a S a m p l e r 1 . a d d ( A U B , 0 . 0 5 ) ; 975 a S a m p l e r 1 . a d d ( B U C , 0 . 0 3 ) ; 976 a S a m p l e r 1 . a d d ( C U A , 0 . 1 ) ; 977 a S a m p l e r 1 . a d d ( A , 0 . 1 1 ) ; 978 a S a m p l e r 1 . a d d ( o n e , 0 . 4 ) ; 979 / / 980 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r 2 = a S a m p l e r 1 . i n s t a n c e ( ) ; 981 a S a m p l e r 2 . a d d ( A , 0 . 1 ) ; 982 a S a m p l e r 2 . a d d ( B , 0 . 1 ) ; 983 a S a m p l e r 2 . a d d ( C , 0 . 2 ) ; 984 a S a m p l e r 2 . a d d ( A U B , 0 . 2 ) ; 985 a S a m p l e r 2 . a d d ( B U C , 0 . 1 ) ; 986 a S a m p l e r 2 . a d d ( C U A , 0 . 1 ) ; 987 a S a m p l e r 2 . a d d ( o n e , 0 . 2 ) ; 988 / / 989 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r = a S a m p l e r 1 . i n s t a n c e ( ) ; 990 / / 991 992 i n t p r i n t M o d e = 1 ; 993 994 S y s t e m . o u t . p r i n t l n ( 995 " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \ n " + 996 " / / S a m p l i n g Me t h o d \ n " + 997 " / / / / / / / / / / / / / / / / / / / / \ n " ) ; 998 999 i n t n ; 1000 i n t N b S a m p l e s = 1 0 0 0 0 0 0 ; 1001 d o u b l e Z ; 1002 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t S a m p l e s = a S a m p l e r 1 . i n s t a n c e ( ) ; 1003 1004 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r 1 " ) ; 1005 S y s t e m . o u t . p r i n t l n ( a S a m p l e r 1 . s t a t e ( p r i n t M o d e ) ) ; 1006 S y s t e m . o u t . p r i n t l n ( ) ; 1007 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r 2 " ) ; 1008 S y s t e m . o u t . p r i n t l n ( a S a m p l e r 2 . s t a t e ( p r i n t M o d e ) ) ; 1009 S y s t e m . o u t . p r i n t l n ( ) ; 1010 / / 1011 a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 1 ) ; 1012 S a m p l e s . c l e a r ( ) ; 1013 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 1014 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 1015 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D e m p s t e r − − " + N b S a m p l e s + " p a r t i c l e s " ) ; 1016 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 1017 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 1018 S y s t e m . o u t . p r i n t l n ( ) ; 1019 / / 1020 a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 2 ) ; 1021 S a m p l e s . c l e a r ( ) ; 1022 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 1023 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 1024 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D i s j u n c t i v e − − " + N b S a m p l e s + " p a r t i c l e s " ← ֓ ) ; 1025 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 1026 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 1027 S y s t e m . o u t . p r i n t l n ( ) ; 1028 / / 1029 a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 3 ) ; 1030 S a m p l e s . c l e a r ( ) ; 1031 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 1032 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 1033 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D u b o i s & P r a d e − − " + N b S a m p l e s + " ← ֓ p a r t i c l e s " ) ; 1034 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 1035 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 1036 S y s t e m . o u t . p r i n t l n ( ) ; 1037 / / 1038 a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 4 ) ; 1039 S a m p l e s . c l e a r ( ) ; 1040 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 1041 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 1042 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − P CR 6 − − " + N b S a m p l e s + " p a r t i c l e s " ) ; 1043 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 1044 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 110 1045 S y s t e m . o u t . p r i n t l n ( ) ; 1046 / / 1047 a S a m p l e r . s e t F u s e r ( a S a m p l e r 1 , a S a m p l e r 2 , r e f e r e e 5 ) ; 1048 S a m p l e s . c l e a r ( ) ; 1049 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 1050 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 1051 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − P C R # − − " + N b S a m p l e s + " p a r t i c l e s " ) ; 1052 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 1053 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 1054 S y s t e m . o u t . p r i n t l n ( ) ; 1055 1056 } 1057 1058 / ∗ ∗ 1059 ∗ Co m p a r e d i f f e r e n t r e f e r e e f u n c t i o n s a p p l i e d w i t h R e f e r e e F u s e r / ← ֓ R e f e r e e S a m p l e r a n d P o w e r s e t . 1060 ∗ 1061 ∗ / 1062 p u b l i c v o i d R e f e r e e _ C o m p a r i s o n ( ) { 1063 R e f e r e e F u s e r R T S _ C o m p a r i s o n ( ) ; 1064 R e f e r e e S a m p l e r _ C o m p a r i s o n ( ) ; 1065 } 1066 1067 / ∗ ∗ 1068 ∗ T e s t s o m e l o g i c a l m a n i p u l a t i o n s ( { @ l i n k F r e e b o o l e a n } , { @ l i n k S u p e r p o w e r s e t ← ֓ } , 1069 ∗ { @ l i n k O p e n h y p e r p o w e r s e t } , { @ l i n k C l o s e d h y p e r p o w e r s e t } , { @ l i n k P o w e r s e t } ) . 1070 ∗ 1071 ∗ / 1072 p u b l i c v o i d l o g i c a l _ t e s t s ( ) { 1073 i n t t h e S i z e O f F r a m e = 4 ; 1074 i n t t h e S i z e O f F r a m e P o w e r s e t = 8 ; 1075 1076 l o g i c a l _ t e s t s _ F r e e b o o l e a n ( t h e S i z e O f F r a m e ) ; 1077 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " + 1078 " − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \n " ) ; 1079 l o g i c a l _ t e s t s _ S u p e r p o w e r s e t ( t h e S i z e O f F r a m e ) ; 1080 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " + 1081 " − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \n " ) ; 1082 l o g i c a l _ t e s t s _ O p e n h y p e r p o w e r s e t ( t h e S i z e O f F r a m e ) ; 1083 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " + 1084 " − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \n " ) ; 1085 l o g i c a l _ t e s t s _ C l o s e d h y p e r p o w e r s e t ( t h e S i z e O f F r a m e ) ; 1086 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " + 1087 " − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \n " ) ; 1088 l o g i c a l _ t e s t s _ P o w e r s e t ( t h e S i z e O f F r a m e P o w e r s e t ) ; 1089 } 1090 1091 / ∗ ∗ 1092 ∗ T e s t s o m e l o g i c a l m a n i p u l a t i o n s o n F r e e b o o l e a n . 1093 ∗ 1094 ∗ < B R > < B R > 1095 ∗ D e t a i l e d c o d e d e s c r i p t i o n . < / b > < B R > 1096 ∗ T he f o l l o w i n g t y p o n o m i c c o n v e n t i o n s a r e u s e d : 1097 ∗ < c o d e > 1098 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1099 ∗ B l u e c o l o r i s u s e d f o r c o m m e n t i n g t h e f o l l o w i n g c o d e . 1100 ∗ < B R > 1101 ∗ c o d e f o r m a t i n g i s u s e d f o r p r i n t i n g t h e c o d e . 1102 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1103 ∗ R ed c o l o r i s u s e d f o r p r i n t i n g t h e p o s s i b l e o u t p u t r e s u l t i n g o f t h e 1104 ∗ p r e v i o u s c o d e . 1105 ∗ 1106 ∗ < B R > < B R > 1107 ∗ F o r t h e o u t p u t , i t i s a s s u m e d t h a t t h e S i z e O f F r a m e =4 ( p a r a m e t e r o f ← ֓ t h e m e t h o d ) . 1108 ∗ < B R > < B R > 1109 ∗ C om me n te d c o d e : 1110 ∗ < B R > < B R > 1111 ∗ < c o d e > 1112 ∗ i n t i ; 1113 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1114 ∗ D e c l a r a t i o n o f a f r e e B o o l e a n a l g e b r a , f F b ; 1115 ∗ < B R > 111 1116 ∗ f i n a l F r e e b o o l e a n f F b = ne w f i n a l F r e e b o o l e a n ( ) ; 1117 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1118 ∗ R e s i z e < i >f F b t o < i >t h e S i z e O f F r a m e , t h e p a r a m e t e r o f t h e m e t h o d . 1119 ∗ I f t h e r e s i z i n g f a i l e d , p r o d u c e a n e r r o r m e s s a g e a n d e x i t ; 1120 ∗ < B R > 1121 ∗ i f ( f F b . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { < B R > 1122 ∗ &n b s p ; &n b s p ; S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ F r e e b o o l e a n ( i n t ) \ n " + < B R > 1123 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 1124 ∗ &n b s p ; &n b s p ; S y s t e m . e x i t ( 0 ) ; 1125 ∗ } < B R > 1126 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1127 ∗ P r i n t t h e t i t l e o f t h e me t h o d ; 1128 ∗ < B R > 1129 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : F r e e b o o l e a n − s i z e = " + ← ֓ t h e S i z e O f F r a m e + < B R > 1130 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " / / \ n \ n " ) ; 1131 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1132 ∗ / / / / / / T e s t : F r e e b o o l e a n − s i z e = 4 &n b s p ; &n b s p ; //< B R > 1133 ∗ 1134 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1135 ∗ C r e a t e t h e t a b l e o f a t o m i c p r o p o s i t i o n s , < i > ato m F ; < B R > 1136 ∗ C r e a t e e a c h a t o m i c p r o p o s i t i o n b y i n s t a n c i n g a n d r e s i z i n g f r o m < i >f F b < / i > , ← ֓ u s i n g 1137 ∗ { @ c o d e f F b . i n s t a n c e N s i z e ( ) ; } ; < B R > 1138 ∗ D e f i n e e a c h a t o m i c b y a p p l y i n g t h e m e t h o d { @ l i n k G e n e r a t e d L a t t i c e #a t o m i c ( ← ֓ i n t ) } ; < B R > 1139 ∗ 1140 ∗ f i n a l F r e e b o o l e a n [ ] a t o m F = n e w f i n a l F r e e b o o l e a n [ t h e S i z e O f F r a m e ] ; < B R > 1141 ∗ { @ c o d e f o r ( i = 0 ; i 1142 ∗ &n b s p ; &n b s p ; a t o m F [ i ] = f F b . i n s t a n c e N s i z e ( ) ; 1143 ∗ &n b s p ; &n b s p ; a t o m F [ i ] . a t o m i c ( i ) ; 1144 ∗ } < B R > 1145 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1146 ∗ P r i n t < i >z e r o , < i > o n e < / i > a n d t h e t a b l e o f a t o m i c p r o p o s i t i o n s 1147 ∗ ( p r i n t e d w i t h h e x a d e c i m a l c o d i n g ) ; 1148 ∗ < B R > 1149 ∗ f F b . z e r o ( ) ; 1150 ∗ S y s t e m . o u t . p r i n t l n ( " z e r o = "+ f F b . s t a t e ( ) ) ; 1151 ∗ f F b . o n e ( ) ; 1152 ∗ S y s t e m . o u t . p r i n t l n ( " o n e = "+ f F b . s t a t e ( ) ) ; 1153 ∗ { @ c o d e f o r ( i = 0 ; i 1154 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " a t o m F [ " + i + " ] = " + at o m F [ i ] . s t a t e ( ) ) ; 1155 ∗ } < B R > 1156 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1157 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1158 ∗ z e r o = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1159 ∗ o n e = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1160 ∗ at o m F [ 0 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 a a a a < B R > 1161 ∗ at o m F [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 c c c c < B R > 1162 ∗ at o m F [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f 0 < B R > 1163 ∗ at o m F [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f f 0 0 < B R > 1164 ∗ < B R > 1165 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1166 ∗ 1167 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1168 ∗ P r i n t t h e c o m p l e m e n t o f < i > z e r o , o f < i >o n e a n d t h e t a b l e o f 1169 ∗ c o m p l e m e n t s o f t h e a t o m i c p r o p o s i t i o n s . T he c o m p l e m e n t s 1170 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f F b . c o m p l e m e n t ( a t o m F [ i ] ) ; } a n d 1171 ∗ s t o r e d w i t h i n < i >f F b ; 1172 ∗ < B R > 1173 ∗ f F b . z e r o ( ) . c o m p l e m e n t ( ) ; 1174 ∗ S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( z e r o ) = "+ f F b . s t a t e ( ) ) ; 1175 ∗ f F b . o n e ( ) . c o m p l e m e n t ( ) ; 1176 ∗ S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( o n e ) = "+ f F b . s t a t e ( ) ) ; 1177 ∗ { @ c o d e f o r ( i = 0 ; i 1178 ∗ &n b s p ; &n b s p ; f F b . c o m p l e m e n t ( a t o m F [ i ] ) ; 1179 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( a t o m F [ " + i + " ] ) = " +f F b . s t a t e ( ) ← ֓ ) ; 1180 ∗ } < B R > 1181 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1182 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1183 ∗ c o m p l e m e n t ( z e r o ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1184 ∗ c o m p l e m e n t ( o n e ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 112 1185 ∗ c o m p l e m e n t ( at o m F [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 5 < B R > 1186 ∗ c o m p l e m e n t ( at o m F [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 < B R > 1187 ∗ c o m p l e m e n t ( at o m F [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f < B R > 1188 ∗ c o m p l e m e n t ( at o m F [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f f < B R > 1189 ∗ < B R > 1190 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1191 ∗ 1192 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1193 ∗ P r i n t t h e c o c o m p l e m e n t o f < i > z e r o , o f < i >o n e a n d t h e t a b l e o f 1194 ∗ c o c o m p l e m e n t s o f t h e a t o m i c p r o p o s i t i o n s . T he c o c o m p l e m e n t s 1195 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f F b . c o c o m p l e m e n t ( at o m F [ i ] ) ; } a n d 1196 ∗ s t o r e d w i t h i n < i >f F b ; 1197 ∗ < B R > 1198 ∗ f F b . z e r o ( ) . c o c o m p l e m e n t ( ) ; 1199 ∗ S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( z e r o ) = " + f F b . s t a t e ( ) ) ; 1200 ∗ f F b . o n e ( ) . c o c o m p l e m e n t ( ) ; 1201 ∗ S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( o n e ) = "+ f F b . s t a t e ( ) ) ; 1202 ∗ { @ c o d e f o r ( i = 0 ; i 1203 ∗ &n b s p ; &n b s p ; f F b . c o c o m p l e m e n t ( at o m F [ i ] ) ; 1204 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( at o m F [ " + i + " ] ) = " +f F b . s t a t e ← ֓ ( ) ) ; 1205 ∗ } < B R > 1206 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1207 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1208 ∗ c o c o m p l e m e n t ( z e r o ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1209 ∗ c o c o m p l e m e n t ( o n e ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1210 ∗ c o c o m p l e m e n t ( a t om F [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 5 < B R > 1211 ∗ c o c o m p l e m e n t ( a t om F [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 < B R > 1212 ∗ c o c o m p l e m e n t ( a t om F [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f < B R > 1213 ∗ c o c o m p l e m e n t ( a t om F [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f f < B R > 1214 ∗ < B R > 1215 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1216 ∗ 1217 ∗ 1218 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1219 ∗ T he f o l l o w i n g c o d e s ( 2 1 l i n e s ) t e s t s t h e p r o p e r t y < i >( A O R B ) A N D ( B O R C ) ← ֓ = B O R (A A N D C ) , 1220 ∗ a n d p r i n t t h e r e s u l t s o f t h e t e s t . 1221 ∗ P r o p o s i t i o n s < i > A , B , C < / i > a r e d e f i n e d r e s p e c t i v e l y a s t h e < i > ( ← ֓ t h e S i z e O f F r a m e / 4 ) − t h , 1222 ∗ < i >( t h e S i z e O f F r a m e / 2 ) − t h , < i > ( 3 ∗ t h e S i z e O f F r a m e / 4 ) − t h a t o m i c s ← ֓ p r o p o s i t i o n s . 1223 ∗ < B R > 1224 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 1225 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1226 ∗ / / / / / / T e s t : ( A O R B ) A N D ( B O R C ) = B O R (A A N D C )< B R > 1227 ∗ 1228 ∗ f i n a l F r e e b o o l e a n A = at o m F [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 1229 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1230 ∗ / / Me t h o d { @ l i n k L a t t i c e #c l o n e ( ) } c r e a t e a n e x a c t c o p y o f t h e p r o p o s i t i o n ← ֓ < B R > 1231 ∗ f i n a l F r e e b o o l e a n B = a t o m F [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 1232 ∗ f i n a l F r e e b o o l e a n C = a t o m F [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 1233 ∗ f i n a l F r e e b o o l e a n A U B = f F b . i n s t a n c e N s i z e ( ) ; 1234 ∗ f i n a l F r e e b o o l e a n B U C = f F b . i n s t a n c e N s i z e ( ) ; 1235 ∗ f i n a l F r e e b o o l e a n A N C = f F b . i n s t a n c e N s i z e ( ) ; 1236 ∗ f i n a l F r e e b o o l e a n l e f t = f F b . i n s t a n c e N s i z e ( ) ; 1237 ∗ f i n a l F r e e b o o l e a n r i g h t = f F b . i n s t a n c e N s i z e ( ) ; 1238 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1239 ∗ Co m p u t e < i > A O R B a n d s t o r e i t w i t h i n < i > A U B ;< B R > 1240 ∗ Co m p u t e < i > B O R C a n d s t o r e i t w i t h i n < i > B U C ;< B R > 1241 ∗ 1242 ∗ A U B . o r ( A , B ) ; 1243 ∗ B U C . o r ( B , C ) ; 1244 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1245 ∗ Co m p u t e < i > A A N D C < / i > a n d s t o r e i t w i t h i n < i > A N C ;< B R > 1246 ∗ Co m p u t e < i > A U B A N D B U C a n d s t o r e i t w i t h i n < i > l e f t ;< B R > 1247 ∗ Co m p u t e < i > B O R A N C a n d s t o r e i t w i t h i n < i > r i g h t ;< B R > 1248 ∗ 1249 ∗ A N C . a n d ( A , C ) ; 1250 ∗ l e f t . a n d ( A U B , B U C) ; 1251 ∗ r i g h t . o r ( B , A N C) ; 1252 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 113 1253 ∗ T e s t i f < i > l e f t a n d < i > r i g h t a r e e q u a l , a n d s t o r e t h e r e s u l t w i t h i n 1254 ∗ < i >i s E q u a l ;< B R > 1255 ∗ 1256 ∗ b o o l e a n i s E q u a l= l e f t . c o m p a r e T o ( r i g h t ) ==0 ;< B R > 1257 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1258 ∗ P r i n t p r o p o s i t i o n s < i > A , B , C , l e f t , r i g h t a n d t h e b o o l e a n < i >i s E q u a l ;< ← ֓ B R > 1259 ∗ 1260 ∗ S y s t e m . o u t . p r i n t l n ( " A = at o m F [ " + t h e S i z e O f F r a m e / 4 + " ] = " + A . s t a t e ( ) ) ; 1261 ∗ S y s t e m . o u t . p r i n t l n ( " B = at o m F [ " + t h e S i z e O f F r a m e / 2 + " ] = " + B . s t a t e ( ) ) ; 1262 ∗ S y s t e m . o u t . p r i n t l n ( " C = a t o m F [ " + ( 3 ∗ t h e S i z e O f F r a m e ) / 4 + " ] = " + C . s t a t e ( ) ) ; < ← ֓ B R > 1263 ∗ S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 1264 ∗ S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 1265 ∗ S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 1266 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1267 ∗ A = a t o m F [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 c c c c< B R > 1268 ∗ B = at o m F [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f 0 < B R > 1269 ∗ C = at o m F [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f f 0 0 < B R > 1270 ∗ (A O R B ) A N D ( B O R C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f c f 0 < B R > 1271 ∗ B O R (A A N D C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f c f 0 < B R > 1272 ∗ i s E q u a l = t r u e < B R > 1273 ∗ 1274 ∗ 1275 ∗ 1276 ∗ / 1277 p u b l i c v o i d l o g i c a l _ t e s t s _ F r e e b o o l e a n ( i n t t h e S i z e O f F r a m e ) { 1278 1279 i n t i ; 1280 f i n a l F r e e b o o l e a n f F b = ne w f i n a l F r e e b o o l e a n ( ) ; 1281 i f ( f F b . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { 1282 S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ F r e e b o o l e a n ( i n t ) \ n " + 1283 " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 1284 S y s t e m . e x i t ( 0 ) ; 1285 } 1286 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : F r e e b o o l e a n − s i z e = " + ← ֓ t h e S i z e O f F r a m e + 1287 " / / \ n \ n " ) ; 1288 f i n a l F r e e b o o l e a n [ ] a t o m F = ne w f i n a l F r e e b o o l e a n [ t h e S i z e O f F r a m e ] ; 1289 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1290 a t o m F [ i ] = f F b . i n s t a n c e N s i z e ( ) ; 1291 a t o m F [ i ] . a t o m i c ( i ) ; 1292 } 1293 f F b . z e r o ( ) ; 1294 S y s t e m . o u t . p r i n t l n ( " z e r o = " + f F b . s t a t e ( ) ) ; 1295 f F b . o n e ( ) ; 1296 S y s t e m . o u t . p r i n t l n ( " o n e = " + f F b . s t a t e ( ) ) ; 1297 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1298 S y s t e m . o u t . p r i n t l n ( " a t o m F [ " + i + " ] = " + a t o m F [ i ] . s t a t e ( ) ) ; 1299 } 1300 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1301 f F b . z e r o ( ) . c o m p l e m e n t ( ) ; 1302 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( z e r o ) = " + f F b . s t a t e ( ) ) ; 1303 f F b . o n e ( ) . c o m p l e m e n t ( ) ; 1304 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( o n e ) = " + f F b . s t a t e ( ) ) ; 1305 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1306 f F b . c o m p l e m e n t ( a t o m F [ i ] ) ; 1307 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( a t o m F [ " + i + " ] ) = " + f F b . s t a t e ( ) ) ; 1308 } 1309 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1310 f F b . z e r o ( ) . c o c o m p l e m e n t ( ) ; 1311 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( z e r o ) = " + f F b . s t a t e ( ) ) ; 1312 f F b . o n e ( ) . c o c o m p l e m e n t ( ) ; 1313 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( o n e ) = " + f F b . s t a t e ( ) ) ; 1314 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1315 f F b . c o c o m p l e m e n t ( a t o m F [ i ] ) ; 1316 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( a t o m F [ " + i + " ] ) = " + f F b . s t a t e ( ) ) ; 1317 } 1318 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1319 1320 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 1321 f i n a l F r e e b o o l e a n A = a t o m F [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 114 1322 f i n a l F r e e b o o l e a n B = a t o m F [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 1323 f i n a l F r e e b o o l e a n C = a t o m F [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 1324 f i n a l F r e e b o o l e a n A U B = f F b . i n s t a n c e N s i z e ( ) ; 1325 f i n a l F r e e b o o l e a n B U C = f F b . i n s t a n c e N s i z e ( ) ; 1326 f i n a l F r e e b o o l e a n A N C = f F b . i n s t a n c e N s i z e ( ) ; 1327 f i n a l F r e e b o o l e a n l e f t = f F b . i n s t a n c e N s i z e ( ) ; 1328 f i n a l F r e e b o o l e a n r i g h t = f F b . i n s t a n c e N s i z e ( ) ; 1329 A U B . o r ( A , B ) ; 1330 B U C . o r ( B , C ) ; 1331 A N C . a n d ( A , C ) ; 1332 l e f t . a n d ( A U B , B U C ) ; 1333 r i g h t . o r ( B , A N C ) ; 1334 b o o l e a n i s E q u a l = l e f t . c o m p a r e T o ( r i g h t ) = =0 ; 1335 S y s t e m . o u t . p r i n t l n ( " A = at o m F [ " + t h e S i z e O f F r a m e /4+ " ] = " + A . s t a t e ( ) ) ; 1336 S y s t e m . o u t . p r i n t l n ( " B = at o m F [ " + t h e S i z e O f F r a m e /2+ " ] = " + B . s t a t e ( ) ) ; 1337 S y s t e m . o u t . p r i n t l n ( " C = at o m F [ " + ( 3 ∗ t h e S i z e O f F r a m e ) /4+ " ] = " + C . s t a t e ( ) ) ; 1338 S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 1339 S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 1340 S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 1341 1342 } 1343 1344 / ∗ ∗ 1345 ∗ T e s t s o m e l o g i c a l m a n i p u l a t i o n s o n S u p e r p o w e r s e t . 1346 ∗ 1347 ∗ < B R > < B R > 1348 ∗ D e t a i l e d c o d e d e s c r i p t i o n . < / b > < B R > 1349 ∗ T he f o l l o w i n g t y p o n o m i c c o n v e n t i o n s a r e u s e d : 1350 ∗ < c o d e > 1351 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1352 ∗ B l u e c o l o r i s u s e d f o r c o m m e n t i n g t h e f o l l o w i n g c o d e . 1353 ∗ < B R > 1354 ∗ c o d e f o r m a t i n g i s u s e d f o r p r i n t i n g t h e c o d e . 1355 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1356 ∗ R ed c o l o r i s u s e d f o r p r i n t i n g t h e p o s s i b l e o u t p u t r e s u l t i n g o f t h e 1357 ∗ p r e v i o u s c o d e . 1358 ∗ 1359 ∗ < B R > < B R > 1360 ∗ F o r t h e o u t p u t , i t i s a s s u m e d t h a t t h e S i z e O f F r a m e =4 ( p a r a m e t e r o f ← ֓ t h e m e t h o d ) . 1361 ∗ < B R > < B R > 1362 ∗ C om me n te d c o d e : 1363 ∗ < B R > < B R > 1364 ∗ < c o d e > 1365 ∗ i n t i ; 1366 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1367 ∗ D e c l a r a t i o n o f a s u p e r p o w e r s e t , < i >f S p s ; 1368 ∗ < B R > 1369 ∗ f i n a l S u p e r p o w e r s e t f S p s = ne w f i n a l S u p e r p o w e r s e t ( ) ; 1370 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1371 ∗ R e s i z e < i >f S p s t o < i > t h e S i z e O f F r a m e , t h e p a r a m e t e r o f t h e m e t h o d . 1372 ∗ I f t h e r e s i z i n g f a i l e d , p r o d u c e a n e r r o r m e s s a g e a n d e x i t ; 1373 ∗ < B R > 1374 ∗ i f ( f S p s . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { < B R > 1375 ∗ &n b s p ; &n b s p ; S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ S u p e r p o w e r s e t ( i n t ) \ n " + < B R > 1376 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 1377 ∗ &n b s p ; &n b s p ; S y s t e m . e x i t ( 0 ) ; 1378 ∗ } < B R > 1379 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1380 ∗ P r i n t t h e t i t l e o f t h e me t h o d ; 1381 ∗ < B R > 1382 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : S u p e r p o w e r s e t − s i z e = " + ← ֓ t h e S i z e O f F r a m e + < B R > 1383 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " / / \ n \ n " ) ; 1384 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1385 ∗ / / / / / / T e s t : S u p e r p o w e r s e t − s i z e = 4 &n b s p ; &n b s p ; // 1386 ∗ 1387 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1388 ∗ C r e a t e t h e t a b l e o f a t o m i c p r o p o s i t i o n s , < i > a t o m S ; < B R > 1389 ∗ C r e a t e e a c h a t o m i c p r o p o s i t i o n b y i n s t a n c i n g a n d r e s i z i n g f r o m < i >f S p s , ← ֓ u s i n g 1390 ∗ { @ c o d e f S p s . i n s t a n c e N s i z e ( ) ; } ; < B R > 1391 ∗ D e f i n e e a c h a t o m i c b y a p p l y i n g t h e m e t h o d { @ l i n k G e n e r a t e d L a t t i c e #a t o m i c ( ← ֓ 115 i n t ) } ; < B R > 1392 ∗ 1393 ∗ f i n a l S u p e r p o w e r s e t [ ] a t o m S = ne w f i n a l S u p e r p o w e r s e t [ t h e S i z e O f F r a m e ] ; < B R > 1394 ∗ { @ c o d e f o r ( i = 0 ; i 1395 ∗ &n b s p ; &n b s p ; a t o m S [ i ] = f S p s . i n s t a n c e N s i z e ( ) ; 1396 ∗ &n b s p ; &n b s p ; a t o m S [ i ] . a t o m i c ( i ) ; 1397 ∗ } < B R > 1398 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1399 ∗ P r i n t < i >z e r o , < i > o n e < / i > a n d t h e t a b l e o f a t o m i c p r o p o s i t i o n s ( p r i n t e d 1400 ∗ w i t h h e x a d e c i m a l c o d i n g ) ; 1401 ∗ < B R > 1402 ∗ f S p s . z e r o ( ) ; 1403 ∗ S y s t e m . o u t . p r i n t l n ( " z e r o = "+ f S p s . s t a t e ( ) ) ; 1404 ∗ f S p s . o n e ( ) ; 1405 ∗ S y s t e m . o u t . p r i n t l n ( " o n e = "+ f S p s . s t a t e ( ) ) ; 1406 ∗ { @ c o d e f o r ( i = 0 ; i 1407 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " a t o m S [ " + i + " ] = " +a t o m S [ i ] . s t a t e ( ) ) ; 1408 ∗ } < B R > 1409 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1410 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1411 ∗ z e r o = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1412 ∗ o n e = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f e < B R > 1413 ∗ a t o m S [ 0 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 a a a a < B R > 1414 ∗ a t o m S [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 c c c c < B R > 1415 ∗ a t o m S [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f 0 < B R > 1416 ∗ a t o m S [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f f 0 0 < B R > 1417 ∗ < B R > 1418 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1419 ∗ 1420 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1421 ∗ P r i n t t h e c o m p l e m e n t o f < i > z e r o , o f < i >o n e a n d t h e t a b l e o f 1422 ∗ c o m p l e m e n t s o f t h e a t o m i c p r o p o s i t i o n s . T he c o m p l e m e n t s 1423 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f S p s . c o m p l e m e n t ( at o m [ i ] ) ; } a n d 1424 ∗ s t o r e d w i t h i n < i >f S p s ; 1425 ∗ < B R > 1426 ∗ f S p s . z e r o ( ) . c o m p l e m e n t ( ) ; 1427 ∗ S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( z e r o ) = "+ f S p s . s t a t e ( ) ) ; 1428 ∗ f S p s . o n e ( ) . c o m p l e m e n t ( ) ; 1429 ∗ S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( o n e ) = "+ f S p s . s t a t e ( ) ) ; 1430 ∗ { @ c o d e f o r ( i = 0 ; i 1431 ∗ &n b s p ; &n b s p ; f S p s . c o m p l e m e n t ( a t o m S [ i ] ) ; 1432 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( a t o m S [ " + i + " ] ) = " + f S p s . s t a t e ← ֓ ( ) ) ; 1433 ∗ } < B R > 1434 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1435 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1436 ∗ c o m p l e m e n t ( z e r o ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f e < B R > 1437 ∗ c o m p l e m e n t ( o n e ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1438 ∗ c o m p l e m e n t ( a t o m S [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 4 < B R > 1439 ∗ c o m p l e m e n t ( a t o m S [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 2 < B R > 1440 ∗ c o m p l e m e n t ( a t o m S [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 f 0 e < B R > 1441 ∗ c o m p l e m e n t ( a t o m S [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f e < B R > 1442 ∗ < B R > 1443 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1444 ∗ 1445 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1446 ∗ P r i n t t h e c o c o m p l e m e n t o f < i > z e r o , o f < i >o n e a n d t h e t a b l e o f 1447 ∗ c o c o m p l e m e n t s o f t h e a t o m i c p r o p o s i t i o n s . T he c o c o m p l e m e n t s 1448 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f S p s . c o c o m p l e m e n t ( a t o m S [ i ] ) ; } a n d 1449 ∗ s t o r e d w i t h i n < i >f S p s ; 1450 ∗ < B R > 1451 ∗ f S p s . z e r o ( ) . c o c o m p l e m e n t ( ) ; 1452 ∗ S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( z e r o ) = " + f S p s . s t a t e ( ) ) ; 1453 ∗ f S p s . o n e ( ) . c o c o m p l e m e n t ( ) ; 1454 ∗ S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( o n e ) = "+ f S p s . s t a t e ( ) ) ; 1455 ∗ { @ c o d e f o r ( i = 0 ; i 1456 ∗ &n b s p ; &n b s p ; f S p s . c o c o m p l e m e n t ( a t o m S [ i ] ) ; 1457 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( a t o m S [ " + i + " ] ) = " + f S p s . ← ֓ s t a t e ( ) ) ; 1458 ∗ } < B R > 1459 ∗ 1460 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1461 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1462 ∗ c o c o m p l e m e n t ( z e r o ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f e < B R > 116 1463 ∗ c o c o m p l e m e n t ( o n e ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1464 ∗ c o c o m p l e m e n t ( a t o m S [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 5 5 5 4 < B R > 1465 ∗ c o c o m p l e m e n t ( a t o m S [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 2 < B R > 1466 ∗ c o c o m p l e m e n t ( a t o m S [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 f 0 e < B R > 1467 ∗ c o c o m p l e m e n t ( a t o m S [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f e < B R > 1468 ∗ < B R > 1469 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1470 ∗ 1471 ∗ 1472 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1473 ∗ T he f o l l o w i n g c o d e s ( 2 1 l i n e s ) t e s t s t h e p r o p e r t y < i >( A O R B ) A N D ( B O R C ) ← ֓ = B O R (A A N D C ) , 1474 ∗ a n d p r i n t t h e r e s u l t s o f t h e t e s t . 1475 ∗ P r o p o s i t i o n s < i > A , B , C < / i > a r e d e f i n e d r e s p e c t i v e l y a s t h e < i > ( ← ֓ t h e S i z e O f F r a m e / 4 ) − t h , 1476 ∗ < i >( t h e S i z e O f F r a m e / 2 ) − t h , < i > ( 3 ∗ t h e S i z e O f F r a m e / 4 ) − t h a t o m i c s ← ֓ p r o p o s i t i o n s . 1477 ∗ < B R > 1478 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 1479 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1480 ∗ / / / / / / T e s t : ( A O R B ) A N D ( B O R C ) = B O R (A A N D C )< B R > 1481 ∗ 1482 ∗ f i n a l S u p e r p o w e r s e t A = a t o m S [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 1483 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1484 ∗ / / Me t h o d { @ l i n k L a t t i c e #c l o n e ( ) } c r e a t e a n e x a c t c o p y o f t h e p r o p o s i t i o n ← ֓ < B R > 1485 ∗ f i n a l S u p e r p o w e r s e t B = a t o m S [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 1486 ∗ f i n a l S u p e r p o w e r s e t C = a t o m S [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 1487 ∗ f i n a l S u p e r p o w e r s e t A U B = f S p s . i n s t a n c e N s i z e ( ) ; 1488 ∗ f i n a l S u p e r p o w e r s e t B U C = f S p s . i n s t a n c e N s i z e ( ) ; 1489 ∗ f i n a l S u p e r p o w e r s e t A N C = f S p s . i n s t a n c e N s i z e ( ) ; 1490 ∗ f i n a l S u p e r p o w e r s e t l e f t = f S p s . i n s t a n c e N s i z e ( ) ; 1491 ∗ f i n a l S u p e r p o w e r s e t r i g h t = f S p s . i n s t a n c e N s i z e ( ) ; 1492 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1493 ∗ Co m p u t e < i > A O R B a n d s t o r e i t w i t h i n < i > A U B ;< B R > 1494 ∗ Co m p u t e < i > B O R C a n d s t o r e i t w i t h i n < i > B U C ;< B R > 1495 ∗ 1496 ∗ A U B . o r ( A , B ) ; 1497 ∗ B U C . o r ( B , C ) ; 1498 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1499 ∗ Co m p u t e < i > A A N D C < / i > a n d s t o r e i t w i t h i n < i > A N C ;< B R > 1500 ∗ Co m p u t e < i > A U B A N D B U C a n d s t o r e i t w i t h i n < i > l e f t ;< B R > 1501 ∗ Co m p u t e < i > B O R A N C a n d s t o r e i t w i t h i n < i > r i g h t ;< B R > 1502 ∗ 1503 ∗ A N C . a n d ( A , C ) ; 1504 ∗ l e f t . a n d ( A U B , B U C) ; 1505 ∗ r i g h t . o r ( B , A N C) ; 1506 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1507 ∗ T e s t i f < i > l e f t a n d < i > r i g h t a r e e q u a l , a n d s t o r e t h e r e s u l t w i t h i n 1508 ∗ < i >i s E q u a l ;< B R > 1509 ∗ 1510 ∗ b o o l e a n i s E q u a l= l e f t . c o m p a r e T o ( r i g h t ) ==0 ;< B R > 1511 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1512 ∗ P r i n t p r o p o s i t i o n s < i > A , B , C , l e f t , r i g h t a n d t h e b o o l e a n < i >i s E q u a l ;< ← ֓ B R > 1513 ∗ 1514 ∗ S y s t e m . o u t . p r i n t l n ( " A = a t o m S [ " + t h e S i z e O f F r a m e / 4 + " ] = " + A . s t a t e ( ) ) ; 1515 ∗ S y s t e m . o u t . p r i n t l n ( " B = a t o m S [ " + t h e S i z e O f F r a m e / 2 + " ] = " + B . s t a t e ( ) ) ; 1516 ∗ S y s t e m . o u t . p r i n t l n ( " C = a t o m S [ " + ( 3 ∗ t h e S i z e O f F r a m e ) / 4 + " ] = " + C . s t a t e ( ) ) ; < ← ֓ B R > 1517 ∗ S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 1518 ∗ S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 1519 ∗ S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 1520 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1521 ∗ A = a t o m S [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 c c c c< B R > 1522 ∗ B = a t o m S [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f 0 < B R > 1523 ∗ C = a t o m S [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f f 0 0 < B R > 1524 ∗ (A O R B ) A N D ( B O R C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f c f 0 < B R > 1525 ∗ B O R (A A N D C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f c f 0 < B R > 1526 ∗ i s E q u a l = t r u e < B R > 1527 ∗ 1528 ∗ 1529 ∗ / 117 1530 p u b l i c v o i d l o g i c a l _ t e s t s _ S u p e r p o w e r s e t ( i n t t h e S i z e O f F r a m e ) { 1531 1532 i n t i ; 1533 f i n a l S u p e r p o w e r s e t f S p s = n e w f i n a l S u p e r p o w e r s e t ( ) ; 1534 i f ( f S p s . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { 1535 S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ S u p e r p o w e r s e t ( i n t ) \ n " + 1536 " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 1537 S y s t e m . e x i t ( 0 ) ; 1538 } 1539 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : S u p e r p o w e r s e t − s i z e = " + ← ֓ t h e S i z e O f F r a m e + 1540 " / / \ n \ n " ) ; 1541 f i n a l S u p e r p o w e r s e t [ ] a t o m S = n ew f i n a l S u p e r p o w e r s e t [ t h e S i z e O f F r a m e ] ; 1542 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1543 a t o m S [ i ] = f S p s . i n s t a n c e N s i z e ( ) ; 1544 a t o m S [ i ] . a t o m i c ( i ) ; 1545 } 1546 f S p s . z e r o ( ) ; 1547 S y s t e m . o u t . p r i n t l n ( " z e r o = " + f S p s . s t a t e ( ) ) ; 1548 f S p s . o n e ( ) ; 1549 S y s t e m . o u t . p r i n t l n ( " o n e = " + f S p s . s t a t e ( ) ) ; 1550 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1551 S y s t e m . o u t . p r i n t l n ( " a t o m S [ " + i + " ] = " + a t o m S [ i ] . s t a t e ( ) ) ; 1552 } 1553 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1554 f S p s . z e r o ( ) . c o m p l e m e n t ( ) ; 1555 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( z e r o ) = " + f S p s . s t a t e ( ) ) ; 1556 f S p s . o n e ( ) . c o m p l e m e n t ( ) ; 1557 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( o n e ) = " + f S p s . s t a t e ( ) ) ; 1558 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1559 f S p s . c o m p l e m e n t ( a t o m S [ i ] ) ; 1560 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( a t o m S [ " + i + " ] ) = " + f S p s . s t a t e ( ) ) ; 1561 } 1562 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1563 f S p s . z e r o ( ) . c o c o m p l e m e n t ( ) ; 1564 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( z e r o ) = " + f S p s . s t a t e ( ) ) ; 1565 f S p s . o n e ( ) . c o c o m p l e m e n t ( ) ; 1566 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( o n e ) = " + f S p s . s t a t e ( ) ) ; 1567 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1568 f S p s . c o c o m p l e m e n t ( a t o m S [ i ] ) ; 1569 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( a t o m S [ " + i + " ] ) = " + f S p s . s t a t e ( ) ) ; 1570 } 1571 1572 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1573 1574 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 1575 f i n a l S u p e r p o w e r s e t A = a t o m S [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 1576 f i n a l S u p e r p o w e r s e t B = a t o m S [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 1577 f i n a l S u p e r p o w e r s e t C = a t o m S [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 1578 f i n a l S u p e r p o w e r s e t A U B = f S p s . i n s t a n c e N s i z e ( ) ; 1579 f i n a l S u p e r p o w e r s e t B U C = f S p s . i n s t a n c e N s i z e ( ) ; 1580 f i n a l S u p e r p o w e r s e t A N C = f S p s . i n s t a n c e N s i z e ( ) ; 1581 f i n a l S u p e r p o w e r s e t l e f t = f S p s . i n s t a n c e N s i z e ( ) ; 1582 f i n a l S u p e r p o w e r s e t r i g h t = f S p s . i n s t a n c e N s i z e ( ) ; 1583 A U B . o r ( A , B ) ; 1584 B U C . o r ( B , C ) ; 1585 A N C . a n d ( A , C ) ; 1586 l e f t . a n d ( A U B , B U C ) ; 1587 r i g h t . o r ( B , A N C ) ; 1588 b o o l e a n i s E q u a l = l e f t . c o m p a r e T o ( r i g h t ) = =0 ; 1589 S y s t e m . o u t . p r i n t l n ( " A = a t o m S [ " + t h e S i z e O f F r a m e /4+ " ] = " + A . s t a t e ( ) ) ; 1590 S y s t e m . o u t . p r i n t l n ( " B = a t o m S [ " + t h e S i z e O f F r a m e /2+ " ] = " + B . s t a t e ( ) ) ; 1591 S y s t e m . o u t . p r i n t l n ( " C = a t o m S [ " + ( 3 ∗ t h e S i z e O f F r a m e ) /4+ " ] = " + C . s t a t e ( ) ) ; 1592 S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 1593 S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 1594 S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 1595 1596 } 1597 1598 / ∗ ∗ 1599 ∗ T e s t s o m e l o g i c a l m a n i p u l a t i o n s o n O p e n h y p e r p o w e r s e t . 1600 ∗ 118 1601 ∗ < B R > < B R > 1602 ∗ D e t a i l e d c o d e d e s c r i p t i o n . < / b > < B R > 1603 ∗ T he f o l l o w i n g t y p o n o m i c c o n v e n t i o n s a r e u s e d : 1604 ∗ < c o d e > 1605 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1606 ∗ B l u e c o l o r i s u s e d f o r c o m m e n t i n g t h e f o l l o w i n g c o d e . 1607 ∗ < B R > 1608 ∗ c o d e f o r m a t i n g i s u s e d f o r p r i n t i n g t h e c o d e . 1609 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1610 ∗ R ed c o l o r i s u s e d f o r p r i n t i n g t h e p o s s i b l e o u t p u t r e s u l t i n g o f t h e 1611 ∗ p r e v i o u s c o d e . 1612 ∗ 1613 ∗ < B R > < B R > 1614 ∗ F o r t h e o u t p u t , i t i s a s s u m e d t h a t t h e S i z e O f F r a m e =4 ( p a r a m e t e r o f ← ֓ t h e m e t h o d ) . 1615 ∗ < B R > < B R > 1616 ∗ C om me n te d c o d e : 1617 ∗ < B R > < B R > 1618 ∗ < c o d e > 1619 ∗ i n t i ; 1620 1621 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1622 ∗ D e c l a r a t i o n o f a n o p e n h y p e r p o w e r s e t , < i >f O h p s ; 1623 ∗ < B R > 1624 ∗ f i n a l O p e n h y p e r p o w e r s e t f O h p s = ne w f i n a l O p e n h y p e r p o w e r s e t ( ) ; 1625 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1626 ∗ R e s i z e < i >f O h p s t o < i >t h e S i z e O f F r a m e , t h e p a r a m e t e r o f t h e m e t h o d . 1627 ∗ I f t h e r e s i z i n g f a i l e d , p r o d u c e a n e r r o r m e s s a g e a n d e x i t ; 1628 ∗ < B R > 1629 ∗ i f ( f O h p s . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { < B R > 1630 ∗ &n b s p ; &n b s p ; S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ O p e n h y p e r p o w e r s e t ( i n t ) \ n " + < B R > 1631 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 1632 ∗ &n b s p ; &n b s p ; S y s t e m . e x i t ( 0 ) ; 1633 ∗ } < B R > 1634 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1635 ∗ P r i n t t h e t i t l e o f t h e me t h o d ; 1636 ∗ < B R > 1637 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : O p e n h y p e r p o w e r s e t − s i z e = " + ← ֓ t h e S i z e O f F r a m e + < B R > 1638 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " / / \ n \ n " ) ; 1639 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1640 ∗ / / / / / / T e s t : O p e n h y p e r p o w e r s e t − s i z e = 4 &n b s p ; &n b s p ; // 1641 ∗ 1642 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1643 ∗ C r e a t e t h e t a b l e o f a t o m i c p r o p o s i t i o n s , < i > a t o m ; < B R > 1644 ∗ C r e a t e e a c h a t o m i c p r o p o s i t i o n b y i n s t a n c i n g a n d r e s i z i n g f r o m < i >f O h p s , u s i n g 1645 ∗ { @ c o d e f O h p s . i n s t a n c e N s i z e ( ) ; } ; < B R > 1646 ∗ D e f i n e e a c h a t o m i c b y a p p l y i n g t h e m e t h o d { @ l i n k G e n e r a t e d L a t t i c e #a t o m i c ( ← ֓ i n t ) } ; < B R > 1647 ∗ 1648 ∗ f i n a l O p e n h y p e r p o w e r s e t [ ] at o m = n e w f i n a l O p e n h y p e r p o w e r s e t [ t h e S i z e O f F r a m e ← ֓ ] ; < B R > 1649 ∗ { @ c o d e f o r ( i = 0 ; i 1650 ∗ &n b s p ; &n b s p ; a t o m [ i ] = f O h p s . i n s t a n c e N s i z e ( ) ; 1651 ∗ &n b s p ; &n b s p ; a t o m [ i ] . a t o m i c ( i ) ; 1652 ∗ } < B R > 1653 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1654 ∗ P r i n t < i >z e r o , < i > o n e < / i > a n d t h e t a b l e o f a t o m i c p r o p o s i t i o n s ( p r i n t e d 1655 ∗ w i t h h e x a d e c i m a l c o d i n g ) ; 1656 ∗ < B R > 1657 ∗ f O h p s . z e r o ( ) ; 1658 ∗ S y s t e m . o u t . p r i n t l n ( " z e r o = "+ f O h p s . s t a t e ( ) ) ; 1659 ∗ f O h p s . o n e ( ) ; 1660 ∗ S y s t e m . o u t . p r i n t l n ( " o n e = "+ f O h p s . s t a t e ( ) ) ; 1661 ∗ { @ c o d e f o r ( i = 0 ; i 1662 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " a t o m [ " + i + " ] = " + a t o m [ i ] . s t a t e ( ) ) ; 1663 ∗ } < B R > 1664 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1665 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1666 ∗ z e r o = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1667 ∗ o n e = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1668 ∗ at o m [ 0 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 a a a a < B R > 119 1669 ∗ at o m [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 c c c c < B R > 1670 ∗ at o m [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f 0 < B R > 1671 ∗ at o m [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f f 0 0 < B R > 1672 ∗ < B R > 1673 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1674 ∗ 1675 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1676 ∗ P r i n t t h e c o m p l e m e n t o f < i > z e r o , o f < i >o n e a n d t h e t a b l e o f 1677 ∗ c o m p l e m e n t s o f t h e a t o m i c p r o p o s i t i o n s . T he c o m p l e m e n t s 1678 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f O h p s . c o m p l e m e n t ( a t o m [ i ] ) ; } a n d 1679 ∗ s t o r e d w i t h i n < i >f O h p s ; 1680 ∗ < B R > 1681 ∗ f O h p s . z e r o ( ) . c o m p l e m e n t ( ) ; 1682 ∗ S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( z e r o ) = "+ f O h p s . s t a t e ( ) ) ; 1683 ∗ f O h p s . o n e ( ) . c o m p l e m e n t ( ) ; 1684 ∗ S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( o n e ) = "+ f O h p s . s t a t e ( ) ) ; 1685 ∗ { @ c o d e f o r ( i = 0 ; i 1686 ∗ &n b s p ; &n b s p ; f O h p s . c o m p l e m e n t ( at o m [ i ] ) ; 1687 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( a t o m [ " + i + " ] ) = " +f O h p s . s t a t e ← ֓ ( ) ) ; 1688 ∗ } < B R > 1689 ∗ 1690 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1691 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1692 ∗ c o m p l e m e n t ( z e r o ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1693 ∗ c o m p l e m e n t ( o n e ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1694 ∗ c o m p l e m e n t ( at o m [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1695 ∗ c o m p l e m e n t ( at o m [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1696 ∗ c o m p l e m e n t ( at o m [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1697 ∗ c o m p l e m e n t ( at o m [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1698 ∗ < B R > 1699 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1700 ∗ 1701 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1702 ∗ P r i n t t h e c o c o m p l e m e n t o f < i > z e r o , o f < i >o n e a n d t h e t a b l e o f 1703 ∗ c o c o m p l e m e n t s o f t h e a t o m i c p r o p o s i t i o n s . T he c o c o m p l e m e n t s 1704 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f O h p s . c o c o m p l e m e n t ( a t o m [ i ] ) ; } a n d 1705 ∗ s t o r e d w i t h i n < i >f O h p s ; 1706 ∗ < B R > 1707 ∗ f O h p s . z e r o ( ) . c o c o m p l e m e n t ( ) ; 1708 ∗ S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( z e r o ) = " + f O h p s . s t a t e ( ) ) ; 1709 ∗ f O h p s . o n e ( ) . c o c o m p l e m e n t ( ) ; 1710 ∗ S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( o n e ) = "+ f O h p s . s t a t e ( ) ) ; 1711 ∗ { @ c o d e f o r ( i = 0 ; i 1712 ∗ &n b s p ; &n b s p ; f O h p s . c o c o m p l e m e n t ( at o m [ i ] ) ; 1713 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( at o m [ " + i + " ] ) = " +f O h p s . ← ֓ s t a t e ( ) ) ; 1714 ∗ } < B R > 1715 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1716 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1717 ∗ c o c o m p l e m e n t ( z e r o ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1718 ∗ c o c o m p l e m e n t ( o n e ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1719 ∗ c o c o m p l e m e n t ( a t om [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1720 ∗ c o c o m p l e m e n t ( a t om [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1721 ∗ c o c o m p l e m e n t ( a t om [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1722 ∗ c o c o m p l e m e n t ( a t om [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f f < B R > 1723 ∗ < B R > 1724 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1725 ∗ 1726 ∗ 1727 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1728 ∗ T he f o l l o w i n g c o d e s ( 2 1 l i n e s ) t e s t s t h e p r o p e r t y < i >( A O R B ) A N D ( B O R C ) ← ֓ = B O R (A A N D C ) , 1729 ∗ a n d p r i n t t h e r e s u l t s o f t h e t e s t . 1730 ∗ P r o p o s i t i o n s < i > A , B , C < / i > a r e d e f i n e d r e s p e c t i v e l y a s t h e < i > ( ← ֓ t h e S i z e O f F r a m e / 4 ) − t h , 1731 ∗ < i >( t h e S i z e O f F r a m e / 2 ) − t h , < i > ( 3 ∗ t h e S i z e O f F r a m e / 4 ) − t h a t o m i c s ← ֓ p r o p o s i t i o n s . 1732 ∗ < B R > 1733 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 1734 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1735 ∗ / / / / / / T e s t : ( A O R B ) A N D ( B O R C ) = B O R (A A N D C )< B R > 1736 ∗ 120 1737 ∗ f i n a l O p e n h y p e r p o w e r s e t A = a t o m [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 1738 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1739 ∗ / / Me t h o d { @ l i n k L a t t i c e #c l o n e ( ) } c r e a t e a n e x a c t c o p y o f t h e p r o p o s i t i o n ← ֓ < B R > 1740 ∗ f i n a l O p e n h y p e r p o w e r s e t B = a t o m [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 1741 ∗ f i n a l O p e n h y p e r p o w e r s e t C = a t o m [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 1742 ∗ f i n a l O p e n h y p e r p o w e r s e t A U B = f O h p s . i n s t a n c e N s i z e ( ) ; 1743 ∗ f i n a l O p e n h y p e r p o w e r s e t B U C = f O h p s . i n s t a n c e N s i z e ( ) ; 1744 ∗ f i n a l O p e n h y p e r p o w e r s e t A N C = f O h p s . i n s t a n c e N s i z e ( ) ; 1745 ∗ f i n a l O p e n h y p e r p o w e r s e t l e f t = f O h p s . i n s t a n c e N s i z e ( ) ; 1746 ∗ f i n a l O p e n h y p e r p o w e r s e t r i g h t = f O h p s . i n s t a n c e N s i z e ( ) ; 1747 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1748 ∗ Co m p u t e < i > A O R B a n d s t o r e i t w i t h i n < i > A U B ;< B R > 1749 ∗ Co m p u t e < i > B O R C a n d s t o r e i t w i t h i n < i > B U C ;< B R > 1750 ∗ 1751 ∗ A U B . o r ( A , B ) ; 1752 ∗ B U C . o r ( B , C ) ; 1753 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1754 ∗ Co m p u t e < i > A A N D C < / i > a n d s t o r e i t w i t h i n < i > A N C ;< B R > 1755 ∗ Co m p u t e < i > A U B A N D B U C a n d s t o r e i t w i t h i n < i > l e f t ;< B R > 1756 ∗ Co m p u t e < i > B O R A N C a n d s t o r e i t w i t h i n < i > r i g h t ;< B R > 1757 ∗ 1758 ∗ A N C . a n d ( A , C ) ; 1759 ∗ l e f t . a n d ( A U B , B U C) ; 1760 ∗ r i g h t . o r ( B , A N C) ; 1761 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1762 ∗ T e s t i f < i > l e f t a n d < i > r i g h t a r e e q u a l , a n d s t o r e t h e r e s u l t w i t h i n 1763 ∗ < i >i s E q u a l ;< B R > 1764 ∗ 1765 ∗ b o o l e a n i s E q u a l= l e f t . c o m p a r e T o ( r i g h t ) ==0 ;< B R > 1766 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1767 ∗ P r i n t p r o p o s i t i o n s < i > A , B , C , l e f t , r i g h t a n d t h e b o o l e a n < i >i s E q u a l ;< ← ֓ B R > 1768 ∗ 1769 ∗ S y s t e m . o u t . p r i n t l n ( " A = at o m [ " + t h e S i z e O f F r a m e / 4 + " ] = " + A . s t a t e ( ) ) ; 1770 ∗ S y s t e m . o u t . p r i n t l n ( " B = at o m [ " + t h e S i z e O f F r a m e / 2 + " ] = " + B . s t a t e ( ) ) ; 1771 ∗ S y s t e m . o u t . p r i n t l n ( " C = a t o m [ " + ( 3 ∗ t h e S i z e O f F r a m e ) / 4 + " ] = " + C . s t a t e ( ) ) ; 1772 ∗ S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 1773 ∗ S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 1774 ∗ S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 1775 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1776 ∗ A = a t o m [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 c c c c< B R > 1777 ∗ B = at o m [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f 0 < B R > 1778 ∗ C = at o m [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f f 0 0 < B R > 1779 ∗ (A O R B ) A N D ( B O R C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f c f 0 < B R > 1780 ∗ B O R (A A N D C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f c f 0 < B R > 1781 ∗ i s E q u a l = t r u e < B R > 1782 ∗ 1783 ∗ 1784 ∗ 1785 ∗ / 1786 p u b l i c v o i d l o g i c a l _ t e s t s _ O p e n h y p e r p o w e r s e t ( i n t t h e S i z e O f F r a m e ) { 1787 1788 i n t i ; 1789 f i n a l O p e n h y p e r p o w e r s e t f O h p s = ne w f i n a l O p e n h y p e r p o w e r s e t ( ) ; 1790 i f ( f O h p s . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { 1791 S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ O p e n h y p e r p o w e r s e t ( i n t ) \ n " + 1792 " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 1793 S y s t e m . e x i t ( 0 ) ; 1794 } 1795 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : O p e n h y p e r p o w e r s e t − s i z e = " + ← ֓ t h e S i z e O f F r a m e + 1796 " / / \ n \ n " ) ; 1797 f i n a l O p e n h y p e r p o w e r s e t [ ] a t o m = n e w f i n a l O p e n h y p e r p o w e r s e t [ t h e S i z e O f F r a m e ← ֓ ] ; 1798 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1799 a t o m [ i ] = f O h p s . i n s t a n c e N s i z e ( ) ; 1800 a t o m [ i ] . a t o m i c ( i ) ; 1801 } 1802 f O h p s . z e r o ( ) ; 1803 S y s t e m . o u t . p r i n t l n ( " z e r o = " + f O h p s . s t a t e ( ) ) ; 1804 f O h p s . o n e ( ) ; 121 1805 S y s t e m . o u t . p r i n t l n ( " o n e = " + f O h p s . s t a t e ( ) ) ; 1806 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1807 S y s t e m . o u t . p r i n t l n ( " a t o m [ " + i + " ] = " + a t o m [ i ] . s t a t e ( ) ) ; 1808 } 1809 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1810 f O h p s . z e r o ( ) . c o m p l e m e n t ( ) ; 1811 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( z e r o ) = " + f O h p s . s t a t e ( ) ) ; 1812 f O h p s . o n e ( ) . c o m p l e m e n t ( ) ; 1813 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( o n e ) = " + f O h p s . s t a t e ( ) ) ; 1814 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1815 f O h p s . c o m p l e m e n t ( a t o m [ i ] ) ; 1816 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( a t o m [ " + i + " ] ) = " + f O h p s . s t a t e ( ) ) ; 1817 } 1818 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1819 f O h p s . z e r o ( ) . c o c o m p l e m e n t ( ) ; 1820 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( z e r o ) = " + f O h p s . s t a t e ( ) ) ; 1821 f O h p s . o n e ( ) . c o c o m p l e m e n t ( ) ; 1822 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( o n e ) = " + f O h p s . s t a t e ( ) ) ; 1823 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 1824 f O h p s . c o c o m p l e m e n t ( a t o m [ i ] ) ; 1825 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( a t o m [ " + i + " ] ) = " + f O h p s . s t a t e ( ) ) ; 1826 } 1827 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1828 1829 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 1830 f i n a l O p e n h y p e r p o w e r s e t A = a t o m [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 1831 f i n a l O p e n h y p e r p o w e r s e t B = a t o m [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 1832 f i n a l O p e n h y p e r p o w e r s e t C = a t o m [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 1833 f i n a l O p e n h y p e r p o w e r s e t A U B = f O h p s . i n s t a n c e N s i z e ( ) ; 1834 f i n a l O p e n h y p e r p o w e r s e t B U C = f O h p s . i n s t a n c e N s i z e ( ) ; 1835 f i n a l O p e n h y p e r p o w e r s e t A N C = f O h p s . i n s t a n c e N s i z e ( ) ; 1836 f i n a l O p e n h y p e r p o w e r s e t l e f t = f O h p s . i n s t a n c e N s i z e ( ) ; 1837 f i n a l O p e n h y p e r p o w e r s e t r i g h t = f O h p s . i n s t a n c e N s i z e ( ) ; 1838 A U B . o r ( A , B ) ; 1839 B U C . o r ( B , C ) ; 1840 A N C . a n d ( A , C ) ; 1841 l e f t . a n d ( A U B , B U C ) ; 1842 r i g h t . o r ( B , A N C ) ; 1843 b o o l e a n i s E q u a l = l e f t . c o m p a r e T o ( r i g h t ) = =0 ; 1844 S y s t e m . o u t . p r i n t l n ( " A = at o m [ " + t h e S i z e O f F r a m e /4+ " ] = " + A . s t a t e ( ) ) ; 1845 S y s t e m . o u t . p r i n t l n ( " B = at o m [ " + t h e S i z e O f F r a m e /2+ " ] = " + B . s t a t e ( ) ) ; 1846 S y s t e m . o u t . p r i n t l n ( " C = at o m [ " + ( 3 ∗ t h e S i z e O f F r a m e ) /4+ " ] = " + C . s t a t e ( ) ) ; 1847 S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 1848 S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 1849 S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 1850 1851 } 1852 1853 / ∗ ∗ 1854 ∗ T e s t s o m e l o g i c a l m a n i p u l a t i o n s o n C l o s e d h y p e r p o w e r s e t . 1855 ∗ 1856 ∗ < B R > < B R > 1857 ∗ D e t a i l e d c o d e d e s c r i p t i o n . < / b > < B R > 1858 ∗ T he f o l l o w i n g t y p o n o m i c c o n v e n t i o n s a r e u s e d : 1859 ∗ < c o d e > 1860 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1861 ∗ B l u e c o l o r i s u s e d f o r c o m m e n t i n g t h e f o l l o w i n g c o d e . 1862 ∗ < B R > 1863 ∗ c o d e f o r m a t i n g i s u s e d f o r p r i n t i n g t h e c o d e . 1864 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1865 ∗ R ed c o l o r i s u s e d f o r p r i n t i n g t h e p o s s i b l e o u t p u t r e s u l t i n g o f t h e 1866 ∗ p r e v i o u s c o d e . 1867 ∗ 1868 ∗ < B R > < B R > 1869 ∗ F o r t h e o u t p u t , i t i s a s s u m e d t h a t t h e S i z e O f F r a m e =4 ( p a r a m e t e r o f ← ֓ t h e m e t h o d ) . 1870 ∗ < B R > < B R > 1871 ∗ C om me n te d c o d e : 1872 ∗ < B R > < B R > 1873 ∗ < c o d e > 1874 ∗ i n t i ; 1875 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1876 ∗ D e c l a r a t i o n o f a c l o s e d h y p e r p o w e r s e t , < i >f C h p s ; 122 1877 ∗ < B R > 1878 ∗ f i n a l C l o s e d h y p e r p o w e r s e t f C h p s = ne w f i n a l C l o s e d h y p e r p o w e r s e t ( ) ; 1879 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1880 ∗ R e s i z e < i >f C h p s t o < i >t h e S i z e O f F r a m e , t h e p a r a m e t e r o f t h e m e t h o d . 1881 ∗ I f t h e r e s i z i n g f a i l e d , p r o d u c e a n e r r o r m e s s a g e a n d e x i t ; 1882 ∗ < B R > 1883 ∗ i f ( f C h p s . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { < B R > 1884 ∗ &n b s p ; &n b s p ; S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ C l o s e d h y p e r p o w e r s e t ( i n t ) \ n " + < B R > 1885 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 1886 ∗ &n b s p ; &n b s p ; S y s t e m . e x i t ( 0 ) ; 1887 ∗ } < B R > 1888 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1889 ∗ P r i n t t h e t i t l e o f t h e me t h o d ; 1890 ∗ < B R > 1891 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : C l o s e d h y p e r p o w e r s e t − s i z e = " + ← ֓ t h e S i z e O f F r a m e + < B R > 1892 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " / / \ n \ n " ) ; 1893 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1894 ∗ / / / / / / T e s t : C l o s e d h y p e r p o w e r s e t − s i z e = 4 &n b s p ; &n b s p ; //< B R > 1895 ∗ 1896 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1897 ∗ C r e a t e t h e t a b l e o f a t o m i c p r o p o s i t i o n s , < i > ato m C ; < B R > 1898 ∗ C r e a t e e a c h a t o m i c p r o p o s i t i o n b y i n s t a n c i n g a n d r e s i z i n g f r o m < i >f C h p s , u s i n g 1899 ∗ { @ c o d e f C h p s . i n s t a n c e N s i z e ( ) ; } ; < B R > 1900 ∗ D e f i n e e a c h a t o m i c b y a p p l y i n g t h e m e t h o d { @ l i n k G e n e r a t e d L a t t i c e #a t o m i c ( ← ֓ i n t ) } ; < B R > 1901 ∗ 1902 ∗ f i n a l C l o s e d h y p e r p o w e r s e t [ ] a to mC = ne w f i n a l C l o s e d h y p e r p o w e r s e t [ ← ֓ t h e S i z e O f F r a m e ] ; < B R > 1903 ∗ { @ c o d e f o r ( i = 0 ; i 1904 ∗ &n b s p ; &n b s p ; at om C [ i ] = f C h p s . i n s t a n c e N s i z e ( ) ; 1905 ∗ &n b s p ; &n b s p ; at om C [ i ] . a t o m i c ( i ) ; 1906 ∗ } < B R > 1907 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1908 ∗ P r i n t < i >z e r o , < i > o n e < / i > a n d t h e t a b l e o f a t o m i c p r o p o s i t i o n s ( p r i n t e d 1909 ∗ w i t h h e x a d e c i m a l c o d i n g ) ; 1910 ∗ < B R > 1911 ∗ f C h p s . z e r o ( ) ; 1912 ∗ S y s t e m . o u t . p r i n t l n ( " z e r o = "+ f C h p s . s t a t e ( ) ) ; 1913 ∗ f C h p s . o n e ( ) ; 1914 ∗ S y s t e m . o u t . p r i n t l n ( " o n e = "+ f C h p s . s t a t e ( ) ) ; 1915 ∗ { @ c o d e f o r ( i = 0 ; i 1916 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " at om C [ " + i + " ] = " + a tom C [ i ] . s t a t e ( ) ) ; 1917 ∗ } < B R > 1918 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1919 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1920 ∗ z e r o = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1921 ∗ o n e = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f e < B R > 1922 ∗ a to mC [ 0 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 a a a a < B R > 1923 ∗ a to mC [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 c c c c < B R > 1924 ∗ a to mC [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f 0 < B R > 1925 ∗ a to mC [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f f 0 0 < B R > 1926 ∗ < B R > 1927 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1928 ∗ 1929 ∗ 1930 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1931 ∗ P r i n t t h e c o m p l e m e n t o f < i > z e r o , o f < i >o n e a n d t h e t a b l e o f ← ֓ c o m p l e m e n t s 1932 ∗ o f t h e a t o m i c p r o p o s i t i o n s . T he c o m p l e m e n t s a r e c o m p u t e d b y m e a n s o f c o d e 1933 ∗ { @ c o d e f C h p s . c o m p l e m e n t ( at om C [ i ] ) ; } a n d s t o r e d w i t h i n < i >f C h p s ; 1934 ∗ < B R > 1935 ∗ f C h p s . z e r o ( ) . c o m p l e m e n t ( ) ; 1936 ∗ S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( z e r o ) = "+ f C h p s . s t a t e ( ) ) ; 1937 ∗ f C h p s . o n e ( ) . c o m p l e m e n t ( ) ; 1938 ∗ S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( o n e ) = "+ f C h p s . s t a t e ( ) ) ; 1939 ∗ { @ c o d e f o r ( i = 0 ; i 1940 ∗ &n b s p ; &n b s p ; f C h p s . c o m p l e m e n t ( a to m C [ i ] ) ; 1941 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( at om C [ " + i + " ] ) = " +f C h p s . s t a t e ← ֓ ( ) ) ; 1942 ∗ } < B R > 1943 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 123 1944 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1945 ∗ c o m p l e m e n t ( z e r o ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f e < B R > 1946 ∗ c o m p l e m e n t ( o n e ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1947 ∗ c o m p l e m e n t ( at om C [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1948 ∗ c o m p l e m e n t ( at om C [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1949 ∗ c o m p l e m e n t ( at om C [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1950 ∗ c o m p l e m e n t ( at om C [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1951 ∗ < B R > 1952 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1953 ∗ 1954 ∗ 1955 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1956 ∗ P r i n t t h e c o c o m p l e m e n t o f < i > z e r o , o f < i >o n e a n d t h e t a b l e o f ← ֓ c o c o m p l e m e n t s 1957 ∗ o f t h e a t o m i c p r o p o s i t i o n s . T he c o c o m p l e m e n t s 1958 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f C h p s . c o c o m p l e m e n t ( at om C [ i ] ) ; } a n d 1959 ∗ s t o r e d w i t h i n < i >f C h p s ; 1960 ∗ < B R > 1961 ∗ f C h p s . z e r o ( ) . c o c o m p l e m e n t ( ) ; 1962 ∗ S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( z e r o ) = " + f C h p s . s t a t e ( ) ) ; 1963 ∗ f C h p s . o n e ( ) . c o c o m p l e m e n t ( ) ; 1964 ∗ S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( o n e ) = "+ f C h p s . s t a t e ( ) ) ; 1965 ∗ { @ c o d e f o r ( i = 0 ; i 1966 ∗ &n b s p ; &n b s p ; f C h p s . c o c o m p l e m e n t ( at om C [ i ] ) ; 1967 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( at om C [ " + i + " ] ) = " +f C h p s . ← ֓ s t a t e ( ) ) ; 1968 ∗ } < B R > 1969 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 1970 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1971 ∗ c o c o m p l e m e n t ( z e r o ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f e < B R > 1972 ∗ c o c o m p l e m e n t ( o n e ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 < B R > 1973 ∗ c o c o m p l e m e n t ( a to mC [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f c < B R > 1974 ∗ c o c o m p l e m e n t ( a to mC [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f f a < B R > 1975 ∗ c o c o m p l e m e n t ( a to mC [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f f e e < B R > 1976 ∗ c o c o m p l e m e n t ( a to mC [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f e f e < B R > 1977 ∗ < B R > 1978 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 1979 ∗ 1980 ∗ 1981 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1982 ∗ T he f o l l o w i n g c o d e s ( 2 1 l i n e s ) t e s t s t h e p r o p e r t y < i >( A O R B ) A N D ( B O R C ) ← ֓ = B O R (A A N D C ) , 1983 ∗ a n d p r i n t t h e r e s u l t s o f t h e t e s t . 1984 ∗ P r o p o s i t i o n s < i > A , B , C < / i > a r e d e f i n e d r e s p e c t i v e l y a s t h e < i > ( ← ֓ t h e S i z e O f F r a m e / 4 ) − t h , 1985 ∗ < i >( t h e S i z e O f F r a m e / 2 ) − t h , < i > ( 3 ∗ t h e S i z e O f F r a m e / 4 ) − t h a t o m i c s ← ֓ p r o p o s i t i o n s . 1986 ∗ < B R > 1987 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 1988 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1989 ∗ / / / / / / T e s t : ( A O R B ) A N D ( B O R C ) = B O R (A A N D C )< B R > 1990 ∗ 1991 ∗ f i n a l C l o s e d h y p e r p o w e r s e t A = at om C [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 1992 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 1993 ∗ / / Me t h o d { @ l i n k L a t t i c e #c l o n e ( ) } c r e a t e a n e x a c t c o p y o f t h e p r o p o s i t i o n ← ֓ < B R > 1994 ∗ f i n a l C l o s e d h y p e r p o w e r s e t B = at om C [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 1995 ∗ f i n a l C l o s e d h y p e r p o w e r s e t C = ato m C [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 1996 ∗ f i n a l C l o s e d h y p e r p o w e r s e t A U B = f C h p s . i n s t a n c e N s i z e ( ) ; 1997 ∗ f i n a l C l o s e d h y p e r p o w e r s e t B U C = f C h p s . i n s t a n c e N s i z e ( ) ; 1998 ∗ f i n a l C l o s e d h y p e r p o w e r s e t A N C = f C h p s . i n s t a n c e N s i z e ( ) ; 1999 ∗ f i n a l C l o s e d h y p e r p o w e r s e t l e f t = f C h p s . i n s t a n c e N s i z e ( ) ; 2000 ∗ f i n a l C l o s e d h y p e r p o w e r s e t r i g h t = f C h p s . i n s t a n c e N s i z e ( ) ; 2001 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2002 ∗ Co m p u t e < i > A O R B a n d s t o r e i t w i t h i n < i > A U B ;< B R > 2003 ∗ Co m p u t e < i > B O R C a n d s t o r e i t w i t h i n < i > B U C ;< B R > 2004 ∗ 2005 ∗ A U B . o r ( A , B ) ; 2006 ∗ B U C . o r ( B , C ) ; 2007 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2008 ∗ Co m p u t e < i > A A N D C < / i > a n d s t o r e i t w i t h i n < i > A N C ;< B R > 2009 ∗ Co m p u t e < i > A U B A N D B U C a n d s t o r e i t w i t h i n < i > l e f t ;< B R > 2010 ∗ Co m p u t e < i > B O R A N C a n d s t o r e i t w i t h i n < i > r i g h t ;< B R > 124 2011 ∗ 2012 ∗ A N C . a n d ( A , C ) ; 2013 ∗ l e f t . a n d ( A U B , B U C) ; 2014 ∗ r i g h t . o r ( B , A N C) ; 2015 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2016 ∗ T e s t i f < i > l e f t a n d < i > r i g h t a r e e q u a l , a n d s t o r e t h e r e s u l t w i t h i n 2017 ∗ < i >i s E q u a l ;< B R > 2018 ∗ 2019 ∗ b o o l e a n i s E q u a l= l e f t . c o m p a r e T o ( r i g h t ) ==0 ;< B R > 2020 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2021 ∗ P r i n t p r o p o s i t i o n s < i > A , B , C , l e f t , r i g h t a n d t h e b o o l e a n < i >i s E q u a l ;< ← ֓ B R > 2022 ∗ 2023 ∗ S y s t e m . o u t . p r i n t l n ( " A = a to mC [ " + t h e S i z e O f F r a m e / 4 + " ] = " + A . s t a t e ( ) ) ; 2024 ∗ S y s t e m . o u t . p r i n t l n ( " B = a tom C [ " + t h e S i z e O f F r a m e / 2 + " ] = " + B . s t a t e ( ) ) ; 2025 ∗ S y s t e m . o u t . p r i n t l n ( " C = at om C [ " + ( 3 ∗ t h e S i z e O f F r a m e ) / 4 + " ] = " + C . s t a t e ( ) ) ; < ← ֓ B R > 2026 ∗ S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 2027 ∗ S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 2028 ∗ S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 2029 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2030 ∗ A = a to m C [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 c c c c< B R > 2031 ∗ B = a to mC [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f 0 f 0 < B R > 2032 ∗ C = a tom C [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 f f 0 0 < B R > 2033 ∗ (A O R B ) A N D ( B O R C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f c f 0 < B R > 2034 ∗ B O R (A A N D C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 f c f 0 < B R > 2035 ∗ i s E q u a l = t r u e < B R > 2036 ∗ 2037 ∗ 2038 ∗ 2039 ∗ / 2040 p u b l i c v o i d l o g i c a l _ t e s t s _ C l o s e d h y p e r p o w e r s e t ( i n t t h e S i z e O f F r a m e ) { 2041 2042 i n t i ; 2043 f i n a l C l o s e d h y p e r p o w e r s e t f C h p s = n e w f i n a l C l o s e d h y p e r p o w e r s e t ( ) ; 2044 i f ( f C h p s . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { 2045 S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ C l o s e d h y p e r p o w e r s e t ( i n t ) \ n " + 2046 " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 2047 S y s t e m . e x i t ( 0 ) ; 2048 } 2049 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : C l o s e d h y p e r p o w e r s e t − s i z e = " + ← ֓ t h e S i z e O f F r a m e + 2050 " / / \ n \ n " ) ; 2051 f i n a l C l o s e d h y p e r p o w e r s e t [ ] a t o m C = n ew f i n a l C l o s e d h y p e r p o w e r s e t [ ← ֓ t h e S i z e O f F r a m e ] ; 2052 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 2053 a t o m C [ i ] = f C h p s . i n s t a n c e N s i z e ( ) ; 2054 a t o m C [ i ] . a t o m i c ( i ) ; 2055 } 2056 f C h p s . z e r o ( ) ; 2057 S y s t e m . o u t . p r i n t l n ( " z e r o = " + f C h p s . s t a t e ( ) ) ; 2058 f C h p s . o n e ( ) ; 2059 S y s t e m . o u t . p r i n t l n ( " o n e = " + f C h p s . s t a t e ( ) ) ; 2060 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 2061 S y s t e m . o u t . p r i n t l n ( " ato m C [ " + i + " ] = " + a t o m C [ i ] . s t a t e ( ) ) ; 2062 } 2063 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2064 f C h p s . z e r o ( ) . c o m p l e m e n t ( ) ; 2065 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( z e r o ) = " + f C h p s . s t a t e ( ) ) ; 2066 f C h p s . o n e ( ) . c o m p l e m e n t ( ) ; 2067 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( o n e ) = " + f C h p s . s t a t e ( ) ) ; 2068 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 2069 f C h p s . c o m p l e m e n t ( a t o m C [ i ] ) ; 2070 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( ato m C [ " + i + " ] ) = " + f C h p s . s t a t e ( ) ) ; 2071 } 2072 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2073 f C h p s . z e r o ( ) . c o c o m p l e m e n t ( ) ; 2074 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( z e r o ) = " + f C h p s . s t a t e ( ) ) ; 2075 f C h p s . o n e ( ) . c o c o m p l e m e n t ( ) ; 2076 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( o n e ) = " + f C h p s . s t a t e ( ) ) ; 2077 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 2078 f C h p s . c o c o m p l e m e n t ( a t o m C [ i ] ) ; 2079 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( a to mC [ " + i + " ] ) = " + f C h p s . s t a t e ( ) ) ; 125 2080 } 2081 2082 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2083 2084 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 2085 f i n a l C l o s e d h y p e r p o w e r s e t A = a t o m C [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 2086 f i n a l C l o s e d h y p e r p o w e r s e t B = a t o m C [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 2087 f i n a l C l o s e d h y p e r p o w e r s e t C = a t o m C [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 2088 f i n a l C l o s e d h y p e r p o w e r s e t A U B = f C h p s . i n s t a n c e N s i z e ( ) ; 2089 f i n a l C l o s e d h y p e r p o w e r s e t B U C = f C h p s . i n s t a n c e N s i z e ( ) ; 2090 f i n a l C l o s e d h y p e r p o w e r s e t A N C = f C h p s . i n s t a n c e N s i z e ( ) ; 2091 f i n a l C l o s e d h y p e r p o w e r s e t l e f t = f C h p s . i n s t a n c e N s i z e ( ) ; 2092 f i n a l C l o s e d h y p e r p o w e r s e t r i g h t = f C h p s . i n s t a n c e N s i z e ( ) ; 2093 A U B . o r ( A , B ) ; 2094 B U C . o r ( B , C ) ; 2095 A N C . a n d ( A , C ) ; 2096 l e f t . a n d ( A U B , B U C ) ; 2097 r i g h t . o r ( B , A N C ) ; 2098 b o o l e a n i s E q u a l = l e f t . c o m p a r e T o ( r i g h t ) = =0 ; 2099 S y s t e m . o u t . p r i n t l n ( " A = a to mC [ " + t h e S i z e O f F r a m e /4+ " ] = " + A . s t a t e ( ) ) ; 2100 S y s t e m . o u t . p r i n t l n ( " B = a to mC [ " + t h e S i z e O f F r a m e /2+ " ] = " + B . s t a t e ( ) ) ; 2101 S y s t e m . o u t . p r i n t l n ( " C = a t om C [ " + ( 3 ∗ t h e S i z e O f F r a m e ) /4+ " ] = " + C . s t a t e ( ) ) ; 2102 S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 2103 S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 2104 S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 2105 2106 } 2107 2108 / ∗ ∗ 2109 ∗ T e s t s o m e l o g i c a l m a n i p u l a t i o n s o n P o w e r s e t . 2110 ∗ 2111 ∗ < B R > < B R > 2112 ∗ D e t a i l e d c o d e d e s c r i p t i o n . < / b > < B R > 2113 ∗ T he f o l l o w i n g t y p o n o m i c c o n v e n t i o n s a r e u s e d : 2114 ∗ < c o d e > 2115 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2116 ∗ B l u e c o l o r i s u s e d f o r c o m m e n t i n g t h e f o l l o w i n g c o d e . 2117 ∗ < B R > 2118 ∗ c o d e f o r m a t i n g i s u s e d f o r p r i n t i n g t h e c o d e . 2119 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2120 ∗ R ed c o l o r i s u s e d f o r p r i n t i n g t h e p o s s i b l e o u t p u t r e s u l t i n g o f t h e 2121 ∗ p r e v i o u s c o d e . 2122 ∗ 2123 ∗ < B R > < B R > 2124 ∗ F o r t h e o u t p u t , i t i s a s s u m e d t h a t t h e S i z e O f F r a m e =8 ( p a r a m e t e r o f ← ֓ t h e m e t h o d ) . 2125 ∗ < B R > < B R > 2126 ∗ C om me n te d c o d e : 2127 ∗ < B R > < B R > 2128 ∗ < c o d e > 2129 ∗ i n t i ; 2130 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2131 ∗ D e c l a r a t i o n o f a p o w e r s e t , < i > f P s e t ; 2132 ∗ < B R > 2133 ∗ f i n a l P o w e r s e t f P s e t = ne w f i n a l P o w e r s e t ( ) ; 2134 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2135 ∗ R e s i z e < i > f P s e t t o < i >t h e S i z e O f F r a m e , t h e p a r a m e t e r o f t h e m e t h o d . 2136 ∗ I f t h e r e s i z i n g f a i l e d , p r o d u c e a n e r r o r m e s s a g e a n d e x i t ; 2137 ∗ < B R > 2138 ∗ i f ( f P s e t . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { < B R > 2139 ∗ &n b s p ; &n b s p ; S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ C l o s e d h y p e r p o w e r s e t ( i n t ) \ n " + < B R > 2140 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 2141 ∗ &n b s p ; &n b s p ; S y s t e m . e x i t ( 0 ) ; 2142 ∗ } < B R > 2143 ∗ //< B R > 2144 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2145 ∗ P r i n t t h e t i t l e o f t h e me t h o d ; 2146 ∗ < B R > 2147 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : P o w e r s e t − s i z e = " + t h e S i z e O f F r a m e ← ֓ + < B R > 2148 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " / / \ n \ n " ) ; 2149 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 126 2150 ∗ / / / / / / T e s t : P o w e r s e t − s i z e = 8 &n b s p ; &n b s p ; // 2151 ∗ 2152 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2153 ∗ C r e a t e t h e t a b l e o f a t o m i c p r o p o s i t i o n s , < i >a t o m P s e t ; < B R > 2154 ∗ C r e a t e e a c h a t o m i c p r o p o s i t i o n b y i n s t a n c i n g a n d r e s i z i n g f r o m < i > f P s e t , u s i n g 2155 ∗ { @ c o d e f P s e t . i n s t a n c e N s i z e ( ) ; } ; < B R > 2156 ∗ D e f i n e e a c h a t o m i c b y a p p l y i n g t h e m e t h o d { @ l i n k G e n e r a t e d L a t t i c e #a t o m i c ( ← ֓ i n t ) } ; < B R > 2157 ∗ 2158 ∗ f i n a l P o w e r s e t [ ] a t o m P s e t = n e w f i n a l P o w e r s e t [ t h e S i z e O f F r a m e ] ; < B R > 2159 ∗ { @ c o d e f o r ( i = 0 ; i 2160 ∗ &n b s p ; &n b s p ; a t o m P s e t [ i ] = f P s e t . i n s t a n c e N s i z e ( ) ; 2161 ∗ &n b s p ; &n b s p ; a t o m P s e t [ i ] . a t o m i c ( i ) ; 2162 ∗ } < B R > 2163 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2164 ∗ P r i n t t h e t a b l e o f a t o m i c p r o p o s i t i o n s ( p r i n t e d w i t h h e x a d e c i m a l c o d i n g ) ; 2165 ∗ < B R > 2166 ∗ { @ c o d e f o r ( i = 0 ; i 2167 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " a t o m P s e t [ " + i + " ] " + < B R > 2168 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " = " +a t o m P s e t [ i ] . s t a t e ( ) ) ; 2169 ∗ } < B R > 2170 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2171 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2172 ∗ a t o m P s e t [ 0 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 < B R > 2173 ∗ a t o m P s e t [ 1 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 < B R > 2174 ∗ a t o m P s e t [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 < B R > 2175 ∗ a t o m P s e t [ 3 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 < B R > 2176 ∗ a t o m P s e t [ 4 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 < B R > 2177 ∗ a t o m P s e t [ 5 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 < B R > 2178 ∗ a t o m P s e t [ 6 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 < B R > 2179 ∗ a t o m P s e t [ 7 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 < B R > 2180 ∗ < B R > 2181 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 2182 ∗ 2183 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2184 ∗ P r i n t t h e t a b l e o f c o m p l e m e n t s o f t h e a t o m i c p r o p o s i t i o n s . Th e c o m p l e m e n t s 2185 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f P s e t . c o m p l e m e n t ( a t o m P s e t [ i ] ) ; } a n d 2186 ∗ s t o r e d w i t h i n < i >f P s e t ; 2187 ∗ < B R > 2188 ∗ { @ c o d e f o r ( i = 0 ; i 2189 ∗ &n b s p ; &n b s p ; f P s e t . c o m p l e m e n t ( a t o m P s e t [ i ] ) ; 2190 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( a t o m P s e t [ " + i + " ] ) " + < B R > 2191 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " = " + f P s e t . s t a t e ( ) ) ; 2192 ∗ } < B R > 2193 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2194 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2195 ∗ c o m p l e m e n t ( a t o m P s e t [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f e < B R > 2196 ∗ c o m p l e m e n t ( a t o m P s e t [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f d < B R > 2197 ∗ c o m p l e m e n t ( a t o m P s e t [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f b < B R > 2198 ∗ c o m p l e m e n t ( a t o m P s e t [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f 7 < B R > 2199 ∗ c o m p l e m e n t ( a t o m P s e t [ 4 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 e f < B R > 2200 ∗ c o m p l e m e n t ( a t o m P s e t [ 5 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 d f < B R > 2201 ∗ c o m p l e m e n t ( a t o m P s e t [ 6 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b f < B R > 2202 ∗ c o m p l e m e n t ( a t o m P s e t [ 7 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 f < B R > 2203 ∗ < B R > 2204 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 2205 ∗ 2206 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2207 ∗ P r i n t t h e t a b l e o f c o c o m p l e m e n t s o f t h e a t o m i c p r o p o s i t i o n s . The ← ֓ c o c o m p l e m e n t s 2208 ∗ a r e c o m p u t e d b y m e a n s o f c o d e { @ c o d e f P s e t . c o c o m p l e m e n t ( a t o m P s e t [ i ] ) ; } a n d 2209 ∗ s t o r e d w i t h i n < i >f P s e t ; 2210 ∗ < B R > 2211 ∗ { @ c o d e f o r ( i = 0 ; i 2212 ∗ &n b s p ; &n b s p ; f P s e t . c o c o m p l e m e n t ( a t o m P s e t [ i ] ) ; 2213 ∗ &n b s p ; &n b s p ; S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( a t o m P s e t [ " + i + " ] ) " + < B R > 2214 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; " = " + f P s e t . s t a t e ( ) ) ; 2215 ∗ } < B R > 2216 ∗ 2217 ∗ S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2218 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2219 ∗ c o c o m p l e m e n t ( a t o m P s e t [ 0 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f e < B R > 2220 ∗ c o c o m p l e m e n t ( a t o m P s e t [ 1 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f d < B R > 127 2221 ∗ c o c o m p l e m e n t ( a t o m P s e t [ 2 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f b < B R > 2222 ∗ c o c o m p l e m e n t ( a t o m P s e t [ 3 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f 7 < B R > 2223 ∗ c o c o m p l e m e n t ( a t o m P s e t [ 4 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 e f < B R > 2224 ∗ c o c o m p l e m e n t ( a t o m P s e t [ 5 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 d f < B R > 2225 ∗ c o c o m p l e m e n t ( a t o m P s e t [ 6 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 b f < B R > 2226 ∗ c o c o m p l e m e n t ( a t o m P s e t [ 7 ] ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 f < B R > 2227 ∗ < B R > 2228 ∗ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − < B R > 2229 ∗ 2230 ∗ 2231 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2232 ∗ T he f o l l o w i n g c o d e s ( 2 1 l i n e s ) t e s t s t h e p r o p e r t y < i >( A O R B ) A N D ( B O R C ) ← ֓ = B O R (A A N D C ) , 2233 ∗ a n d p r i n t t h e r e s u l t s o f t h e t e s t . 2234 ∗ P r o p o s i t i o n s < i > A , B , C < / i > a r e d e f i n e d r e s p e c t i v e l y a s t h e < i > ( ← ֓ t h e S i z e O f F r a m e / 4 ) − t h , 2235 ∗ < i >( t h e S i z e O f F r a m e / 2 ) − t h , < i > ( 3 ∗ t h e S i z e O f F r a m e / 4 ) − t h a t o m i c s ← ֓ p r o p o s i t i o n s . 2236 ∗ < B R > 2237 ∗ S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 2238 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2239 ∗ / / / / / / T e s t : ( A O R B ) A N D ( B O R C ) = B O R (A A N D C )< B R > 2240 ∗ 2241 ∗ f i n a l P o w e r s e t A = a t o m P s e t [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; < f o n t c o l o r = "# 0 0 0 0FF " ← ֓ s t y l e =" f o n t − f a m i l y : g e o r g i a "> 2242 ∗ / / Me t h o d { @ l i n k L a t t i c e #c l o n e ( ) } c r e a t e a n e x a c t c o p y o f t h e p r o p o s i t i o n ← ֓ < B R > 2243 ∗ f i n a l P o w e r s e t B = a t o m P s e t [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 2244 ∗ f i n a l P o w e r s e t C = a t o m P s e t [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 2245 ∗ f i n a l P o w e r s e t A U B = f P s e t . i n s t a n c e N s i z e ( ) ; 2246 ∗ f i n a l P o w e r s e t B U C = f P s e t . i n s t a n c e N s i z e ( ) ; 2247 ∗ f i n a l P o w e r s e t A N C = f P s e t . i n s t a n c e N s i z e ( ) ; 2248 ∗ f i n a l P o w e r s e t l e f t = f P s e t . i n s t a n c e N s i z e ( ) ; 2249 ∗ f i n a l P o w e r s e t r i g h t = f P s e t . i n s t a n c e N s i z e ( ) ; 2250 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2251 ∗ Co m p u t e < i > A O R B a n d s t o r e i t w i t h i n < i > A U B ;< B R > 2252 ∗ Co m p u t e < i > B O R C a n d s t o r e i t w i t h i n < i > B U C ;< B R > 2253 ∗ 2254 ∗ A U B . o r ( A , B ) ; 2255 ∗ B U C . o r ( B , C ) ; 2256 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2257 ∗ Co m p u t e < i > A A N D C < / i > a n d s t o r e i t w i t h i n < i > A N C ;< B R > 2258 ∗ Co m p u t e < i > A U B A N D B U C a n d s t o r e i t w i t h i n < i > l e f t ;< B R > 2259 ∗ Co m p u t e < i > B O R A N C a n d s t o r e i t w i t h i n < i > r i g h t ;< B R > 2260 ∗ 2261 ∗ A N C . a n d ( A , C ) ; 2262 ∗ l e f t . a n d ( A U B , B U C) ; 2263 ∗ r i g h t . o r ( B , A N C) ; 2264 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2265 ∗ T e s t i f < i > l e f t a n d < i > r i g h t a r e e q u a l , a n d s t o r e t h e r e s u l t w i t h i n 2266 ∗ < i >i s E q u a l ;< B R > 2267 ∗ 2268 ∗ b o o l e a n i s E q u a l= l e f t . c o m p a r e T o ( r i g h t ) ==0 ;< B R > 2269 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2270 ∗ P r i n t p r o p o s i t i o n s < i > A , B , C , l e f t , r i g h t a n d t h e b o o l e a n < i >i s E q u a l ;< ← ֓ B R > 2271 ∗ 2272 ∗ S y s t e m . o u t . p r i n t l n ( " A = a t o m P s e t [ " + t h e S i z e O f F r a m e / 4 + " ] = " + A . s t a t e ( ) ) ; 2273 ∗ S y s t e m . o u t . p r i n t l n ( " B = a t o m P s e t [ " + t h e S i z e O f F r a m e / 2 + " ] = " + B . s t a t e ( ) ) ; 2274 ∗ S y s t e m . o u t . p r i n t l n ( " C = a t o m P s e t [ " + ( 3 ∗ t h e S i z e O f F r a m e ) / 4 + " ] = " + C . s t a t e ( ) ) ← ֓ ; 2275 ∗ S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 2276 ∗ S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 2277 ∗ S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 2278 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2279 ∗ A = a t o m P s e t [ 2 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 < B R > 2280 ∗ B = a t o m P s e t [ 4 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 < B R > 2281 ∗ C = a t o m P s e t [ 6 ] = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 < B R > 2282 ∗ (A O R B ) A N D ( B O R C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 < B R > 2283 ∗ B O R (A A N D C ) = x 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 < B R > 2284 ∗ i s E q u a l = t r u e < B R > 128 2285 ∗ 2286 ∗ 2287 ∗ 2288 ∗ 2289 ∗ / 2290 p u b l i c v o i d l o g i c a l _ t e s t s _ P o w e r s e t ( i n t t h e S i z e O f F r a m e ) { 2291 2292 i n t i ; 2293 f i n a l P o w e r s e t f P s e t = n ew f i n a l P o w e r s e t ( ) ; 2294 i f ( f P s e t . s i z e ( t h e S i z e O f F r a m e ) ! = t h e S i z e O f F r a m e ) { 2295 S y s t e m . e r r . p r i n t l n ( " E r r o r : : R e f e r e e T o o l b o x _ T u t o r i a l . ← ֓ l o g i c a l _ t e s t s _ C l o s e d h y p e r p o w e r s e t ( i n t ) \ n " + 2296 " E x c e e d a u t h o r i z e d b o u n d s ! " ) ; 2297 S y s t e m . e x i t ( 0 ) ; 2298 } 2299 / / 2300 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : P o w e r s e t − s i z e = " + t h e S i z e O f F r a m e ← ֓ + 2301 " / / \ n \ n " ) ; 2302 f i n a l P o w e r s e t [ ] a t o m P s e t = ne w f i n a l P o w e r s e t [ t h e S i z e O f F r a m e ] ; 2303 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 2304 a t o m P s e t [ i ] = f P s e t . i n s t a n c e N s i z e ( ) ; 2305 a t o m P s e t [ i ] . a t o m i c ( i ) ; 2306 } 2307 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 2308 S y s t e m . o u t . p r i n t l n ( " a t o m P s e t [ " + i + " ] " + 2309 " = " + a t o m P s e t [ i ] . s t a t e ( ) ) ; 2310 } 2311 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2312 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 2313 f P s e t . c o m p l e m e n t ( a t o m P s e t [ i ] ) ; 2314 S y s t e m . o u t . p r i n t l n ( " c o m p l e m e n t ( a t o m P s e t [ " + i + " ] ) " + 2315 " = " + f P s e t . s t a t e ( ) ) ; 2316 } 2317 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2318 f o r ( i = 0 ; i < t h e S i z e O f F r a m e ; i ++ ) { 2319 f P s e t . c o c o m p l e m e n t ( a t o m P s e t [ i ] ) ; 2320 S y s t e m . o u t . p r i n t l n ( " c o c o m p l e m e n t ( a t o m P s e t [ " + i + " ] ) " + 2321 " = " + f P s e t . s t a t e ( ) ) ; 2322 } 2323 2324 S y s t e m . o u t . p r i n t l n ( " \ n − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − \ n " ) ; 2325 2326 S y s t e m . o u t . p r i n t l n ( " \ n \ n / / / / / / T e s t : (A O R B ) A N D ( B O R C ) = B O R (A A N D C ← ֓ ) " ) ; 2327 f i n a l P o w e r s e t A = a t o m P s e t [ t h e S i z e O f F r a m e / 4 ] . c l o n e ( ) ; 2328 f i n a l P o w e r s e t B = a t o m P s e t [ t h e S i z e O f F r a m e / 2 ] . c l o n e ( ) ; 2329 f i n a l P o w e r s e t C = a t o m P s e t [ ( 3 ∗ t h e S i z e O f F r a m e ) / 4 ] . c l o n e ( ) ; 2330 f i n a l P o w e r s e t A U B = f P s e t . i n s t a n c e N s i z e ( ) ; 2331 f i n a l P o w e r s e t B U C = f P s e t . i n s t a n c e N s i z e ( ) ; 2332 f i n a l P o w e r s e t A N C = f P s e t . i n s t a n c e N s i z e ( ) ; 2333 f i n a l P o w e r s e t l e f t = f P s e t . i n s t a n c e N s i z e ( ) ; 2334 f i n a l P o w e r s e t r i g h t = f P s e t . i n s t a n c e N s i z e ( ) ; 2335 A U B . o r ( A , B ) ; 2336 B U C . o r ( B , C ) ; 2337 A N C . a n d ( A , C ) ; 2338 l e f t . a n d ( A U B , B U C ) ; 2339 r i g h t . o r ( B , A N C ) ; 2340 b o o l e a n i s E q u a l = l e f t . c o m p a r e T o ( r i g h t ) = =0 ; 2341 S y s t e m . o u t . p r i n t l n ( " A = a t o m P s e t [ " + t h e S i z e O f F r a m e /4+ " ] = " + A . s t a t e ( ) ) ; 2342 S y s t e m . o u t . p r i n t l n ( " B = a t o m P s e t [ " + t h e S i z e O f F r a m e /2+ " ] = " + B . s t a t e ( ) ) ; 2343 S y s t e m . o u t . p r i n t l n ( " C = a t o m P s e t [ " + ( 3 ∗ t h e S i z e O f F r a m e ) /4+ " ] = " + C . s t a t e ( ) ← ֓ ) ; 2344 S y s t e m . o u t . p r i n t l n ( " ( A O R B ) A N D ( B O R C ) = " + l e f t . s t a t e ( ) ) ; 2345 S y s t e m . o u t . p r i n t l n ( " B O R (A A N D C ) = " + r i g h t . s t a t e ( ) ) ; 2346 S y s t e m . o u t . p r i n t l n ( " i s E q u a l = " + i s E q u a l ) ; 2347 2348 } 2349 2350 / ∗ ∗ 2351 ∗ Co m p a r e d i f f e r e n t r e f e r e e f u n c t i o n s a p p l i e d t o t h e f u s i o n o f 3 bb a . 2352 ∗ B o t h s a m p l i n g a n d r e l a x e d a p p r o a c h e s a r e c o n s i d e r e d . 2353 ∗ 2354 ∗ T h i s e x a m p l e w o r k s l i k e { @ l i n k R e f e r e e T o o l b o x _ T u t o r i a l # ← ֓ 129 R e f e r e e F u s e r R T S _ C o m p a r i s o n ( ) } 2355 ∗ a n d { @ l i n k R e f e r e e T o o l b o x _ T u t o r i a l #R e f e r e e S a m p l e r _ C o m p a r i s o n ( ) } s o t h a t 2356 ∗ i t i s n o t e x p l a i n e d i n d e t a i l s . 2357 ∗ H o w e v e r , i t i s n o t i c e d t h a t t h e c o m b i n a t i o n s w o r k h e r e o n t h r e e s o u r c e s , 2358 ∗ d e n o t e d < i >a F u s e r 1 , a F u s e r 2 , a F u s e r 3 f o r t h e r e l a x e d ← ֓ a p p r o a c h , 2359 ∗ a n d a S a m p l e r 1 < / i > , a S a m p l e r 2 , < i >a S a m p l e r 3 f o r t h e s a m p l e d ← ֓ a p p r o a c h . 2360 ∗ I n o r d e r t o c o m p u t e o n t h e s e t r e e s o u r c e s , i t i s n e c e s s a r y t o u s e a n < i > ← ֓ A r r a y L i s t 2361 ∗ c o n t a i n i n g t h e s o u r c e s , a n d a p p l y t h e m e t h o d s : 2362 ∗ { @ l i n k B B A R e f e r e e F u s e r #f u s e ( j a v a . u t i l . A r r a y L i s t , R e f e r e e T o o l b o x . ← ֓ R e f e r e e F u n c t i o n D e f a u l t ) } 2363 ∗ f o r t h e r e l a x e d a p p r o a c h < B R > 2364 ∗ { @ l i n k S a m p l e d B B A R e f e r e e F u s e r #s e t F u s e r ( j a v a . u t i l . A r r a y L i s t , R e f e r e e T o o l b o x . ← ֓ R e f e r e e F u n c t i o n D e f a u l t ) } 2365 ∗ f o r t h e s a m p l i n g a p p r o a c h < B R > 2366 ∗ < B R > 2367 ∗ T y p i c a l l y , t h e f u s i o n b y m e a n s o f P C R # i s d o n e b y t h e f o l l o w i n g c o d e s : 2368 ∗ < c o d e > 2369 ∗ / / r e f e r e e f u n c t i o n d e f i n i t i o n < B R > 2370 ∗ RF P C R S h a r p _ P o w e r s e t r e f e r e e 5 = ne w R F P C R S h a r p _ P o w e r s e t ( ) ; 2371 ∗ / / [ . . . ] < B R > 2372 ∗ / / A r r a y c r e a t i o n < B R > 2373 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " > 2374 ∗ A r r a y L i s t b b a A r r a y R = < B R > 2375 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; ne w { @ c o d e A r r a y L i s t < ← ֓ f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t > } ( ) ; 2376 ∗ b b a A r r a y R . a d d ( a F u s e r 1 ) ; 2377 ∗ b b a A r r a y R . a d d ( a F u s e r 2 ) ; 2378 ∗ b b a A r r a y R . a d d ( a F u s e r 3 ) ; 2379 ∗ 2380 ∗ / / [ . . . ] < B R > 2381 ∗ / / C o m b i n a t i o n < B R > 2382 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " > 2383 ∗ a F u s e r . f u s e ( b b a A r r a y R , r e f e r e e 5 ) ; 2384 ∗ 2385 ∗ 2386 ∗ f o r t h e r e l a x e d a p p r o a c h , 2387 ∗ < c o d e > 2388 ∗ / / r e f e r e e f u n c t i o n d e f i n i t i o n < B R > 2389 ∗ RF P C R S h a r p _ P o w e r s e t r e f e r e e 5 = ne w R F P C R S h a r p _ P o w e r s e t ( ) ; 2390 ∗ / / [ . . . ] < B R > 2391 ∗ / / A r r a y c r e a t i o n < B R > 2392 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " > 2393 ∗ A r r a y L i s t b b a A r r a y S = < B R > 2394 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; ne w { @ c o d e A r r a y L i s t < ← ֓ f i n a l R e f e r e e S a m p l e r _ P o w e r s e t > } ( ) ; 2395 ∗ b b a A r r a y S . a d d ( a S a m p l e r 1 ) ; 2396 ∗ b b a A r r a y S . a d d ( a S a m p l e r 2 ) ; 2397 ∗ b b a A r r a y S . a d d ( a S a m p l e r 3 ) ; 2398 ∗ 2399 ∗ / / [ . . . ] < B R > 2400 ∗ / / C o m b i n a t i o n < B R > 2401 ∗ < f o n t c o l o r =" #FF 0 0 0 0 " > 2402 ∗ a S a m p l e r . s e t F u s e r ( b b a A r r a y S , r e f e r e e 5 ) ; 2403 ∗ 2404 ∗ S a m p l e s . c l e a r ( ) ; 2405 ∗ { @ c o d e f o r ( n = 0 ; n < N b S a m p l e s ; n++ ) } S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; < ← ֓ B R > 2406 ∗ Z =a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 2407 ∗ 2408 ∗ f o r t h e s a m p l e d a p p r o a c h , 2409 ∗ < B R > 2410 ∗ w h e r e < i >a F u s e r a n d < i >a S a m p l e r a r e o u t p u t bb a f o r e a c h 2411 ∗ r e s p e c t i v e a p p r o a c h e s . 2412 ∗ 2413 ∗ / 2414 p u b l i c v o i d R e f e r e e _ O n _ 3 _ E n t r i e s ( ) { 2415 2416 i n t p r i n t M o d e = 1 ; 2417 / / 2418 f i n a l P o w e r s e t A = n e w f i n a l P o w e r s e t ( ) ; 2419 A . s i z e ( 3 ) ; A . a t o m i c ( 0 ) ; 130 2420 f i n a l P o w e r s e t B = A . i n s t a n c e N s i z e ( ) ; B . a t o m i c ( 1 ) ; 2421 f i n a l P o w e r s e t C = A . i n s t a n c e N s i z e ( ) ; C . a t o m i c ( 2 ) ; 2422 / / 2423 f i n a l P o w e r s e t A U B = A . i n s t a n c e N s i z e ( ) ; A U B . o r ( A , B ) ; 2424 f i n a l P o w e r s e t B U C = A . i n s t a n c e N s i z e ( ) ; B U C . o r ( B , C ) ; 2425 f i n a l P o w e r s e t C U A = A . i n s t a n c e N s i z e ( ) ; C U A . o r ( C , A ) ; 2426 / / 2427 f i n a l P o w e r s e t z e r o = A . i n s t a n c e N s i z e ( ) ; z e r o . z e r o ( ) ; 2428 f i n a l P o w e r s e t o n e = A . i n s t a n c e N s i z e ( ) ; o n e . o n e ( ) ; 2429 / / 2430 / / 2431 R F D e m p s t e r _ P o w e r s e t r e f e r e e 1 = n e w R F D e m p s t e r _ P o w e r s e t ( ) ; 2432 R F D i s j u n c t i v e _ P o w e r s e t r e f e r e e 2 = ne w R F D i s j u n c t i v e _ P o w e r s e t ( ) ; 2433 R F D u b o i s P r a d e _ P o w e r s e t r e f e r e e 3 = ne w R F D u b o i s P r a d e _ P o w e r s e t ( ) ; 2434 R F P C R 6 _ P o w e r s e t r e f e r e e 4 = n e w R F P C R 6 _ P o w e r s e t ( ) ; 2435 R F P C R S h a r p _ P o w e r s e t r e f e r e e 5 = ne w R F P C R S h a r p _ P o w e r s e t ( ) ; 2436 / / 2437 / / 2438 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 1 = ne w f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t ← ֓ ( ) ; 2439 a F u s e r 1 . a d d ( A , 0 . 6 ) ; 2440 a F u s e r 1 . a d d ( A U B , 0 . 4 ) ; 2441 / / 2442 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 2 = a F u s e r 1 . i n s t a n c e ( ) ; 2443 a F u s e r 2 . a d d ( A , 0 . 3 ) ; 2444 a F u s e r 2 . a d d ( C U A , 0 . 7 ) ; 2445 / / 2446 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 3 = a F u s e r 1 . i n s t a n c e ( ) ; 2447 a F u s e r 3 . a d d ( B , 0 . 8 ) ; 2448 a F u s e r 3 . a d d ( o n e , 0 . 2 ) ; 2449 / / 2450 A r r a y L i s t < f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t > b b a A r r a y R = 2451 new A r r a y L i s t < f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t > ( ) ; 2452 b b a A r r a y R . a d d ( a F u s e r 1 ) ; 2453 b b a A r r a y R . a d d ( a F u s e r 2 ) ; 2454 b b a A r r a y R . a d d ( a F u s e r 3 ) ; 2455 / / 2456 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r = a F u s e r 1 . i n s t a n c e ( ) ; 2457 2458 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r 1 = ne w f i n a l R e f e r e e S a m p l e r _ P o w e r s e t ← ֓ ( ) ; 2459 a S a m p l e r 1 . a d d A l l ( a F u s e r 1 . t o A r r a y ( ) ) ; 2460 / / 2461 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r 2 = a S a m p l e r 1 . i n s t a n c e ( ) ; 2462 a S a m p l e r 2 . a d d A l l ( a F u s e r 2 . t o A r r a y ( ) ) ; 2463 / / 2464 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r 3 = a S a m p l e r 1 . i n s t a n c e ( ) ; 2465 a S a m p l e r 3 . a d d A l l ( a F u s e r 3 . t o A r r a y ( ) ) ; 2466 / / 2467 A r r a y L i s t < f i n a l R e f e r e e S a m p l e r _ P o w e r s e t > b b a A r r a y S = 2468 new A r r a y L i s t < f i n a l R e f e r e e S a m p l e r _ P o w e r s e t > ( ) ; 2469 b b a A r r a y S . a d d ( a S a m p l e r 1 ) ; 2470 b b a A r r a y S . a d d ( a S a m p l e r 2 ) ; 2471 b b a A r r a y S . a d d ( a S a m p l e r 3 ) ; 2472 / / 2473 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t a S a m p l e r = a S a m p l e r 1 . i n s t a n c e ( ) ; 2474 / / 2475 / / 2476 S y s t e m . o u t . p r i n t l n ( 2477 " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \ n " + 2478 " / / R e l a x e d Me t h o d \ n " + 2479 " / / / / / / / / / / / / / / / / / / / / \ n " ) ; 2480 S y s t e m . o u t . p r i n t l n ( " a F u s e r 1 " ) ; 2481 S y s t e m . o u t . p r i n t l n ( a F u s e r 1 . s t a t e ( p r i n t M o d e ) ) ; 2482 S y s t e m . o u t . p r i n t l n ( ) ; 2483 S y s t e m . o u t . p r i n t l n ( " a F u s e r 2 " ) ; 2484 S y s t e m . o u t . p r i n t l n ( a F u s e r 2 . s t a t e ( p r i n t M o d e ) ) ; 2485 S y s t e m . o u t . p r i n t l n ( ) ; 2486 S y s t e m . o u t . p r i n t l n ( " a F u s e r 3 " ) ; 2487 S y s t e m . o u t . p r i n t l n ( a F u s e r 3 . s t a t e ( p r i n t M o d e ) ) ; 2488 S y s t e m . o u t . p r i n t l n ( ) ; 2489 a F u s e r . f u s e ( b b a A r r a y R , r e f e r e e 1 ) ; 2490 S y s t e m . o u t . p r i n t l n ( " a F u s e r − D e m p s t e r " ) ; 2491 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 131 2492 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 2493 S y s t e m . o u t . p r i n t l n ( ) ; 2494 a F u s e r . f u s e ( b b a A r r a y R , r e f e r e e 2 ) ; 2495 S y s t e m . o u t . p r i n t l n ( " a F u s e r − D i s j u n c t i v e " ) ; 2496 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 2497 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 2498 S y s t e m . o u t . p r i n t l n ( ) ; 2499 a F u s e r . f u s e ( b b a A r r a y R , r e f e r e e 3 ) ; 2500 S y s t e m . o u t . p r i n t l n ( " a F u s e r − D u b o i s & P r a d e " ) ; 2501 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 2502 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 2503 S y s t e m . o u t . p r i n t l n ( ) ; 2504 a F u s e r . f u s e ( b b a A r r a y R , r e f e r e e 4 ) ; 2505 S y s t e m . o u t . p r i n t l n ( " a F u s e r − P C R 6 " ) ; 2506 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 2507 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 2508 S y s t e m . o u t . p r i n t l n ( ) ; 2509 a F u s e r . f u s e ( b b a A r r a y R , r e f e r e e 5 ) ; 2510 S y s t e m . o u t . p r i n t l n ( " a F u s e r − P C R #" ) ; 2511 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 2512 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 2513 S y s t e m . o u t . p r i n t l n ( ) ; 2514 2515 S y s t e m . o u t . p r i n t l n ( 2516 " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \ n " + 2517 " / / S a m p l i n g Me t h o d \ n " + 2518 " / / / / / / / / / / / / / / / / / / / / \ n " ) ; 2519 2520 i n t n ; 2521 i n t N b S a m p l e s = 1 0 0 0 0 0 0 ; 2522 d o u b l e Z ; 2523 f i n a l R e f e r e e S a m p l e r _ P o w e r s e t S a m p l e s = a S a m p l e r 1 . i n s t a n c e ( ) ; 2524 2525 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r 1 " ) ; 2526 S y s t e m . o u t . p r i n t l n ( a S a m p l e r 1 . s t a t e ( p r i n t M o d e ) ) ; 2527 S y s t e m . o u t . p r i n t l n ( ) ; 2528 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r 2 " ) ; 2529 S y s t e m . o u t . p r i n t l n ( a S a m p l e r 2 . s t a t e ( p r i n t M o d e ) ) ; 2530 S y s t e m . o u t . p r i n t l n ( ) ; 2531 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r 3 " ) ; 2532 S y s t e m . o u t . p r i n t l n ( a S a m p l e r 3 . s t a t e ( p r i n t M o d e ) ) ; 2533 S y s t e m . o u t . p r i n t l n ( ) ; 2534 / / 2535 a S a m p l e r . s e t F u s e r ( b b a A r r a y S , r e f e r e e 1 ) ; 2536 S a m p l e s . c l e a r ( ) ; 2537 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 2538 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 2539 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D e m p s t e r − − " + N b S a m p l e s + " p a r t i c l e s " ) ; 2540 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 2541 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 2542 S y s t e m . o u t . p r i n t l n ( ) ; 2543 / / 2544 a S a m p l e r . s e t F u s e r ( b b a A r r a y S , r e f e r e e 2 ) ; 2545 S a m p l e s . c l e a r ( ) ; 2546 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 2547 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 2548 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D i s j u n c t i v e − − " + N b S a m p l e s + " p a r t i c l e s " ← ֓ ) ; 2549 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 2550 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 2551 S y s t e m . o u t . p r i n t l n ( ) ; 2552 / / 2553 a S a m p l e r . s e t F u s e r ( b b a A r r a y S , r e f e r e e 3 ) ; 2554 S a m p l e s . c l e a r ( ) ; 2555 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 2556 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 2557 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − D u b o i s & P r a d e − − " + N b S a m p l e s + " ← ֓ p a r t i c l e s " ) ; 2558 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 2559 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 2560 S y s t e m . o u t . p r i n t l n ( ) ; 2561 / / 2562 a S a m p l e r . s e t F u s e r ( b b a A r r a y S , r e f e r e e 4 ) ; 2563 S a m p l e s . c l e a r ( ) ; 132 2564 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 2565 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 2566 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − P CR 6 − − " + N b S a m p l e s + " p a r t i c l e s " ) ; 2567 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 2568 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 2569 S y s t e m . o u t . p r i n t l n ( ) ; 2570 / / 2571 a S a m p l e r . s e t F u s e r ( b b a A r r a y S , r e f e r e e 5 ) ; 2572 S a m p l e s . c l e a r ( ) ; 2573 f o r ( n = 0 ; n < N b S a m p l e s ; n ++ ) S a m p l e s . a d d ( a S a m p l e r . m a k e F u s e d S a m p l e ( ) ) ; 2574 Z = a S a m p l e r . l e a r n F r o m ( S a m p l e s . t o A r r a y ( ) ) ; 2575 S y s t e m . o u t . p r i n t l n ( " a S a m p l e r − P C R # − − " + N b S a m p l e s + " p a r t i c l e s " ) ; 2576 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + Z + " %" ) ; 2577 S y s t e m . o u t . p r i n t l n ( a S a m p l e r . s t a t e ( p r i n t M o d e ) ) ; 2578 S y s t e m . o u t . p r i n t l n ( ) ; 2579 2580 } 2581 2582 2583 / ∗ ∗ 2584 ∗ D e m o n s t r a t e t h e c r e a t i o n o f a ne w R e f e r e e F u n c t i o n . 2585 ∗ < B R > < B R > 2586 ∗ I n t h i s e x a m p l e , a ne w r e f e r e e f u n c t i o n i s c r e a t e d f r o m t h e r e f e r e e ← ֓ f u n c t i o n 2587 ∗ f o r D e m p s t e r − S h a f e r b y e x c l u d i n g a p r o p o s i t i o n < i > e x c l u d e d P r o p o s i t i o n . 2588 ∗ M or e p r e c i s e l y : 2589 ∗ &n b s p ; &n b s p ; − I f < i > e x c l u d e d P r o p o s i t i o n = n u l l , j u s t d o a s f o r D e m p s t e r ← ֓ − S h a f e r , 2590 ∗ < B R > 2591 ∗ &n b s p ; &n b s p ; − O t h e r w i s e : 2592 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; − L e t < i > ( X , 1 . ) b e t h e r e f e r e e o u t p u t f o r ← ֓ D e m p s t e r − S h a f e r , 2593 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; − I f < i >e x c l u d e d P r o p o s i t i o n C O N T A I N S X , ← ֓ t h e n r e t u r n < i >( z e r o , 1 . ) , 2594 ∗ t h a t i s a f u l l r e j e c t i o n , 2595 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; − O t h e r w i s e , r e t u r n < i >( X A N D c o c o m p l e m e n t ( ← ֓ e x c l u d e d P r o p o s i t i o n ) 2596 ∗ , 1 . ) , t h a t i s < i > X t r u n c a t e d b y < i > e x c l u d e d P r o p o s i t i o n . 2597 ∗ < B R > < B R > 2598 ∗ E x c e p t f o r t h e r e f e r e e f u n c t i o n c r e a t i o n , t h i s e x a m p l e w o r k s l i k e 2599 ∗ { @ l i n k R e f e r e e T o o l b o x _ T u t o r i a l #R e f e r e e F u s e r R T S _ C o m p a r i s o n ( ) } , s o t h a t t h e 2600 ∗ s u b s e q u e n t e x p l a i n e d c o d e o n l y c o n c e r n t h e R e f e r e e F u n c t i o n c r e a t i o n . 2601 ∗ 2602 ∗ < B R > < B R > 2603 ∗ D e t a i l e d c o d e d e s c r i p t i o n . < / b > < B R > 2604 ∗ T he f o l l o w i n g t y p o n o m i c c o n v e n t i o n s a r e u s e d : 2605 ∗ < c o d e > 2606 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2607 ∗ B l u e c o l o r i s u s e d f o r c o m m e n t i n g t h e f o l l o w i n g c o d e . 2608 ∗ < B R > 2609 ∗ c o d e f o r m a t i n g i s u s e d f o r p r i n t i n g t h e c o d e . 2610 ∗ 2611 ∗ < B R > 2612 ∗ C om me n te d c o d e : 2613 ∗ < B R > < B R > 2614 ∗ < c o d e > 2615 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2616 ∗ C r e a t i o n o f a c l a s s < i >m y R e f e r e e F u n c t i o n e x t e n d i n g t h e c l a s s 2617 ∗ { @ l i n k R e f e r e e F u n c t i o n D e m p s t e r } ( a r e f e r e e f u n c t i o n f o r D e m p s t e r − S h a f e r ) . 2618 ∗ T h i s d e f i n i t i o n i s g e n e r i c , d e p e n d i n g o n a c l a s s < i > P r o p w h i c h i s a ← ֓ c o m p l e m e n t e d l a t t i c e , 2619 ∗ t h a t i s { @ c o d e P r o p e x t e n d s C o m p l e m e n t e d L a t t i c e< P r o p> } ; 2620 ∗ < B R > 2621 ∗ c l a s s { @ c o d e m y R e f e r e e F u n c t i o n

> } < ← ֓ B R > 2622 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; 2623 ∗ { @ c o d e e x t e n d s R e f e r e e F u n c t i o n D e m p s t e r

}{< B R > 2624 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2625 ∗ D e c l a r a t i o n o f t h e e x c l u d e d p r o p o s i t i o n < i >e x c l u d e d P r o p o s i t i o n . B y 2626 ∗ d e f a u l t , i t i s u n d e f i n e d ; 2627 ∗ < B R > 2628 ∗ &n b s p ; &n b s p ; p u b l i c P r o p e x c l u d e d P r o p o s i t i o n = n u l l ; 2629 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2630 ∗ R e d e f i n i t i o n ( o v e r r i d i n g ) o f m e t h o d { @ c o d e A r r a y L i s t > ← ֓ 133 r e f e r e e F u n c t i o n ( . . . ) } ; 2631 ∗ < B R > 2632 ∗ &n b s p ; &n b s p ; @ O v e r r i d e < B R > 2633 ∗ &n b s p ; &n b s p ; p u b l i c { @ c o d e A r r a y L i s t > } r e f e r e e F u n c t i o n (< ← ֓ B R > 2634 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ← ֓ ; &n b s p ; 2635 ∗ { @ c o d e A r r a y L i s t > a s s i g n I n , } < B R > 2636 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ← ֓ ; &n b s p ; 2637 ∗ { @ c o d e A r r a y L i s t > b b a I n ) }{< B R > 2638 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2639 ∗ I n c a s e < i > e x c l u d e d P r o p o s i t i o n i s u n d e f i n e d , d o l i k e t h e r e f e r e e ← ֓ f u n c t i o n 2640 ∗ f o r D e m p s t e r − S h a f e r ; 2641 ∗ < B R > 2642 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; i f ( e x c l u d e d P r o p o s i t i o n = = n u l l ) r e t u r n 2643 ∗ s u p e r . r e f e r e e F u n c t i o n ( a s s i g n I n , b b a I n ) ; 2644 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2645 ∗ O t h e r w i s e , c o m p u t e t h e r e f e r e e f u n c t i o n f o r D e m p s t e r − S h a f e r a n d s t o r e t h e 2646 ∗ r e s u l t w i t h i n < i >o u t p u t ; 2647 ∗ < B R > 2648 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; { @ c o d e A r r a y L i s t > } 2649 ∗ o u t p u t= s u p e r . r e f e r e e F u n c t i o n ( a s s i g n I n , b b a I n ) ; 2650 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2651 ∗ I f t h e a t t r i b u t e o f < i >o u t p u t i s c o n t a i n e d b y < i > e x c l u d e d P r o p o s i t i o n 2652 ∗ < B R > 2653 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; i f ( e x c l u d e d P r o p o s i t i o n . c o n t a i n s ( o u t p u t . g e t ( 0 ) . ← ֓ a t t r i b u t e ) )< B R > 2654 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2655 ∗ T he n , s e t < i >o u t p u t t o a r e j e c t i o n ; 2656 ∗ < B R > 2657 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; o u t p u t . g e t ( 0 ) . a t t r i b u t e . z e r o ( ) ; < ← ֓ B R > 2658 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2659 ∗ O t h e r w i s e , s e t o u t p u t t o i t s c o n j u n c t i o n w i t h c o c o m p l e m e n t ( ← ֓ e x c l u d e d P r o p o s i t i o n ) ; 2660 ∗ < B R > 2661 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; e l s e o u t p u t . g e t ( 0 ) . a t t r i b u t e . a n d ( o u t p u t . g e t ( 0 ) . ← ֓ a t t r i b u t e , 2662 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ← ֓ ; &n b s p ; 2663 ∗ e x c l u d e d P r o p o s i t i o n . c l o n e ( ) . c o c o m p l e m e n t ( ) ) ; 2664 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2665 ∗ A t l a s t , r e t u r n < i >o u t p u t ; 2666 ∗ < B R > 2667 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; r e t u r n o u t p u t ; 2668 ∗ &n b s p ; &n b s p ; } < B R > 2669 ∗ < B R > 2670 ∗ } < B R > 2671 ∗ < B R > 2672 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2673 ∗ T y p i c a l u s a g e : < / b > 2674 ∗ < B R > < B R > 2675 ∗ C r e a t e a r e f e r e e f u n c t i o n < i >m y R e f e r e e t y p e d < i >m y R e f e r e e F u n c t i o n 2676 ∗ a n d i n s t a n t i a t e d f o r p o w e r s e t ; 2677 ∗ < B R > 2678 ∗ { @ c o d e m y R e f e r e e F u n c t i o n< f i n a l P o w e r s e t > m y R e f e r e e = }< B R > 2679 ∗ &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; &n b s p ; 2680 ∗ { @ c o d e ne w m y R e f e r e e F u n c t i o n ( ) ; } < B R > 2681 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2682 ∗ S e t t h e e x c l u d e d p r o p o s i t i o n t o p r o p o s i t i o n < i > A ; 2683 ∗ < B R > 2684 ∗ m y R e f e r e e . e x c l u d e d P r o p o s i t i o n = A ; 2685 ∗ < f o n t c o l o r = " # 0 0 0 0F F " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 2686 ∗ Do t h e f u s i o n o f a F u s e r 1 a n d < i >a F u s e r 2 i n t o < i >a F u s e r ; 2687 ∗ < B R > 2688 ∗ a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , m y R e f e r e e ) ; 2689 ∗ 2690 ∗ 2691 ∗ / 2692 p u b l i c v o i d C r e a t e _ R e f e r e e F u n c t i o n ( ) { 2693 134 2694 c l a s s m y R e f e r e e F u n c t i o n < P r o p e x t e n d s C o m p l e m e n t e d L a t t i c e < P r o p > > 2695 e x t e n d s R e f e r e e F u n c t i o n D e m p s t e r < P r o p > { 2696 p u b l i c P r o p e x c l u d e d P r o p o s i t i o n = n u l l ; 2697 2698 @ O v e r r i d e 2699 p u b l i c A r r a y L i s t < A s s i g n m e n t < P r o p > > r e f e r e e F u n c t i o n ( 2700 A r r a y L i s t < A s s i g n m e n t < P r o p > > a s s i g n I n , 2701 A r r a y L i s t < m i n A s s i g n m e n t < P r o p > > b b a I n ) { 2702 i f ( e x c l u d e d P r o p o s i t i o n = = n u l l ) r e t u r n s u p e r . r e f e r e e F u n c t i o n ( ← ֓ a s s i g n I n , b b a I n ) ; 2703 A r r a y L i s t < A s s i g n m e n t < P r o p > > o u t p u t = s u p e r . r e f e r e e F u n c t i o n ( a s s i g n I n , ← ֓ b b a I n ) ; 2704 i f ( e x c l u d e d P r o p o s i t i o n . c o n t a i n s ( o u t p u t . g e t ( 0 ) . a t t r i b u t e ) ) 2705 o u t p u t . g e t ( 0 ) . a t t r i b u t e . z e r o ( ) ; 2706 e l s e o u t p u t . g e t ( 0 ) . a t t r i b u t e . a n d ( o u t p u t . g e t ( 0 ) . a t t r i b u t e , 2707 e x c l u d e d P r o p o s i t i o n . c l o n e ( ) . c o c o m p l e m e n t ( ) ) ; 2708 r e t u r n o u t p u t ; 2709 } 2710 2711 } 2712 2713 f i n a l P o w e r s e t A = n e w f i n a l P o w e r s e t ( ) ; 2714 A . s i z e ( 3 ) ; A . a t o m i c ( 0 ) ; 2715 f i n a l P o w e r s e t B = A . i n s t a n c e N s i z e ( ) ; B . a t o m i c ( 1 ) ; 2716 f i n a l P o w e r s e t C = A . i n s t a n c e N s i z e ( ) ; C . a t o m i c ( 2 ) ; 2717 / / 2718 f i n a l P o w e r s e t A U B = A . i n s t a n c e N s i z e ( ) ; A U B . o r ( A , B ) ; 2719 f i n a l P o w e r s e t B U C = A . i n s t a n c e N s i z e ( ) ; B U C . o r ( B , C ) ; 2720 f i n a l P o w e r s e t C U A = A . i n s t a n c e N s i z e ( ) ; C U A . o r ( C , A ) ; 2721 / / 2722 f i n a l P o w e r s e t z e r o = A . i n s t a n c e N s i z e ( ) ; z e r o . z e r o ( ) ; 2723 f i n a l P o w e r s e t o n e = A . i n s t a n c e N s i z e ( ) ; o n e . o n e ( ) ; 2724 / / 2725 / / 2726 m y R e f e r e e F u n c t i o n < f i n a l P o w e r s e t > m y R e f e r e e = 2727 ne w m y R e f e r e e F u n c t i o n < f i n a l P o w e r s e t > ( ) ; 2728 m y R e f e r e e . e x c l u d e d P r o p o s i t i o n = A ; 2729 / / 2730 / / 2731 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 1 = ne w f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t ← ֓ ( ) ; 2732 a F u s e r 1 . a d d ( A , 0 . 0 9 ) ; 2733 a F u s e r 1 . a d d ( B , 0 . 2 ) ; 2734 a F u s e r 1 . a d d ( C , 0 . 0 2 ) ; 2735 a F u s e r 1 . a d d ( A U B , 0 . 0 5 ) ; 2736 a F u s e r 1 . a d d ( B U C , 0 . 0 3 ) ; 2737 a F u s e r 1 . a d d ( C U A , 0 . 1 ) ; 2738 a F u s e r 1 . a d d ( A , 0 . 1 1 ) ; 2739 a F u s e r 1 . a d d ( o n e , 0 . 4 ) ; 2740 / / 2741 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r 2 = a F u s e r 1 . i n s t a n c e ( ) ; 2742 a F u s e r 2 . a d d ( A , 0 . 1 ) ; 2743 a F u s e r 2 . a d d ( B , 0 . 1 ) ; 2744 a F u s e r 2 . a d d ( C , 0 . 2 ) ; 2745 a F u s e r 2 . a d d ( A U B , 0 . 2 ) ; 2746 a F u s e r 2 . a d d ( B U C , 0 . 1 ) ; 2747 a F u s e r 2 . a d d ( C U A , 0 . 1 ) ; 2748 a F u s e r 2 . a d d ( o n e , 0 . 2 ) ; 2749 / / 2750 f i n a l R e f e r e e F u s e r R T S _ P o w e r s e t a F u s e r = a F u s e r 1 . i n s t a n c e ( ) ; 2751 / / 2752 2753 i n t p r i n t M o d e = 1 ; 2754 2755 S y s t e m . o u t . p r i n t l n ( 2756 " / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \ n " + 2757 " / / R e l a x e d Me t h o d \ n " + 2758 " / / / / / / / / / / / / / / / / / / / / \ n " ) ; 2759 2760 S y s t e m . o u t . p r i n t l n ( " a F u s e r 1 " ) ; 2761 S y s t e m . o u t . p r i n t l n ( a F u s e r 1 . s t a t e ( p r i n t M o d e ) ) ; 2762 S y s t e m . o u t . p r i n t l n ( ) ; 2763 S y s t e m . o u t . p r i n t l n ( " a F u s e r 2 " ) ; 2764 S y s t e m . o u t . p r i n t l n ( a F u s e r 2 . s t a t e ( p r i n t M o d e ) ) ; 135 2765 S y s t e m . o u t . p r i n t l n ( ) ; 2766 a F u s e r . f u s e ( a F u s e r 1 , a F u s e r 2 , m y R e f e r e e ) ; 2767 S y s t e m . o u t . p r i n t l n ( " a F u s e r − m y R e f e r e e " ) ; 2768 S y s t e m . o u t . p r i n t l n ( " C o n f l i c t Z = " + a F u s e r . c o n f l i c t ( ) + " % " ) ; 2769 S y s t e m . o u t . p r i n t l n ( a F u s e r . s t a t e ( p r i n t M o d e ) ) ; 2770 S y s t e m . o u t . p r i n t l n ( ) ; 2771 2772 } 2773 2774 2775 } 136 Source Co de: RefereeT o olb o x_V ersion.ja v a 1 / ∗ 2 ∗ R e f e r e e T o o l b o x _ V e r s i o n . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; V e r s i o n . 3 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 4 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 5 ∗ 6 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 7 ∗ 8 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 9 ∗ 10 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 11 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 12 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 13 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 14 ∗ 15 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 16 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 17 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 18 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 19 ∗ 20 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 21 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 22 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 23 ∗ / 24 25 p a c k a g e R e f e r e e T o o l b o x ; 26 27 / ∗ ∗ 28 ∗ C l a s s p r o v i d i n g i n f o r m a t i o n a b o u t t h e v e r s i o n o f p a c k a g e R e f e r e e T o o l b o x . 29 ∗ 30 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 31 ∗ 32 ∗ 33 ∗ 34 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 35 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 36 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 37 ∗ < B R > 38 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 39 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 40 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 41 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 42 ∗ < B R > 43 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 44 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 45 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 46 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 47 ∗ < B R > 48 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 49 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 50 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 51 ∗ < / t a b l e > < B R > 52 ∗ 53 ∗ / 54 p u b l i c c l a s s R e f e r e e T o o l b o x _ V e r s i o n { 55 56 / ∗ ∗ 57 ∗ R e t u r n t h e c u r r e n t v e r s i o n n a me . 58 ∗ 59 ∗ / 60 p u b l i c S t r i n g v e r s i o n ( ) { 61 r e t u r n " Z E R O . 0 . 1 " ; 62 } 63 64 / ∗ ∗ 65 ∗ R e t u r n t h e c u r r e n t v e r s i o n c o d e . 66 ∗ 67 ∗ / 68 p u b l i c i n t v e r s i o n _ c o d e ( ) { 69 r e t u r n 1 ; 70 } 71 137 72 } 138 Source Co de: RelaxedBBA.ja v a 1 / ∗ 2 ∗ R e l ax e d B BA . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r B a s i c 3 ∗ B e l i e f A s s i g n m e n t w i t h r e l a x a t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ M e t h o d s f o r r e l a x i n g B a s i c B e l i e f A s s i g n m e n t . T he r e l a x t i o n i s b a s e d on a 30 ∗ s i m p l e l o g a r i t h m i c − t i m e s u m m a r i z a t i o n m e t h o d . 31 ∗ 32 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 33 ∗ 34 ∗ 35 ∗ 36 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 37 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 38 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 39 ∗ < B R > 40 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 41 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 42 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 43 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 46 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 47 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 48 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 49 ∗ < B R > 50 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 51 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 52 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 53 ∗ < / t a b l e > < B R > 54 ∗ 55 ∗ / 56 p u b l i c i n t e r f a c e R e l a x e d B B A < P r o p e x t e n d s L a t t i c e < P r o p > , B e x t e n d s R e l a x e d B B A < P r o p , ← ֓ B > > 57 e x t e n d s B a s i c B e l i e f A s s i g n m e n t < P r o p , B > { 58 59 / ∗ ∗ 60 ∗ R e l a x < i > t h i s s o t h a t i t c o n t a i n s n o m o r e t h a n < i > m a x M e m a s s i g n m e n t s . 61 ∗ 62 ∗ / 63 b o o l e a n r e l a x ( i n t m a x M e m ) ; 64 65 / ∗ ∗ 66 ∗ R e l a x < i > t h i s s o t h a t i t c o n t a i n s n o m o r e t h a n { @ l i n k Re l a x e d B B A #m a x S i z e ( ← ֓ i n t ) } 67 ∗ a s s i g n m e n t s . 68 ∗ 69 ∗ / 139 70 b o o l e a n r e l a x ( ) ; 71 72 / ∗ ∗ 73 ∗ S e t o r r e t u r n t h e d e f a u l t maxim um n u m b e r o f a s s i g n m e n t s s t o r e d i n < i > t h i s , 74 ∗ d e p e n d i n g o n p a r a m e t e r < i >n e w S i z e . 75 ∗ I f < i >n e w S i z e >0 , t h e n s e t t h e d e f a u l t maxi mum n u m b e r o f a s s i g n m e n t s t o < i > ← ֓ n e w S i z e . 76 ∗ I n a n y c a s e , r e t u r n t h e a c t u a l v a l u e o f t h e d e f a u l t max imum n u m b e r . 77 ∗ < B R > < B R > 78 ∗ N . B . I t i s n o t p o s s i b l e t o e x c e e d t h i s n u m b e r o f a s s i g n m e n t s , e x c e p t f o r ← ֓ t e m p o r a r y 79 ∗ c o m p u t e d a s s i g n m e n t s . 80 ∗ 81 ∗ / 82 i n t m a x S i z e ( i n t n e w S i z e ) ; 83 } 140 Source Co de: RelaxedT reeSetBBA.ja v a 1 / ∗ 2 ∗ R e l a x e d T r e e S e t B B A . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ r e l a x e d B a s i c B e l i e f A s s i g n m e n t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ R e l a x e d e x t e n s i o n o f { @ l i n k T r e e S e t B B A } . 30 ∗ 31 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 32 ∗ 33 ∗ 34 ∗ 35 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 36 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 37 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 38 ∗ < B R > 39 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 40 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 41 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 42 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 43 ∗ < B R > 44 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 45 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 46 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 47 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 48 ∗ < B R > 49 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 50 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 51 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 52 ∗ < / t a b l e > < B R > 53 ∗ 54 ∗ / 55 p u b l i c c l a s s R e l a x e d T r e e S e t B B A < P r o p e x t e n d s L a t t i c e < P r o p > , 56 B e x t e n d s R e l a x e d T r e e S e t B B A < P r o p , B > > 57 e x t e n d s T r e e S e t B B A < P r o p , B > 58 i m p l e m e n t s R e l a x e d B B A < P r o p , B > { 59 60 @ O v e r r i d e 61 p r o t e c t e d b o o l e a n r e l a x e d ( ) { r e t u r n t r u e ; } 62 63 64 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 65 / / p u b l i c p a r t 66 / / / / / / / / / / / / / / / 67 68 / ∗ ∗ 69 ∗ R e l a x < i > t h i s s o t h a t i t c o n t a i n s n o m o r e t h a n < i > m a x M e m a s s i g n m e n t s . 70 ∗ 71 ∗ / 141 72 @ O v e r r i d e 73 p u b l i c b o o l e a n r e l a x ( i n t m a x M e m ) { r e t u r n s u p e r . r e l a x ( m a x M e m ) ; } 74 75 / ∗ ∗ 76 ∗ R e l a x < i > t h i s s o t h a t i t c o n t a i n s n o m o r e t h a n { @ l i n k Re l a x e d B B A #m a x S i z e ( ← ֓ i n t ) } 77 ∗ a s s i g n m e n t s . 78 ∗ 79 ∗ / 80 @ O v e r r i d e 81 p u b l i c b o o l e a n r e l a x ( ) { r e t u r n s u p e r . r e l a x ( ) ; } 82 83 / ∗ ∗ 84 ∗ S e t o r r e t u r n t h e d e f a u l t maxim um n u m b e r o f a s s i g n m e n t s s t o r e d i n < i > t h i s , 85 ∗ d e p e n d i n g o n p a r a m e t e r < i >n e w S i z e . 86 ∗ I f < i >n e w S i z e >0 , t h e n s e t t h e d e f a u l t maxi mum n u m b e r o f a s s i g n m e n t s t o < i > ← ֓ n e w S i z e . 87 ∗ I n a n y c a s e , r e t u r n t h e a c t u a l v a l u e o f t h e d e f a u l t max imum n u m b e r . 88 ∗ < B R > < B R > 89 ∗ N . B . I t i s n o t p o s s i b l e t o e x c e e d t h i s n u m b e r o f a s s i g n m e n t s , e x c e p t f o r ← ֓ t e m p o r a r y 90 ∗ c o m p u t e d a s s i g n m e n t s . 91 ∗ 92 ∗ / 93 @ O v e r r i d e 94 p u b l i c i n t m a x S i z e ( i n t n e w S i z e ) { r e t u r n s u p e r . m a x S i z e ( n e w S i z e ) ; } 95 } 142 Source Co de: RFDempster_P o werset.ja v a 1 / ∗ 2 ∗ R F D e m p s t e r _ P o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n 3 ∗ o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A n o n g e n e r i c i n s t a n c e o f { @ l i n k R e f e r e e F u n c t i o n D e m p s t e r } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l P o w e r s e t } . 31 ∗ 32 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 33 ∗ 34 ∗ 35 ∗ 36 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 37 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 38 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 39 ∗ < B R > 40 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 41 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 42 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 43 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 46 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 47 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 48 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 49 ∗ < B R > 50 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 51 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 52 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 53 ∗ < / t a b l e > < B R > 54 ∗ 55 ∗ / 56 p u b l i c c l a s s R F D e m p s t e r _ P o w e r s e t e x t e n d s R e f e r e e F u n c t i o n D e m p s t e r < f i n a l P o w e r s e t > { 57 58 } 143 Source Co de: RFDisjunctiv e_P o werset.ja v a 1 / ∗ 2 ∗ R F D i s j u n c t i v e _ P o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A n o n g e n e r i c i n s t a n c e o f { @ l i n k R e f e r e e F u n c t i o n D i s j u n c t i v e } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l P o w e r s e t } . 31 ∗ 32 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 33 ∗ 34 ∗ 35 ∗ 36 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 37 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 38 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 39 ∗ < B R > 40 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 41 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 42 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 43 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 46 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 47 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 48 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 49 ∗ < B R > 50 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 51 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 52 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 53 ∗ < / t a b l e > < B R > 54 ∗ 55 ∗ / 56 p u b l i c c l a s s R F D i s j u n c t i v e _ P o w e r s e t e x t e n d s R e f e r e e F u n c t i o n D i s j u n c t i v e < ← ֓ f i n a l P o w e r s e t > { 57 58 } 144 Source Co de: RFDub oisPrade_P ow erset.ja v a 1 / ∗ 2 ∗ R F D u b o i s P r a d e _ P o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; 3 ∗ I m p l e m e n t a t i o n o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A n o n g e n e r i c i n s t a n c e o f { @ l i n k R e f e r e e F u n c t i o n D u b o i s P r a d e } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l P o w e r s e t } . 31 ∗ 32 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 33 ∗ 34 ∗ 35 ∗ 36 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 37 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 38 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 39 ∗ < B R > 40 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 41 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 42 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 43 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 46 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 47 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 48 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 49 ∗ < B R > 50 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 51 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 52 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 53 ∗ < / t a b l e > < B R > 54 ∗ 55 ∗ / 56 p u b l i c c l a s s R F D u b o i s P r a d e _ P o w e r s e t e x t e n d s R e f e r e e F u n c t i o n D u b o i s P r a d e < ← ֓ f i n a l P o w e r s e t > { 57 58 } 145 Source Co de: RFPCR6_P o werset.ja v a 1 / ∗ 2 ∗ RF P CR6 _P ow er se t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A n o n g e n e r i c i n s t a n c e o f { @ l i n k R e f e r e e F u n c t i o n P C R 6 } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l P o w e r s e t } . 31 ∗ 32 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 33 ∗ 34 ∗ 35 ∗ 36 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 37 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 38 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 39 ∗ < B R > 40 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 41 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 42 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 43 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 46 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 47 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 48 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 49 ∗ < B R > 50 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 51 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 52 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 53 ∗ < / t a b l e > < B R > 54 ∗ 55 ∗ / 56 p u b l i c c l a s s R F P C R 6 _ P o w e r s e t e x t e n d s R e f e r e e F u n c t i o n P C R 6 < f i n a l P o w e r s e t > { 57 58 } 146 Source Co de: RFPCRSharp_P o w erset.ja v a 1 / ∗ 2 ∗ R F P CR S h a r p _ P o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n 3 ∗ o f r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ A n o n g e n e r i c i n s t a n c e o f { @ l i n k R e f e r e e F u n c t i o n P C R S h a r p } s p e c i a l i z e d f o r 30 ∗ L a t t i c e s t r u c t u r e s t y p e d { @ l i n k f i n a l P o w e r s e t } . 31 ∗ 32 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 33 ∗ 34 ∗ 35 ∗ 36 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 37 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 38 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 39 ∗ < B R > 40 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 41 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 42 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 43 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 44 ∗ < B R > 45 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 46 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 47 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 48 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 49 ∗ < B R > 50 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 51 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 52 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 53 ∗ < / t a b l e > < B R > 54 ∗ 55 ∗ / 56 p u b l i c c l a s s R F P C R S h a r p _ P o w e r s e t e x t e n d s R e f e r e e F u n c t i o n P C R S h a r p < f i n a l P o w e r s e t > { 57 58 } 147 Source Co de: SampledBBA.ja v a 1 / ∗ 2 ∗ S am pl e dB BA . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r s a m p l e d 3 ∗ B a s i c B e l i e f A s s i g n m e n t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ M e t h o d s f o r s a m p l i n g B a s i c B e l i e f A s s i g n m e n t s a n d l e a r n i n g B a s i c B e l i e f ← ֓ A s s i g n m e n t s 32 ∗ f r o m a s a m p l e s v e c t o r . 33 ∗ 34 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 35 ∗ 36 ∗ 37 ∗ 38 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 39 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 40 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 41 ∗ < B R > 42 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 43 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 44 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 45 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 46 ∗ < B R > 47 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 48 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 49 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 50 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 51 ∗ < B R > 52 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 53 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 54 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 55 ∗ < / t a b l e > < B R > 56 ∗ 57 ∗ / 58 p u b l i c i n t e r f a c e S a m p l e d B B A < P r o p e x t e n d s L a t t i c e < P r o p > , s B e x t e n d s S a m p l e d B B A < P r o p ← ֓ , s B > > 59 e x t e n d s B a s i c B e l i e f A s s i g n m e n t < P r o p , s B > { 60 61 / ∗ ∗ 62 ∗ L e a r n a ne w b a s i c b e l i e f a s s i g n m e n t f o r < i > t h i s f r o m a g i v e n a r r a y o f ← ֓ w e i g h t e d 63 ∗ p r o p o s i t i o n p a r t i c l e s . Th e w e i g t h e d p a r t i c l e a r e p r o v i d e d a s a n a r r a y o f ← ֓ a s s i g n m e n t 64 ∗ A r r a y L a t t i c e <{ @ l i n k A s s i g n m e n t } > . 65 ∗ A m e s u r e o f c o n f l i c t i s r e t u r n e d , a s a p e r c e n t a g e o f t h e c o n f l i c t i n g s a m p l e s . 66 ∗ 67 ∗ / 148 68 d o u b l e l e a r n F r o m ( A r r a y L i s t < A s s i g n m e n t < P r o p > > w e i g h t e d S a m p l e s ) ; 69 70 / ∗ ∗ 71 ∗ Make a p r o p o s i t i o n s a m p l e a c c o r d i n g t o t h e b a s i c b e l i e f a s s i g n e m e n t s t o r e d 72 ∗ w i t h i n < i > t h i s . 73 ∗ The p r o d u c e d s a m p l e i s w e i g h t e d ( a t t h i s t i m e , t h e w e i g h t i s 1 ) , a n d , f o r t h i s 74 ∗ r e a s o n , i s p r o d u c e d a s a n a s s i g n m e n t { @ l i n k A s s i g n m e n t } w i t h 75 ∗ v a l u e 1 . 76 ∗ 77 ∗ / 78 A s s i g n m e n t < P r o p > m a k e S a m p l e ( ) ; / / w e i g h t may b e n u l l 79 / / i n s u c h a c a s e , u n i f o r m w e i g h t i s c o n s i d e r e d 80 81 / ∗ ∗ 82 ∗ I n i t i a l i z e t h e s a m p l e d m i x e r . A r e n e e d e d a s e n t r y t h e b a s i c b e l i e f a s s i g n m e n t s 83 ∗ t o b e m i x e d , p r o v i d e d w i t h i n a r r a y < i >b b a I n , a n d t h e w e i g h t s s t o r e d w i t h i n 84 ∗ < i > w e i g h t s . I t i s n o t n e c e s s a r y t h a t t h e w e i g h t s sum t o 1 , b u t t h e w e i g h t s 85 ∗ c a n n o t b e n e g a t i v e . 86 ∗ 87 ∗ / 88 b o o l e a n s e t M i x e r ( d o u b l e [ ] w e i g h t s , A r r a y L i s t < s B > b b a I n ) ; 89 90 / ∗ ∗ 91 ∗ Make a < i > ra n d om c h o i c e am on g t h e b a s i c b e l i e f a s s i g n m e n t s i n p r o p o r t i o n 92 ∗ t o t h e i r r e s p e c t i v e w e i g h t s . 93 ∗ B o t h t h e w e i g h t s a n d b a s i c b e l i e f a s s i g n m e n t s h a v e b e e n f i r s t p r o v i d e d t o ← ֓ m e t h o d 94 ∗ { @ l i n k S a m p l e d B B A R e f e r e e F u s e r #s e t M i x e r } . I t i s n e c e s s a r y t o r u n t h e m e t h o d 95 ∗ { @ l i n k S a m p l e d B B A R e f e r e e F u s e r #s e t M i x e r } b e f o r e t h e f i r s t r u n o f 96 ∗ { @ l i n k S a m p l e d B B A R e f e r e e F u s e r # m a k e M i x e d C h o i c e ( ) } . 97 ∗ The p r o d u c e d s a m p l e i s w e i g h t e d ( a t t h i s t i m e , t h e w e i g h t i s 1 ) , a n d , f o r t h i s 98 ∗ r e a s o n , i s p r o d u c e d a s a n a s s i g n m e n t { @ l i n k A s s i g n m e n t } w i t h 99 ∗ v a l u e 1 . 100 ∗ 101 ∗ / 102 s B m a k e M i x e d C h o i c e ( ) ; 103 104 } 149 Source Co de: Sa mpl edBBARefereeF user.jav a 1 / ∗ 2 ∗ S a m p l e d B B A R e f e r e e F u s e r . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I n t e r f a c e f o r 3 ∗ s a m p l e d f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ M e t h o d s f o r f u s i n g B a s i c B e l i e f A s s i g n m e n t s b y t h e m e a n s o f r e f e r e e f u n c t i o n s 32 ∗ a n d o n t h e b a s i s o f a p a r t i c l e a p p r o x i m a t i o n . T h i s i n t e r f a c e d o e s n o t c o n c e r n 33 ∗ d i r e c t r u l e i m p l e m e n t a t i o n s , { @ l i n k BB A F u s e r } , o r e x a c t r e f e r e e − b a s e d f u s i o n 34 ∗ { @ l i n k B B A R e f e r e e F u s e r } . 35 ∗ 36 ∗ @ s e e BB A F u s e r 37 ∗ @ s e e B B A R e f e r e e F u s e r 38 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 39 ∗ 40 ∗ 41 ∗ 42 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 43 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 44 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 45 ∗ < B R > 46 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 47 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 48 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 49 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 50 ∗ < B R > 51 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 52 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 53 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 54 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 55 ∗ < B R > 56 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 57 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 58 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 59 ∗ < / t a b l e > < B R > 60 ∗ 61 ∗ / 62 p u b l i c i n t e r f a c e S a m p l e d B B A R e f e r e e F u s e r < P r o p e x t e n d s L a t t i c e < P r o p > , 63 s B e x t e n d s S a m p l e d B B A R e f e r e e F u s e r < P r o p , s B > > 64 e x t e n d s S a m p l e d B B A < P r o p , s B > { 65 66 / ∗ ∗ 67 ∗ I n i t i a l i z e t h e s a m p l e d f u s e r . A r e n e e d e d a s e n t r y t h e b a s i c b e l i e f a s s i g n m e n t s 68 ∗ t o b e f u s e d , p r o v i d e d w i t h i n a r r a y < i >b b a I n , a n d a r e f e r e e f u n c t i o n 69 ∗ < i > t h e R e f e r e e F u n c t i o n . 70 ∗ 71 ∗ / 150 72 b o o l e a n s e t F u s e r ( A r r a y L i s t < s B > b b a I n , R e f e r e e F u n c t i o n D e f a u l t < P r o p > ← ֓ t h e R e f e r e e F u n c t i o n ) ; 73 74 / ∗ ∗ 75 ∗ I n i t i a l i z e t h e s a m p l e d f u s e r . A r e n e e d e d a s e n t r y t h e b a s i c b e l i e f a s s i g n m e n t s 76 ∗ t o b e f u s e d , p r o v i d e d a s < i > l e f t a n d < i > r i g h t , a n d a r e f e r e e f u n c t i o n 77 ∗ < i > t h e R e f e r e e F u n c t i o n . 78 ∗ 79 ∗ / 80 b o o l e a n s e t F u s e r ( s B l e f t , s B r i g h t , R e f e r e e F u n c t i o n D e f a u l t < P r o p > ← ֓ t h e R e f e r e e F u n c t i o n ) ; 81 82 / ∗ ∗ 83 ∗ Make a p r o p o s i t i o n s a m p l e a c c o r d i n g t o t h e f u s e d b a s i c b e l i e f a s s i g n e m e n t ← ֓ i m p l i e d 84 ∗ b y t h e b a s i c b e l i e f a s s i g n e m e n t s a n d r e f e r e e f u n c t i o n p r o v i d e d t o m e t h o d 85 ∗ { @ l i n k S a m p l e d B B A R e f e r e e F u s e r #s e t F u s e r ( j a v a . u t i l . A r r a y L i s t , 86 ∗ R e f e r e e T o o l b o x . R e f e r e e F u n c t i o n D e f a u l t ) } 87 ∗ o r { @ l i n k S a m p l e d B B A R e f e r e e F u s e r #s e t F u s e r ( R e f e r e e T o o l b o x . S a m p l e d B B A R e f e r e e F u s e r ← ֓ , 88 ∗ R e f e r e e T o o l b o x . S a m p l e d B B A R e f e r e e F u s e r , R e f e r e e T o o l b o x . R e f e r e e F u n c t i o n D e f a u l t ) ← ֓ } . 89 ∗ I t i s n e c e s s a r y t o r u n t h e s e m e t h o d s 90 ∗ b e f o r e t h e f i r s t r u n o f 91 ∗ { @ l i n k S a m p l e d B B A R e f e r e e F u s e r # m a k e F u s e d S a m p l e ( ) } . 92 ∗ The p r o d u c e d s a m p l e i s w e i g h t e d ( a t t h i s t i m e , t h e w e i g h t i s 1 ) , a n d , f o r t h i s 93 ∗ r e a s o n , i s p r o d u c e d a s a n a s s i g n m e n t { @ l i n k A s s i g n m e n t } w i t h 94 ∗ v a l u e 1 . 95 ∗ 96 ∗ / 97 A s s i g n m e n t < P r o p > m a k e F u s e d S a m p l e ( ) ; 98 99 } 151 Source Co de: Sup erp ow erset.ja v a 1 / ∗ 2 ∗ S u p e r p o w e r s e t . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f 3 ∗ s u p e r p o w e r s e t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 / ∗ ∗ 29 ∗ I m p l e m e n t a t i o n o f a S u p e r p o w e r s e t s t r u c t u r e b y m e a n s o f a n a r r a y o f { @ c o d e l o n g ← ֓ } . 30 ∗ S t r u c t u r a l a n d l o g i c a l m e t h o d s a r e i n h e r i t e d f r o m { @ l i n k F r e e b o o l e a n } . 31 ∗ H o w e v e r , S u p e r p o w e r s e t s c o m e w i t h t h e c o n s t r a i n t t h a t t h e u n i o n o f a l l a t o m i c 32 ∗ p r o p o s i t i o n s i s < i > o n e o r e q u i v a l e n t l y , t h e i n t e r s e c t i o n o f a l l n e g a t e d ← ֓ a t o m i c 33 ∗ p r o p o s i t i o n s i s z e r o : 34 ∗ < B R > < B R > 35 ∗ < i > < b > O R 0 = < i < s i z e F r a m e a t o m i c ( i ) = o n e < / i > 36 ∗ < B R > 37 ∗ < i > < b > A N D < /b > 0 = < i < s i z e F r a m e a t o m i c ( i ) = z e r o 38 ∗ < B R > < B R > 39 ∗ The n , < i >z e r o i s s t i l l d e f i n e d by z e r o i n g a l l b i t s ; b u t < i > o n e < / i > i s ← ֓ d e f i n e d 40 ∗ b y s e t t i n g t o 1 a l l a c t i v e b i t s e x c e p t t h e f i r s t o n e . 41 ∗ The c o m p l e m e n t / c o c o m p l e m e n t o p e r a t o r s a r e i n h e r i t e d f r o m t h e o p e r a t o r s { @ c o d e ~ ← ֓ } 42 ∗ w o r k i n g on { @ c o d e l o n g } ; e x c e e d i n g b i t s a r e m a s k e d by a A N D w i t h < i >o n e . 43 ∗ 44 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 45 ∗ 46 ∗ 47 ∗ 48 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 49 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 50 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 51 ∗ < B R > 52 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 53 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 54 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 55 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 56 ∗ < B R > 57 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 58 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 59 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 60 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 61 ∗ < B R > 62 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 63 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 64 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 65 ∗ < / t a b l e > < B R > 66 ∗ 67 ∗ / 152 68 p u b l i c c l a s s S u p e r p o w e r s e t < L e x t e n d s S u p e r p o w e r s e t < L > > e x t e n d s F r e e b o o l e a n < L > { 69 70 71 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 72 / / p u b l i c p a r t 73 / / / / / / / / / / / / / / / 74 75 / ∗ ∗ 76 ∗ S e t < i > t h i s t o o n e , t h e n e u t r a l e l e m e n t f o r 77 ∗ { @ l i n k S u p e r p o w e r s e t # a n d ( j a v a . l a n g . O b j e c t , j a v a . l a n g . O b j e c t ) } . 78 ∗ F o r t h e c l a s s { @ l i n k S u p e r p o w e r s e t } , t h e f i r s t b i t o f < i >o n e < / i > i s s e t t o 0 . 79 ∗ 80 ∗ / 81 @ O v e r r i d e 82 p u b l i c L o n e ( ) { 83 s u p e r . o n e ( ) ; 84 _ m e m o r y [ 0 ] & = 0 x F F F F F F F F F F F F F F F E L ; / / r e m o v e t h e f i r s t b i t 85 r e t u r n ( L ) t h i s ; 86 } 87 88 / ∗ ∗ 89 ∗ C om p u t e t h e c o m p l e m e n t o f < i > a P r o p o s i t i o n a n d s t o r e t h e r e s u l t ← ֓ w i t h i n 90 ∗ < i > t h i s . 91 ∗ F o r t h e c l a s s { @ l i n k S u p e r p o w e r s e t } , t h e f i r s t b i t o f t h e r e s u l t i s s e t t o 0 . 92 ∗ < B R > < B R > 93 ∗ < b >D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k F r e e b o o l e a n } : < / b> < B R > 94 ∗ { @ i n h e r i t D o c } 95 ∗ 96 ∗ / 97 @ O v e r r i d e 98 p u b l i c L c o m p l e m e n t ( L a P r o p o s i t i o n ) { 99 s u p e r . c o m p l e m e n t ( a P r o p o s i t i o n ) ; 100 _ m e m o r y [ 0 ] & = 0 x F F F F F F F F F F F F F F F E L ; / / r e m o v e t h e f i r s t b i t 101 r e t u r n ( L ) t h i s ; 102 } 103 104 / ∗ ∗ 105 ∗ C o m p u t e t h e c o m p l e m e n t o f < i > t h i s a n d s t o r e t h e r e s u l t w i t h i n 106 ∗ < i > t h i s . 107 ∗ F o r t h e c l a s s { @ l i n k S u p e r p o w e r s e t } , t h e f i r s t b i t o f t h e r e s u l t i s s e t t o 0 . 108 ∗ < B R > < B R > 109 ∗ D o c u m e n t a t i o n i n h e r i t e d f r o m { @ l i n k F r e e b o o l e a n } : < / b> < B R > 110 ∗ { @ i n h e r i t D o c } 111 ∗ 112 ∗ / 113 @ O v e r r i d e 114 p u b l i c L c o m p l e m e n t ( ) { 115 s u p e r . c o m p l e m e n t ( ) ; 116 _ m e m o r y [ 0 ] & = 0 x F F F F F F F F F F F F F F F E L ; / / r e m o v e t h e f i r s t b i t 117 r e t u r n ( L ) t h i s ; 118 } 119 120 } 153 Source Co de: T reeSetBBA.ja v a 1 / ∗ 2 ∗ Tr e e S e t B B A . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n o f B a s i c 3 ∗ B e l i e f A s s i g m e n t . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ I m p l e m e n t t h e B a s i c B e l i e f A s s i g m e n t b y m e a n s o f a d o u b l e { @ l i n k T r e e S e t } . 32 ∗ The T r e e S e t i s a p p l i e d t o s t o r i n g t h e l i s t o f a s s i g n m e n t s , t y p e d { @ l i n k ← ֓ A s s i g n m e n t } , 33 ∗ w h i c h d e f i n e t h e B a s i c B e l i e f A s s i g m e n t . A d o u b l e o r d e r i n g o f t h e a s s i g n m e n t i s 34 ∗ i m p l e m e n t e d : a n i n c r e a s i n g t o t a l o r d e r o v e r t h e a t t r i b u t e s o f t h e a s s i g n m e n t s , 35 ∗ a n d a d e c r e a s i n g ( t o t a l ) o r d e r i n g o v e r t h e v a l u e s o f t h e a s s i g n m e n t s . 36 ∗ The a t t r i b u t e − r e l a t e d o r d e r i n g i s i n s t r u m e n t a l f o r l o g a r i t h m i c m a n i p u l a t i o n o f 37 ∗ t h e a s s i g n m e n t s o n t h e b a s i s o f a n a d d r e s s i n g b y t h e a t t r i b u t e . 38 ∗ The v a l u e − r e l a t e d o r d e r i n g i s u s e d b y s u b c l a s s e s o f { @ l i n k T r e e S e t B B A } f o r 39 ∗ r e l a x i n g t h e B a s i c B e l i e f A s s i g n m e n t : b y m e a n s o f a n i n t e r a t i v e s u m m a r i z a t i o n , 40 ∗ e a c h s t e p b e i n g l o g a r i t h m i c t i m e , t h e s i z e o f t h e a s s i g n m e n t s l i s t i s ← ֓ m a i n t a i n e d 41 ∗ u n d e r a m a x i m a l b o u n d . 42 ∗ The r e l a x a t i o n i s n o t a v a i l a b l e f r o m t h i s c l a s s . 43 ∗ < B R > 44 ∗ T h e s e l o g a r i t h m i c o p e r a t i o n s a r e ma de p o s s i b l e b y t h e p r o p e r t y o f t h e c l a s s 45 ∗ { @ l i n k T r e e S e t } . 46 ∗ 47 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 48 ∗ 49 ∗ 50 ∗ 51 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 52 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 53 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 54 ∗ < B R > 55 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 56 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 57 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 58 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 59 ∗ < B R > 60 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 61 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 62 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 63 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 64 ∗ < B R > 65 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 66 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 67 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 68 ∗ < / t a b l e > < B R > 69 ∗ 154 70 ∗ / 71 p u b l i c c l a s s T r e e S e t B B A < P r o p e x t e n d s L a t t i c e < P r o p > , 72 B e x t e n d s T r e e S e t B B A < P r o p , B > > 73 e x t e n d s B B A C o m m o n < P r o p , B > { 74 75 p r o t e c t e d i n t t h e M a x S i z e = 2 0 ; 76 77 p r o t e c t e d b o o l e a n r e l a x e d ( ) { r e t u r n f a l s e ; } 78 79 p r o t e c t e d f i n a l C o m p a r a t o r < A s s i g n m e n t < P r o p > > c o m p a r a t o r A = 80 n ew C o m p a r a t o r < A s s i g n m e n t < P r o p > > ( ) { 81 / / 82 p u b l i c i n t c o m p a r e ( A s s i g n m e n t < P r o p > l e f t , A s s i g n m e n t < P r o p > r i g h t ) { 83 84 r e t u r n l e f t . a t t r i b u t e . c o m p a r e T o ( r i g h t . a t t r i b u t e ) ; 85 } 86 } ; 87 88 89 p r o t e c t e d f i n a l C o m p a r a t o r < A s s i g n m e n t < P r o p > > c o m p a r a t o r V A = 90 n ew C o m p a r a t o r < A s s i g n m e n t < P r o p > > ( ) { 91 92 p u b l i c i n t c o m p a r e ( A s s i g n m e n t < P r o p > l e f t , A s s i g n m e n t < P r o p > r i g h t ) { 93 / / C o m p a r i s o n o r d e r i s r e v e r t e d 94 i n t a n s w e r V = r i g h t . v a l u e . c o m p a r e T o ( l e f t . v a l u e ) ; 95 i f ( a n s w e r V ! = 0 ) r e t u r n a n s w e r V ; 96 r e t u r n l e f t . a t t r i b u t e . c o m p a r e T o ( r i g h t . a t t r i b u t e ) ; 97 } 98 } ; 99 100 101 p r o t e c t e d T r e e S e t < A s s i g n m e n t < P r o p > > b b a T r e e A = ne w T r e e S e t < A s s i g n m e n t < P r o p > > ( ← ֓ c o m p a r a t o r A ) ; 102 103 p r o t e c t e d T r e e S e t < A s s i g n m e n t < P r o p > > b b a T r e e V A = ne w T r e e S e t < A s s i g n m e n t < P r o p > > ( ← ֓ c o m p a r a t o r V A ) ; 104 105 106 p r o t e c t e d b o o l e a n _ r e l a x S t e p ( ) { / / o n l y u s e d w i t h t h e r e l a x e d e x t e n s i o n s o f ← ֓ t h e c l a s s 107 i f ( b b a T r e e A . s i z e ( ) < 2 ) { 108 S y s t e m . e r r . p r i n t l n ( " E r r o r : : " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) + 109 " . _ r e l a x S t e p ( ) : : b b a T r e e A . s i z e ( ) <2 " ) ; 110 S y s t e m . e x i t ( 0 ) ; 111 } 112 A s s i g n m e n t < P r o p > l a s t P a i r = b b a T r e e V A . p o l l L a s t ( ) ; 113 A s s i g n m e n t < P r o p > p r e v L a s t P a i r = b b a T r e e V A . p o l l L a s t ( ) ; 114 b b a T r e e A . r e m o v e ( l a s t P a i r ) ; 115 b b a T r e e A . r e m o v e ( p r e v L a s t P a i r ) ; 116 p r e v L a s t P a i r . v a l u e + = l a s t P a i r . v a l u e ; 117 p r e v L a s t P a i r . a t t r i b u t e . o r ( p r e v L a s t P a i r . a t t r i b u t e , l a s t P a i r . a t t r i b u t e ) ; 118 a d d ( p r e v L a s t P a i r ) ; 119 r e t u r n t r u e ; 120 } 121 122 123 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 124 / / p u b l i c p a r t 125 / / / / / / / / / / / / / / / 126 127 / ∗ ∗ 128 ∗ D o an e x a c t c o p y o f i n p u t i n t o < i > t h i s . 129 ∗ 130 ∗ / 131 @ O v e r r i d e 132 p u b l i c B d u p l i c a t e ( B i n p u t ) { 133 l o a d ( i n p u t . b b a T r e e V A ) ; 134 r e t u r n ( B ) t h i s ; 135 } 136 137 / ∗ ∗ 138 ∗ R e t u r n a r e p r e s e n t a t i o n o f t h e s t a t e o f < i > t h i s p r i n t e d a s 139 ∗ a S t r i n g . T y p i c a l l y , t h i s s t a t e i s t h e l i s t o f a l l s t o r e d a s s i g n m e n t s ( ← ֓ p r o p o s i t i o n 155 140 ∗ a n d v a l u e ) . D e p e n d i n g o n t h e p a r a m e t e r < i >c h o i x i n e n t r y , t h e ← ֓ r e p r e s e n t a t i o n 141 ∗ i s m o d i f i e d a s f o l l l o w s : < b r> 142 ∗ < i >c h o i x == 0 − − N o t h i n g i s p r i n t e d . 143 ∗ 144 ∗ < i >c h o i x == 1 < / i > − − A s s i g n m e n t s a r e p r i n t e d i n i n c r e a s i n g o r d e r o f t h e i r 145 ∗ p r o p o s i t i o n s , 146 ∗ 147 ∗ < i >c h o i x == 2 < / i > − − A s s i g n m e n t s a r e p r i n t e d i n d e c r e a s i n g o r d e r o f t h e i r 148 ∗ v a l u e , 149 ∗ 150 ∗ < i >c h o i x == 3 < / i > − − Do b o t h p r i n t i n t h a t o r d e r . 151 ∗ < b r > 152 ∗ A s s i g n m e n t s a r e p r i n t e d a c c o r d i n g t o t h e f o l l o w i n g f o r m a t : 153 ∗ 154 ∗ < c o d e> a t t r i b u t e − > v a l u e 155 ∗ 156 ∗ Th e a t t r i b u t e i s p r i n t e d a c c o r d i n g t o i t s own s t a t e m e t h o d { @ l i n k L a t t i c e # s t a t e ← ֓ ( ) } . 157 ∗ 158 ∗ / 159 @ O v e r r i d e 160 p u b l i c S t r i n g s t a t e ( i n t c h o i x ) { 161 S t r i n g t h e S t a t e = " " ; 162 i f ( ( c h o i x & 1 ) ==1) { 163 t h e S t a t e = " b b a T r e e A : \ n " ; 164 f o r ( I t e r a t o r < A s s i g n m e n t < P r o p > > i t = b b a T r e e A . i t e r a t o r ( ) ; 165 i t . h a s N e x t ( ) ; ) { 166 A s s i g n m e n t < P r o p > c u r r e n t P a i r = i t . n e x t ( ) ; 167 t h e S t a t e + = c u r r e n t P a i r . a t t r i b u t e . s t a t e ( ) + " − > " + 168 c u r r e n t P a i r . v a l u e + " \ n " ; 169 } 170 } 171 i f ( ( c h o i x & 3 ) ==3) t h e S t a t e + = " \ n " ; 172 i f ( ( c h o i x & 2 ) ==2) { 173 t h e S t a t e + = " b b a T r e e V A : \ n " ; 174 f o r ( I t e r a t o r < A s s i g n m e n t < P r o p > > i t = b b a T r e e V A . i t e r a t o r ( ) ; 175 i t . h a s N e x t ( ) ; ) { 176 A s s i g n m e n t < P r o p > c u r r e n t P a i r = i t . n e x t ( ) ; 177 t h e S t a t e + = c u r r e n t P a i r . a t t r i b u t e . s t a t e ( ) + " − > " + 178 c u r r e n t P a i r . v a l u e + " \ n " ; 179 } 180 } 181 r e t u r n t h e S t a t e ; 182 } 183 184 185 / ∗ ∗ 186 ∗ C r e a t e a n a r r a y o f t h e a s s i g n m e n t s s t o r e d w i t h i n t h e c l a s s . T h e s e a s s i g n m e n t s ← ֓ n o t 187 ∗ n e c e s s a r y sum t o 1 . N o t i c e t h a t t h e a s s i g n m e n t s s h o u l d b e p o s i t i v e l y v a l u e d 188 ∗ ( f o c a l e l e m e n t s ) , a l t h o u g h < i > t h i s i s n o t a s t r i c t r e q u i r e m e n t . 189 ∗ 190 ∗ / 191 @ O v e r r i d e 192 p u b l i c A r r a y L i s t < A s s i g n m e n t < P r o p > > t o A r r a y ( ) { 193 r e t u r n ne w A r r a y L i s t < A s s i g n m e n t < P r o p > > ( b b a T r e e V A ) ; 194 } 195 196 / ∗ ∗ 197 ∗ Re m ov e a l l a s s i g n m e n t s f r o m < i > t h i s . Th e c l a s s i n s t a n c e i s c l e a r e d . 198 ∗ 199 ∗ / 200 @ O v e r r i d e 201 p u b l i c v o i d c l e a r ( ) { 202 b b a T r e e A . c l e a r ( ) ; 203 b b a T r e e V A . c l e a r ( ) ; 204 u p d a t e _ n o t i f i c a t i o n ( ) ; 205 } 206 207 / ∗ ∗ 208 ∗ A dd a n a s s i g n m e n t c h a r a c t e r i z e d b y a p r o p o s i t i o n < i > a P r o p o s i t i o n a n d a ← ֓ v a l u e 209 ∗ < i >a n A s s i g n m e n t V a l u e t o < i > t h i s . 156 210 ∗ I f a n a s s i g n m e n t a l r e a d y e x i s t s f o r a P r o p o s i t i o n , s a y w i t h v a l u e < i > ← ֓ t h e O l d V a l u e , 211 ∗ t h e n t h e n e w a s s i g n e m e n t o f a P r o p o s i t i o n i s s t o r e d w i t h v a l u e 212 ∗ < i >t h e O l d V a l u e +a n A s s i g n m e n t V a l u e . 213 ∗ 214 ∗ / 215 @ O v e r r i d e 216 p u b l i c b o o l e a n a d d ( P r o p a P r o p o s i t i o n , d o u b l e a n A s s i g n m e n t V a l u e ) { 217 i f ( a n A s s i g n m e n t V a l u e <=0) r e t u r n f a l s e ; 218 A s s i g n m e n t < P r o p > a n A s s i g n m e n t = new A s s i g n m e n t < P r o p > ( ) ; 219 a n A s s i g n m e n t . a t t r i b u t e = a P r o p o s i t i o n . c l o n e ( ) ; / / a v o i d b o r d e r e f f e c t w i t h ← ֓ e n t r y 220 a n A s s i g n m e n t . v a l u e = a n A s s i g n m e n t V a l u e ; 221 A s s i g n m e n t < P r o p > f o u n d P a i r = f i n d P r o p o s i t i o n ( a n A s s i g n m e n t ) ; 222 i f ( f o u n d P a i r ! = n u l l ) { 223 a n A s s i g n m e n t . v a l u e + = f o u n d P a i r . v a l u e ; 224 b b a T r e e A . r e m o v e ( f o u n d P a i r ) ; 225 b b a T r e e V A . r e m o v e ( f o u n d P a i r ) ; 226 } 227 b b a T r e e A . a d d ( a n A s s i g n m e n t ) ; 228 b b a T r e e V A . a d d ( a n A s s i g n m e n t ) ; 229 u p d a t e _ n o t i f i c a t i o n ( ) ; 230 r e t u r n t r u e ; 231 } 232 233 / ∗ ∗ 234 ∗ S e a r c h i f t h e r e i s a n a s s i g n m e n t s t o r e d w i t h i n t h e c l a s s , a n d w h i c h a t t r i b u t e 235 ∗ i s e q u a l t o t h e a t t r i b u t e o f a n A s s i g n m e n t . 236 ∗ R e t u r n t h e f o u n d a s s i g n m e n t , i f t h e r e i s o n e . O t h e w i s e , r e t u r n < i > n u l l . 237 ∗ 238 ∗ / 239 @ O v e r r i d e 240 p u b l i c A s s i g n m e n t < P r o p > f i n d P r o p o s i t i o n ( A s s i g n m e n t < P r o p > a n A s s i g n m e n t ) { 241 A s s i g n m e n t < P r o p > f o u n d P a i r = b b a T r e e A . c e i l i n g ( a n A s s i g n m e n t ) ; 242 i f ( f o u n d P a i r ! = n u l l ) { 243 i f ( f o u n d P a i r . a t t r i b u t e . c o m p a r e T o ( a n A s s i g n m e n t . a t t r i b u t e ) ==0) { 244 r e t u r n f o u n d P a i r ; 245 } 246 } 247 r e t u r n n u l l ; 248 } 249 250 / ∗ ∗ 251 ∗ G e t t h e b e l i e f o f < i > a P r o p o s i t i o n . A l t h o u g h n o t r e q u i r e d , i t i s a s s u m e d ← ֓ t h a t 252 ∗ t h e a s s i g n m e n t s sum t o 1 . 253 ∗ 254 ∗ / 255 @ O v e r r i d e 256 p u b l i c d o u b l e B e l ( P r o p a P r o p o s i t i o n ) { 257 d o u b l e b e l i e f = 0 . ; 258 f o r ( I t e r a t o r < A s s i g n m e n t < P r o p > > i t = b b a T r e e A . i t e r a t o r ( ) ; 259 i t . h a s N e x t ( ) ; ) { 260 A s s i g n m e n t < P r o p > c u r r e n t P a i r = i t . n e x t ( ) ; 261 i f ( a P r o p o s i t i o n . c o n t a i n s ( c u r r e n t P a i r . a t t r i b u t e ) ) 262 b e l i e f + = c u r r e n t P a i r . v a l u e ; 263 } 264 r e t u r n b e l i e f ; 265 } 266 267 / ∗ ∗ 268 ∗ G e t t h e p l a u s i b i l i t y o f < i > a P r o p o s i t i o n . A l t h o u g h n o t r e q u i r e d , i t i s ← ֓ a s s u m e d t h a t 269 ∗ t h e a s s i g n m e n t s sum t o 1 . 270 ∗ 271 ∗ / 272 @ O v e r r i d e 273 p u b l i c d o u b l e P l ( P r o p a P r o p o s i t i o n ) { 274 d o u b l e b e l i e f = 0 . ; 275 f o r ( I t e r a t o r < A s s i g n m e n t < P r o p > > i t = b b a T r e e A . i t e r a t o r ( ) ; 276 i t . h a s N e x t ( ) ; ) { 277 A s s i g n m e n t < P r o p > c u r r e n t P a i r = i t . n e x t ( ) ; 278 i f ( a P r o p o s i t i o n . i n t e r s e c t s ( c u r r e n t P a i r . a t t r i b u t e ) ) 279 b e l i e f + = c u r r e n t P a i r . v a l u e ; 157 280 } 281 r e t u r n b e l i e f ; 282 } 283 284 / ∗ ∗ 285 ∗ Re m ov e t h e a s s i g n m e n t r e l a t e d t o p r o p o s i t i o n < i > a P r o p o s i t i o n , i f t h e r e i s 286 ∗ s u c h a s s i g n m e n t s t o r e d w i t h i n < i > t h i s . 287 ∗ R e t u r n t h e v a l u e a s s i g n e d t o t h e p r o p o s i t i o n . 288 ∗ 289 ∗ / 290 @ O v e r r i d e 291 p u b l i c d o u b l e r e m o v e ( P r o p a P r o p o s i t i o n ) { 292 A s s i g n m e n t < P r o p > f o u n d P a i r = f i n d P r o p o s i t i o n ( a P r o p o s i t i o n ) ; 293 i f ( f o u n d P a i r ! = n u l l ) { 294 d o u b l e t h e V a l u e = f o u n d P a i r . v a l u e ; 295 b b a T r e e A . r e m o v e ( f o u n d P a i r ) ; 296 b b a T r e e V A . r e m o v e ( f o u n d P a i r ) ; 297 u p d a t e _ n o t i f i c a t i o n ( ) ; 298 r e t u r n t h e V a l u e ; 299 } 300 r e t u r n 0 . ; 301 } 302 303 / ∗ ∗ 304 ∗ Make a m i x o f t h e b a s i c b e l i e f a s s i g n m e n t s s t o r e d w i t h i n t h e e n t r y , < i >b b a I n 305 ∗ a c c o r d i n g t o t h e i r r e s p e c t i v e w e i g h t < i >w e i g h t . T h i s m i x i s s t o r e d i n t o < i > ← ֓ t h i s . 306 ∗ 307 ∗ / 308 @ O v e r r i d e 309 p u b l i c B m i x ( A r r a y L i s t < B > b b a I n , d o u b l e [ ] w e i g h t ) { 310 i n t n b I n = b b a I n . s i z e ( ) ; 311 312 i f ( n b I n < 1 ) r e t u r n n u l l ; 313 i f ( n b I n ! = w e i g h t . l e n g t h ) r e t u r n n u l l ; 314 d o u b l e c u m u l =0 ; 315 d o u b l e a V a l u e ; 316 i n t i ; 317 I t e r a t o r j ; 318 A s s i g n m e n t < P r o p > r e f O u t ; 319 f o r ( i = 0 ; i < n b I n ; i ++ ) { 320 a V a l u e = w e i g h t [ i ] ; 321 i f ( a V a l u e <0 ) r e t u r n n u l l ; 322 c u m u l + = a V a l u e ; 323 } 324 i f ( c u m u l ==0) r e t u r n n u l l ; 325 c l e a r ( ) ; 326 B b b a R e s u l t = i n s t a n c e ( ) ; 327 f o r ( i = 0 ; i < n b I n ; i ++ ) { 328 a V a l u e = w e i g h t [ i ] / c u m u l ; 329 f o r ( j =( b b a I n . g e t ( i ) ) . b b a T r e e V A . i t e r a t o r ( ) ; j . h a s N e x t ( ) ; ) { 330 r e f O u t = ( A s s i g n m e n t < P r o p > ) j . n e x t ( ) ; 331 b b a R e s u l t . a d d ( r e f O u t . a t t r i b u t e , a V a l u e ∗ r e f O u t . v a l u e ) ; 332 } 333 } 334 d u p l i c a t e ( b b a R e s u l t ) ; 335 u p d a t e _ n o t i f i c a t i o n ( ) ; 336 r e t u r n ( B ) t h i s ; 337 } 338 339 @ O v e r r i d e 340 p u b l i c v o i d u p d a t e _ n o t i f i c a t i o n ( ) { / / c a l l e d e a c h t i m e a c h a n g e i s d o n e 341 i f ( r e l a x e d ( ) ) r e l a x ( ) ; 342 e l s e s u p e r . u p d a t e _ n o t i f i c a t i o n ( ) ; 343 } 344 345 346 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 347 / / r e s e r v e d p a r t 348 / / / / / / / / / / / / / / / 349 350 / ∗ ∗ 351 ∗ T h i s m e t h o d i s n o t a c c e s s i b l e f r o m c l a s s { @ l i n k T r e e S e t B B A } a n d g e n e r a t e s an ← ֓ 158 e r r o r 352 ∗ r e p o r t a n d a c o d e e x i t . 353 ∗ 354 ∗ / 355 p u b l i c b o o l e a n r e l a x ( i n t m a x M e m ) { 356 i f ( ! r e l a x e d ( ) ) { 357 S y s t e m . e r r . p r i n t l n ( " C l a s s " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) 358 + " d o e s n o t i m p l e m e n t r e l a x a t i o n " ) ; 359 S y s t e m . e x i t ( 0 ) ; 360 } 361 i f ( m a x M e m <1 ) r e t u r n f a l s e ; 362 b o o l e a n t e s t = t r u e ; 363 w h i l e ( b b a T r e e A . s i z e ( )> m a x M e m ) { 364 t e s t = t e s t & & _ r e l a x S t e p ( ) ; 365 } 366 s u p e r . u p d a t e _ n o t i f i c a t i o n ( ) ; 367 r e t u r n t e s t ; 368 } 369 370 / ∗ ∗ 371 ∗ T h i s m e t h o d i s n o t a c c e s s i b l e f r o m c l a s s { @ l i n k T r e e S e t B B A } a n d g e n e r a t e s an ← ֓ e r r o r 372 ∗ r e p o r t a n d a c o d e e x i t . 373 ∗ 374 ∗ / 375 p u b l i c b o o l e a n r e l a x ( ) { 376 i f ( ! r e l a x e d ( ) ) { 377 S y s t e m . e r r . p r i n t l n ( " C l a s s " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) 378 + " d o e s n o t i m p l e m e n t r e l a x a t i o n " ) ; 379 S y s t e m . e x i t ( 0 ) ; 380 } 381 r e t u r n r e l a x ( m a x S i z e ( − 1 ) ) ; 382 } 383 384 / ∗ ∗ 385 ∗ T h i s m e t h o d i s n o t a c c e s s i b l e f r o m c l a s s { @ l i n k T r e e S e t B B A } a n d g e n e r a t e s an ← ֓ e r r o r 386 ∗ r e p o r t a n d a c o d e e x i t . 387 ∗ 388 ∗ / 389 p u b l i c i n t m a x S i z e ( i n t n e w S i z e ) { 390 i f ( ! r e l a x e d ( ) ) { 391 S y s t e m . e r r . p r i n t l n ( " C l a s s " + t h i s . g e t C l a s s ( ) . g e t N a m e ( ) 392 + " d o e s n o t i m p l e m e n t r e l a x a t i o n " ) ; 393 S y s t e m . e x i t ( 0 ) ; 394 } 395 i f ( n e w S i z e >0) { 396 t h e M a x S i z e = n e w S i z e ; 397 r e l a x ( ) ; 398 } 399 r e t u r n t h e M a x S i z e ; 400 } 401 402 } 159 Source Co de: T reeSetRefereeF use r.ja v a 1 / ∗ 2 ∗ T r e e S e t R e f e r e e F u s e r . j a v a : p a r t o f p a c k a g e R e f e r e e T o o l b o x ; I m p l e m e n t a t i o n 3 ∗ o f f u s e r b a s e d o n r e f e r e e f u n c t i o n . 4 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 5 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e 6 ∗ 7 ∗ A u t h o r : Frà c  dà c  r ic D a m b r e v i l l e < h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com > 8 ∗ 9 ∗ T h i s f i l e i s p a r t o f R e f e r e e T o o l b o x . 10 ∗ 11 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 12 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 13 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 14 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 15 ∗ 16 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 17 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 18 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 19 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 20 ∗ 21 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 22 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e < h t t p : / /w w w . g n u . o r g / l i c e n s e s / > . 23 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ 24 ∗ / 25 26 p a c k a g e R e f e r e e T o o l b o x ; 27 28 i m p o r t j a v a . u t i l . ∗ ; 29 30 / ∗ ∗ 31 ∗ T h i s c l a s s i m p l e m e n t s a g e n e r i c c o m b i n a t i o n o f B a s i c B e l i e f A s s i g n m e n t s b y t h e 32 ∗ m e a n s o f r e f e r e e f u n c t i o n s a n d o n t h e b a s i s o f a n e x a c t c o m p u t a t i o n . T h i s 33 ∗ c l a s s d o e s n o t h a n d l e d i r e c t r u l e i m p l e m e n t a t i o n s , { @ l i n k BBA F u se r } , o r 34 ∗ i m p l e m e n t a t i o n s b a s e d on r e f e r e e s a m p l i n g , { @ l i n k S a m p l e d B B A R e f e r e e F u s e r } . 35 ∗ 36 ∗ @ a u t h o r < A h r e f =" h t t p : / / e m a i l . f r e d e r i c d a m b r e v i l l e . com " >Frà c  dà c  ric ← ֓ D a m b r e v i l l e 37 ∗ 38 ∗ 39 ∗ 40 ∗ < B R > < B R > < t a b l e b o r d e r = ’ 1 ’ c e l l P a d d i n g = ’4 ’ > < t r > < t d > 41 ∗ < f o n t c o l o r = " # 0 0 8 0 0 0 " s t y l e = " f o n t − f a m i l y : g e o r g i a "> 42 ∗ C o p y r i g h t ( c ) 2 0 1 0 Frà c  dà c  ric D a m b r e v i l l e < B R > 43 ∗ < B R > 44 ∗ R e f e r e e T o o l b o x i s f r e e s o f t w a r e : y o u c a n r e d i s t r i b u t e i t a n d / o r m o d i f y 45 ∗ i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y 46 ∗ t h e F r e e S o f t w a r e F o u n d a t i o n , e i t h e r v e r s i o n 3 o f t h e L i c e n s e , o r 47 ∗ ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n . 48 ∗ < B R > 49 ∗ R e f e r e e T o o l b o x i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l , 50 ∗ b u t W I T H O U T A N Y W A R R A N T Y ; w i t h o u t e v e n t h e i m p l i e d w a r r a n t y o f 51 ∗ M E R C H A N T A B I L I T Y o r FITNESS F O R A P A R T I C U L A R P U R P O S E. S e e t h e 52 ∗ G N U G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s . 53 ∗ < B R > 54 ∗ You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e 55 ∗ a l o n g w i t h R e f e r e e T o o l b o x . I f n o t , s e e 56 ∗ h t t p : / /w w w . g n u . o r g / l i c e n s e s / . 57 ∗ < / t a b l e > < B R > 58 ∗ 59 ∗ / 60 61 p u b l i c c l a s s T r e e S e t R e f e r e e F u s e r < P r o p e x t e n d s L a t t i c e < P r o p > , 62 B e x t e n d s T r e e S e t R e f e r e e F u s e r < P r o p , B > > 63 e x t e n d s T r e e S e t B B A < P r o p , B > 64 i m p l e m e n t s B B A R e f e r e e F u s e r < P r o p , B > { 65 66 p r o t e c t e d d o u b l e t h e C o n f l i c t = − 1 . ; 67 p r o t e c t e d P r o p t h e Z e r o = n u l l ; 68 p r o t e c t e d A r r a y L i s t < m i n A s s i g n m e n t < P r o p > > B B A S o u r c e s = ne w A r r a y L i s t < ← ֓ m i n A s s i g n m e n t < P r o p >> () ; 69 70 160 71 / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / : 72 / / p u b l i c p a r t 73 / / / / / / / / / / / / / / / 74 75 p u b l i c d o u b l e c o n f l i c t ( ) { 76 r e t u r n t h e C o n f l i c t ; 77 } 78 79 p u b l i c B f u s e ( B l e f t , B r i g h t , R e f e r e e F u n c t i o n D e f a u l t < P r o p > t h e R e f e r e e F u n c t i o n ← ֓ ) { 80 A r r a y L i s t < B > b b a T a b = ne w A r r a y L i s t < B > ( ) ; 81 b b a T a b . a d d ( l e f t ) ; 82 b b a T a b . a d d ( r i g h t ) ; 83 r e t u r n f u s e ( b b a T a b , t h e R e f e r e e F u n c t i o n ) ; 84 } 85 86 87 p u b l i c B f u s e ( A r r a y L i s t < B > b b a I n , R e f e r e e F u n c t i o n D e f a u l t < P r o p > ← ֓ t h e R e f e r e e F u n c t i o n ) { 88 i n t n b I n ; 89 i n t k , l ; 90 d o u b l e N o r m ; 91 n b I n = b b a I n . s i z e ( ) ; 92 i f ( n b I n < 1 ) r e t u r n n u l l ; 93 I t e r a t o r [ ] j = ne w I t e r a t o r [ n b I n ] ; 94 A r r a y L i s t < A s s i g n m e n t < P r o p > > a s s i g n I n = ne w A r r a y L i s t < A s s i g n m e n t < P r o p > >( ) ; 95 B B A S o u r c e s . c l e a r ( ) ; 96 f o r ( k = 0 ; k < n b I n ; k ++ ) { 97 a s s i g n I n . a d d ( n u l l ) ; 98 B B A S o u r c e s . a d d ( b b a I n . g e t ( k ) ) ; 99 } / / C h e r c h e r m i e u x ? 100 / / 101 d o u b l e [ ] p r o p E v a l = ne w d o u b l e [ 1 + n b I n ] ; 102 p r o p E v a l [ n b I n ] = 1 . ; 103 A r r a y L i s t < A s s i g n m e n t < P r o p > > r e f O u t ; 104 A s s i g n m e n t < P r o p > a T m p A s s i g n ; 105 B b b a R e s u l t = i n s t a n c e ( ) ; 106 b b a R e s u l t . c l e a r ( ) ; 107 f o r ( k = 0 ; k < n b I n ; k ++ ) j [ k ] = b b a I n . g e t ( k ) . b b a T r e e V A . i t e r a t o r ( ) ; 108 f o r ( k = n b I n − 1 ; k < n b I n ; ) { 109 i f ( j [ k ] . h a s N e x t ( ) ) { 110 a T m p A s s i g n =( A s s i g n m e n t < P r o p >) j [ k ] . n e x t ( ) ; 111 a s s i g n I n . s e t ( k , a T m p A s s i g n ) ; 112 p r o p E v a l [ k ] = p r o p E v a l [ k + 1 ] ∗ a T m p A s s i g n . v a l u e ; 113 i f ( k ==0) { 114 r e f O u t = t h e R e f e r e e F u n c t i o n . r e f e r e e F u n c t i o n ( a s s i g n I n , B B A S o u r c e s ) ← ֓ ; 115 f o r ( l = 0 ; l < r e f O u t . s i z e ( ) ; l ++ ) 116 b b a R e s u l t . a d d ( r e f O u t . g e t ( l ) . a t t r i b u t e , 117 p r o p E v a l [ 0 ] ∗ r e f O u t . g e t ( l ) . v a l u e ) ; 118 } e l s e { 119 k −− ; 120 } 121 } e l s e { 122 j [ k ] = b b a I n . g e t ( k ) . b b a T r e e V A . i t e r a t o r ( ) ; 123 k ++; 124 } 125 } 126 b b a R e s u l t . u p d a t e _ n o t i f i c a t i o n ( ) ; 127 N o r m = 0 . ; 128 i f ( t h e Z e r o = = n u l l ) 129 t h e Z e r o = b b a R e s u l t . b b a T r e e A . f i r s t ( ) . a t t r i b u t e . i n s t a n c e N s i z e ( ) . ← ֓ z e r o ( ) ; 130 t h e C o n f l i c t = b b a R e s u l t . r e m o v e ( t h e Z e r o ) ; 131 f o r ( I t e r a t o r < A s s i g n m e n t < P r o p > > i t = b b a R e s u l t . b b a T r e e A . i t e r a t o r ( ) ; 132 i t . h a s N e x t ( ) ; ) { 133 A s s i g n m e n t < P r o p > c u r r e n t P a i r = i t . n e x t ( ) ; 134 N o r m + = c u r r e n t P a i r . v a l u e ; 135 } 136 c l e a r ( ) ; 137 f o r ( I t e r a t o r < A s s i g n m e n t < P r o p > > i t = b b a R e s u l t . b b a T r e e A . i t e r a t o r ( ) ; 138 i t . h a s N e x t ( ) ; ) { 139 A s s i g n m e n t < P r o p > c u r r e n t P a i r = i t . n e x t ( ) ; 140 c u r r e n t P a i r . v a l u e /= N o r m ; 161 141 a d d ( c u r r e n t P a i r ) ; 142 } 143 u p d a t e _ n o t i f i c a t i o n ( ) ; 144 145 r e t u r n ( B ) t h i s ; 146 } 147 148 } 162 4 License R efer e e T o olb ox is relea s ed under the GNU GE NERAL PUBLIC LICENSE: GNU GENERA L PUBLIC LICENSE Versio n 3, 29 June 2007 Copyri ght (C) 2007 Free Software Founda tion, I nc. Everyo ne is permitted to copy and distrib ute verbatim copies of this lice nse documen t, bu t changin g it i s not allow ed. Preamb le The GNU Gene ral Public License is a free, copyl eft license for softwa re a nd other kind s of works. The licens es for most software and other practi cal w orks are desi gned to take away your free dom to share and chang e the works. By contras t, the GNU Genera l Public License is intende d to g uaran tee your freedom t o share and chan ge all versions of a program --to ma ke sure it remai ns free softwa re f or all its user s. W e, the Free Softwa re Foundati on, use the GNU Genera l Public License for most of our softwa re; it applies also to any other work rel eased this way by its authors . You can ap ply it to your progr ams, too. When we spea k of free softwar e, we are r eferr ing to f reedo m, not price. Our Gene ral Public Licenses are designed to make sure that you have the freed om to distrib ute cop ies of free softwa re ( and charge for them if you wish ), that you receive source code or can get it if yo u want it, that you can ch ange the softwar e or u se piec es of it in new free progr ams, and that you know you can do thes e things. To prot ect y our right s, we need to prevent others from denyi ng you these rights or askin g you to surrende r the rights. Therefo re, you h ave certai n re spons ibili ties if you dis tribu te copi es of the software , or i f you modify it: res ponsi bilit ies t o respect the freedo m of others. For exampl e, if you distrib ute cop ies of such a progra m, w hethe r gratis or for a fee, you mus t pass on to the recip ients the same freedo ms t hat you recei ved. Yo u must make sure that they , too, receive or can get the so urce code. And you must show them these ter ms so they know their right s. Develo pers t hat use the GNU GPL pr otect your rights with two ste ps: (1) assert copyr ight on the software , and (2) o ffer you this Lice nse giving you legal perm issio n to cop y, distribut e an d/or modify it. For the deve loper s’ and auth ors’ protectio n, the G PL clearly expla ins that there is no war ranty for this free softwar e. For bot h users’ and author s’ s ake, the GPL requi res that modified version s be m arked as 163 change d, s o that thei r problems will not be attrib uted e rrone ously t o author s of p revio us versions. Some devic es are designed to deny users access to instal l or run modifi ed v ersio ns of the softwar e inside them, although the manufact urer can do so. This is fu ndame ntall y incompa tible wit h the aim of protec ting u sers’ freedo m to change the software . The syste matic patter n of s uch abuse occ urs in the area of produ cts for i ndivi duals to use, which is prec isely where it is most unacce ptabl e. Therefor e, we have desig ned this version of the GPL to prohib it t he practi ce for those produc ts. If suc h problem s ari se substa ntial ly in other domain s, we stand ready to ext end this provisi on to tho se domain s in f uture versio ns of the GPL, as ne eded to protect the freedom of users . Finall y, e very prog ram i s threa tened constant ly by so ftwar e pat ents. States shoul d not allow patents to restrict develo pment a nd use of softwa re o n gener al-pu rpose comput ers, but in those that do, we wish to avoid the spec ial danger that patents applied to a free prog ram could make it effect ively propriet ary. To prevent this, the GPL assu res that patent s ca nnot be used to ren der the program non-fre e. The precis e terms and conditio ns for c opying , di strib ution a nd modifi catio n follow. TERMS AND COND ITION S 0. Defi nitio ns. "This Licens e" refers to version 3 of the GNU Gener al Public License. "Copyr ight" also means copyright- like laws tha t apply to other kinds of works, such as sem icond uctor mas ks. "The Progr am" refers to any copyrigh table w ork licens ed u nder this Licens e. Eac h license e is a ddres sed as "y ou". "Licen sees" a nd "recip ients " may be ind ividua ls or organ izati ons. To "mod ify" a work means to copy from or adapt all or pa rt of the work in a fash ion r equir ing copyright permissio n, othe r than the making of an exact copy. The resu lting work is called a "modi fied ve rsion " of the earlie r wo rk or a work "bas ed on" the earlier work. A "cove red w ork" mean s either the unmodif ied Pro gram or a work base d on the Progr am. To "pro pagat e" a work mea ns to do anythi ng wi th it that, withou t permis sion, would m ake you dir ectly or seconda rily li able for infrin gemen t under appli cable c opyri ght l aw, excep t executing it on a comput er o r modif ying a private copy. Propaga tion in clude s co pying , distri butio n (with or with out modificati on), maki ng available to the 164 public , an d in some cou ntrie s other act iviti es as wel l. To "con vey" a work means any kind of propa gatio n that enab les other partie s to m ake or rece ive copies. M ere inter actio n with a user thr ough a compu ter n etwor k, with no transfer of a copy, is not conve ying. An inte racti ve user int erface displays "Appropr iate Lega l Notices " to the exten t that it include s a co nveni ent a nd promin ently v isibl e featur e th at (1) disp lays an appropri ate cop yrigh t no tice, and (2) tells the user tha t there is no warran ty f or the work (excep t to the extent that warr antie s are pro vided ), that lic ensee s may con vey the work under this Licen se, and how to view a copy of thi s License. If the interf ace presents a list of user command s or o ption s, su ch as a menu, a promin ent item in the list meets this crite rion. 1. Sour ce Code. The "sourc e code" for a work means the prefe rred form of the work for making modif icati ons to it. "Obj ect code" means any non-so urce form of a wor k. A "Stan dard Interface " means an in terfa ce th at either is an offici al standa rd d efine d by a recogniz ed stan dards body, or, in the case of interf aces s pecif ied f or a part icula r progr ammin g lang uage, one that is wide ly used among developer s wo rking in that langua ge. The "Syste m Libraries " of an exe cutab le work inc lude anythin g, o ther than the work as a who le, that (a) is includ ed i n the norma l form of packag ing a Major Component, but which is not part of that Major Compon ent, a nd (b) serv es only to enable use of the work with that Major Compon ent, or to implement a Standard Interf ace for which an implem entat ion is availa ble t o the publi c in source code form. A "Major Compo nent" , in this con text, means a major essenti al c ompon ent (kerne l, w indow system , and so on) of the specific opera ting system (if any) on whic h the executa ble wor k runs, or a comp iler used to produc e th e work, or an obj ect code interpr eter us ed to run it. The "Corre spond ing Sourc e" for a work in object code form means all the source code neede d to generate , in stall, and (for an execut able work) run the obje ct code and to modify the work , including scripts to contro l th ose activ ities . However , it d oes not includ e the work’s System Libra ries, o r gener al-pu rpose tools or gen erall y av ailab le fr ee progra ms w hich are used unmo difie d in per formi ng th ose activiti es b ut which are not part of th e work. For example , Correspond ing Sourc e includ es i nterf ace d efini tion f iles assoc iated w ith sourc e files for the work, and the sour ce code for shared librar ies and dynamicall y linked subpr ogram s that the work is sp ecific ally d esign ed to r equir e, such as by intim ate data communica tion or con trol flow betwee n those subpro grams and o ther part s of the work. 165 The Corres pondi ng Sour ce need not include anythi ng th at users can regene rate automatic ally from oth er parts of the Corres pondi ng Source . The Corres pondi ng Sour ce for a work in source code form is tha t same work. 2. Basi c Permission s. All rights grant ed under this Licens e are g rante d fo r the term of copyri ght on t he Prog ram, and are irrevoc able pr ovide d the sta ted condit ions a re met. This Lice nse explicit ly affi rms your unlimit ed permis sion t o run the unm odifi ed Prog ram. T he output from runni ng a covere d wo rk is cover ed by this License only if the output , given its conten t, c onsti tutes a c overe d work. Th is Licens e acknowledg es your rights of fair use or ot her equivale nt, as p rovide d by c opyri ght law. You may make , run and propaga te co vered works that you do not convey , wi thout condit ions so long as your license otherw ise remains in forc e. You m ay convey covere d works t o other s for the sole purpos e of havi ng them make modific ation s exclusiv ely for you , or provid e you with facil ities f or run ning those works, provide d tha t you comply with the terms of this Lice nse in conveyi ng a ll materia l fo r which you do not contro l copyright . Those thus making or runni ng the covered works for you must do so exc lusiv ely on y our behalf , un der your direc tion and contro l, o n terms tha t prohibit them from making any copies of your copyr ighte d mater ial outside their relations hip wit h you. Convey ing under a ny oth er circumsta nces is per mitte d sol ely under the condit ions stated below. Sub licen sing i s not allowe d; s ectio n 10 makes it unnec essar y. 3. Prot ectin g Users ’ Legal Rights From Anti-Ci rcumv ention Law. No cove red w ork shall be de emed part of an effect ive technologi cal measur e un der any appli cable law fulfillin g ob ligat ions un der article 11 of the WIP O copyrigh t trea ty adopted on 20 Decem ber 1 996, or simila r la ws prohib iting o r restr ictin g circu mvent ion of such measur es. When you conve y a covered work, you waive any legal power to fo rbid circum venti on of techn ologi cal measu res t o the exten t such circumve ntion is effe cted by exercisi ng righ ts under this Licens e wit h respect to the covere d work, and you disclaim any intent ion to l imit opera tion or modifi catio n of the wor k as a means of enforc ing, ag ainst the work’ s users, your or thi rd parties’ legal rights to forbi d circumvent ion of techno logic al measur es. 4. Conv eying Verbatim Copies. 166 You may conv ey verbatim copies of the Program ’s s ource code as you receiv e it , in any medi um, provide d tha t you conspic uousl y and approp riate ly publis h on e ach copy an app ropri ate cop yrigh t not ice; keep intac t all notices stating that this License and any non-pe rmiss ive terms added in accor d with section 7 apply to the code ; keep intac t all notices of the absence of any warra nty; and give all recipi ents a c opy of this Lic ense along with the Progr am. You may char ge any price or no price for each copy tha t you convey, and you may offe r support or warrant y pr otect ion f or a fee. 5. Conv eying Modified Source Versions . You may conv ey a work based on the Program , or the modifica tions to produc e it f rom the Pro gram, in the form of sourc e code under the terms of secti on 4, provide d tha t you also meet all of these con ditio ns: a) The work must car ry promin ent not ices stating that you modif ied it, and givi ng a relevant date. b) The work must car ry promin ent not ices stating that it is releas ed u nder this Lic ense and any conditio ns a dded under secti on 7. This requi remen t modif ies the requirem ent in s ection 4 to "keep inta ct all notices". c) You must lice nse the entire work, as a whol e, under this Licens e to anyone who comes into possessi on o f a copy. This Licens e will therefor e app ly, along with any appli cable s ectio n 7 additi onal terms, to the whole of the work, and all its par ts, regard less of how they are package d. This Licen se gives no permis sion to license the work in any other way, but it doe s not invali date such permissi on if yo u have separat ely rec eived it. d) If the wor k has interact ive use r interfa ces, ea ch must displ ay Approp riate Legal Notices; however, if the Program has intera ctive interf aces that do not display Appropri ate Leg al Notice s, y our work need not make the m do so. A compi latio n of a cove red work with other separat e an d indep enden t works, which are not by the ir nature extensio ns o f the cover ed work, and which are not comb ined with it such as to form a lar ger program, in or on a volu me of a storage or distr ibuti on medium , is called an "aggre gate" if the compilati on and its re sulti ng c opyri ght are n ot used to limit the acce ss or legal rights of the compi latio n’s users beyond what the indiv idual works permit. I nclus ion o f a cove red work in an aggreg ate does not cause this Licens e to ap ply to the othe r parts of the aggre gate. 6. Conv eying Non-Sour ce Form s. 167 You may conv ey a covered work in object code form under the ter ms of sect ions 4 and 5, provided that you also conv ey the machin e-rea dable Corre spond ing Source under the term s of this License , in one of the se ways: a) Conv ey the object code in, or embodie d in, a physical product (inclu ding a physical distribu tion me dium) , acc ompan ied by th e Corres pondi ng Source fixed on a du rable physic al m edium custom arily used for software interch ange. b) Conv ey the object code in, or embodie d in, a physical product (inclu ding a physical distribu tion me dium) , acc ompan ied by a writte n offer, valid for at least three years and valid for as long as you offe r spare parts or custome r support f or that pro duct model, to give any one who possesse s th e objec t code either (1) a copy of the Corr espon ding Sour ce for all the softw are in the produc t that is covered by this Licens e, on a durable physi cal medium custo maril y used for so ftwar e int ercha nge, for a pr ice no more than your rea sonab le cost of ph ysica lly p erfor ming th is convey ing of source, or (2) access to copy the Corres pondi ng Source from a ne twork server at no charg e. c) Conv ey individua l copie s of the object code with a copy of th e writte n offer to provide the Corresp onding Sou rce. This altern ative is allowed only occasio nally and n oncom merci ally, and only if you rece ived the object code with such an offer , in accord with subse ction 6b. d) Conv ey the object code by offerin g ac cess from a des ignate d place (gra tis or for a charge ), an d offer equiv alent a ccess to the Corres pondi ng Source in the sa me way through the same place at no furthe r charge. Yo u need not requi re r ecipi ents to copy the Corres pondi ng Source along with the obj ect code. If the plac e to copy the objec t code is a network server , the Correspond ing Sourc e may be on a dif feren t ser ver (operat ed by y ou or a thir d party) that suppo rts equivalent copying facilitie s, p rovid ed yo u maintai n clear dire ction s next to the obj ect code saying where to fin d the Corres pondi ng Source . Re gardl ess of w hat server hosts the Corres pondi ng Source , you remain obligated to ensure that it is availa ble for as long as needed to satis fy t hese requi remen ts. e) Conv ey the object code using peer-t o-pee r trans missi on, provid ed you inform oth er peers where the object code and Corr espon ding Source of the work are b eing offered to the gene ral public at no charge under sub secti on 6d. A separ able portion of the object code, whose sourc e code is excluded from the Corre spond ing Sourc e as a System Library, need not be includ ed i n conve ying the object code work. 168 A "User Prod uct" is either (1) a "consum er p roduct ", w hich mean s any tangib le p erson al pr opert y which is normally used for personal , fam ily, or hous ehold p urpos es, o r (2) anyth ing designe d or so ld for incorp orati on into a dwell ing. In de termi ning wh ether a produ ct is a consume r pro duct, doubtf ul c ases shal l be resolved in favor of coverag e. For a par ticul ar produc t re ceive d by a particul ar user , "normal ly us ed" refers to a typica l or c ommon use of that clas s of produc t, r egard less of t he stat us of the parti cular user or of the way in which the part icula r use r actual ly u ses, or expec ts or is expecte d to u se, the produ ct. A pr oduct is a cons umer product regardle ss of wh ether the produc t has s ubsta ntial commer cial, industrial o r non-c onsum er uses , unless such uses represe nt the only signi fican t mode of use of th e product . "Insta llati on Inform ation " for a User Prod uct means any method s, proced ures, authorizat ion keys, or other inf ormat ion req uired to install and execut e modified versions of a covered work in that User Pro duct from a modif ied v ersio n of its Correspon ding Sour ce. The informa tion mu st suffic e to e nsure that the co ntinu ed func tioni ng of the m odifi ed o bject code is in no cas e prevente d or i nterf ered wi th solely becaus e modifi catio n has been made . If you conve y an object code work under this sectio n in, or with, or specif icall y for use in, a Us er Product , an d the conve ying oc curs as part of a tra nsact ion in whic h the right of posse ssion a nd use of the User Produ ct i s trans ferre d to the reci pient in perpetu ity or f or a fixed term (rega rdles s of how the tr ansac tion is c harac teriz ed), the Corres pondi ng Source convey ed u nder this sec tion must be accompan ied by the Insta llati on Inf ormati on. But this requir ement d oes not apply if neit her y ou nor any thir d party retains the ability to inst all modifi ed o bject code on the User Pro duct (for exampl e, t he work has been insta lled in ROM). The requir ement t o prov ide Installa tion Info rmatio n does not i nclud e a requir ement to continue to provide support service , war ranty , or u pdate s for a work that has be en modified or install ed by the recipie nt, or for the User Produ ct in which it has been modifi ed or install ed. Acce ss to a networ k ma y be deni ed when the modifica tion it self materi ally an d advers ely affects t he oper ation of the network or violate s th e rules and protoc ols for communicat ion acros s the network. Corres pondi ng Source convey ed, and Installati on Info rmati on prov ided, in acco rd with this section must be in a forma t that is publicly docume nted ( and with an impl ement ation ava ilabl e to the pu blic in source code form ), and must require no specia l pa sswor d or ke y for unpack ing, r eadin g o r copy ing. 7. Addi tiona l Terms . "Addit ional permission s" are term s that supplemen t th e terms of this Licens e by m aking excep tions from one or more of its condi tions . 169 Additi onal p ermis sions t hat are app licab le to the ent ire Program shall be trea ted a s thoug h they were included in this Licens e, t o the exten t that they are vali d under applicab le law. If a dditi onal pe rmiss ions apply only to part of th e Program , tha t part may be used sepa rately under those perm issio ns, but the enti re Program remains govern ed b y this Licen se w ithou t regard to the additiona l pe rmiss ions. When you conve y a copy of a covered work, you may at you r option remove any addit ional permissi ons fro m that copy, or from any part of it. (Addi tiona l permi ssion s may be writ ten to require their own remova l in c ertai n cases when you modify the work.) You may plac e additi onal p ermis sions o n mater ial, added by you to a covered work, for which you have or ca n give appropr iate c opyrig ht p ermis sion. Notwit hstan ding any othe r provision of this License , fo r material you add to a cove red work, you may (if authori zed by the copyright holders of that mater ial) supplemen t the terms of th is Licens e wit h terms: a) Disc laimi ng warr anty or limiting liabilit y dif feren tly fro m the terms of secti ons 15 and 16 of this Licens e; or b) Requ iring preserva tion of spe cified reasonab le leg al notices or author attri butio ns in tha t materia l or i n the Appro priat e Legal Notice s displayed by works containi ng it; o r c) Proh ibiti ng misr epres entat ion of th e origi n of t hat mater ial, or requir ing that modified versions of such materia l be m arked in reason able ways as different from the origina l version; o r d) Limi ting the use for publicit y pu rpose s of n ames of licens ors or author s of the material ; or e) Decl ining to grant rights under tradem ark law for use of some trade name s, trademar ks, or se rvice marks; or f) Requ iring indemnif icati on of l icens ors and authors of that materi al b y anyon e who conveys the materi al (o r modifie d versions of it) with contr actua l assum ption s of liab ility to the recipie nt, for any liabil ity that these contrac tual as sumpt ions di rectl y imp ose on those lice nsors and authors. All other non- permi ssive add ition al term s are consider ed "fur ther restri ction s" within the meanin g of section 10. If the Progr am a s you receiv ed i t, or any par t of it, contai ns a n otice statin g that it is govern ed b y this Lice nse along with a term that is a furt her restri ction , you may remov e that term. I f a licen se document contains a furth er restricti on but perm its relicens ing or c onvey ing und er this Licens e, y ou may add to a cov ered work materi al g overn ed by the terms of that licens e document, provided that the furthe r re stric tion do es not surviv e such relicensi ng or co nveyi ng. 170 If you add terms to a c overed work in accord with this sect ion, you must place , in the relevant source files, a state ment of t he additi onal t erms that appl y to those files, or a notic e indicatin g where to find the appl icabl e ter ms. Additi onal t erms, perm issiv e or non -perm issive , ma y be stated in the form of a sep arate ly writ ten license, or stated as excep tions ; the above requ ireme nts apply eit her way. 8. Term inati on. You may not prop agate or modify a covere d work except as expressly provid ed u nder this Lic ense. Any a ttemp t ot herwi se to p ropag ate or modify it is void, and will aut omati cally ter minat e you r rights under this Licen se ( inclu ding any patent licenses granted under the third paragr aph of s ectio n 11). Howeve r, i f you cease all vio lation of this Licens e, t hen your licens e fr om a part icula r copyr ight holder is reinsta ted (a) provis ional ly, unles s and until the copyrigh t hol der explici tly and finall y te rmina tes y our licen se, and (b) permanen tly, if the c opyri ght holder fails to notif y you of the violat ion by so me reason able means prior to 60 days aft er the cessat ion. Moreov er, your license from a partic ular co pyrig ht ho lder is reinst ated p erman ently i f the copyr ight holder notifies you of the violat ion by s ome reaso nable means, this is the first time you have receiv ed n otice of viol ation of this License (for any work) from that copyri ght holder, a nd you cure the vio lation prior to 30 days after your recei pt o f the not ice. Termin ation of your rights under this section does not termi nate the licens es o f parti es who have received copies or rights from you under this Licen se. If you r rights have been termi nated and not permanent ly reinst ated, you d o not quali fy to receive new licens es f or the same materi al u nder sect ion 1 0. 9. Acce ptanc e Not Req uired for Having Copies. You are not requ ired to accept this Licens e in order to receive or run a copy of the Prog ram. A ncill ary propagatio n of a cov ered work occurr ing solely as a conseque nce of usin g peer-to -peer t ransm issio n to rece ive a c opy likew ise does not require accept ance. Howe ver, nothin g ot her than this Lice nse grants you permiss ion to pr opaga te o r modify any cover ed work. Th ese actio ns i nfrin ge copyright i f you do not accept this Licen se. Th erefo re, by m odify ing o r propa gatin g a covere d wo rk, you indic ate your accepta nce of th is Licens e to d o so. 10. Automa tic Licensing of Downstre am Reci pient s. 171 Each time you conv ey a covered work, the recipi ent automatica lly receiv es a l icens e from the original licensors , to r un, modif y and propag ate that work, subject to this License. Y ou are not resp onsib le for enforc ing compliance b y thir d parties with this License . An "ent ity t ransa ction " is a tra nsact ion tra nsfer ring co ntrol of an organi zatio n, or subst antia lly all asset s of one, or subdivi ding an organi zatio n, or mergi ng o rgani zatio ns. If propag ation o f a cover ed work resul ts f rom an enti ty transacti on, eac h party to that transa ction who r eceiv es a copy of the wor k also receiv es wh ateve r licens es t o the work the part y’s predeces sor in in teres t ha d or could give under the pre vious paragrap h, plus a rig ht to posse ssion o f the Corres pondi ng Source of the work from the pre deces sor in in teres t, i f the predec essor h as it or can get i t with reasona ble efforts. You may not impo se any further restric tions o n the exerc ise o f the rights grant ed or affirmed under this License . For examp le, you may not impose a licen se fee, royalty, or other charg e for exercise of rights grant ed under this License, and you may not initi ate litigation (inclu ding a c ross- claim o r count ercla im in a la wsuit) alleging that any patent claim is in fring ed by mak ing, using, sellin g, of ferin g for sale, or impor ting the Program or any portion of it. 11. Patent s. A "cont ribut or" is a copy right holder who author izes us e under this Licens e of t he Prog ram or a work on which the Progr am i s based . Th e work thus lice nsed is called the contribu tor’s "co ntrib utor ve rsion ". A contr ibuto r’s "essen tial patent claims" are all patent claims owned or contr olled by the contrib utor, whe ther already acquir ed o r hereaf ter acquired, that w ould be inf ringe d by som e manner, permit ted by this Licens e, of making, using, or selling its contri butor v ersio n, but do not inclu de claims that would be infring ed o nly as a conseq uence of further modificati on of the con tribu tor ver sion. For purpos es o f this defi nitio n, "con trol" includes the right to grant patent subli cense s in a mann er consiste nt with the r equir ement s of this Licen se. Each contr ibuto r grant s you a non-exc lusiv e, w orldw ide, royalty-f ree patent licen se under the contributo r’s ess entia l pa tent claims, to make, use, sell, offe r for sale, import and other wise ru n, modify and propag ate the contents of its contribut or vers ion. In the follo wing three paragraph s, a " patent license" is any expr ess agreem ent or c ommit ment, h oweve r denominate d, not to enf orce a patent (such as an expr ess permiss ion to pr actic e a pa tent or covena nt n ot to sue for patent inf ringe ment) . To " grant " su ch a pate nt license to a party means to mak e such an agreemen t or c ommit ment no t to enforc e a 172 patent again st the party. If you conve y a covered work, knowin gly rel ying on a paten t license, and the Corres pondi ng Sour ce of the work is not availa ble for anyone to copy , free of charge and under the terms of this Licen se, through a public ly a vaila ble n etwor k server or other readily accessi ble mea ns, then you must eith er (1) cause the Corresp ondin g Sourc e to be so availa ble, o r (2) arran ge to deprive yourself of the benefi t of t he patent licen se for this particul ar work , or (3) arrang e, in a manner consis tent w ith the req uireme nts of this Lic ense, to extend the patent licens e to d ownst ream recipient s. "Knowing ly r elyin g" me ans you have actual knowl edge that, but for the patent license, your conv eying the covere d wo rk in a count ry, or your recipien t’s use o f the cover ed work in a coun try, would infring e one or mo re identi fiabl e patents in that countr y th at you have rea son to believe are valid. If, pursua nt to or in connect ion wit h a single tran sacti on or arrang ement , you conve y, o r propa gate by procurin g co nveya nce of, a covere d wo rk, and grant a pat ent license to some of the part ies receiv ing the covered work authoriz ing the m to use, propaga te, m odify or conv ey a specific copy of the covered work, then the pat ent license you grant is autom atica lly ext ended to all recipie nts of th e cover ed work and works bas ed on it. A paten t license is "discri minat ory" if it does not include withi n the scope of its cov erage , pr ohibit s the ex ercis e of, or is condit ioned on the non-exerc ise of one or mor e of the rights that are specif icall y granted under this Lic ense. Yo u may not convey a cov ered work if you are a part y to an arrange ment wi th a thi rd party that is in the busin ess of distribu ting so ftwar e, unde r which you make payme nt to the third party bas ed on the extent of your activi ty of conveying the work, and unde r which the third party grants, to any of the partie s wh o would recei ve the covered work from you, a discr imina tory patent licen se (a) in connecti on with cop ies of the covered work convey ed b y you (or cop ies made from those copies) , or ( b) primar ily for and in conne ction with specifi c pr oducts or compil ation s that contai n th e cover ed work, unless you entered into that arrang ement , or that patent lic ense was granted , pr ior to 28 March 2007. Nothin g in t his Licen se shall be construe d as e xclud ing o r limit ing any implie d license or other defense s to in fring ement tha t may otherw ise be a vaila ble t o you under app licab le pate nt law. 12. No Surre nder of Others’ Freedom. If cond ition s are imp osed on you (whether by court order , agreement or otherw ise) t hat contra dict the condition s of this Lic ense, they do not excuse you from the co nditi ons of th is Licens e. If you ca nnot convey a covere d wo rk so as to sat isfy simultane ously you r obligat ions un der this Licens e an d any other per tinen t obl igati ons, then as a co nsequ ence yo u may 173 not convey it at all . Fo r exam ple, if you agree to terms that oblig ate y ou to coll ect a r oyalt y for further conveyin g fro m those to whom you con vey the Progra m, t he only way you coul d satisfy both those terms and this Licens e wo uld be to ref rain entirely from conveyin g the Program . 13. Use with the GNU Aff ero General Public Licens e. Notwit hstan ding any othe r provision of this License , yo u have permis sion t o link or com bine any covered work with a work licen sed under versio n 3 of the GNU Affero Genera l Pu blic Licen se i nto a singl e combin ed w ork, and to con vey the resultin g wor k. The terms of this Licens e wi ll contin ue to apply to the part which is the cove red work, but the specia l requiremen ts of th e GNU Affero General Public Licens e, sectio n 13 , conce rning i ntera ction t hroug h a network will apply to the combin ation as such. 14. Revise d Versions of this License . The Free Softw are Foundati on may publ ish revised and/or new versio ns o f the GNU Genera l Public License from time to time. Such new vers ions will be simi lar i n spiri t to the present version , bu t may diffe r in detail to addres s ne w probl ems or concerns. Each versi on is given a distingu ishin g version number . If th e Progra m sp ecifi es th at a certai n numbered version of the GNU Gener al Public Licen se "or any later version " app lies to it, you have the option of foll owing the terms and conditi ons eit her of that numbe red versio n or o f any later ver sion publish ed by th e Free Softwar e Founda tion. If the P rogra m doe s not specify a versi on number of the GNU Genera l Public License, you may choose any version ever publi shed by the Free Soft ware Foundatio n. If the Progr am specifie s tha t a proxy can decid e which f uture versio ns o f the GNU Gen eral Public License can be used, that prox y’s public state ment of acceptan ce of a ve rsion perman ently a uthor izes yo u to choo se that version for the Program . Later licens e versions may give you additio nal or di ffere nt permis sions . However, no additio nal obl igati ons a re impose d on a ny author or copy right holder as a result of your choosi ng to follow a later versio n. 15. Discla imer of Warranty . THERE IS NO WARR ANTY FOR THE PROGRAM , TO T HE EXTENT PERMIT TED BY APPLIC ABLE L AW. EXCEP T WHEN OTHERWISE STATED IN WRITIN G THE COPYRIG HT HOLDER S AN D/OR OTHE R PARTIES PROVIDE THE PROGRAM "AS IS" WITHOU T WARRANTY OF ANY KIND, EITHE R EXPRESS ED OR IMP LIED, INCLUDIN G, BU T NOT LIMIT ED T O, THE IMPLIE D WARRANTIE S OF MERC HANTA BILIT Y AN D FITNE SS FO R A PART ICULA R PURPOS E. THE ENT IRE RISK AS TO THE QUALI TY AND PERFORMA NCE OF TH E PROGRAM 174 IS WITH YOU. SHOU LD THE PROGRAM PROVE DEFECT IVE, YO U ASSUME THE COST OF ALL NECESS ARY SERVICING, R EPAIR OR CORR ECTIO N. 16. Limita tion of Liabilit y. IN NO EVENT UNLE SS REQUIRED BY APPLICA BLE L AW OR AGREE D TO IN WRITING WILL ANY COPYR IGHT HOLDER, OR ANY OTHER PARTY WHO MODIFI ES A ND/OR CON VEYS THE PROGRA M AS PERMITTE D ABOVE , BE LIABLE TO YOU FOR DAMAG ES, INCLUDING ANY GENERA L, S PECIA L, IN CIDEN TAL OR CONSEQUE NTIAL DAMA GES ARISING OUT OF THE USE OR INABI LITY TO USE THE PROGRAM (INCLU DING BU T NOT LIMIT ED TO LOSS OF DATA OR DATA BEING REN DERED INACCURA TE OR LOS SES SUSTA INED BY Y OU OR THIRD PARTIE S OR A F AILUR E OF THE PROGRAM TO OPERAT E WI TH ANY OTHE R PROGRAMS), EVEN IF SUCH HOLDE R OR OTHER PARTY HAS BEEN ADVI SED O F THE POSSI BILIT Y OF SUCH DAMAG ES. 17. Interp retat ion of Sect ions 15 and 16. If the discl aimer of warranty and limitat ion of l iabil ity p rovid ed above cannot be given loc al legal effect accord ing t o their terms , review ing courts shall apply local law that most close ly a pprox imate s an abso lute waiver of all civil liabil ity in co nnect ion with the Progra m, u nless a warra nty or assumptio n of li abili ty acco mpani es a copy of the Prog ram in return for a fee. END OF TERMS AND CON DITIO NS How to Apply These Ter ms to Your New Progr ams If you devel op a new program, and you want it to be of the g reate st possib le u se to the pub lic, the best way to achie ve t his is to mak e it free softw are which everyone can redistri bute an d change under these terms. To do so, att ach the followin g not ices to the progr am. It i s safest to atta ch them to the start of each source file to mos t effectiv ely state the excl usion of warranty; and each file should have at leas t the "copyr ight" l ine and a po inter to where the full notic e is found. Copyri ght (C) < name of author > This progr am is free software: you can redist ribut e it and/or mod ify it unde r the terms of the GNU Gener al Pu blic Lice nse as published by the Free Softw are Foundati on, ei ther version 3 of the Licen se, or (at your optio n) any later version . This progr am is distrib uted in the h ope that it will be usef ul, but WITHOU T ANY WARRANT Y; with out even the implied warran ty o f MERCHA NTABI LITY or FITNE SS FOR A PARTICULA R PU RPOSE . See the GNU Genera l Public License for more details . 175 You should hav e receive d a co py of the GNU Genera l Public License along with thi s program . If not, see . Also add infor matio n on how to con tact you by elect ronic a nd pape r mail. If the progr am does termina l int eract ion, ma ke it output a shor t notice like this when it star ts in an intera ctive m ode: Co pyrig ht (C) < year> < name of aut hor> This progr am comes with ABSOLUTE LY NO WAR RANTY ; fo r detai ls ty pe ‘show w’. This is free sof tware , an d you are welco me to r edist ribut e it under cert ain conditions ; type ‘sho w c’ for detail s. The hypoth etica l comma nds ‘show w’ and ‘show c’ should show the appro priat e parts of the Gener al Public License. Of course , your pr ogram ’s c ommand s might be diffe rent; for a GUI interfac e, yo u would use an "abo ut box". You should also get yo ur employe r (i f you work as a progr ammer ) or scho ol, if any, to sign a "cop yrigh t di sclai mer" fo r the progr am, i f nece ssary. For more infor matio n on this , and how to apply and foll ow the GNU GPL, see . The GNU Gene ral Public License does not permit inco rporat ing your prog ram into propr ietar y progr ams. If yo ur progra m is a subro utine l ibrar y, yo u may consid er i t more usef ul to permit linking propri etary a pplic ation s with the librar y. If th is is what you want to do, us e the GNU Lesse r G enera l Public Licen se instead of this License. But first, please read . 176


Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment