Ejemplo n.º 1
0
  public static void main(String args[]) {

    ArrayUtilities au = new ArrayUtilities("num.txt");

    au.sysLinePrintArray();

    System.out.println("\n45 is at index " + au.search(45) + ".");

    au.insert(9999);
    au.sysLinePrintArray();
  }
 public static boolean isJDK14() {
   boolean z = true;
   try {
     ClassLoader loader = getClassLoader(ObjectUtilities.class);
     if (loader != null) {
       try {
         loader.loadClass("java.util.RandomAccess");
         return true;
       } catch (ClassNotFoundException e) {
         return false;
       } catch (Exception e2) {
       }
     }
   } catch (Exception e3) {
   }
   try {
     String version = System.getProperty("java.vm.specification.version");
     if (version == null) {
       return false;
     }
     if (ArrayUtilities.compareVersionArrays(parseVersions(version), new String[] {"1", "4"})
         < 0) {
       z = false;
     }
     return z;
   } catch (Exception e4) {
     return false;
   }
 }
Ejemplo n.º 3
0
  /** Restore a previously deleted n-cube. */
  public static void restoreCubes(ApplicationID appId, Object[] cubeNames, String username) {
    validateAppId(appId);
    appId.validateBranchIsNotHead();

    if (appId.isRelease()) {
      throw new IllegalArgumentException(
          ReleaseStatus.RELEASE + " cubes cannot be restored, app: " + appId);
    }

    if (ArrayUtilities.isEmpty(cubeNames)) {
      throw new IllegalArgumentException(
          "Error, empty array of cube names passed in to be restored.");
    }

    // Batch restore
    getPersister().restoreCubes(appId, cubeNames, username);

    // Load cache
    for (Object name : cubeNames) {
      if ((name instanceof String)) {
        String cubeName = (String) name;
        NCube.validateCubeName(cubeName);
        NCube ncube = getPersister().loadCube(appId, cubeName);
        addCube(appId, ncube);
      } else {
        throw new IllegalArgumentException("Non string name given for cube to restore: " + name);
      }
    }
  }