Package trams.data

Examples of trams.data.Vehicle


        theRouteSchedule.setRouteNumber("2A");
        theRouteSchedule.setScheduleNumber(1);
        theRouteSchedule.setDelayInMins(5);
        //session.save(theRouteSchedule);
       
        Vehicle theVehicle = new Vehicle();
        theVehicle.setRegistrationNumber(registrationNumber);
        theVehicle.setAssignedSchedule(theRouteSchedule);
        theVehicle.setDeliveryDate(deliveryDate);
        theVehicle.setDepreciationFactor(depreciationFactor);
        theVehicle.setImagePath(imagePath);
        theVehicle.setModel(model);
        theVehicle.setSeatingNum(seatingNum);
        theVehicle.setStandingNum(standingNum);
        theVehicle.setPurchasePrice(purchasePrice);
       
        return theVehicle;
        //session.save(theVehicle);

        //session.getTransaction().commit();
View Full Code Here


            NodeList vehicleList = (NodeList) xpath.evaluate("//scenario/vehicles/vehicle", document.getDocumentElement(), XPathConstants.NODESET);
            for ( int i = 0; i < vehicleList.getLength(); i++ ) {
                Element thisElem = (Element) vehicleList.item(i);
                String[] deliveryDates = thisElem.getAttribute("deliveryDate").split("-");
                Calendar deliveryDate = new GregorianCalendar(Integer.parseInt(deliveryDates[0]), Integer.parseInt(deliveryDates[1])-1, Integer.parseInt(deliveryDates[2]));
                Vehicle myVeh = createVehicleObject(thisElem.getAttribute("id"), thisElem.getAttribute("type"), deliveryDate);
                myVeh.setAssignedSchedule(null);
                myScenario.addVehicle(myVeh);
                //Add allocation to route.
                String schedId = thisElem.getAttribute("route") + "/" + thisElem.getAttribute("schedId");
                for ( int j = 0; j < myScenario.getNumberRoutes(); j++ ) {
                    if ( myScenario.getRoute(j).getRouteNumber().equalsIgnoreCase(thisElem.getAttribute("route")) ) {
View Full Code Here

     * @param type a <code>String</code> with the vehicle type.
     * @param deliveryDate a <code>Calendar</code> with the delivery date.
     * @return a <code>Vehicle</code> object.
     */
    public Vehicle createVehicleObject ( String id, String type, Calendar deliveryDate ) {
      Vehicle vehicle = null;
        if ( type.equalsIgnoreCase("MyBus Single Decker") ) {
          vehicle = (Vehicle) theContext.getBean("singleDeckerBus");
        } else if ( type.equalsIgnoreCase("MyBus Double Decker") ) {
            vehicle = (Vehicle) theContext.getBean("doubleDeckerBus");
        } else if ( type.equalsIgnoreCase("MyBus Bendy") ) {
            vehicle = (Vehicle) theContext.getBean("bendyBus");
        } else if ( type.equalsIgnoreCase("MyTram Tram1") ) {
          vehicle = (Vehicle) theContext.getBean("tram");
        }
        vehicle.setRegistrationNumber(id);
        System.out.println("This vehicle has registration number " + vehicle.getRegistrationNumber());
      vehicle.setDeliveryDate(deliveryDate);
      return (Vehicle) vehicle.clone();
    }
View Full Code Here

TOP

Related Classes of trams.data.Vehicle

Copyright © 2018 www.massapicom. 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.