1473N/A/*
1473N/A * Copyright 2009 Google Inc. All Rights Reserved.
1473N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1473N/A *
1473N/A * This code is free software; you can redistribute it and/or modify it
1473N/A * under the terms of the GNU General Public License version 2 only, as
1473N/A * published by the Free Software Foundation.
1473N/A *
1473N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1473N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1473N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1473N/A * version 2 for more details (a copy is included in the LICENSE file that
1473N/A * accompanied this code).
1473N/A *
1473N/A * You should have received a copy of the GNU General Public License version
1473N/A * 2 along with this work; if not, write to the Free Software Foundation,
1473N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1473N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1473N/A */
1473N/A
1473N/Aimport java.util.*;
1473N/A
1473N/Apublic enum Sorter {
1473N/A TIMSORT {
1473N/A public void sort(Object[] array) {
1473N/A ComparableTimSort.sort(array);
1473N/A }
1473N/A },
1473N/A MERGESORT {
1473N/A public void sort(Object[] array) {
1473N/A Arrays.sort(array);
1473N/A }
1473N/A };
1473N/A
1473N/A public abstract void sort(Object[] array);
1473N/A
1473N/A public static void warmup() {
1473N/A System.out.println("start warm up");
1473N/A Integer[] gold = new Integer[10000];
1473N/A Random random = new java.util.Random();
1473N/A for (int i=0; i < gold.length; i++)
1473N/A gold[i] = random.nextInt();
1473N/A
1473N/A for (int i=0; i < 10000; i++) {
1473N/A for (Sorter s : values()) {
1473N/A Integer[] test= gold.clone();
1473N/A s.sort(test);
1473N/A }
1473N/A }
1473N/A System.out.println(" end warm up");
1473N/A }
1473N/A}