public void sort() { synchronized( mutex ) { list.sort(); } } public void sort( int fromIndex, int toIndex ) {
public void sort( int fromIndex, int toIndex ) { synchronized( mutex ) { list.sort( fromIndex, toIndex ); } }
/** * Add a variable number of int arguments or an array of ints to the bag for a given stopcluster. * Optionally sort all the entries after a bulk add. */ public void add(StopCluster stopCluster, boolean sort, int... time) { TIntList times = timesForCluster.get(stopCluster); if (times == null) { times = new TIntArrayList(); timesForCluster.put(stopCluster, times); } times.add(time); if (sort) { times.sort(); } }
removeIndexes.sort(); removeIndexes.reverse(); for (int index : removeIndexes.toArray()) {
/** * @param arrivals find arrival times rather than departure times for this Ride. * @return a list of sorted departure or arrival times within the window. * FIXME this is a hot spot in execution, about 50 percent of runtime. */ public TIntList getSortedStoptimes (TimeWindow window, boolean arrivals) { // Using Lists because we don't know the length in advance TIntList times = new TIntArrayList(); // TODO include exact-times frequency trips along with non-frequency trips // non-exact (headway-based) frequency trips will be handled elsewhere since they don't have specific boarding times. for (PatternRide patternRide : patternRides) { for (TripTimes tt : patternRide.pattern.scheduledTimetable.tripTimes) { if (window.servicesRunning.get(tt.serviceCode)) { int t = arrivals ? tt.getArrivalTime(patternRide.toIndex) : tt.getDepartureTime(patternRide.fromIndex); if (window.includes(t)) times.add(t); } } } times.sort(); return times; }
public static <T> void shiftIntegerMapKeys(int startKey, int shift, TIntObjectMap<T> intToObject) { if (shift == 0) { return; } TIntList keysToShift = new TIntArrayList(intToObject.keys()); // Exclude anything before and including startKey for (int currentKey : keysToShift.toArray()) { if (currentKey <= startKey) { keysToShift.remove(currentKey); } } keysToShift.sort(); if (shift > 0) { // Shifting keys up, so start at the end to avoid overwriting keys. keysToShift.reverse(); } for (int currentKey : keysToShift.toArray()) { T obj = intToObject.get(currentKey); intToObject.remove(currentKey); intToObject.put(currentKey + shift, obj); } } }
break; case PERCENTILE: timeList.sort(); mins[stop] = timeList.get(timeList.size() / 40); maxs[stop] = timeList.get(39 * timeList.size() / 40);
break; case PERCENTILE: timeList.sort(); mins[target] = timeList.get(timeList.size() / 40); maxs[target] = timeList.get(39 * timeList.size() / 40);
@Override public void sort() { synchronized( mutex ) { list.sort(); } } @Override
public void sort() { synchronized( mutex ) { list.sort(); } } public void sort( int fromIndex, int toIndex ) {
public void sort( int fromIndex, int toIndex ) { synchronized( mutex ) { list.sort( fromIndex, toIndex ); } }
public void sort() { synchronized( mutex ) { list.sort(); } } public void sort( int fromIndex, int toIndex ) {
@Override public void sort( int fromIndex, int toIndex ) { synchronized( mutex ) { list.sort( fromIndex, toIndex ); } }
public void sort() { synchronized( mutex ) { list.sort(); } } public void sort( int fromIndex, int toIndex ) {
public void sort( int fromIndex, int toIndex ) { synchronized( mutex ) { list.sort( fromIndex, toIndex ); } }
public void sort( int fromIndex, int toIndex ) { synchronized( mutex ) { list.sort( fromIndex, toIndex ); } }
public static List<IntRange> intoRanges(TIntList ids) { if (ids.isEmpty()) { throw new NoSuchElementException(); } List<IntRange> ranges = new ArrayList<>(); if (ids.size() == 1) { return ImmutableList.of(new IntRange(ids.get(0))); } ids.sort(); int start = ids.get(0); int cur = start; for (int id : ids.subList(1, ids.size()).toArray()) { if (cur + 1 == id) { cur = id; } else { ranges.add(new IntRange(start, cur)); start = id; cur = id; } } if (start == cur) { ranges.add(new IntRange(start)); } else { ranges.add(new IntRange(start, cur)); } return ranges; }
timesAtStop.sort();
private int[] getLinks(int pageId1, boolean outLinks) throws DaoException { TIntList result = new TIntArrayList(); for (LocalLink ll : linkDao.getLinks(getLanguage(), pageId1, outLinks)) { result.add(ll.getLocalId()); } result.sort(); return result.toArray(); }
indexes.sort();