public MappingData <TOutput, TState> Process(MappingData <TInput, TState> input) { if (!CanMap(input)) { throw new ArgumentOutOfRangeException(nameof(input), "There are no row in table with such input data."); } return(table[input]); }
public void RemoveRow(MappingData <TInput, TState> input) { if (!IsRowExist(input)) { throw new InvalidOperationException("This row does not exist in table."); } rows.Remove(input); }
public void AddRow(MappingData <TInput, TState> input, MappingData <TOutput, TState> output) { if (IsRowExist(input)) { throw new InvalidOperationException("This row already exist in table."); } rows.Add(input, output); }
public Information <TOutput> Process(Information <TInput> input) { var mappingInput = new MappingData <TInput, TState>(input.Value, CurrentState.Value); if (!Mapping.CanMap(mappingInput)) { throw new Exception("Mapping cannot process given input with current state");//TODO: создать своё исключение для этого случая } var mappingOutput = Mapping.Process(mappingInput); CurrentState = new Information <TState>(mappingOutput.State, StateDomain); return(new Information <TOutput>(mappingOutput.Data, OutputDomain)); }
public bool CanMap(MappingData <TInput, TState> value) { return(table.ContainsKey(value)); }
public bool IsRowExist(MappingData <TInput, TState> input) { return(rows.ContainsKey(input)); }