本文整理汇总了Java中javax.measure.unit.SI.MILLI属性的典型用法代码示例。如果您正苦于以下问题:Java SI.MILLI属性的具体用法?Java SI.MILLI怎么用?Java SI.MILLI使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.measure.unit.SI
的用法示例。
在下文中一共展示了SI.MILLI属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLocationInterp2D
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());
}
示例2: testLocationInterp
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());
}
示例3: testLocationCalc2D
public void testLocationCalc2D()
{
final LocationDocumentBuilder loc1 =
new LocationDocumentBuilder("loc1", null, SI.MILLI(SI.SECOND), SI.METER);
final LocationDocumentBuilder loc2 =
new LocationDocumentBuilder("loc2", null, SI.MILLI(SI.SECOND), SI.METER);
final List<IStoreItem> selection = new ArrayList<IStoreItem>();
selection.add(loc1.toDocument());
final StoreGroup store = new StoreGroup("Results");
// ok, try adding some data
final IGeoCalculator builder = loc1.getCalculator();
loc1.add(1000, builder.createPoint(4, 3));
loc1.add(2000, builder.createPoint(3, 4));
loc2.add(1000, builder.createPoint(5, 3));
loc2.add(2000, builder.createPoint(3, 6));
// put in the new documents
selection.clear();
selection.add(loc1.toDocument());
selection.add(loc2.toDocument());
List<ICommand> ops =
new DistanceBetweenTracksOperation().actionsFor(selection, store,
context);
assertEquals("not empty collection", 1, ops.size());
ICommand firstC = ops.get(0);
// ok, execute it
firstC.execute();
NumberDocument output = (NumberDocument) firstC.getOutputs().get(0);
DoubleDataset data = (DoubleDataset) output.getDataset();
assertEquals(1d, data.get(0), 0.0001);
assertEquals(2d, data.get(1), 0.0001);
}
示例4: testLocationCalc
public void testLocationCalc()
{
final LocationDocumentBuilder loc1 =
new LocationDocumentBuilder("loc1", null, SI.MILLI(SI.SECOND));
final LocationDocumentBuilder loc2 =
new LocationDocumentBuilder("loc2", null, SI.MILLI(SI.SECOND));
final NumberDocumentBuilder len1b =
new NumberDocumentBuilder("dummy", METRE.asType(Length.class), null,
null);
final List<IStoreItem> selection = new ArrayList<IStoreItem>();
selection.add(loc1.toDocument());
final StoreGroup store = new StoreGroup("Results");
Collection<ICommand> ops =
new DistanceBetweenTracksOperation().actionsFor(selection, store,
context);
assertEquals("empty collection", 0, ops.size());
final NumberDocument len1 = len1b.toDocument();
selection.add(len1);
ops =
new DistanceBetweenTracksOperation().actionsFor(selection, store,
context);
assertEquals("empty collection", 0, ops.size());
selection.remove(len1);
selection.add(loc2.toDocument());
ops =
new DistanceBetweenTracksOperation().actionsFor(selection, store,
context);
assertEquals("empty collection", 0, ops.size());
// ok, try adding some data
final IGeoCalculator builder = loc1.getCalculator();
loc1.add(1000, builder.createPoint(4, 3));
loc2.add(2000, builder.createPoint(3, 4));
// put in the new documents
selection.clear();
selection.add(loc1.toDocument());
selection.add(loc2.toDocument());
ops =
new DistanceBetweenTracksOperation().actionsFor(selection, store,
context);
assertEquals("not empty collection", 1, ops.size());
}
示例5: testLocationSingletonCalcDistance
public void testLocationSingletonCalcDistance()
{
final LocationDocumentBuilder loc1 =
new LocationDocumentBuilder("loc1", null, SI.MILLI(SI.SECOND));
final LocationDocumentBuilder singletonLoc =
new LocationDocumentBuilder("loc2", null, SI.MILLI(SI.SECOND));
final NumberDocumentBuilder len1b =
new NumberDocumentBuilder("dummy", METRE.asType(Length.class), null,
null);
final IOperation distanceOp = new DistanceBetweenTracksOperation();
final IGeoCalculator builder = loc1.getCalculator();
final List<IStoreItem> selection = new ArrayList<IStoreItem>();
selection.add(loc1.toDocument());
final StoreGroup store = new StoreGroup("Results");
List<ICommand> ops = distanceOp.actionsFor(selection, store, context);
assertEquals("empty collection", 0, ops.size());
final NumberDocument len1 = len1b.toDocument();
selection.add(len1);
ops = distanceOp.actionsFor(selection, store, context);
assertEquals("empty collection", 0, ops.size());
selection.remove(len1);
selection.add(singletonLoc.toDocument());
ops = distanceOp.actionsFor(selection, store, context);
assertEquals("empty collection", 0, ops.size());
// ok, try adding some data
loc1.add(1000, builder.createPoint(4, 3));
singletonLoc.add(2000, builder.createPoint(3, 4));
// put in the new documents
selection.clear();
selection.add(loc1.toDocument());
selection.add(singletonLoc.toDocument());
ops = distanceOp.actionsFor(selection, store, context);
assertEquals("not empty collection", 1, ops.size());
assertEquals("store empty", 0, store.size());
ops.get(0).execute();
assertEquals("store no longer empty", 1, store.size());
// add some more entries to loc1
loc1.add(2000, builder.createPoint(4, 3));
loc1.add(3000, builder.createPoint(4, 3));
loc1.add(4000, builder.createPoint(4, 3));
// put in the new documents
selection.clear();
selection.add(loc1.toDocument());
selection.add(singletonLoc.toDocument());
ops = distanceOp.actionsFor(selection, store, context);
assertEquals("not empty collection", 1, ops.size());
// run the interpolation command
store.clear();
ops.get(0).execute();
assertEquals("store has other collection", 1, store.size());
}
示例6: testLocationSingletonCalcDistanceMixedIndex
public void testLocationSingletonCalcDistanceMixedIndex()
{
final LocationDocumentBuilder loc1 =
new LocationDocumentBuilder("loc1", null, SI.MILLI(SI.SECOND));
final LocationDocumentBuilder singletonLoc =
new LocationDocumentBuilder("loc2", null, null);
final NumberDocumentBuilder len1b =
new NumberDocumentBuilder("dummy", METRE.asType(Length.class), null,
null);
final IOperation distanceOp = new DistanceBetweenTracksOperation();
final IGeoCalculator builder = loc1.getCalculator();
final List<IStoreItem> selection = new ArrayList<IStoreItem>();
selection.add(loc1.toDocument());
final StoreGroup store = new StoreGroup("Results");
List<ICommand> ops = distanceOp.actionsFor(selection, store, context);
assertEquals("empty collection", 0, ops.size());
final NumberDocument len1 = len1b.toDocument();
selection.add(len1);
ops = distanceOp.actionsFor(selection, store, context);
assertEquals("empty collection", 0, ops.size());
selection.remove(len1);
selection.add(singletonLoc.toDocument());
ops = distanceOp.actionsFor(selection, store, context);
assertEquals("empty collection", 0, ops.size());
// ok, try adding some data
loc1.add(1000, builder.createPoint(4, 3));
singletonLoc.add(builder.createPoint(3, 4));
// put in the new documents
selection.clear();
selection.add(loc1.toDocument());
selection.add(singletonLoc.toDocument());
ops = distanceOp.actionsFor(selection, store, context);
assertEquals("not empty collection", 1, ops.size());
assertEquals("store empty", 0, store.size());
ops.get(0).execute();
assertEquals("store no longer empty", 1, store.size());
// check the output has the time units from the time provider
NumberDocument output = (NumberDocument) ops.get(0).getOutputs().get(0);
assertTrue("does not have index units", output.getIndexUnits() == null);
// add some more entries to loc1
loc1.add(2000, builder.createPoint(4, 3));
loc1.add(3000, builder.createPoint(4, 3));
loc1.add(4000, builder.createPoint(4, 3));
// put in the new documents
selection.clear();
selection.add(loc1.toDocument());
selection.add(singletonLoc.toDocument());
ops = distanceOp.actionsFor(selection, store, context);
assertEquals("not empty collection", 1, ops.size());
// run the interpolation command
store.clear();
ops.get(0).execute();
assertEquals("store has other collection", 1, store.size());
// check that the results object is indexed
output = (NumberDocument) ops.get(0).getOutputs().get(0);
assertTrue("has index units", output.getIndexUnits() != null);
}
示例7: testLocationSingletonCalcBearing
public void testLocationSingletonCalcBearing()
{
final LocationDocumentBuilder loc1 =
new LocationDocumentBuilder("loc1", null, SI.MILLI(SI.SECOND));
final LocationDocumentBuilder singletonLoc =
new LocationDocumentBuilder("loc2", null, SI.MILLI(SI.SECOND));
final IOperation bearingOp = new BearingBetweenTracksOperation();
final IGeoCalculator builder = loc1.getCalculator();
final List<IStoreItem> selection = new ArrayList<IStoreItem>();
final StoreGroup store = new StoreGroup("Results");
// ok, try adding some data
loc1.add(1000, builder.createPoint(4, 3));
singletonLoc.add(2000, builder.createPoint(3, 4));
selection.add(loc1.toDocument());
selection.add(singletonLoc.toDocument());
// try the bearing operation
List<ICommand> ops = bearingOp.actionsFor(selection, store, context);
assertEquals("not empty collection", 1, ops.size());
store.clear();
assertEquals("store empty", 0, store.size());
ops.get(0).execute();
assertEquals("store no longer empty", 1, store.size());
// try the bearing operation
ops = bearingOp.actionsFor(selection, store, context);
assertEquals("not empty collection", 1, ops.size());
store.clear();
assertEquals("store empty", 0, store.size());
ops.get(0).execute();
assertEquals("store no longer empty", 1, store.size());
// add some more entries to loc1
loc1.add(2000, builder.createPoint(4, 3));
loc1.add(3000, builder.createPoint(4, 3));
loc1.add(4000, builder.createPoint(4, 3));
// put in the new documents
selection.clear();
selection.add(loc1.toDocument());
selection.add(singletonLoc.toDocument());
// run the interpolation command
store.clear();
ops.get(0).execute();
assertEquals("store has other collection", 1, store.size());
// try the bearing operation
ops = bearingOp.actionsFor(selection, store, context);
assertEquals("not empty collection", 1, ops.size());
store.clear();
assertEquals("store empty", 0, store.size());
ops.get(0).execute();
assertEquals("store no longer empty", 1, store.size());
}
示例8: getWithPrefix
/**
* returns an new unit with the given Prefix
*
* @param pre
* @param unit
* @return
*/
public Unit getWithPrefix(String pre, Unit unit) {
if (pre.equals(PrefixName.ATTO)) {
return SI.ATTO(unit);
} else if (pre.equals(PrefixName.CENTI)) {
return SI.CENTI(unit);
} else if (pre.equals(PrefixName.DECI)) {
return SI.DECI(unit);
} else if (pre.equals(PrefixName.DEKA)) {
return SI.DEKA(unit);
} else if (pre.equals(PrefixName.EXA)) {
return SI.EXA(unit);
} else if (pre.equals(PrefixName.FEMTO)) {
return SI.FEMTO(unit);
} else if (pre.equals(PrefixName.GIGA)) {
return SI.GIGA(unit);
} else if (pre.equals(PrefixName.HECTO)) {
return SI.HECTO(unit);
} else if (pre.equals(PrefixName.KILO)) {
return SI.KILO(unit);
} else if (pre.equals(PrefixName.MEGA)) {
return SI.MEGA(unit);
} else if (pre.equals(PrefixName.MICRO)) {
return SI.MICRO(unit);
} else if (pre.equals(PrefixName.MILLI)) {
return SI.MILLI(unit);
} else if (pre.equals(PrefixName.NANO)) {
return SI.NANO(unit);
} else if (pre.equals(PrefixName.PETA)) {
return SI.PETA(unit);
} else if (pre.equals(PrefixName.PICO)) {
return SI.PICO(unit);
} else if (pre.equals(PrefixName.YOCTO)) {
return SI.YOCTO(unit);
} else if (pre.equals(PrefixName.ZEPTO)) {
return SI.ZEPTO(unit);
} else if (pre.equals(PrefixName.ZETTA)) {
return SI.ZETTA(unit);
} else {
return unit;
}
}
示例9: getUnitWithPrefix
/**
* Return an new Unit with the set Prefix
*
* @param unit
* @param prefix
* @return
*/
public Unit getUnitWithPrefix(Unit unit, JEVisUnit.Prefix prefix) {
// System.out.println("getUnitWithPrefix: " + prefix);
switch (prefix) {
case ATTO:
return SI.ATTO(unit);
case CENTI:
return SI.CENTI(unit);
case DECI:
return SI.DECI(unit);
case DEKA:
return SI.DEKA(unit);
case EXA:
return SI.EXA(unit);
case FEMTO:
return SI.FEMTO(unit);
case GIGA:
return SI.GIGA(unit);
case HECTO:
return SI.HECTO(unit);
case KILO:
return SI.KILO(unit);
case MEGA:
return SI.MEGA(unit);
case MICRO:
return SI.MICRO(unit);
case MILLI:
return SI.MILLI(unit);
case NANO:
return SI.NANO(unit);
case PETA:
return SI.PETA(unit);
case PICO:
return SI.PICO(unit);
case TERA:
return SI.TERA(unit);
case YOCTO:
return SI.YOCTO(unit);
case ZEPTO:
return SI.ZEPTO(unit);
case ZETTA:
return SI.ZETTA(unit);
case NONE:
return unit;
default:
throw new AssertionError();
}
}
示例10: getTimeUnit
@Override
public Unit<Duration> getTimeUnit() {
return SI.MILLI(SI.SECOND);
}