@Test public void insertRowGridOnly() { int setCellInvocations = backgroundDataMock.getUnmodifiableFactMappingValues().size(); backgroundGridModelSpy.insertRowGridOnly(ROW_INDEX, gridRowMock, backgroundDataMock); verify(backgroundGridModelSpy, atLeast(1)).checkSimulation(); verify(backgroundGridModelSpy, never()).insertRow(eq(ROW_INDEX), eq(gridRowMock)); verify(backgroundGridModelSpy, times(setCellInvocations)).setCell(anyInt(), anyInt(), isA(Supplier.class)); reset(backgroundGridModelSpy); FactMapping factMappingByIndexMock = mock(FactMapping.class); when(factMappingByIndexMock.getClassName()).thenReturn(List.class.getName()); when(simulationDescriptorMock.getFactMappingByIndex(2)).thenReturn(factMappingByIndexMock); backgroundGridModelSpy.insertRowGridOnly(ROW_INDEX, gridRowMock, backgroundDataMock); verify(backgroundGridModelSpy, atLeast(1)).checkSimulation(); verify(backgroundGridModelSpy, never()).insertRow(eq(ROW_INDEX), eq(gridRowMock)); verify(backgroundGridModelSpy, times(setCellInvocations)).setCell(anyInt(), anyInt(), isA(Supplier.class)); }
@Override public void insertRowGridOnly(final int rowIndex, final GridRow row, final BackgroundData abstractScesimData) { insertRowGridOnly(rowIndex, row); abstractScesimData.getUnmodifiableFactMappingValues().forEach(value -> { FactIdentifier factIdentifier = value.getFactIdentifier(); ExpressionIdentifier expressionIdentifier = value.getExpressionIdentifier(); if (value.getRawValue() == null || value.getRawValue() instanceof String) { String stringValue = (String) value.getRawValue(); int columnIndex = abstractScesimModel.getScesimModelDescriptor().getIndexByIdentifier(factIdentifier, expressionIdentifier); final FactMapping factMappingByIndex = abstractScesimModel.getScesimModelDescriptor().getFactMappingByIndex(columnIndex); String placeHolder = ((ScenarioGridColumn) columns.get(columnIndex)).getPlaceHolder(); setCell(rowIndex, columnIndex, () -> { ScenarioGridCell newCell = new ScenarioGridCell(new ScenarioGridCellValue(stringValue, placeHolder)); if (ScenarioSimulationSharedUtils.isCollection((factMappingByIndex.getClassName()))) { newCell.setListMap(ScenarioSimulationSharedUtils.isList((factMappingByIndex.getClassName()))); } return newCell; }); } else { throw new UnsupportedOperationException("Only string is supported at the moment"); } }); }
BackgroundGridModel extends AbstractScesimGridModel<Background, BackgroundData> { @Override public void insertRowGridOnly(final int rowIndex, final GridRow row, final BackgroundData abstractScesimData) { insertRowGridOnly(rowIndex, row); abstractScesimData.getUnmodifiableFactMappingValues().forEach(value -> { FactIdentifier factIdentifier = value.getFactIdentifier(); ExpressionIdentifier expressionIdentifier = value.getExpressionIdentifier(); if (value.getRawValue() == null || value.getRawValue() instanceof String) { String stringValue = (String) value.getRawValue(); int columnIndex = abstractScesimModel.getScesimModelDescriptor().getIndexByIdentifier(factIdentifier, expressionIdentifier); final FactMapping factMappingByIndex = abstractScesimModel.getScesimModelDescriptor().getFactMappingByIndex(columnIndex); String placeHolder = ((ScenarioGridColumn) columns.get(columnIndex)).getPlaceHolder(); setCell(rowIndex, columnIndex, () -> { ScenarioGridCell newCell = new ScenarioGridCell(new ScenarioGridCellValue(stringValue, placeHolder)); if (ScenarioSimulationSharedUtils.isCollection((factMappingByIndex.getClassName()))) { newCell.setListMap(ScenarioSimulationSharedUtils.isList((factMappingByIndex.getClassName()))); } return newCell; }); } else { throw new UnsupportedOperationException("Only string is supported at the moment"); } }); } }
BackgroundGridModel extends AbstractScesimGridModel<Background, BackgroundData> { @Override public void insertRowGridOnly(final int rowIndex, final GridRow row, final BackgroundData abstractScesimData) { insertRowGridOnly(rowIndex, row); abstractScesimData.getUnmodifiableFactMappingValues().forEach(value -> { FactIdentifier factIdentifier = value.getFactIdentifier(); ExpressionIdentifier expressionIdentifier = value.getExpressionIdentifier(); if (value.getRawValue() == null || value.getRawValue() instanceof String) { String stringValue = (String) value.getRawValue(); int columnIndex = abstractScesimModel.getScesimModelDescriptor().getIndexByIdentifier(factIdentifier, expressionIdentifier); final FactMapping factMappingByIndex = abstractScesimModel.getScesimModelDescriptor().getFactMappingByIndex(columnIndex); String placeHolder = ((ScenarioGridColumn) columns.get(columnIndex)).getPlaceHolder(); setCell(rowIndex, columnIndex, () -> { ScenarioGridCell newCell = new ScenarioGridCell(new ScenarioGridCellValue(stringValue, placeHolder)); if (ScenarioSimulationSharedUtils.isCollection((factMappingByIndex.getClassName()))) { newCell.setListMap(ScenarioSimulationSharedUtils.isList((factMappingByIndex.getClassName()))); } return newCell; }); } else { throw new UnsupportedOperationException("Only string is supported at the moment"); } }); } private  BackgroundGridModel();  BackgroundGridModel(boolean isMerged); }
BackgroundGridModel extends AbstractScesimGridModel<Background, BackgroundData> { @Override public void insertRowGridOnly(final int rowIndex, final GridRow row, final BackgroundData abstractScesimData) { insertRowGridOnly(rowIndex, row); abstractScesimData.getUnmodifiableFactMappingValues().forEach(value -> { FactIdentifier factIdentifier = value.getFactIdentifier(); ExpressionIdentifier expressionIdentifier = value.getExpressionIdentifier(); if (value.getRawValue() == null || value.getRawValue() instanceof String) { String stringValue = (String) value.getRawValue(); int columnIndex = abstractScesimModel.getScesimModelDescriptor().getIndexByIdentifier(factIdentifier, expressionIdentifier); final FactMapping factMappingByIndex = abstractScesimModel.getScesimModelDescriptor().getFactMappingByIndex(columnIndex); String placeHolder = ((ScenarioGridColumn) columns.get(columnIndex)).getPlaceHolder(); setCell(rowIndex, columnIndex, () -> { ScenarioGridCell newCell = new ScenarioGridCell(new ScenarioGridCellValue(stringValue, placeHolder)); if (ScenarioSimulationSharedUtils.isCollection((factMappingByIndex.getClassName()))) { newCell.setListMap(ScenarioSimulationSharedUtils.isList((factMappingByIndex.getClassName()))); } return newCell; }); } else { throw new UnsupportedOperationException("Only string is supported at the moment"); } }); } private  BackgroundGridModel();  BackgroundGridModel(boolean isMerged); @Override GridWidget getGridWidget(); @Override Range getInstanceLimits(int columnIndex); @Override void insertRowGridOnly(final int rowIndex,
                                  final GridRow row,
                                  final BackgroundData abstractScesimData); }
BackgroundGridModel extends AbstractScesimGridModel<Background, BackgroundData> { @Override public void insertRowGridOnly(final int rowIndex, final GridRow row, final BackgroundData abstractScesimData) { insertRowGridOnly(rowIndex, row); abstractScesimData.getUnmodifiableFactMappingValues().forEach(value -> { FactIdentifier factIdentifier = value.getFactIdentifier(); ExpressionIdentifier expressionIdentifier = value.getExpressionIdentifier(); if (value.getRawValue() == null || value.getRawValue() instanceof String) { String stringValue = (String) value.getRawValue(); int columnIndex = abstractScesimModel.getScesimModelDescriptor().getIndexByIdentifier(factIdentifier, expressionIdentifier); final FactMapping factMappingByIndex = abstractScesimModel.getScesimModelDescriptor().getFactMappingByIndex(columnIndex); String placeHolder = ((ScenarioGridColumn) columns.get(columnIndex)).getPlaceHolder(); setCell(rowIndex, columnIndex, () -> { ScenarioGridCell newCell = new ScenarioGridCell(new ScenarioGridCellValue(stringValue, placeHolder)); if (ScenarioSimulationSharedUtils.isCollection((factMappingByIndex.getClassName()))) { newCell.setListMap(ScenarioSimulationSharedUtils.isList((factMappingByIndex.getClassName()))); } return newCell; }); } else { throw new UnsupportedOperationException("Only string is supported at the moment"); } }); } private  BackgroundGridModel();  BackgroundGridModel(boolean isMerged); @Override GridWidget getGridWidget(); @Override Range getInstanceLimits(int columnIndex); @Override void insertRowGridOnly(final int rowIndex,
                                  final GridRow row,
                                  final BackgroundData abstractScesimData);  }