Examples of Destroyer


Examples of Destroyers.Destroyer

    Submarine submarine1 = new Submarine(); //using default constructor
    Submarine submarine2 = new Submarine(250, 21000, 13, "India", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    Submarine submarine3 = new Submarine(250, 21000, 13, "India", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    Submarine submarine4 = new Submarine(260, 21000, 13, "India", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    //create two Destroyers
    Destroyer destroyer1 = new Destroyer(); //using default constructor
    Destroyer destroyer2 = new Destroyer(300, 22000, 14, "France", AttackType.ANTIAIRCRAFT, 5,5); //using parametrized constructor
    //create three AircraftCarriers
    AircraftCarrier aircraftCarrier1 = new AircraftCarrier(); //using default constructor
    AircraftCarrier aircraftCarrier2 = new AircraftCarrier(200, 19000,14, "USA", 4, 2 ); //using parametrized constructor
    AircraftCarrier aircraftCarrier3 = new AircraftCarrier(200, 19000,14, "USA", 4, 2 ); //using parametrized constructor
    //create two AmphibiousAssaultShips
    AmphibiousAssaultShip aaShip1 = new AmphibiousAssaultShip();//using default constructor
    AmphibiousAssaultShip aaShip2 = new AmphibiousAssaultShip(210,19500,14,"India",3,3,5); //using parametrized constructor
    //create three SuperCarriers
    SuperCarrier superCarrier1 = new SuperCarrier();//using default constructor
    SuperCarrier superCarrier2 = new SuperCarrier(220,18300,17,"France",2,2,5); //using parametrzed constructor
    SuperCarrier superCarrier3 = new SuperCarrier(220,18300,17,"France",2,2,5); //using parametrzed constructor
   
    System.out.println("A few differnt types of Warships were created and will be displayed below using their respectively defined toString() methods.");
    //Print the objects using the toString method
    System.out.println();
    System.out.println("\nHere are the three Warships: ");
    System.out.println(warship1);
    System.out.println(warship2);
    System.out.println(warship3);
    System.out.println("\nHere are the Four Submarines: ");
    System.out.println(submarine1);
    System.out.println(submarine2);
    System.out.println(submarine3);
    System.out.println(submarine4);
    System.out.println("\nHere are the two Destroyers: ");
    System.out.println(destroyer1);
    System.out.println(destroyer2);
    System.out.println("\nHere are the three Aircraft Carriers: ");
    System.out.println(aircraftCarrier1);
    System.out.println(aircraftCarrier2);
    System.out.println(aircraftCarrier3);
    System.out.println("\nHere are the two Amphibious Assault Ships: ");
    System.out.println(aaShip1);
    System.out.println(aaShip2);
    System.out.println("\nHere are the three Super Carriers: ");
    System.out.println(superCarrier1);
    System.out.println(superCarrier2);
    System.out.println(superCarrier3);
   
    System.out.println("\nLet's test some of these objects for equality!");
    //testing objects for equality
    if(warship1.equals(warship2)){
      System.out.println("Warship1 is the same as Warship2");
    }else {
      System.out.println("Warship1 is not the same as Warship2");
    }
    if(warship2.equals(warship3)){
      System.out.println("Warship2 is the same as Warship3");
    }else {
      System.out.println("Warship2 is not the same as Warship3");
    }
    if(submarine1.equals(submarine3)){
      System.out.println("Submarine1 is the same as Submarine3");
    }else {
      System.out.println("Submarine1 is not the same as Submarine3");
    }
    if(submarine2.equals(submarine3)){
      System.out.println("Submarine2 is the same as Submarine3");
    }else {
      System.out.println("Submarine2 is not the same as Submarine3");
    }if(submarine1.equals(warship3)){
      System.out.println("Submarine1 is the same as Warship3");
    }else {
      System.out.println("Submarine1 is not the same as Warship3");
    }
    if(destroyer1.equals(destroyer2)){
      System.out.println("Destroyer1 is the same as Destroyer2");
    }else {
      System.out.println("Destroyer1 is not the same as Destroyer2");
    }
    if(aircraftCarrier1.equals(aircraftCarrier2)){
      System.out.println("Aircraft Carrier1 is the same as Aircraft Carrier2");
    }else {
      System.out.println("Aircraft Carrier1 is not the same as Aircraft Carrier2");
    }
    if(aaShip1.equals(aaShip2)){
      System.out.println("Amphibious Assault Ship1 is the same as Amphibious Assault Ship2");
    }else {
      System.out.println("Amphibious Assault Ship1 is not the same as Amphibious Assault Ship2");
    }
    if(submarine3.equals(submarine4)){
      System.out.println("Submarine3 is the same as Submarine4");
    }else {
      System.out.println("Submarine3 is not the same as Submarine4");
    }
   
    //part b) creating an array of 10 warships
    Warship[] navalForce = new Warship[10];
    navalForce[0] = warship1;
    navalForce[1] = warship2;
    navalForce[2] = warship3;
    navalForce[3] = destroyer1;
    navalForce[4] = submarine1;
    navalForce[5] = submarine2;
    navalForce[6] = submarine3;
    navalForce[7] = aircraftCarrier1;
    navalForce[8] = aaShip1;
    navalForce[9] = superCarrier2;
   
    //filling the array with objects
    navalForce[0] = new Warship(); //using default constructor
    navalForce[1] = new Warship(199, 20200, 13, "INDIA" ); //using parametrized constructor
    navalForce[2] = new Warship(201, 22000, 15, "RUSSIA" ); //using parametrized constructor
    navalForce[3] = new Destroyer(300, 22300, 12, "France", AttackType.ANTIAIRCRAFT, 5,5); //using parametrized constructor
    navalForce[4] = new Submarine(150, 21000, 13, "India", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    navalForce[5] = new Submarine(450, 27000, 19, "USA", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    navalForce[6] = new Submarine(350, 21000, 12, "UK", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    navalForce[7] = new AircraftCarrier(200, 19000,14, "USA", 4, 2 ); //using parametrized constructor
    navalForce[8] = new AmphibiousAssaultShip(210,19500,14,"UAE",3,3,5); //using parametrized constructor
View Full Code Here

Examples of Destroyers.Destroyer

    //create three Submarines
    Submarine submarine1 = new Submarine(); //using default constructor
    Submarine submarine2 = new Submarine(250, 21000, 13, "India", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    Submarine submarine3 = new Submarine(250, 21000, 13, "India", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    //create two Destroyers
    Destroyer destroyer1 = new Destroyer(); //using default constructor
    Destroyer destroyer2 = new Destroyer(300, 22000, 14, "France", AttackType.ANTIAIRCRAFT, 5,5); //using parametrized constructor
    //create three AircraftCarriers
    AircraftCarrier aircraftCarrier1 = new AircraftCarrier(); //using default constructor
    AircraftCarrier aircraftCarrier2 = new AircraftCarrier(200, 19000,14, "USA", 4, 2 ); //using parametrized constructor
    AircraftCarrier aircraftCarrier3 = new AircraftCarrier(200, 19000,14, "USA", 4, 2 ); //using parametrized constructor
    //create two AmphibiousAssaultShips
    AmphibiousAssaultShip aaShip1 = new AmphibiousAssaultShip();//using default constructor
    AmphibiousAssaultShip aaShip2 = new AmphibiousAssaultShip(210,19500,14,"India",3,3,5); //using parametrized constructor
    //create three SuperCarriers
    SuperCarrier superCarrier1 = new SuperCarrier();//using default constructor
    SuperCarrier superCarrier2 = new SuperCarrier(220,18300,17,"France",2,2,5); //using parametrzed constructor
    SuperCarrier superCarrier3 = new SuperCarrier(220,18300,17,"France",2,2,5); //using parametrzed constructor
   
    System.out.println("A few types of Warships were created and will be displayed below using their respectively defined toString() methods.");
    //Print the objects using the toString method
    System.out.println("\nHere are the three Warships: ");
    System.out.println(warship1);
    System.out.println(warship2);
    System.out.println(warship3);
    System.out.println("\nHere are the three Submarines: ");
    System.out.println(submarine1);
    System.out.println(submarine2);
    System.out.println(submarine3);
    System.out.println("\nHere are the two Destroyers: ");
    System.out.println(destroyer1);
    System.out.println(destroyer2);
    System.out.println("\nHere are the three Aircraft Carriers: ");
    System.out.println(aircraftCarrier1);
    System.out.println(aircraftCarrier2);
    System.out.println(aircraftCarrier3);
    System.out.println("\nHere are the two Amphibious Assault Ships: ");
    System.out.println(aaShip1);
    System.out.println(aaShip2);
    System.out.println("\nHere are the three Super Carriers: ");
    System.out.println(superCarrier1);
    System.out.println(superCarrier2);
    System.out.println(superCarrier3);
   
    System.out.println("\nLet's test some of these objects for equality!");
    //testing objects for equality
    if(warship1.equals(warship2)){
      System.out.println("Warship1 is the same as Warship2");
    }else {
      System.out.println("Warship1 is not the same as Warship2");
    }
    if(warship2.equals(warship3)){
      System.out.println("Warship2 is the same as Warship3");
    }else {
      System.out.println("Warship2 is not the same as Warship3");
    }
    if(submarine1.equals(submarine3)){
      System.out.println("Submarine1 is the same as Submarine3");
    }else {
      System.out.println("Submarine1 is not the same as Submarine3");
    }
    if(submarine2.equals(submarine3)){
      System.out.println("Submarine2 is the same as Submarine3");
    }else {
      System.out.println("Submarine2 is not the same as Submarine3");
    }if(submarine1.equals(warship3)){
      System.out.println("Submarine1 is the same as Warship3");
    }else {
      System.out.println("Submarine1 is not the same as Warship3");
    }
    if(destroyer1.equals(destroyer2)){
      System.out.println("Destroyer1 is the same as Destroyer2");
    }else {
      System.out.println("Destroyer1 is not the same as Destroyer2");
    }
    if(aircraftCarrier1.equals(aircraftCarrier2)){
      System.out.println("Aircraft Carrier1 is the same as Aircraft Carrier2");
    }else {
      System.out.println("Aircraft Carrier1 is not the same as Aircraft Carrier2");
    }
    if(aaShip1.equals(aaShip2)){
      System.out.println("Amphibious Assault Ship1 is the same as Amphibious Assault Ship2");
    }else {
      System.out.println("Amphibious Assault Ship1 is not the same as Amphibious Assault Ship2");
    }
   
    //creating an array of 10 warships
    Warship[] navalForce = new Warship[10];
    navalForce[0] = warship1;
    navalForce[1] = warship2;
    navalForce[2] = warship3;
    navalForce[3] = destroyer1;
    navalForce[4] = submarine1;
    navalForce[5] = submarine2;
    navalForce[6] = submarine3;
    navalForce[7] = aircraftCarrier1;
    navalForce[8] = aaShip1;
    navalForce[9] = superCarrier2;
   
    //filling the array with objects
    navalForce[0] = new Warship(); //using default constructor
    navalForce[1] = new Warship(199, 20200, 13, "INDIA" ); //using parametrized constructor
    navalForce[2] = new Warship(201, 22000, 15, "RUSSIA" ); //using parametrized constructor
    navalForce[3] = new Destroyer(300, 22300, 12, "France", AttackType.ANTIAIRCRAFT, 5,5); //using parametrized constructor
    navalForce[4] = new Submarine(150, 21000, 13, "India", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    navalForce[5] = new Submarine(450, 27000, 19, "USA", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    navalForce[6] = new Submarine(350, 21000, 12, "UK", PowerSource.NUCLEAR, 2, "Periscope"); //using parametrized constructor
    navalForce[7] = new AircraftCarrier(200, 19000,14, "USA", 4, 2 ); //using parametrized constructor
    navalForce[8] = new AmphibiousAssaultShip(210,19500,14,"UAE",3,3,5); //using parametrized constructor
View Full Code Here

Examples of org.apache.sqoop.job.etl.Destroyer

   * @param configuration Configuration object to get destroyer class with context
   *                      and configuration objects.
   * @param propertyName Name of property that holds destroyer class.
   */
  public static void executeDestroyer(boolean success, Configuration configuration, String propertyName) {
    Destroyer destroyer = (Destroyer) ClassUtils.instantiate(configuration.get(propertyName));

    if(destroyer == null) {
      LOG.info("Skipping running destroyer as non was defined.");
      return;
    }

    // Objects that should be pass to the Destroyer execution
    PrefixContext subContext = new PrefixContext(configuration, JobConstants.PREFIX_CONNECTOR_CONTEXT);
    Object configConnection = ConfigurationUtils.getConfigConnectorConnection(configuration);
    Object configJob = ConfigurationUtils.getConfigConnectorJob(configuration);

    // Propagate connector schema in every case for now
    // TODO: Change to coditional choosing between HIO and Connector schema
    Schema schema = ConfigurationUtils.getConnectorSchema(configuration);

    DestroyerContext destroyerContext = new DestroyerContext(subContext, success, schema);

    LOG.info("Executing destroyer class " + destroyer.getClass());
    destroyer.destroy(destroyerContext, configConnection, configJob);
  }
View Full Code Here

Examples of org.apache.sqoop.job.etl.Destroyer

   */
  private static void destroySubmission(SubmissionRequest request) {
    CallbackBase baseCallbacks = request.getConnectorCallbacks();

    Class<? extends Destroyer> destroyerClass = baseCallbacks.getDestroyer();
    Destroyer destroyer = (Destroyer) ClassUtils.instantiate(destroyerClass);

    if(destroyer == null) {
      throw  new SqoopException(FrameworkError.FRAMEWORK_0006,
        "Can't create destroyer instance: " + destroyerClass.getName());
    }

    // Initialize submission from connector perspective
    destroyer.destroy(false, request.getConnectorContext(),
      request.getConfigConnectorConnection(), request.getConfigConnectorJob());
  }
View Full Code Here

Examples of org.apache.sqoop.job.etl.Destroyer

   * @param configuration Configuration object to get destroyer class with context
   *                      and configuration objects.
   * @param propertyName Name of property that holds destroyer class.
   */
  public static void executeDestroyer(boolean success, Configuration configuration, String propertyName) {
    Destroyer destroyer = (Destroyer) ClassUtils.instantiate(configuration.get(propertyName));

    if(destroyer == null) {
      LOG.info("Skipping running destroyer as non was defined.");
      return;
    }

    // Objects that should be pass to the Destroyer execution
    PrefixContext subContext = new PrefixContext(configuration, JobConstants.PREFIX_CONNECTOR_CONTEXT);
    Object configConnection = ConfigurationUtils.getConnectorConnection(configuration);
    Object configJob = ConfigurationUtils.getConnectorJob(configuration);

    LOG.info("Executing destroyer class " + destroyer.getClass());
    destroyer.destroy(success, subContext, configConnection, configJob);
  }
View Full Code Here

Examples of org.apache.sqoop.job.etl.Destroyer

   * @param configuration Configuration object to get destroyer class with context
   *                      and configuration objects.
   * @param propertyName Name of property that holds destroyer class.
   */
  public static void executeDestroyer(boolean success, Configuration configuration, String propertyName) {
    Destroyer destroyer = (Destroyer) ClassUtils.instantiate(configuration.get(propertyName));

    if(destroyer == null) {
      LOG.info("Skipping running destroyer as non was defined.");
      return;
    }

    // Objects that should be pass to the Destroyer execution
    PrefixContext subContext = new PrefixContext(configuration, JobConstants.PREFIX_CONNECTOR_CONTEXT);
    Object configConnection = ConfigurationUtils.getConnectorConnection(configuration);
    Object configJob = ConfigurationUtils.getConnectorJob(configuration);

    DestroyerContext destroyerContext = new DestroyerContext(subContext, success);

    LOG.info("Executing destroyer class " + destroyer.getClass());
    destroyer.destroy(destroyerContext, configConnection, configJob);
  }
View Full Code Here

Examples of org.apache.sqoop.job.etl.Destroyer

   */
  private void destroySubmission(SubmissionRequest request) {
    CallbackBase baseCallbacks = request.getConnectorCallbacks();

    Class<? extends Destroyer> destroyerClass = baseCallbacks.getDestroyer();
    Destroyer destroyer = (Destroyer) ClassUtils.instantiate(destroyerClass);

    if(destroyer == null) {
      throw  new SqoopException(FrameworkError.FRAMEWORK_0006,
        "Can't create destroyer instance: " + destroyerClass.getName());
    }

    DestroyerContext destroyerContext = new DestroyerContext(request.getConnectorContext(), false);

    // Initialize submission from connector perspective
    destroyer.destroy(destroyerContext, request.getConfigConnectorConnection(), request.getConfigConnectorJob());
  }
View Full Code Here

Examples of org.rioproject.impl.service.Destroyer

         */
        public void discard() {
            if(terminated)
                return;
            terminated = true;
            new Destroyer(null, null);
        }
View Full Code Here

Examples of org.rioproject.impl.service.Destroyer

         */
        public boolean unregister(final Object impl) {
            if(terminated)
                return (true);
            terminate();
            new Destroyer(null, null);
            return (true);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.