FileDocCategorySizeDatePackage
Test.javaAPI DocAzureus 3.0.3.43898Thu Feb 09 19:43:16 GMT 2006com.aelitis.azureus.core.dht.control.impl

Test

public class Test extends Object
author
parg

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		//   :AFC97EA1 :lookup complete for B6589FC6 
		//    :AFC97EA1 :    queried = {91032AD7 ,AC3478D6 ,ACCA5B51 ,B6692EA5 ,ACF10F2C ,F66B7DCD ,B3F0C7F6 ,A8A2B30F ,972A67C4 ,AE7B4B79 ,887309D0 ,8383DA94 ,9E6A55B6 ,902BA3CD ,AFC97EA1 ,BD307A3E ,B1D57811 ,8665243E ,9EE0DF7C ,B6589FC6 ,BC33EA4E }
		//    :AFC97EA1 :    to query = {F6E1126C ,F22FE10D ,F0483F25 ,F1F836CB ,F1ABD670 ,FE5DBBCE ,FA35E192 ,FBDD85A9 ,FBEA31C7 ,EAEF5296 ,D435A6CD ,D051BF1D ,DA4B9237 ,C1DFD96E ,CB4E5208 ,356A192B ,17BA0791 ,1574BDDB ,1B645389 ,0716D970 ,0ADE7C2C ,77DE68DA ,7B52009B ,4D134BC0 }

		// final byte[]	target 	= { (byte)0xB6, (byte)0x58, (byte)0x9f, (byte)0xc6 };

		//  :9A79BE61:lookup complete for 31017A72
		//    :9A79BE61:    queried = {77DE68DA,1B645389,31BD9B9F,356A192B,310B86E0}
		//    :9A79BE61:    to query = {6FB84AED,B6589FC6,812ED456,DA4B9237}
		//    :9A79BE61:    ok = {77DE68DA,1B645389,356A192B,31BD9B9F,310B86E0}
		
		final byte[]	target 	= { (byte)0x35, (byte)0x6a, (byte)0x19, (byte)0x28 };
		final byte[]	t1 		= { (byte)0x76, (byte)0x1f, (byte)0x22, (byte)0xb2 };
		final byte[]	t2 		= { (byte)0x47, (byte)0x2b, (byte)0x07, (byte)0xb9 };
				   		
		byte[]	d1 = DHTControlImpl.computeDistance2( t1, target );
		byte[]	d2 = DHTControlImpl.computeDistance2( t2, target );
		
		System.out.println( "d1 = " + ByteFormatter.nicePrint( d1 ));
		System.out.println( "d2 = " + ByteFormatter.nicePrint( d2 ));
		
		System.out.println( "comp1 = " + DHTControlImpl.compareDistances2( d1, d2 ));
		System.out.println( "comp2 = " + DHTControlImpl.computeAndCompareDistances2( t1, t2, target ));
		
		final Set			set = 
			new TreeSet(
				new Comparator()
				{
					public int
					compare(
						Object	o1,
						Object	o2 )
					{						
						byte[] d1 = DHTControlImpl.computeDistance2( (byte[])o1, target );
						byte[] d2 = DHTControlImpl.computeDistance2( (byte[])o2, target );
						
						System.out.println( "dist:" + ByteFormatter.nicePrint((byte[])o1) + " -> " + ByteFormatter.nicePrint(d1));
						System.out.println( "dist:" + ByteFormatter.nicePrint((byte[])o2) + " -> " + ByteFormatter.nicePrint(d2));
						return( DHTControlImpl.compareDistances2( d1, d2 ));
					}
				});
		
		set.add( t1 );
		set.add( t2 );
		
		//set.add( new byte[]{ (byte)0xF0, (byte)0x48 ,(byte)0x3F, (byte)0x25 });
		//set.add( new byte[]{ (byte)0xF1, (byte)0xF8, (byte)0x36, (byte)0xCB });
		//set.add( new byte[]{ (byte)0xF2, (byte)0x2F, (byte)0xE1, (byte)0x0D });
	
		
		Iterator it = set.iterator();
		
		while( it.hasNext()){
			
			byte[]	val = (byte[])it.next();
			
			System.out.println( ByteFormatter.nicePrint( val ));
		}