Advertisement
Guest User

vetoStuff

a guest
Aug 19th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. public static doStuff(VetoSet[] input) {
  2.     Pair[][] p = vetoSetToPairArray(input);
  3.     for(Pair[] m : p) {
  4.         for(Pair n : m)
  5.             System.out.println(n.toString());
  6.         System.out.println("SEPARATOR");
  7.     }
  8. }
  9.  
  10. private static Pair[][] vetoSetToPairArray(VetoSet[] input) throws Exception {
  11.     if(!validVetoSetArray(input)) { throw new Exception("Bad VSA"); }
  12.     Pair[][] pairArray = new Pair[input[0].getVetoPairs().length][input.length];
  13.     for(int i = 0; i < input.length; i++)
  14.         pairArray[i] = input[i].getVetoPairs();
  15.     return pairArray;
  16. }
  17.  
  18. // This function returns false if the VetoSet array (pairs) isn't rectangular
  19. private static boolean validVetoSetArray(VetoSet[] input) {
  20.     int l = input[0].getVetoPairs().length;
  21.     for(VetoSet v : input)
  22.         if(v.getVetoPairs().length != l) { return false; }
  23.     return true;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement