public DBID findPrototype ( DBIDs members ) { // Find the last merge within the cluster. // The object with maximum priority will merge outside of the cluster, // So we need the second largest priority. DBIDIter it = members . iter ( ) ; DBIDVar proto = DBIDUtil . newVar ( it ) , last = DBIDUtil . newVar ( it ) ; int maxprio = Integer . MIN_VALUE , secprio = Integer . MIN_VALUE ; for ( ; it . valid ( ) ; it . advance ( ) ) { int prio = mergeOrder . intValue ( it ) ; if ( prio > maxprio ) { secprio = maxprio ; proto . set ( last ) ; maxprio = prio ; last . set ( it ) ; } else if ( prio > secprio ) { secprio = prio ; proto . set ( it ) ; } } return DBIDUtil . deref ( prototypes . assignVar ( proto , proto ) ) ; }
Extract the prototype of a given cluster . When the argument is not a valid cluster of this Pointer Hierarchy the return value is unspecified .