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

Java SI类代码示例

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

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



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

示例1: importFromPastCorrupted

import javax.measure.unit.SI; //导入依赖的package包/类
public static Tensor<QuantifiedValue<Double>> importFromPastCorrupted() {
    Set<Class<?>> dimensions = ImmutableSet.of(Time.class, Longitude.class, Latitude.class);
    Builder<QuantifiedValue<Double>> tensorBuilder = ImmutableTensor.<QuantifiedValue<Double>> builder(dimensions);

    Random rand = new Random();
    for (int x = 0; x < 10; x++) {
        for (int y = 0; y < 10; y++) {
            for (int t = 0; t < 10; t++) {
                if (y != 5) {
                    QuantifiedValue<Double> entryValue = ImmutableQuantifiedValue.<Double> of(rand.nextDouble(),
                            JScienceUnit.of(SI.CELSIUS));
                    tensorBuilder.put(Position.of(new Time(t), new Longitude(x), new Latitude(y)), entryValue);
                }
            }
        }
    }

    return tensorBuilder.build();
}
 
开发者ID:tensorics,项目名称:tensorics-core,代码行数:20,代码来源:FakeMeteoDataImporter.java


示例2: compareExactToErrorous

import javax.measure.unit.SI; //导入依赖的package包/类
@Test
public void compareExactToErrorous() {
    ImmutableQuantifiedValue<Double> v1 = Tensorics.quantityOf(99.9, SI.METER);
    ImmutableQuantifiedValue<Double> v2 = Tensorics.quantityOf(100.0, SI.METER).withError(0.1);

    assertFalse(TensoricDoubles.testIf(v1).isLessThan(v2));
    assertFalse(TensoricDoubles.testIf(v2).isGreaterThan(v1));
    assertFalse(TensoricDoubles.testIf(v2).isLessThan(v1));
    assertFalse(TensoricDoubles.testIf(v1).isGreaterThan(v2));

    v1 = v1.withError(0.0);
    v2 = v2.withError(0.01);

    assertTrue(TensoricDoubles.testIf(v1).isLessThan(v2));
    assertTrue(TensoricDoubles.testIf(v2).isGreaterThan(v1));
    assertFalse(TensoricDoubles.testIf(v2).isLessThan(v1));
    assertFalse(TensoricDoubles.testIf(v1).isGreaterThan(v2));
}
 
开发者ID:tensorics,项目名称:tensorics-core,代码行数:19,代码来源:QuantifiedPredicatesTest.java


示例3: compareExactValues

import javax.measure.unit.SI; //导入依赖的package包/类
@Test
public void compareExactValues() {
    ImmutableQuantifiedValue<Double> v1 = Tensorics.quantityOf(99.9, SI.METER);
    ImmutableQuantifiedValue<Double> v2 = Tensorics.quantityOf(100.0, SI.METER);

    assertTrue(TensoricDoubles.testIf(v1).isLessThan(v2));
    assertTrue(TensoricDoubles.testIf(v2).isGreaterThan(v1));
    assertFalse(TensoricDoubles.testIf(v2).isLessThan(v1));
    assertFalse(TensoricDoubles.testIf(v1).isGreaterThan(v2));

    v1 = v1.withError(0.0);
    v2 = v2.withError(0.0);

    assertTrue(TensoricDoubles.testIf(v1).isLessThan(v2));
    assertTrue(TensoricDoubles.testIf(v2).isGreaterThan(v1));
    assertFalse(TensoricDoubles.testIf(v2).isLessThan(v1));
    assertFalse(TensoricDoubles.testIf(v1).isGreaterThan(v2));
}
 
开发者ID:tensorics,项目名称:tensorics-core,代码行数:19,代码来源:QuantifiedPredicatesTest.java


示例4: profileQuantifiedRepetitiveTensor

import javax.measure.unit.SI; //导入依赖的package包/类
@Ignore
@Test
public void profileQuantifiedRepetitiveTensor() {
    final Unit unit = JScienceUnit.of(SI.METER);
    CoordinateRange range = CoordinateRange.fromSize(TensorSize.ofXYZ(100, 1000, 1));

    List<ProfileResult> results = profileTensorCreationNTimes(10, range,
            new ValueFactory<QuantifiedValue<Double>>() {

                @Override
                public QuantifiedValue<Double> create(int x, int y, int z) {
                    return Tensorics.quantityOf(valueForBig(x, y, z, 2.0), unit).withError(0.0);
                }
            });
    printProfileResult(results);
}
 
开发者ID:tensorics,项目名称:tensorics-core,代码行数:17,代码来源:TensorCalculationsTest.java


示例5: testLocationInterp2D

import javax.measure.unit.SI; //导入依赖的package包/类
public void testLocationInterp2D()
{
  final LocationDocumentBuilder loc1b =
      new LocationDocumentBuilder("loc1", null, SI.MILLI(SI.SECOND), SI.METER);
  final IGeoCalculator builder = loc1b.getCalculator();
  loc1b.add(1000, builder.createPoint(2, 3));
  loc1b.add(2000, builder.createPoint(3, 4));

  final LocationDocument loc1 = loc1b.toDocument();

  Point2D geo1 = loc1.locationAt(1500);
  assertEquals("correct value", 2.5, geo1.getX());
  assertEquals("correct value", 3.5, geo1.getY());

  geo1 = loc1.locationAt(1700);
  assertEquals("correct value", 2.7, geo1.getX());
  assertEquals("correct value", 3.7, geo1.getY());
}
 
开发者ID:debrief,项目名称:limpet,代码行数:19,代码来源:TestGeotoolsGeometry.java


示例6: testLocationInterp

import javax.measure.unit.SI; //导入依赖的package包/类
public void testLocationInterp()
{
  final LocationDocumentBuilder loc1b =
      new LocationDocumentBuilder("loc1", null, SI.MILLI(SI.SECOND));
  final IGeoCalculator builder = loc1b.getCalculator();
  loc1b.add(1000, builder.createPoint(2, 3));
  loc1b.add(2000, builder.createPoint(3, 4));

  final LocationDocument loc1 = loc1b.toDocument();

  Point2D geo1 = loc1.locationAt(1500);
  assertEquals("correct value", 2.5, geo1.getX());
  assertEquals("correct value", 3.5, geo1.getY());

  geo1 = loc1.locationAt(1700);
  assertEquals("correct value", 2.7, geo1.getX());
  assertEquals("correct value", 3.7, geo1.getY());
}
 
开发者ID:debrief,项目名称:limpet,代码行数:19,代码来源:TestGeotoolsGeometry.java


示例7: testStoreWrongNumberType

import javax.measure.unit.SI; //导入依赖的package包/类
public void testStoreWrongNumberType()
{
  LocationDocumentBuilder ldb =
      new LocationDocumentBuilder("name", null, SI.METER);
  ldb.add(12, new Point2D.Double(12, 13));
  ldb.add(14, new Point2D.Double(15, 23));

  LocationDocument locDoc = ldb.toDocument();
  IDataset oData = locDoc.getDataset();
  assertTrue("we're expecting an object dataset",
      oData instanceof ObjectDataset);

  // ok, now check an error is thrown if we put it into a nubmer document
  NumberDocument nd = new NumberDocument(null, null, null);
  boolean thrown = false;
  try
  {
    nd.setDataset(oData);
  }
  catch (IllegalArgumentException ee)
  {
    thrown = true;
  }
  assertTrue("the expected exception got caught", thrown);
}
 
开发者ID:debrief,项目名称:limpet,代码行数:26,代码来源:TestCollections.java


示例8: testStoreWrongLocationType

import javax.measure.unit.SI; //导入依赖的package包/类
public void testStoreWrongLocationType()
{
  NumberDocumentBuilder ldb =
      new NumberDocumentBuilder("name", null, null, SI.METER);
  ldb.add(12, 213d);
  ldb.add(14, 413d);

  NumberDocument locDoc = ldb.toDocument();
  IDataset oData = locDoc.getDataset();
  assertTrue("we're expecting an object dataset",
      oData instanceof DoubleDataset);

  // ok, now check an error is thrown if we put it into a nubmer document
  LocationDocument nd = new LocationDocument(null, null);
  boolean thrown = false;
  try
  {
    nd.setDataset(oData);
  }
  catch (IllegalArgumentException ee)
  {
    thrown = true;
  }
  assertTrue("the expected exception got caught", thrown);
}
 
开发者ID:debrief,项目名称:limpet,代码行数:26,代码来源:TestCollections.java


示例9: testStoreWrongStringType

import javax.measure.unit.SI; //导入依赖的package包/类
public void testStoreWrongStringType()
{
  NumberDocumentBuilder ldb =
      new NumberDocumentBuilder("name", null, null, SI.METER);
  ldb.add(12, 213d);
  ldb.add(14, 413d);

  NumberDocument locDoc = ldb.toDocument();
  IDataset oData = locDoc.getDataset();
  assertTrue("we're expecting an object dataset",
      oData instanceof DoubleDataset);

  // ok, now check an error is thrown if we put it into a nubmer document
  StringDocument nd = new StringDocument(null, null);
  boolean thrown = false;
  try
  {
    nd.setDataset(oData);
  }
  catch (IllegalArgumentException ee)
  {
    thrown = true;
  }
  assertTrue("the expected exception got caught", thrown);
}
 
开发者ID:debrief,项目名称:limpet,代码行数:26,代码来源:TestCollections.java


示例10: calculatorFor

import javax.measure.unit.SI; //导入依赖的package包/类
public static IGeoCalculator calculatorFor(Unit<?> units)
{
  final IGeoCalculator res;
  if(units.equals(SampleData.DEGREE_ANGLE))
  {
    res = getCalculatorWGS84();
  }
  else if(units.equals(SI.METRE))
  {
    res = getCalculatorGeneric2D();
  }
  else
  {
    throw new IllegalArgumentException("Don't have calculator for:" + units);
  }
  return res;
}
 
开发者ID:debrief,项目名称:limpet,代码行数:18,代码来源:GeoSupport.java


示例11: isATrack

import javax.measure.unit.SI; //导入依赖的package包/类
/**
 * test for if a group contains enough data for us to treat it as a track
 * 
 * @param group
 *          the group of tracks
 * @return yes/no
 */
public boolean isATrack(final IStoreGroup group, final boolean needsSpeed,
    final boolean needsCourse)
{
  boolean res = true;

  // ok, keep looping through, to check we have the right types
  if (needsSpeed
      && !isDimensionPresent(group, METRE.divide(SECOND).getDimension()))
  {
    return false;
  }

  // ok, keep looping through, to check we have the right types
  if (needsCourse && !isDimensionPresent(group, SI.RADIAN.getDimension()))
  {
    return false;
  }

  if (!hasLocation(group))
  {
    return false;
  }

  return res;
}
 
开发者ID:debrief,项目名称:limpet,代码行数:33,代码来源:CollectionComplianceTests.java


示例12: getCreate

import javax.measure.unit.SI; //导入依赖的package包/类
private static List<IOperation> getCreate()
{
  List<IOperation> create = new ArrayList<IOperation>();

  create.add(new AddLayerOperation());

  create
      .add(new CreateSingletonGenerator("dimensionless", Dimensionless.UNIT));

  create.add(new CreateSingletonGenerator("frequency", HERTZ
      .asType(Frequency.class)));

  create.add(new CreateSingletonGenerator("decibels", NonSI.DECIBEL));

  create.add(new CreateSingletonGenerator("speed (m/s)", METRE.divide(SECOND)
      .asType(Velocity.class)));

  create.add(new CreateSingletonGenerator("course (degs)",
      SampleData.DEGREE_ANGLE.asType(Angle.class)));
  create.add(new CreateSingletonGenerator("time (secs)",
      SI.SECOND.asType(Duration.class)));
  // create.add(new CreateLocationAction());
  create.add(new GenerateGrid());

  return create;
}
 
开发者ID:debrief,项目名称:limpet,代码行数:27,代码来源:OperationsLibrary.java


示例13: CutGenerator

import javax.measure.unit.SI; //导入依赖的package包/类
public CutGenerator(final String name)
{
  _name = name;
  // generate the builders
  _origin =
      new LocationDocumentBuilder(name + "-location", null,
          SampleData.MILLIS);
  _brg =
      new NumberDocumentBuilder(name + "-brg", SampleData.DEGREE_ANGLE,
          null, SampleData.MILLIS);
  _brg2 =
      new NumberDocumentBuilder(name + "-brg (ambig)",
          SampleData.DEGREE_ANGLE, null, SampleData.MILLIS);
  _range =
      new NumberDocumentBuilder(name + "-range", METRE, null,
          SampleData.MILLIS);
  _freq =
      new NumberDocumentBuilder(name + "-freq", SI.HERTZ, null,
          SampleData.MILLIS);
  _label =
      new StringDocumentBuilder(name + "-label", null, SampleData.MILLIS);
}
 
开发者ID:debrief,项目名称:limpet,代码行数:23,代码来源:RepParser.java


示例14: visitDistanceSpatialOperator

import javax.measure.unit.SI; //导入依赖的package包/类
protected void visitDistanceSpatialOperator(DistanceBufferOperator filter,
        PropertyName property, Literal geometry, boolean swapped,
        Object extraData) {

    property.accept(delegate, extraData);
    key = (String) delegate.field;
    geometry.accept(delegate, extraData);
    final Geometry geo = delegate.currentGeometry;
    lat = geo.getCentroid().getY();
    lon = geo.getCentroid().getX();
    final double inputDistance = filter.getDistance();
    final String inputUnits = filter.getDistanceUnits();
    distance = Double.valueOf(toMeters(inputDistance, inputUnits));

    delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must", MATCH_ALL,
            "filter", ImmutableMap.of("geo_distance", 
                    ImmutableMap.of("distance", distance+SI.METER.toString(), key, ImmutableList.of(lon,lat)))));

    if ((filter instanceof DWithin && swapped)
            || (filter instanceof Beyond && !swapped)) {
        delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must_not", delegate.queryBuilder));
    }
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:24,代码来源:FilterToElasticHelper.java


示例15: testDWithinFilter

import javax.measure.unit.SI; //导入依赖的package包/类
@Test
public void testDWithinFilter() throws Exception {
    init();
    FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
    GeometryFactory gf = new GeometryFactory();
    PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
    Point ls = gf.createPoint(sf.create(new double[] { 0, 0 }, 2));
    DWithin f = ff.dwithin(ff.property("geo"), ff.literal(ls), 3, SI.METRE.getSymbol());
    SimpleFeatureCollection features = featureSource.getFeatures(f);
    assertEquals(2, features.size());
    SimpleFeatureIterator fsi = features.features();
    assertTrue(fsi.hasNext());
    assertEquals(fsi.next().getID(), "active.01");
    assertTrue(fsi.hasNext());
    assertEquals(fsi.next().getID(), "active.10");
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:17,代码来源:ElasticGeometryFilterIT.java


示例16: testInsertSourceScenario

import javax.measure.unit.SI; //导入依赖的package包/类
public void testInsertSourceScenario() {
	final EActivity dataSource2 = PLAN_FACTORY.createActivity(dataSourceDef);
	dataSource2.setName("DataSource02");
	final TemporalMember eDataSource2TemporalMember = dataSource2.getMember(TemporalMember.class);
	TransactionUtils.writing(plan, new Runnable() {
		@Override
		public void run() {
			plan.getChildren().add(dataSource2);
			eDataSource2TemporalMember.setStartTime(DATA_SOURCE_ACTIVITY_START);
		}
	});
	recomputePlan(plan);
	TransactionUtils.reading(plan, new Runnable() {
		@Override
		public void run() {
			Amount<Duration> duration = eDataSource2TemporalMember.getDuration();
			assertAmountProximity(ONE_HOUR.to(SI.SECOND), duration); 
			assertEquals(DATA_SOURCE_ACTIVITY_START, eDataSource2TemporalMember.getStartTime());
			assertEquals(DATA_SOURCE_ACTIVITY_END, eDataSource2TemporalMember.getEndTime());
		}
	});
	assertResourceProfileScenario(Amount.valueOf(200, MB));
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:24,代码来源:TestDataTransferScenario.java


示例17: getName

import javax.measure.unit.SI; //导入依赖的package包/类
@Override
public String getName(EPlan plan) {
	// Don't append date information for template plans, just use plan name
	if (plan.isTemplate()) {
		return plan.getName();
	}
	TemporalMember temporalMember = plan.getMember(TemporalMember.class);
	Date start = temporalMember.getStartTime();
	if (start == null) {
		return super.getName(plan);
	}
	Amount<Duration> duration = temporalMember.getDuration();
	if (duration == null) {
		duration = Amount.valueOf(0L, SI.SECOND);
	}
	Date end = DateUtils.add(start, duration);
	int startSol = MissionCalendarUtils.getDayOfMission(start);
	int endSol = MissionCalendarUtils.getDayOfMission(end);
	if (startSol != endSol) {
		return super.getName(plan) + ":" + startSol + "-" + endSol;
	}
	return super.getName(plan) + ":" + startSol;

}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:25,代码来源:TemporalPlanNameHelper.java


示例18: convertTimeDistanceToNetwork

import javax.measure.unit.SI; //导入依赖的package包/类
public Time convertTimeDistanceToNetwork(Amount<Duration> duration) {
	long milliseconds = duration.longValue(SI.MILLI(SI.SECOND));
	// Convert milliseconds to seconds.
	long value = Math.round(milliseconds/((double)CONVERSION_CONSTANT));
	if (value < DistanceGraph.MIN_DISTANCE) {
		if ((milliseconds != Long.MIN_VALUE) && (value != DistanceGraph.NEG_INFINITY)) {
			trace.warn("value (" + value + ") too negative, becoming negative infinity (" + DistanceGraph.NEG_INFINITY + ")");
		}
		value = DistanceGraph.NEG_INFINITY;
	}
	if (value > DistanceGraph.MAX_DISTANCE) {
		if ((milliseconds != Long.MAX_VALUE) && (value != DistanceGraph.POS_INFINITY)) {
			trace.warn("value (" + value + ") too positive, becoming positive infinity (" + DistanceGraph.POS_INFINITY + ")");
		}
		value = DistanceGraph.POS_INFINITY;
	}
	Time distance = getTime(value);
	if (distance != value) {
		trace.warn("time distance " + value + " changed during conversion to time " + distance);
	}
	trace.debug("convertTimeDistanceToNetwork(" + milliseconds + "): " + distance);
	return distance;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:24,代码来源:TemporalNetworkModel.java


示例19: initialize

import javax.measure.unit.SI; //导入依赖的package包/类
private void initialize() throws IOException {
	if (conditionToAdd == null) {
		conditionToAdd = ResourceConditionsUtils.readConditions(file);
		conditionToAdd.setActive(true);
		TransactionUtils.reading(plan, new Runnable() {
			@Override
			public void run() {
				ResourceConditionsMember member = plan.getMember(ResourceConditionsMember.class);
				Date time = conditionToAdd.getTime();
				Iterator<Conditions> iterator = member.getConditions().iterator();
				while (iterator.hasNext()) {
					Conditions oldConditions = iterator.next();
					Date oldTime = oldConditions.getTime();
					if (DateUtils.subtract(oldTime, time).abs().isLessThan(Amount.valueOf(500, SI.MILLI(SI.SECOND)))) {
						conditionsToRemove.add(oldConditions);
					}
				}
			}
		});
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:22,代码来源:ConditionsImportOperation.java


示例20: coalesceElements

import javax.measure.unit.SI; //导入依赖的package包/类
@Override
protected Object coalesceElements(Collection elements) {
	Date earliest = null;
	Date latest = null;
	for (Object o : elements) {
		IObservableValue v = (IObservableValue) o;
		Date value = (Date) v.getValue();
		if (value == null) {
			continue;
		}
		if (earliest == null || value.before(earliest)) {
			earliest = value;
		}
		if (latest == null || value.after(latest)) {
			latest = value;
		}
	}
	if (latest == null || earliest == null) {
		return Amount.valueOf(0L, SI.MILLI(SI.SECOND));
	}
	return Amount.valueOf(latest.getTime() - earliest.getTime(), SI.MILLI(SI.SECOND));
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:TemporalPropertyDescriptorContributor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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