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


Java SI类代码示例

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


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


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