当前位置: 首页>>代码示例>>Java>>正文


Java Vector.sort方法代码示例

本文整理汇总了Java中java.util.Vector.sort方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.sort方法的具体用法?Java Vector.sort怎么用?Java Vector.sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Vector的用法示例。


在下文中一共展示了Vector.sort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findManPlace

import java.util.Vector; //导入方法依赖的package包/类
/**
 * the program getting two databases of Vector<sameScanWifi>
 * every scan from the second the program will take the most close scans from the first and will revalue the coordinates of the scan with them.
 * @param database 
 * @param manScans
 * @param num_of_points-how many scans from the first to use for revalue
 */
public static void findManPlace(Vector<sameScanWifi> database,Vector<sameScanWifi> manScans,int num_of_points){
	for(sameScanWifi fixingNow : manScans){
		HashMap<sameScanWifi,Double> scansWeight= new HashMap<sameScanWifi,Double>();

		for(sameScanWifi gettingWeight : database){				
			scansWeight.put(gettingWeight, getScanWeight(gettingWeight,fixingNow));
		}
		database.sort(Comparator.comparing(scan -> -scansWeight.get(scan)));
		double lat=0,lon=0,alt=0,weight=0;
		for(sameScanWifi currentScan : database){	
			num_of_points--;
			lat+= scansWeight.get(currentScan)*currentScan.getLatitude();
			lon+= scansWeight.get(currentScan)*currentScan.getLongitude();
			alt+= scansWeight.get(currentScan)*currentScan.getAltitude();
			weight+= scansWeight.get(currentScan);
			if(num_of_points==0) break;
		}
		fixingNow.setAltitude(String.valueOf(alt/weight));
		fixingNow.setLatitude(String.valueOf(lat/weight));
		fixingNow.setLongitude(String.valueOf(lon/weight));
	}
}
 
开发者ID:amgross,项目名称:munche_prog,代码行数:30,代码来源:findPlaces.java

示例2: realPlaces

import java.util.Vector; //导入方法依赖的package包/类
/**
 * 
 * @param IdenticalMAC vector that every object in it is vector of the same ruter from diffrent scan from the same placr
 * @param num of points to check with
 * @return the real places of the routers in vector of wifiWithCoordinate
 */
public static Vector<wifiWithCoordinate> realPlaces(Vector<Vector<wifiWithCoordinate>> IdenticalMAC,int num){
	Vector<wifiWithCoordinate> realePlace=new Vector<wifiWithCoordinate>();
	for(Vector<wifiWithCoordinate> sameWifi: IdenticalMAC ){
		sameWifi.sort(Comparator.comparing(sample -> -sample.getRSSI()));
		realePlace.add(avgcomp(sameWifi,num));
	}



	return realePlace;
}
 
开发者ID:amgross,项目名称:munche_prog,代码行数:18,代码来源:findPlaces.java

示例3: updateParticalAnalysisReports

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Takes the processed image and writes information on each particle (blob) into
 * the global <reports> array, in order of overall particle area.
 */
public void updateParticalAnalysisReports ()
{
    if (this.camera.gethaveCamera() == true
            && this.currentImage != null)
        {
        final int numParticles = NIVision
                .imaqCountParticles(this.currentImage, 0);

        // Measure particles and sort by particle size
        final Vector<ParticleReport> particles = new Vector<ParticleReport>();

        if (numParticles > 0)
            {

            for (int particleIndex = 0; particleIndex < numParticles; particleIndex++)
                {

                final ParticleReport particle = new ParticleReport();
                particle.PercentAreaToImageArea = NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_AREA_BY_IMAGE_AREA);
                particle.area = NIVision.imaqMeasureParticle(
                        this.currentImage,
                        particleIndex, 0,
                        NIVision.MeasurementType.MT_AREA);
                particle.ConvexHullArea = NIVision
                        .imaqMeasureParticle(
                                this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CONVEX_HULL_AREA);
                particle.boundingRectTop = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_TOP);
                particle.boundingRectLeft = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_LEFT);
                particle.boundingRectBottom = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_BOTTOM);
                particle.boundingRectRight = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_RIGHT);
                particle.boundingRectWidth = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_BOUNDING_RECT_WIDTH);// par.boundingRectRight
                // -
                // par.boundingRectLeft;
                particle.center_mass_x = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CENTER_OF_MASS_X);
                particle.center_mass_y = (int) NIVision
                        .imaqMeasureParticle(this.currentImage,
                                particleIndex, 0,
                                NIVision.MeasurementType.MT_CENTER_OF_MASS_Y);
                particle.imageWidth = NIVision
                        .imaqGetImageSize(this.currentImage).width;
                particles.add(particle);
                }
            particles.sort(null);

            }
        this.reports = new ParticleReport[particles.size()];
        particles.copyInto(this.reports);
        particles.clear();
        }
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:78,代码来源:ImageProcessor.java


注:本文中的java.util.Vector.sort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。