public void setTargets(Vector pTargets) { for (int i = 0; i < pTargets.size(); i++) { int input2[] = (int[]) pTargets.get(i); // System.out.println("setT(x,y) = (" + input2[0] + "," + input2[1] + ")"); states[input2[0]][input2[1]].isTarget = true; getVal(input2[0], input2[1]).value = 6; getVal(input2[0], input2[1]).pherovalue = (float) 1.0; } this.Targets = pTargets; }
@Override public boolean apply(Vector<T> set, int i, int j) { T x = set.get(i); T y = set.get(j); double d = metric.apply(x, y); double r = strength.evaluate(d); T[] z = move(x, y, r); x = z[0]; y = z[1]; set.set(i, x); set.set(j, y); return metric.apply(x, y) < EPSILON; }
public static void main(String[] args) { // System.out.println( 5 >> 2 ); // System.out.println( (5 & 4) == 4 ); // System.out.println( 10 << 2 ); Vector<Integer> v = new Vector<>(); // ArrayList<Integer> v = new ArrayList<>(); /* long m, p, n; n = System.nanoTime(); for( int i=0; i<100000; i++ ){ v.add( i ); } p = System.nanoTime(); m = p - n; System.out.print( m + " " ); n = System.nanoTime(); for(int i=0; i<100000; i++ ){ v.add(i,-i); } p = System.nanoTime(); m = p - n; System.out.print( m + " " ); n = System.nanoTime(); for(int i=0; i<100000; i++ ){ v.remove(i); // v.remove(i); } p = System.nanoTime(); m = p - n; System.out.print( m ); n = System.nanoTime(); for(int i=0; i<99000; i++ ){ v.remove(0); // v.remove(i); } p = System.nanoTime(); m = p - n; System.out.println( m ); for(int i=0; i<1000; i++ ){ System.out.println( v.get(i)); } */ Integer[] x = new Integer[50]; for (int i = 0; i < x.length; i++) { x[i] = i; } v = new Vector<>(x); for (int i = 0; i < 10; i++) { v.remove(i); } for (int i = 0; i < v.size(); i++) { System.out.println(v.get(i)); } for (Integer k : v) { System.out.println("##" + k); } ArrayCollectionLocation<Integer> loc = new ArrayCollectionLocation<>(4, v); for (Iterator<Integer> iter = v.iterator(loc); iter.hasNext(); ) { System.out.println("#==#" + iter.next()); } }
protected String fieldType(int i) { if (field.get(i) != null) { return field.get(i).getClass().getCanonicalName(); } return null; }
public Object field(int i) { return field.get(i); }