com.bstek.urule.model.table.ScriptDecisionTable Maven / Gradle / Ivy
/*******************************************************************************
* Copyright 2017 Bstek
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
******************************************************************************/
package com.bstek.urule.model.table;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.bstek.urule.model.rule.Library;
/**
* @author Jacky.gao
* @since 2015年5月5日
*/
public class ScriptDecisionTable {
private List rows;
private List columns;
private Map cellMap;
private List libraries;
public List getRows() {
return rows;
}
public void addLibrary(Library library){
if(libraries==null){
libraries=new ArrayList();
}
libraries.add(library);
}
public void addRow(Row row){
if(rows==null){
rows=new ArrayList();
}
rows.add(row);
}
public void addColumn(Column col){
if(columns==null){
columns=new ArrayList();
}
columns.add(col);
}
public void addCell(ScriptCell cell){
if(cellMap==null){
cellMap=new HashMap();
}
cellMap.put(buildCellKey(cell.getRow(),cell.getCol()), cell);
}
public void setRows(List rows) {
this.rows = rows;
}
public List getColumns() {
return columns;
}
public void setColumns(List columns) {
this.columns = columns;
}
public Map getCellMap() {
return cellMap;
}
public List getLibraries() {
return libraries;
}
public void setLibraries(List libraries) {
this.libraries = libraries;
}
public String buildCellKey(int row,int col){
return row+","+col;
}
}