Package models.transit

Examples of models.transit.StopTime


            for (StopTimeWithDeletion stopTime : trip.stopTimes) {
                if (Boolean.TRUE.equals(stopTime.deleted)) {
                    StopTime.delete("id = ? AND trip = ?", stopTime.id, updatedTrip);
                }
                else {
                    StopTime updatedStopTime = StopTime.em().merge(stopTime.toStopTime());
                    // this was getting lost somehow
                    updatedStopTime.trip = updatedTrip;
                    updatedStopTime.save();
                }
            }
           
            updatedTrip.save();
View Full Code Here


     */
    public static class StopTimeWithDeletion extends StopTime {
        public Boolean deleted;
       
        public StopTime toStopTime () {
            StopTime ret = new StopTime();
            ret.id = this.id;
            ret.arrivalTime = this.arrivalTime;
            ret.departureTime = this.departureTime;
            ret.dropOffType = this.dropOffType;
            ret.patternStop = this.patternStop;
View Full Code Here

                
                   if(columnIndex > 5)
                   {
                     if(!column.isEmpty())
                     {
                       StopTime stopTime = new StopTime();
                      
                       stopTime.trip = trip;
                      
                       // check for board/alight only flag
                       if(column.contains(">")) {
                        
                         column = column.replace(">", "");
                        
                         // board only
                         stopTime.dropOffType = StopTimePickupDropOffType.NONE;
                       }
                      
                       if(column.contains("<")) {
                        
                         column = column.replace("<", "");
                        
                         // alight only
                         stopTime.pickupType = StopTimePickupDropOffType.NONE;
                       }
                      
                       column = column.trim();
                      
                       if(column.equals("+"))
                         stopTime.departureTime = firstTimepoint + columnStopDelta.get(columnIndex);
                       else if(column.equals("-"))
                         stopTime.departureTime = null;
                       else
                       {
                         Integer currentTime;
                          
                        
                         try
                         {
                           currentTime = (dfTime.parse(column).getHours() * 60 * 60 ) + (dfTime.parse(column).getMinutes() * 60) + (dfTime.parse(column).getSeconds());
                         }
                         catch(ParseException e)
                         {
                           try
                           {
                             currentTime = (dfsTime.parse(column).getHours() * 60 * 60 ) + (dfsTime.parse(column).getMinutes() * 60) + (dfsTime.parse(column).getSeconds());
                           }
                           catch(ParseException e2)
                           {
                             continue;
                           }
                         }
                        
                         // in case of time that decreases add a day to offset for trips that cross midnight boundary
                         if(previousTime > currentTime)                       
                           dayOffset += 24 * 60 * 60;
                          
                         stopTime.departureTime = currentTime + dayOffset;
                        
                         previousTime = currentTime;
                        
                         if(firstTimepoint == null)
                           {
                           firstTimepoint = stopTime.departureTime;
                           }
                        
                       }
                      
                       stopTime.arrivalTime = stopTime.departureTime;
                      
                       stopTime.patternStop = columnStopIndex.get(columnIndex);
                       stopTime.stop = columnStopIndex.get(columnIndex).stop;
                       stopTime.stopSequence = columnCount + 1;
                      
                       stopTime.save();
                      
                       columnCount++;
                     }
                   }
                    
View Full Code Here

TOP

Related Classes of models.transit.StopTime

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.