Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static doStuff(VetoSet[] input) {
- Pair[][] p = vetoSetToPairArray(input);
- for(Pair[] m : p) {
- for(Pair n : m)
- System.out.println(n.toString());
- System.out.println("SEPARATOR");
- }
- }
- private static Pair[][] vetoSetToPairArray(VetoSet[] input) throws Exception {
- if(!validVetoSetArray(input)) { throw new Exception("Bad VSA"); }
- Pair[][] pairArray = new Pair[input[0].getVetoPairs().length][input.length];
- for(int i = 0; i < input.length; i++)
- pairArray[i] = input[i].getVetoPairs();
- return pairArray;
- }
- // This function returns false if the VetoSet array (pairs) isn't rectangular
- private static boolean validVetoSetArray(VetoSet[] input) {
- int l = input[0].getVetoPairs().length;
- for(VetoSet v : input)
- if(v.getVetoPairs().length != l) { return false; }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement