1 4 package com.tc.l2.state; 5 6 import com.tc.net.groups.NodeID; 7 8 import java.util.Random ; 9 10 public class EnrollmentFactory { 11 12 public static Enrollment createEnrollment(NodeID nodeID, boolean isNew) { 13 int[] weights = createWeigth(); 14 Enrollment e = new Enrollment(nodeID, isNew, weights); 15 return e; 16 } 17 18 private static int[] createWeigth() { 21 int[] weights = new int[2]; 22 Random r = new Random (); 23 weights[1] = r.nextInt(); 24 weights[0] = r.nextInt(); 25 return weights; 26 } 27 28 private static int[] createMaxWeigth() { 30 int[] weights = new int[2]; 31 weights[1] = Integer.MAX_VALUE; 32 weights[0] = Integer.MAX_VALUE; 33 return weights; 34 } 35 36 37 public static Enrollment createTrumpEnrollment(NodeID myNodeId) { 38 int[] weights = createMaxWeigth(); 39 Enrollment e = new Enrollment(myNodeId, false, weights); 40 return e; 41 } 42 43 } 44 | Popular Tags |