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 > 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 > 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 i > . 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 A > 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 / a > . 59 ∗ f o n t > < / 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 i > 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 i > . 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 i > 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 i > . 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 i > 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 i > . 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 i > 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 i > . 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 > 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 > 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 A > 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 / a > . 57 ∗ f o n t > < / 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 i > 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 i > 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 i > 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 i > 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 i > a n d < i > r i g h t i > 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 i > . 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 i > a n d < i >r i g h t i > 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 i > . 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 > 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 > 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 > 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 i > ) . A n s w e r < i > f a l s e i > 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 > 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 > 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 i > . An s w e r < i > f a l s e i > 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 i > t o < i >a P r o p o s i t i o n i > 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 > 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 i > . 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 i > a t t h e s a m e s i z e t h a n < i >i n p u t i > . 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 i > . 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 A > 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 / a > . 54 ∗ f o n t > < / 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 A > 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 / a > . 56 ∗ f o n t > < / 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 i ← ֓ > . 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 i > . 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 > ( 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 i >) . 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 i > , 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 i > . 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 i ← ֓ > 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 i > . T h i s m i x i s s t o r e d i n t o < i > ← ֓ t h i s i > . 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 i > . 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 i > 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 > 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 i > . 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 i > 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 i > t o < i > t h i s i > . 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 i > , s a y w i t h v a l u e < i > ← ֓ t h e O l d V a l u e i > , 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 > 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 i > . 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 i > t o < i > t h i s i > . 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 i > . 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 > , 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 i > . 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 A > 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 / a > . 54 ∗ f o n t > < / 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 A > 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 / a > . 58 ∗ f o n t > < / 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 i > a n d 66 ∗ < i > r i g h t i > 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 i > . 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 i > 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 i > . 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 A > 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 / a > . 59 ∗ f o n t > < / 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 i > a n d 67 ∗ < i > r i g h t i > 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 i > 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 i > . 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 i > 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 i > 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 i > . 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 i > 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 A > 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 / a > . 63 ∗ f o n t > < / 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 i > 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 i > . 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 i > 76 ∗ < B R > 77 ∗ < i > c o m p l e m e n t (X ) = z e r o i > i f < i > X ! = z e r o i > 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 i > 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 i > . 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 i > 97 ∗ < B R > 98 ∗ < i > c o m p l e m e n t (X ) = z e r o i > i f < i > X ! = z e r o i > 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 b > o f < i > a P r o p o s i t i o n i > 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 i > . 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 b > o f < i > t h i s i > 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 i > . 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 A > 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 / a > . 55 ∗ f o n t > < / 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 b > o f < i > a P r o p o s i t i o n i > 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 i > . 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 i > 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 ) i > 69 ∗ < B R > 70 ∗ < b > T h e o r e m 2 . < / b > < i >c o c o m p ( X ) i > c o n t a i n s < i > c om p ( X ) i > 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 b > o f < i > t h i s i > 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 i > . 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 i > 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 ) i > 85 ∗ < B R > 86 ∗ < b > T h e o r e m 2 . < / b > < i >c o c o m p ( X ) i > c o n t a i n s < i > c om p ( X ) i > 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 i > 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 i > . 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 i > o f a l a t t i c e < i > L ← ֓ i > 98 ∗ i s : < i > c o c o m p ( X ) = A N D b > < s u b> Z : Z O R X = o n e s u b> Z i > 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 ) i > 102 ∗ < B R > 103 ∗ Th e o r e m 2 . < / b > < i >c o c o m p ( X ) i > c o n t a i n s < i > com p (X ) i > 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 i > 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 i > . 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 ← ֓ i > 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 i > 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 ) i > 119 ∗ < B R > 120 ∗ Th e o r e m 2 . < / b > < i >c o c o m p ( X ) i > c o n t a i n s < i > com p (X ) i > 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 A > 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 / a > . 54 ∗ f o n t > < / 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 > ( 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 i >) . 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 u > 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 i > , 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 A > 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 / a > . 54 ∗ f o n t > < / 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 > ( 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 i >) . 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 u > 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 i > , 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 A > 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 / a > . 54 ∗ f o n t > < / 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 > ( 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 i >) . 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 u > 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 i > , 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 A > 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 / a > . 54 ∗ f o n t > < / 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 > ( 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 i >) . 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 u > 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 55 ∗ f o n t > < / 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 > ( 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 i >) . 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 i > , 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 A > 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 / a > . 54 ∗ f o n t > < / 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 > ( 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 i >) . 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 u > 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 i > , 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 > 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 > 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 i > . 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 A > 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 / a > . 62 ∗ f o n t > < / 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 S UP > < / 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 SU P > < / i > b i t s t o r e d i n t h e 83 ∗ < i >l o n g i > 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 > i f i 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 i > . 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 > 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 > 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 > i s c h a n g e d t o < i >n e w S i z e i > , 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 i > . 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 i > . 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 > 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 i > 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 i > 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 A > 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 / a > . 54 ∗ f o n t > < / 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 i > 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 i > . 61 ∗ I n d e x < i >i i > r a n g e s f r o m f i r s t v a l u e < i >0 i > . 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 A > 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 / a > . 51 ∗ f o n t > < / 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 i > 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 i > . 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 > 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 > 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 > i s c h a n g e d t o < i >n e w S i z e i > , 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 i > a t t h e sa m e s i z e t h a n < i >i n p u t i > . 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 i > . 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 > ( 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 i >) . 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 u > 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 i > , 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 ∗ c o d e > < / 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 i > 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 i > . 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 i > . 124 ∗ 125 ∗ / 126 L c l o n e ( ) ; 127 128 / ∗ ∗ 129 ∗ S e t < i > t h i s i > 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 i > 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 > 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 > 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 i > . An s w e r < i > f a l s e i > 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 > 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 > 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 > 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 i > ) . A n s w e r < i > f a l s e i > 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 i > a n d < i > r i g h t i > 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 i > . 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 i > a n d < i >r i g h t i > 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 i > . 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 i > t o < i >a P r o p o s i t i o n i > 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 > 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 i > . 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 A > 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 / a > . 52 ∗ f o n t > < / 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 A > 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 / a > . 57 ∗ f o n t > < / 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 > 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 i > . 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 i > . 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 i > . 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 i > . 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 i > . 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 i > . 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 i > . 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 i > 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 A > 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 / a > . 63 ∗ f o n t > < / 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 i > 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 i > . 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 i > 76 ∗ < B R > 77 ∗ < i > c o m p l e m e n t (X ) = z e r o i > i f < i > X ! = z e r o i > 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 i > 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 i > . 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 i > 97 ∗ < B R > 98 ∗ < i > c o m p l e m e n t (X ) = z e r o i > i f < i > X ! = z e r o i > 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 b > o f < i > a P r o p o s i t i o n i > 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 i > . 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 i > 118 ∗ < B R > 119 ∗ < i > c o c o m p l e m e n t ( X ) = o n e i > 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 b > o f < i > t h i s i > 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 i > . 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 i > 139 ∗ < B R > 140 ∗ < i > c o c o m p l e m e n t ( X ) = o n e i > 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 > 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 > 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 i > . 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 A > 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 / a > . 61 ∗ f o n t > < / 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 S UP > < / 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 i > a r r a y . 81 ∗ < B R > < B R > 82 ∗ r e t u r n < i > n u l l i > i f i 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 i > . 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 > 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 > 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 > i s c h a n g e d t o < i >n e w S i z e i > , 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 i > . 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 i > . 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 > 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 i > 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 ) em > 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 i > 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 A > 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 / a > . 55 ∗ f o n t > < / 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 i > . 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 i > . 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 A > 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 / a > . 53 ∗ f o n t > < / 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 A > 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 / a > . 54 ∗ f o n t > < / 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 A > 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 / a > . 54 ∗ f o n t > < / 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 A > 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 / a > . 53 ∗ f o n t > < / 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 A > 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 / a > . 54 ∗ f o n t > < / 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 i > . 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 i > 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 i > . 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 i > a n d < i >aRe v M as k = n u l l i > \ , , 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 i > , t h e n < i > a M a s k i > 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 i > , t h e n < i > a R e v M a s k i > 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 i > 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 i > 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 i > 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 A > 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 .