use of com.serotonin.m2m2.virtual.vo.BrownianChangeVO in project ma-modules-public by infiniteautomation.
the class VirtualPointLocatorModel method toVO.
@Override
public VirtualPointLocatorVO toVO() {
VirtualPointLocatorVO vo = new VirtualPointLocatorVO();
vo.setDataType(DataType.fromName(dataType));
vo.setChangeTypeId(ChangeTypeVO.CHANGE_TYPE_CODES.getId(changeType));
vo.setSettable(settable);
switch(vo.getChangeTypeId()) {
case ChangeTypeVO.Types.ALTERNATE_BOOLEAN:
AlternateBooleanChangeVO abc = new AlternateBooleanChangeVO();
abc.setStartValue(startValue);
vo.setAlternateBooleanChange(abc);
break;
case ChangeTypeVO.Types.ANALOG_ATTRACTOR:
AnalogAttractorChangeVO aac = new AnalogAttractorChangeVO();
aac.setStartValue(startValue);
aac.setMaxChange(maxChange);
aac.setVolatility(volatility);
Integer attractionPointId = DataPointDao.getInstance().getIdByXid(attractionPointXid);
if (attractionPointId != null) {
aac.setAttractionPointId(attractionPointId);
}
vo.setAnalogAttractorChange(aac);
break;
case ChangeTypeVO.Types.BROWNIAN:
BrownianChangeVO bc = new BrownianChangeVO();
bc.setStartValue(startValue);
bc.setMin(min);
bc.setMax(max);
bc.setMaxChange(maxChange);
vo.setBrownianChange(bc);
break;
case ChangeTypeVO.Types.INCREMENT_ANALOG:
IncrementAnalogChangeVO iac = new IncrementAnalogChangeVO();
iac.setStartValue(startValue);
iac.setMin(min);
iac.setMax(max);
iac.setChange(change);
iac.setRoll(roll);
vo.setIncrementAnalogChange(iac);
break;
case ChangeTypeVO.Types.INCREMENT_MULTISTATE:
IncrementMultistateChangeVO imc = new IncrementMultistateChangeVO();
imc.setStartValue(startValue);
imc.setValues(values);
imc.setRoll(roll);
vo.setIncrementMultistateChange(imc);
break;
case ChangeTypeVO.Types.NO_CHANGE:
NoChangeVO nc = new NoChangeVO();
nc.setStartValue(startValue);
vo.setNoChange(nc);
break;
case ChangeTypeVO.Types.RANDOM_ANALOG:
RandomAnalogChangeVO rac = new RandomAnalogChangeVO();
rac.setStartValue(startValue);
rac.setMin(min);
rac.setMax(max);
vo.setRandomAnalogChange(rac);
break;
case ChangeTypeVO.Types.RANDOM_BOOLEAN:
RandomBooleanChangeVO rbc = new RandomBooleanChangeVO();
rbc.setStartValue(startValue);
vo.setRandomBooleanChange(rbc);
break;
case ChangeTypeVO.Types.RANDOM_MULTISTATE:
RandomMultistateChangeVO rmc = new RandomMultistateChangeVO();
rmc.setStartValue(startValue);
rmc.setValues(values);
vo.setRandomMultistateChange(rmc);
break;
case ChangeTypeVO.Types.SINUSOIDAL:
SinusoidalChangeVO sc = new SinusoidalChangeVO();
sc.setStartValue(startValue);
sc.setAmplitude(amplitude);
sc.setOffset(offset);
sc.setPeriod(period);
sc.setPhaseShift(phaseShift);
vo.setSinusoidalChange(sc);
break;
}
return vo;
}
Aggregations