• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Measure类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.measure.Measure的典型用法代码示例。如果您正苦于以下问题:Java Measure类的具体用法?Java Measure怎么用?Java Measure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: positionOf

import javax.measure.Measure; //导入依赖的package包/类
@Override
protected AbsolutePosition positionOf(UTM coordinates,
        AbsolutePosition position) {
    final LatLong latLong;
    if (coordinates.latitudeZone() < 'C'
            || coordinates.latitudeZone() > 'X') {
        latLong = upsToLatLong(coordinates, WGS84);
    } else {
        latLong = utmToLatLong(coordinates, WGS84);
    }
    position.latitudeWGS84 = Measure.valueOf(latLong
            .latitudeValue(SI.RADIAN), SI.RADIAN);
    position.longitudeWGS84 = Measure.valueOf(latLong
            .longitudeValue(SI.RADIAN), SI.RADIAN);
    return position;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:17,代码来源:UTM.java


示例2: main

import javax.measure.Measure; //导入依赖的package包/类
/**
 * Starts the demo.
 * @param args No args.
 */
public static void main(String[] args) {
  final String string = "AgentWise";
  final List<Point> points = measureString(string, 30, 30, 0);
  final RandomGenerator rng = new MersenneTwister(123);
  final Simulator sim = new Simulator(rng, Measure.valueOf(1000L,
      SI.MILLI(SI.SECOND)));
  sim.register(new PlaneRoadModel(new Point(0, 0), new Point(4500, 1200),
      SI.METER, Measure.valueOf(1000d, NonSI.KILOMETERS_PER_HOUR)));
  sim.configure();
  for (final Point p : points) {
    sim.register(new Vehicle(p, rng));
  }
  View.create(sim)
      .with(new PlaneRoadModelRenderer(), new VehicleRenderer(),
          new DemoPanel(string, rng)).show();
}
 
开发者ID:JDevlieghere,项目名称:MAS,代码行数:21,代码来源:SwarmDemo.java


示例3: main

import javax.measure.Measure; //导入依赖的package包/类
/**
    * @param args
    */
   @SuppressWarnings("unchecked")
   public static void main(String[] args) {
@SuppressWarnings("rawtypes")
Measure length = Measure.valueOf(10, SI.METRE);
// LengthAmount length = new LengthAmount(10, SI.KILOGRAM);
// this won't work ;-)

System.out.println(length);
Unit<Length> lenUnit = length.getUnit();
System.out.println(lenUnit);

System.out.println(length.doubleValue(NonSI.FOOT));
// System.out.println(length.doubleValue(USCustomary.POUND));
// this won't work either.
// UnitConverter footConv = lenUnit.getConverterTo(NonSI.INCH);
System.out.print(((Measurable<Length>) length).doubleValue(NonSI.INCH));
System.out.println(" " + NonSI.FOOT);

Measurable<Mass> mass = Measure.valueOf(1000, SI.GRAM);
Measurable<Mass> mass2 = Measure.valueOf(1, SI.KILOGRAM);
System.out.println(mass.equals(mass2));
   }
 
开发者ID:unitsofmeasurement,项目名称:uom-demos,代码行数:26,代码来源:HelloUnits.java


示例4: calculateDistance

import javax.measure.Measure; //导入依赖的package包/类
private void calculateDistance(
		CoordinateReferenceSystem crs, Point[] points) {
	if (crs == null) {
		crs = default_crs;
	}
	double distance = 0.0;
	try {
		distance = JTS.orthodromicDistance(
				points[0].getCoordinate(),
				points[1].getCoordinate(), crs);
	} catch (TransformException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	Measure<Double, Length> dist = Measure.valueOf(
			distance, SI.METER);
	System.out.println(dist.doubleValue(SI.KILOMETER)
			+ " Km");
	System.out.println(dist.doubleValue(NonSI.MILE)
			+ " miles");
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:23,代码来源:OrthodromicDistance.java


示例5: positionOf

import javax.measure.Measure; //导入依赖的package包/类
@Override
protected AbsolutePosition positionOf(LatLong coordinates,
        AbsolutePosition position) {
    position.latitudeWGS84 = Measure.valueOf(coordinates._latitude,
            DEGREE_ANGLE);
    position.longitudeWGS84 = Measure.valueOf(coordinates._longitude,
            DEGREE_ANGLE);
    return position;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:10,代码来源:LatLong.java


示例6: getSemimajorAxis

import javax.measure.Measure; //导入依赖的package包/类
/**
 * Returns the semimajor or equatorial radius of this reference ellipsoid.
 *
 * @return The semimajor radius.
 */
public Measurable<Length> getSemimajorAxis() {
    if (_semimajorAxis == null) {
        _semimajorAxis = Measure.valueOf(a, SI.METRE);
    }
    return _semimajorAxis;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:12,代码来源:ReferenceEllipsoid.java


示例7: getsSemiminorAxis

import javax.measure.Measure; //导入依赖的package包/类
/**
 * Returns the semiminor or polar radius of this reference ellipsoid.
 *
 * @return  The semiminor radius.
 */
public Measurable<Length> getsSemiminorAxis() {
    if (_semiminorAxis == null) {
        _semiminorAxis = Measure.valueOf(b, SI.METRE);
    }
    return _semiminorAxis;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:12,代码来源:ReferenceEllipsoid.java


示例8: positionOf

import javax.measure.Measure; //导入依赖的package包/类
@Override
protected AbsolutePosition positionOf(XYZ coordinates,
        AbsolutePosition position) {
    final double x = coordinates._x;
    final double y = coordinates._y;
    final double z = coordinates._z;

    final double longitude = Math.atan2(y, x);

    final double latitude;
    final double xy = Math.hypot(x, y);
    // conventional result if xy == 0.0...
    if (xy == 0.0) {
        latitude = (z >= 0.0) ? Math.PI / 2.0 : -Math.PI / 2.0;
    } else {
        final double a = WGS84.getSemimajorAxis().doubleValue(METRE);
        final double b = WGS84.getsSemiminorAxis().doubleValue(METRE);
        final double ea2 = WGS84.getEccentricitySquared();
        final double eb2 = WGS84.getSecondEccentricitySquared();
        final double beta = Math.atan2(a * z, b * xy);
        double numerator = z + b * eb2 * cube(Math.sin(beta));
        double denominator = xy - a * ea2 * cube(Math.cos(beta));
        latitude = Math.atan2(numerator, denominator);
    }

    final double height = xy / Math.cos(latitude)
            - WGS84.verticalRadiusOfCurvature(latitude);
    position.latitudeWGS84 = Measure.valueOf(latitude, RADIAN);
    position.longitudeWGS84 = Measure.valueOf(longitude, RADIAN);
    position.heightWGS84 = Measure.valueOf(height, METRE);
    return position;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:33,代码来源:XYZ.java


示例9: fillTable

import javax.measure.Measure; //导入依赖的package包/类
@Override
protected void fillTable(ExperimentGroup experimentGroup, int counter, List<TableRow> tableRows) {
	
	for (ExperimentGroupRun run : experimentGroup.getReports()) {			
		for (int i = 0; i < run.getMeasurement().size(); i++) {
			Measurement measurement = run.getMeasurement().get(i);
							
			for(int j=0; j<measurement.getMeasurementRanges().size(); j++){
				RawMeasurements rawMeasurements = measurement.getMeasurementRanges().get(j).getRawMeasurements();
				
				if (rawMeasurements != null && !rawMeasurements.getDataSeries().isEmpty()){
					
					final IDataSource edp2Source = new Edp2DataTupleDataSource(rawMeasurements);

					Iterator<IMeasureProvider> iter = edp2Source.getDataStream().iterator();
					while (iter.hasNext()) {

						List<Measure<?,?>> measures = iter.next().asList();
						for(int m=0; m<measures.size(); m++){
							Measure<?,?> measure = measures.get(m);
							
							if(m == 1){
								TableRow result = new TableRow("System capacity");
								result.value = Double.parseDouble(measure.getValue().toString());
								tableRows.add(result);
							}
						}
					}
					edp2Source.getDataStream().close();
				}
			}
		}
	}
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:35,代码来源:CapacityResultComposite.java


示例10: fillTable

import javax.measure.Measure; //导入依赖的package包/类
@Override
protected void fillTable(ExperimentGroup experimentGroup, int counter, List<TableRow> tableRows) {
	
	for (ExperimentGroupRun run : experimentGroup.getReports()) {			
		for (int i = 0; i < run.getMeasurement().size(); i++) {
			Measurement measurement = run.getMeasurement().get(i);
							
			for(int j=0; j<measurement.getMeasurementRanges().size(); j++){
				RawMeasurements rawMeasurements = measurement.getMeasurementRanges().get(j).getRawMeasurements();
					
				if (rawMeasurements != null && !rawMeasurements.getDataSeries().isEmpty()){
					
					final IDataSource edp2Source = new Edp2DataTupleDataSource(rawMeasurements);

					Iterator<IMeasureProvider> iter = edp2Source.getDataStream().iterator();
					while (iter.hasNext()) {

						List<Measure<?,?>> measures = iter.next().asList();
						for(int m=0; m<measures.size(); m++){
							Measure<?,?> measure = measures.get(m);
							
							if(m == 1){
								TableRow result = new TableRow("System scalability");
								result.value = Double.parseDouble(measure.getValue().toString());
								tableRows.add(result);
							}
						}
					}
					edp2Source.getDataStream().close();
				}
			}
		}
	}
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:35,代码来源:ScalabilityResultComposite.java


示例11: main

import javax.measure.Measure; //导入依赖的package包/类
/**
 * take two pairs of lat/long and return bearing and distance.
 * 
 * @param args
 */
public static void main(String[] args) {
	DefaultGeographicCRS crs = DefaultGeographicCRS.WGS84;
	if (args.length != 4) {
		System.err.println("Need 4 numbers lat_1 lon_1 lat_2 lon_2");
		return;
	}
	GeometryFactory geomFactory = new GeometryFactory();
	Point[] points = new Point[2];
	for (int i = 0, k = 0; i < 2; i++, k += 2) {
		double x = Double.valueOf(args[k]);
		double y = Double.valueOf(args[k + 1]);
		if (CRS.getAxisOrder(crs).equals(AxisOrder.NORTH_EAST)) {
			System.out.println("working with a lat/lon crs");
			points[i] = geomFactory.createPoint(new Coordinate(x, y));
		} else {
			System.out.println("working with a lon/lat crs");
			points[i] = geomFactory.createPoint(new Coordinate(y, x));
		}

	}


	double distance = 0.0;

	GeodeticCalculator calc = new GeodeticCalculator(crs);
	calc.setStartingGeographicPoint(points[0].getX(), points[0].getY());
	calc.setDestinationGeographicPoint(points[1].getX(), points[1].getY());
	distance = calc.getOrthodromicDistance();
	double bearing = calc.getAzimuth();
	
	Measure<Double, Length> dist = Measure.valueOf(distance, SI.METER);
	System.out.println(dist.doubleValue(SI.KILOMETER) + " Km");
	System.out.println(dist.doubleValue(NonSI.MILE) + " miles");
	System.out.println("Bearing " + bearing + " degrees");
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:41,代码来源:OrthodromicDistance2.java


示例12: onStateChanged

import javax.measure.Measure; //导入依赖的package包/类
@Override
public void onStateChanged(ActivityState previous, ActivityState current, Locale locale, InteractionSession session) throws Exception {
    super.onStateChanged(previous, current, locale, session);
    if (ActivityState.PENDING == previous && ActivityState.ACTIVE == current) {
        final List<UtterancePattern> localizedExpressions = expressions.stream()
                .filter(it -> null == it.getInLanguage() || locale.equals(Locale.forLanguageTag(it.getInLanguage())))
                .collect(Collectors.toList());
        Preconditions.checkState(!localizedExpressions.isEmpty(),
                "Cannot get %s expression for affirmation '%s' from %s expressions: %s",
                locale.toLanguageTag(), getPath(), expressions.size(), expressions);
        final UtterancePattern expression = localizedExpressions.get(RandomUtils.nextInt(0, localizedExpressions.size()));

        // interpolate with in-slots
        final String pattern = expression.getPattern();
        StringBuffer sb = new StringBuffer();
        final Pattern SLOT_PLACEHOLDER = Pattern.compile("\\{([a-z0-9_]+)\\}", Pattern.CASE_INSENSITIVE);
        final Matcher matcher = SLOT_PLACEHOLDER.matcher(pattern);
        while (matcher.find()) {
            matcher.appendReplacement(sb, "");
            final String slotId = matcher.group(1);
            final Object slotValue = getInSlot(slotId).getLast();
            log.debug("in-slot {}.{} = {}", getPath(), slotId, slotValue);

            final String ssmlValue;
            if (slotValue instanceof Measure) {
                final MeasureFormat measureFormat = MeasureFormat.getInstance(NumberFormat.getNumberInstance(locale), UnitFormat.getInstance(locale));
                ssmlValue = measureFormat.format(slotValue);
            } else if (slotValue instanceof LocalDate) {
                ssmlValue = DateTimeFormat.longDate().withLocale(locale).print((LocalDate) slotValue);
            } else if (slotValue instanceof LocalTime) {
                ssmlValue = DateTimeFormat.shortTime().withLocale(locale).print((LocalTime) slotValue);
            } else if (slotValue instanceof DateTime) {
                ssmlValue = DateTimeFormat.longDateTime().withLocale(locale).print((DateTime) slotValue);
            } else {
                ssmlValue = String.valueOf(slotValue);
            }

            sb.append(ssmlValue);
        }
        matcher.appendTail(sb);
        final String result = sb.toString();
        log.info("'{}' requesting CommunicateAction: {}", getPath(), result);

        final CommunicateAction communicateAction = new CommunicateAction(locale, result, null);
        communicateAction.setUsedForSynthesis(true);
        getPendingCommunicateActions().add(communicateAction);

        session.complete(this, locale);
    }
}
 
开发者ID:lumenrobot,项目名称:lumen,代码行数:51,代码来源:AffirmationTask.java


示例13: convertNewtonToDyne

import javax.measure.Measure; //导入依赖的package包/类
public static double convertNewtonToDyne(double value) {
    UnitConverter converter = NEWTON.getConverterTo(DYNE);
    double out = converter.convert(Measure.valueOf(value, NEWTON).doubleValue(NEWTON));
    return out;
}
 
开发者ID:nstrelow,项目名称:ConvertItAll,代码行数:6,代码来源:Force.java


示例14: convertNewtonToPoundForce

import javax.measure.Measure; //导入依赖的package包/类
public static double convertNewtonToPoundForce(double value) {
    UnitConverter converter = NEWTON.getConverterTo(POUND_FORCE);
    double out = converter.convert(Measure.valueOf(value, NEWTON).doubleValue(NEWTON));
    return out;
}
 
开发者ID:nstrelow,项目名称:ConvertItAll,代码行数:6,代码来源:Force.java


示例15: convertNewtonToKilogramForce

import javax.measure.Measure; //导入依赖的package包/类
public static double convertNewtonToKilogramForce(double value) {
    UnitConverter converter = NEWTON.getConverterTo(KILOGRAM_FORCE);
    double out = converter.convert(Measure.valueOf(value, NEWTON).doubleValue(NEWTON));
    return out;
}
 
开发者ID:nstrelow,项目名称:ConvertItAll,代码行数:6,代码来源:Force.java


示例16: convertDyneToNewton

import javax.measure.Measure; //导入依赖的package包/类
public static double convertDyneToNewton(double value) {
    UnitConverter converter = DYNE.getConverterTo(NEWTON);
    double out = converter.convert(Measure.valueOf(value, DYNE).doubleValue(DYNE));
    return out;
}
 
开发者ID:nstrelow,项目名称:ConvertItAll,代码行数:6,代码来源:Force.java


示例17: convertDyneToPoundForce

import javax.measure.Measure; //导入依赖的package包/类
public static double convertDyneToPoundForce(double value) {
    UnitConverter converter = DYNE.getConverterTo(POUND_FORCE);
    double out = converter.convert(Measure.valueOf(value, DYNE).doubleValue(DYNE));
    return out;
}
 
开发者ID:nstrelow,项目名称:ConvertItAll,代码行数:6,代码来源:Force.java


示例18: convertDyneToKilogramForce

import javax.measure.Measure; //导入依赖的package包/类
public static double convertDyneToKilogramForce(double value) {
    UnitConverter converter = DYNE.getConverterTo(KILOGRAM_FORCE);
    double out = converter.convert(Measure.valueOf(value, DYNE).doubleValue(DYNE));
    return out;
}
 
开发者ID:nstrelow,项目名称:ConvertItAll,代码行数:6,代码来源:Force.java


示例19: convertPoundForceToDyne

import javax.measure.Measure; //导入依赖的package包/类
public static double convertPoundForceToDyne(double value) {
    UnitConverter converter = POUND_FORCE.getConverterTo(DYNE);
    double out = converter.convert(Measure.valueOf(value, POUND_FORCE).doubleValue(POUND_FORCE));
    return out;
}
 
开发者ID:nstrelow,项目名称:ConvertItAll,代码行数:6,代码来源:Force.java


示例20: convertPoundForceToKilogramForce

import javax.measure.Measure; //导入依赖的package包/类
public static double convertPoundForceToKilogramForce(double value) {
    UnitConverter converter = POUND_FORCE.getConverterTo(KILOGRAM_FORCE);
    double out = converter.convert(Measure.valueOf(value, POUND_FORCE).doubleValue(POUND_FORCE));
    return out;
}
 
开发者ID:nstrelow,项目名称:ConvertItAll,代码行数:6,代码来源:Force.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CalendarNameProvider类代码示例发布时间:2022-05-22
下一篇:
Java NamedBean类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap