public int compareTo ( WeightedAttribute att ) { double absoltarget = att . weight ; // if (absoltarget < 0) // absoltarget = -absoltarget; double absolsource = this . weight ; // if (absolsource < 0) // absolsource = -absolsource; double diff = absolsource - absoltarget ; if ( diff < 0 ) return - 1 ; if ( diff > 0 ) return + 1 ; return 0 ; }
rank the attributes based on weight