Exemplo n.º 1
0
 public void UpdateCoordinate(PointName pointName, PointCoordinate newPointCoordinate) =>
 _analogPoints[pointName].Update(newPointCoordinate);
Exemplo n.º 2
0
 public Result <Maybe <AnalogCoordinateUpdated> > GenerateAnalogCoordinateUpdatedWith(PointName pointName,
                                                                                      PointCoordinate newPointCoordinate) =>
 _analogPoints.MaybeGetValue(pointName).Unwrap(
     analog => analog.GenerateAnalogCoordinateUpdatedWith(newPointCoordinate).ToOkResult(),
     () => Result.Fail <Maybe <AnalogCoordinateUpdated> >($"Analog point with name '{pointName}' doesnt exist in remote."));
Exemplo n.º 3
0
 public void Add(PointName pointName, PointCoordinate pointCoordinate) =>
 _analogPoints.Add(pointName, AnalogFrom(_remoteId, pointName, pointCoordinate));
Exemplo n.º 4
0
 public Result <AnalogAdded> GenerateAnalogAddedFor(PointName pointName, PointCoordinate pointCoordinate) =>
 _analogPoints.MaybeGetValue(pointName).Unwrap(
     _ => Result.Fail <AnalogAdded>($"Analog point with name {pointName} already exists in remote."),
     () => new AnalogAdded(_remoteId, pointName, pointCoordinate).ToOkResult());
Exemplo n.º 5
0
 public Result <Remote> UpdateAnalogCoordinate(PointName pointName, PointCoordinate newPointCoordinate) =>
 _analogPoints.GenerateAnalogCoordinateUpdatedWith(pointName, newPointCoordinate)
 .OnSuccess(maybeEvent => maybeEvent.Map(ApplyChange))
 .ToTypedResult(this);
Exemplo n.º 6
0
 public Result <Remote> AddAnalog(PointName pointName, PointCoordinate pointCoordinate) =>
 _analogPoints.GenerateAnalogAddedFor(pointName, pointCoordinate)
 .OnSuccess(e => ApplyChange(e))
 .ToTypedResult(this);