Java 类gnu.trove.map.hash.TShortIntHashMap 实例源码

项目:CB_MAP    文件:CB_OSMTagMapping.java   
/**
 * @param histogram a histogram that represents the frequencies of tags
 */
public void optimizePoiOrdering(TShortIntHashMap histogram) {
    this.optimizedPoiIds.clear();
    final TreeSet<HistogramEntry> poiOrdering = new TreeSet<>();

    histogram.forEachEntry(new TShortIntProcedure() {
        @Override
        public boolean execute(short tag, int amount) {
            poiOrdering.add(new HistogramEntry(tag, amount));
            return true;
        }
    });

    short tmpPoiID = 0;

    CB_OSMTag currentTag = null;
    for (HistogramEntry histogramEntry : poiOrdering.descendingSet()) {
        currentTag = this.idToPoiTag.get(Short.valueOf(histogramEntry.id));
        this.optimizedPoiIds.put(Short.valueOf(histogramEntry.id), Short.valueOf(tmpPoiID));
        LOGGER.finer("adding poi tag: " + currentTag.tagKey() + " id:" + tmpPoiID + " amount: "
                + histogramEntry.amount);
        tmpPoiID++;
    }
}
项目:CB_MAP    文件:CB_OSMTagMapping.java   
/**
 * @param histogram a histogram that represents the frequencies of tags
 */
public void optimizeWayOrdering(TShortIntHashMap histogram) {
    this.optimizedWayIds.clear();
    final TreeSet<HistogramEntry> wayOrdering = new TreeSet<>();

    histogram.forEachEntry(new TShortIntProcedure() {
        @Override
        public boolean execute(short tag, int amount) {
            wayOrdering.add(new HistogramEntry(tag, amount));
            return true;
        }
    });
    short tmpWayID = 0;

    CB_OSMTag currentTag = null;
    for (HistogramEntry histogramEntry : wayOrdering.descendingSet()) {
        currentTag = this.idToWayTag.get(Short.valueOf(histogramEntry.id));
        this.optimizedWayIds.put(Short.valueOf(histogramEntry.id), Short.valueOf(tmpWayID));
        LOGGER.finer("adding way tag: " + currentTag.tagKey() + " id:" + tmpWayID + " amount: "
                + histogramEntry.amount);
        tmpWayID++;
    }
}
项目:mapsforge    文件:OSMTagMapping.java   
/**
 * @param histogram
 *            a histogram that represents the frequencies of tags
 */
public void optimizePoiOrdering(TShortIntHashMap histogram) {
    this.optimizedPoiIds.clear();
    final TreeSet<HistogramEntry> poiOrdering = new TreeSet<OSMTagMapping.HistogramEntry>();

    histogram.forEachEntry(new TShortIntProcedure() {
        @Override
        public boolean execute(short tag, int amount) {
            poiOrdering.add(new HistogramEntry(tag, amount));
            return true;
        }
    });

    short tmpPoiID = 0;

    OSMTag currentTag = null;
    for (HistogramEntry histogramEntry : poiOrdering.descendingSet()) {
        currentTag = this.idToPoiTag.get(Short.valueOf(histogramEntry.id));
        this.optimizedPoiIds.put(Short.valueOf(histogramEntry.id), Short.valueOf(tmpPoiID));
        LOGGER.finer("adding poi tag: " + currentTag.tagKey() + " id:" + tmpPoiID + " amount: "
                + histogramEntry.amount);
        tmpPoiID++;
    }
}
项目:mapsforge    文件:OSMTagMapping.java   
/**
 * @param histogram
 *            a histogram that represents the frequencies of tags
 */
public void optimizeWayOrdering(TShortIntHashMap histogram) {
    this.optimizedWayIds.clear();
    final TreeSet<HistogramEntry> wayOrdering = new TreeSet<OSMTagMapping.HistogramEntry>();

    histogram.forEachEntry(new TShortIntProcedure() {
        @Override
        public boolean execute(short tag, int amount) {
            wayOrdering.add(new HistogramEntry(tag, amount));
            return true;
        }
    });
    short tmpWayID = 0;

    OSMTag currentTag = null;
    for (HistogramEntry histogramEntry : wayOrdering.descendingSet()) {
        currentTag = this.idToWayTag.get(Short.valueOf(histogramEntry.id));
        this.optimizedWayIds.put(Short.valueOf(histogramEntry.id), Short.valueOf(tmpWayID));
        LOGGER.finer("adding way tag: " + currentTag.tagKey() + " id:" + tmpWayID + " amount: "
                + histogramEntry.amount);
        tmpWayID++;
    }
}
项目:AisAbnormal    文件:FourKeyStatisticData.java   
protected FourKeyStatisticData(int maxKey1, int maxKey2, int maxKey3, int maxNumKey4) {
    if (maxKey1 <= 0) {
        throw new IllegalArgumentException("maxKey1 <= 0 not supported.");
    }
    if (maxKey2 <= 0) {
        throw new IllegalArgumentException("maxKey2 <= 0 not supported.");
    }
    if (maxKey3 <= 0) {
        throw new IllegalArgumentException("maxKey3 <= 0 not supported.");
    }
    if (maxNumKey4 != 1) {
        throw new IllegalArgumentException("maxNumKey4 != 1 not supported.");
    }

    this.MAX_KEY_1 = (byte) maxKey1;
    this.MAX_KEY_2 = (byte) maxKey2;
    this.MAX_KEY_3 = (byte) maxKey3;

    this.data = new TShortIntHashMap(1);
}
项目:CB_MAP    文件:CB_BaseTileBasedDataProcessor.java   
public CB_BaseTileBasedDataProcessor(CB_MapWriterConfiguration configuration) {
    super();
    this.boundingbox = configuration.getBboxConfiguration();
    this.zoomIntervalConfiguration = configuration.getZoomIntervalConfiguration();
    this.tileGridLayouts = new TileGridLayout[this.zoomIntervalConfiguration.getNumberOfZoomIntervals()];
    this.bboxEnlargement = configuration.getBboxEnlargement();
    this.preferredLanguages = configuration.getPreferredLanguages();
    this.skipInvalidRelations = configuration.isSkipInvalidRelations();

    this.outerToInnerMapping = new TLongObjectHashMap<>();
    this.innerWaysWithoutAdditionalTags = new TLongHashSet();
    this.tilesToCoastlines = new HashMap<>();

    this.countWays = new float[this.zoomIntervalConfiguration.getNumberOfZoomIntervals()];
    this.countWayTileFactor = new float[this.zoomIntervalConfiguration.getNumberOfZoomIntervals()];

    this.histogramPoiTags = new TShortIntHashMap();
    this.histogramWayTags = new TShortIntHashMap();

    // compute horizontal and vertical tile coordinate offsets for all
    // base zoom levels
    for (int i = 0; i < this.zoomIntervalConfiguration.getNumberOfZoomIntervals(); i++) {
        TileCoordinate upperLeft = new TileCoordinate((int) MercatorProjection.longitudeToTileX(
                this.boundingbox.minLongitude, this.zoomIntervalConfiguration.getBaseZoom(i)),
                (int) MercatorProjection.latitudeToTileY(this.boundingbox.maxLatitude,
                        this.zoomIntervalConfiguration.getBaseZoom(i)),
                this.zoomIntervalConfiguration.getBaseZoom(i));
        this.tileGridLayouts[i] = new TileGridLayout(upperLeft, computeNumberOfHorizontalTiles(i),
                computeNumberOfVerticalTiles(i));
    }
}
项目:mapsforge    文件:BaseTileBasedDataProcessor.java   
public BaseTileBasedDataProcessor(MapWriterConfiguration configuration) {
    super();
    this.boundingbox = configuration.getBboxConfiguration();
    this.zoomIntervalConfiguration = configuration.getZoomIntervalConfiguration();
    this.tileGridLayouts = new TileGridLayout[this.zoomIntervalConfiguration.getNumberOfZoomIntervals()];
    this.bboxEnlargement = configuration.getBboxEnlargement();
    this.preferredLanguage = configuration.getPreferredLanguage();
    this.skipInvalidRelations = configuration.isSkipInvalidRelations();

    this.outerToInnerMapping = new TLongObjectHashMap<TLongArrayList>();
    this.innerWaysWithoutAdditionalTags = new TLongHashSet();
    this.tilesToCoastlines = new HashMap<TileCoordinate, TLongHashSet>();

    this.countWays = new float[this.zoomIntervalConfiguration.getNumberOfZoomIntervals()];
    this.countWayTileFactor = new float[this.zoomIntervalConfiguration.getNumberOfZoomIntervals()];

    this.histogramPoiTags = new TShortIntHashMap();
    this.histogramWayTags = new TShortIntHashMap();

    // compute horizontal and vertical tile coordinate offsets for all
    // base zoom levels
    for (int i = 0; i < this.zoomIntervalConfiguration.getNumberOfZoomIntervals(); i++) {
        TileCoordinate upperLeft = new TileCoordinate((int) MercatorProjection.longitudeToTileX(
                this.boundingbox.minLongitude, this.zoomIntervalConfiguration.getBaseZoom(i)),
                (int) MercatorProjection.latitudeToTileY(this.boundingbox.maxLatitude,
                        this.zoomIntervalConfiguration.getBaseZoom(i)),
                this.zoomIntervalConfiguration.getBaseZoom(i));
        this.tileGridLayouts[i] = new TileGridLayout(upperLeft, computeNumberOfHorizontalTiles(i),
                computeNumberOfVerticalTiles(i));
    }
}
项目:pre-cu    文件:AutoDeltaShortIntMap.java   
public AutoDeltaShortIntMap() {
    this.changes = new ArrayList<>(5);
    this.container = new TShortIntHashMap();
    this.baselineCommandCount = 0;
}