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


Java NonSI类代码示例

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


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

示例1: getCreate

import javax.measure.unit.NonSI; //导入依赖的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

示例2: setUp

import javax.measure.unit.NonSI; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
	plan = PLAN_FACTORY.createPlan("TEST_PLAN");
	activity = PLAN_FACTORY.createActivityInstance();
	activity.setName("TEST_ACTIVITY");
	activity.getMember(TemporalMember.class).setStartTime(ACTIVITY_START);
	activity.getMember(TemporalMember.class).setDuration(DateUtils.subtract(ACTIVITY_END, ACTIVITY_START));
	EPlanUtils.contributeProductResources(plan);
	final ResourceProfileMember resourceProfileMember = WrapperUtils.getMember(plan, ResourceProfileMember.class);
	assertNotNull(resourceProfileMember);
	profile = JScienceFactory.eINSTANCE.createProfile();
	profile.setId(KEY_TEST_PROFILE);
	TransactionUtils.writing(plan, new Runnable() {
		@Override
		public void run() {
			plan.getMember(TemporalMember.class).setStartTime(ACTIVITY_START);
			plan.getMember(TemporalMember.class).setDuration(Amount.valueOf(1, NonSI.DAY));
			plan.getChildren().add(activity);
			resourceProfileMember.getResourceProfiles().add(profile);
		}
	});
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:TestProfileEffect.java

示例3: testDelayedNumericProfileEffect

import javax.measure.unit.NonSI; //导入依赖的package包/类
public void testDelayedNumericProfileEffect() throws Exception {
	Amount<Duration> startOffset = Amount.valueOf(30, NonSI.MINUTE);
	
	final ProfileMember profileMember = activity.getMember(ProfileMember.class);
	assertNotNull(profileMember);
	assertNotNull(ResourceUtils.getProfile(plan, KEY_TEST_PROFILE));
	final ProfileEffect effect = createProfileEffect(startOffset, "10", DateUtils.ZERO_DURATION, "-10");
	TransactionUtils.writing(plan, new Runnable() {
		@Override
		public void run() {
			profileMember.getEffects().add(effect);
		}
	});
	recomputePlan(plan);
	
	assertProfileValue(plan, KEY_TEST_PROFILE, ACTIVITY_START, null);
	assertProfileValue(plan, KEY_TEST_PROFILE, DateUtils.add(ACTIVITY_START, startOffset), Amount.valueOf(10, Unit.ONE));
	assertProfileValue(plan, KEY_TEST_PROFILE, ACTIVITY_END  , Amount.valueOf( 0, Unit.ONE));
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:TestProfileEffect.java

示例4: testEarliestDateObservable

import javax.measure.unit.NonSI; //导入依赖的package包/类
@Test
public void testEarliestDateObservable() {
	List<EPlanElement> list = new ArrayList<EPlanElement>();
	final int numActivities = 3;
	final int duration = 1;
	long earliestStartTime = Long.MAX_VALUE;
	for (int i=1; i<=numActivities; i++) {
		long startTime = i*hourInMS;
		list.add(getPlanElement(i, new Date(startTime), Amount.valueOf(duration, NonSI.HOUR)));
		earliestStartTime = Math.min(earliestStartTime, startTime);
	}
	EarliestDateObservable observable = new EarliestDateObservable(list, TemporalPackage.Literals.TEMPORAL_MEMBER__START_TIME);
	Object val = observable.getValue();
	assertNotNull(val);
	assertTrue(val instanceof Date);
	assertEquals(earliestStartTime, ((Date) val).getTime());
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:TestObservableValue.java

示例5: testLateObservable

import javax.measure.unit.NonSI; //导入依赖的package包/类
@Test
public void testLateObservable() {
	List<EPlanElement> list = new ArrayList<EPlanElement>();
	final int numActivities = 3;
	final int duration = 1;
	long latestStartTime = Long.MIN_VALUE;
	for (int i=1; i<=numActivities; i++) {
		long startTime = i*hourInMS;
		list.add(getPlanElement(i, new Date(startTime), Amount.valueOf(duration, NonSI.HOUR)));
		latestStartTime = Math.max(latestStartTime, startTime);
	}
	LatestDateObservable observable = new LatestDateObservable(list, TemporalPackage.Literals.TEMPORAL_MEMBER__START_TIME);
	Object val = observable.getValue();
	assertNotNull(val);
	assertTrue(val instanceof Date);
	assertEquals(latestStartTime, ((Date) val).getTime());
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:TestObservableValue.java

示例6: testProfileEqualityConstraintPassesMaximumGap

import javax.measure.unit.NonSI; //导入依赖的package包/类
/** 
 * Create a constraint that should fail if not for the max gap attribute
 */
public void testProfileEqualityConstraintPassesMaximumGap() {
	final EPlan plan = model.getEPlan();
	TransactionUtils.writing(plan, new Runnable() {
		@Override
		public void run() {
			//
			// Two generates resource activities spread apart
			EActivity a1 = createActivity(ACTIVITY_DEF_GENERATES_RESOURCE);
			a1.getMember(TemporalMember.class).setStartTime(PLAN_START);
			plan.getChildren().add(a1);
			EActivity a2 = createActivity(ACTIVITY_DEF_GENERATES_RESOURCE);
			a2.getMember(TemporalMember.class).setStartTime(DateUtils.add(PLAN_START, Amount.valueOf(2, NonSI.HOUR)));
			plan.getChildren().add(a2);
			//
			// Add a constraint on the plan
			ProfileEqualityConstraint constraint = addEqualityConstraint(plan, ON_OFF_RESOUCE, "ON");
			constraint.setMaximumGap(Amount.valueOf(2, NonSI.HOUR));
		}
	});
	assertViolationCount(plan, new ProfileConstraintPlanAdvisorFactory(), 0);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:25,代码来源:TestProfileConstraintPlanAdvisor.java

示例7: testProfileEqualityConstraintFailsMaximumGap

import javax.measure.unit.NonSI; //导入依赖的package包/类
/**
 * Constraint fails despite specification of max gap
 */
public void testProfileEqualityConstraintFailsMaximumGap() {
	final EPlan plan = model.getEPlan();
	TransactionUtils.writing(plan, new Runnable() {
		@Override
		public void run() {
			//
			// Two generates resource activities spread apart
			EActivity a1 = createActivity(ACTIVITY_DEF_GENERATES_RESOURCE);
			a1.getMember(TemporalMember.class).setStartTime(PLAN_START);
			plan.getChildren().add(a1);
			EActivity a2 = createActivity(ACTIVITY_DEF_GENERATES_RESOURCE);
			a2.getMember(TemporalMember.class).setStartTime(DateUtils.add(PLAN_START, Amount.valueOf(2, NonSI.HOUR)));
			plan.getChildren().add(a2);
			//
			// Add a constraint on the plan
			ProfileEqualityConstraint constraint = addEqualityConstraint(plan, ON_OFF_RESOUCE, "ON");
			constraint.setMaximumGap(Amount.valueOf(10, NonSI.MINUTE));
		}
	});
	assertViolationCount(plan, new ProfileConstraintPlanAdvisorFactory(), 1);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:25,代码来源:TestProfileConstraintPlanAdvisor.java

示例8: convert_fahrenheitToCelsiusToFahrenheit

import javax.measure.unit.NonSI; //导入依赖的package包/类
@Test
public void convert_fahrenheitToCelsiusToFahrenheit() throws Exception {
    assertTemperaturesAreEqual(new TemperatureImpl(new BigDecimal("-40"), NonSI.FAHRENHEIT),
            new TemperatureImpl(new BigDecimal("-40"), SI.CELSIUS));
    assertTemperaturesAreEqual(new TemperatureImpl(new BigDecimal("5"), NonSI.FAHRENHEIT),
            new TemperatureImpl(new BigDecimal("-15"), SI.CELSIUS));
    assertTemperaturesAreEqual(new TemperatureImpl(new BigDecimal("41"), NonSI.FAHRENHEIT),
            new TemperatureImpl(new BigDecimal("5"), SI.CELSIUS));
    assertTemperaturesAreEqual(new TemperatureImpl(new BigDecimal("77"), NonSI.FAHRENHEIT),
            new TemperatureImpl(new BigDecimal("25"), SI.CELSIUS));
    assertTemperaturesAreEqual(new TemperatureImpl(new BigDecimal("113"), NonSI.FAHRENHEIT),
            new TemperatureImpl(new BigDecimal("45"), SI.CELSIUS));
    assertTemperaturesAreEqual(new TemperatureImpl(new BigDecimal("158"), NonSI.FAHRENHEIT),
            new TemperatureImpl(new BigDecimal("70"), SI.CELSIUS));
    assertTemperaturesAreEqual(new TemperatureImpl(new BigDecimal("185"), NonSI.FAHRENHEIT),
            new TemperatureImpl(new BigDecimal("85"), SI.CELSIUS));
    assertTemperaturesAreEqual(new TemperatureImpl(new BigDecimal("203"), NonSI.FAHRENHEIT),
            new TemperatureImpl(new BigDecimal("95"), SI.CELSIUS));
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:20,代码来源:TemperatureImplUnitTest.java

示例9: main

import javax.measure.unit.NonSI; //导入依赖的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

示例10: main

import javax.measure.unit.NonSI; //导入依赖的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

示例11: calculateDistance

import javax.measure.unit.NonSI; //导入依赖的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

示例12: KappaSB

import javax.measure.unit.NonSI; //导入依赖的package包/类
public KappaSB(){
	setName("Kappa-Sorbitol");
	setFuel(new KNSB());
	
	CylindricalChamber c = new CylindricalChamber();
	c.setLength(Amount.valueOf(16, NonSI.INCH));
	c.setID(Amount.valueOf(2.37, NonSI.INCH));
	setChamber(c);
	
	CoredCylindricalGrain g = new CoredCylindricalGrain();
	try{
		g.setLength(Amount.valueOf(3.8, NonSI.INCH));
		g.setOD(Amount.valueOf(2.23, NonSI.INCH));
		g.setID(Amount.valueOf(.75, NonSI.INCH));
	} catch (PropertyVetoException v){
		throw new Error(v);
	}

	setGrain( new MultiGrain(g, 4) );
	
	ConvergentDivergentNozzle n = new ConvergentDivergentNozzle();
	n.setThroatDiameter(Amount.valueOf(.502, NonSI.INCH));
	n.setExitDiameter(Amount.valueOf(1.67, NonSI.INCH));
	n.setEfficiency(.87);
	setNozzle(n);
}
 
开发者ID:bkuker,项目名称:motorsim,代码行数:27,代码来源:KappaSB.java

示例13: setUp

import javax.measure.unit.NonSI; //导入依赖的package包/类
@Before
public void setUp() {
  clock = spy((RealtimeClockController) TimeModel.builder()
    .withRealTime()
    .build(FakeDependencyProvider.empty()));
  doNothing().when(clock).switchToRealTime();
  doNothing().when(clock).switchToSimulatedTime();

  rm = mock(PDPRoadModel.class);
  when(rm.getSpeedUnit()).thenReturn(NonSI.KILOMETERS_PER_HOUR);
  when(rm.getDistanceUnit()).thenReturn(SI.KILOMETER);

  pm = mock(PDPModel.class);
  when(pm.getEventAPI()).thenReturn(mock(EventAPI.class));

  dependencyProvider = FakeDependencyProvider.builder()
    .add(clock, RealtimeClockController.class)
    .add(rm, PDPRoadModel.class)
    .add(pm, PDPModel.class)
    .build();

  model = RtSolverModel.builder().build(dependencyProvider);
  ((TimeModel) clock).register(model);
}
 
开发者ID:rinde,项目名称:RinLog,代码行数:25,代码来源:RtSolverBidderTest.java

示例14: testConvertDescriptionToAmount

import javax.measure.unit.NonSI; //导入依赖的package包/类
@Test
public void testConvertDescriptionToAmount()
{
	Assert.assertEquals(CategoryMapperUtil.convertDescriptionToAmount("1-3 per month"), AmountWrapper.create(
			Amount.rangeOf((double) 1, (double) 3, NonSI.MONTH.inverse()).to(NonSI.WEEK.inverse())));

	Assert.assertEquals(CategoryMapperUtil.convertDescriptionToAmount("once or twice per month"),
			AmountWrapper.create(
					Amount.rangeOf((double) 1, (double) 2, NonSI.MONTH.inverse()).to(NonSI.WEEK.inverse())));

	Assert.assertEquals(CategoryMapperUtil.convertDescriptionToAmount("daily"),
			AmountWrapper.create(Amount.valueOf((double) 1, NonSI.DAY.inverse()).to(NonSI.WEEK.inverse())));

	Assert.assertEquals(CategoryMapperUtil.convertDescriptionToAmount("About once a week"),
			AmountWrapper.create(Amount.valueOf((double) 1, NonSI.WEEK.inverse())));

	Assert.assertEquals(CategoryMapperUtil.convertDescriptionToAmount("several times a month"),
			AmountWrapper.create(Amount.rangeOf((double) 3,
					NonSI.DAY.inverse().getConverterTo(NonSI.MONTH.inverse()).convert((double) 1) - 1,
					NonSI.MONTH.inverse()).to(NonSI.WEEK.inverse()), false));
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:22,代码来源:CategoryMapperTest.java

示例15: calculateBounds

import javax.measure.unit.NonSI; //导入依赖的package包/类
/**
 * Calculate bounds.
 *
 * @return the referenced envelope
 */
private ReferencedEnvelope calculateBounds() {
    ReferencedEnvelope bounds = null;

    try {
        bounds = featureList.getBounds();

        if (bounds == null) {
            // It could be that the above call was too costly!
            bounds = featureList.getFeatures().getBounds();
        }

        if (bounds.getCoordinateReferenceSystem() == null) {
            // We need a coordinate reference system set otherwise
            // transformations fail to render
            bounds = ReferencedEnvelope.create(bounds, DefaultGeographicCRS.WGS84);
        }

        if (bounds != null) {
            Unit<?> unit = CRSUtilities
                    .getUnit(bounds.getCoordinateReferenceSystem().getCoordinateSystem());

            double width;
            double height;
            if (unit == NonSI.DEGREE_ANGLE) {
                width = (bounds.getWidth() < BOUNDINGBOX_BUFFER_THRESHOLD_ANGLE)
                        ? BOUNDINGBOX_BUFFER_MIN_ANGLE
                        : (bounds.getWidth() * BOUNDINGBOX_BUFFER_ANGLE);
                height = (bounds.getHeight() < BOUNDINGBOX_BUFFER_THRESHOLD_ANGLE)
                        ? BOUNDINGBOX_BUFFER_MIN_ANGLE
                        : (bounds.getHeight() * BOUNDINGBOX_BUFFER_ANGLE);
            } else {
                width = (bounds.getWidth() < BOUNDINGBOX_BUFFER_THRESHOLD_LINEAR)
                        ? BOUNDINGBOX_BUFFER_MIN_LINEAR
                        : (bounds.getWidth() * BOUNDINGBOX_BUFFER_LINEAR);
                height = (bounds.getHeight() < BOUNDINGBOX_BUFFER_THRESHOLD_LINEAR)
                        ? BOUNDINGBOX_BUFFER_MIN_LINEAR
                        : (bounds.getHeight() * BOUNDINGBOX_BUFFER_LINEAR);
            }

            bounds.expandBy(width, height);
        }
    } catch (IOException e) {
        ConsoleManager.getInstance().exception(this, e);
    }
    return bounds;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:52,代码来源:RenderPanelImpl.java


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