01: /*
02: * This is free software, licensed under the Gnu Public License (GPL)
03: * get a copy from <http://www.gnu.org/licenses/gpl.html>
04: */
05: package henplus.plugins.tablediff;
06:
07: import henplus.sqlmodel.Column;
08: import henplus.util.ListMap;
09:
10: import java.util.SortedSet;
11: import java.util.TreeSet;
12:
13: /**
14: * <p>Title: TableDiffResult</p>
15: * <p>Description: Represents the result of two diffed tables.<br>
16: * Created on: 24.07.2003</p>
17: * @version $Id: TableDiffResult.java,v 1.4 2005/06/18 04:58:13 hzeller Exp $
18: * @author <a href="mailto:martin.grotzke@javakaffee.de">Martin Grotzke</a>
19: */
20: public final class TableDiffResult {
21: private SortedSet/*<Column>*/_removedColumns;
22: private SortedSet/*<Column>*/_addedColumns;
23: private ListMap/*<Column, Column>*/_modifiedColumns; // key: reference, value: modified
24:
25: public TableDiffResult() {
26: }
27:
28: public boolean hasDiffs() {
29: return (_addedColumns != null || _removedColumns != null || _modifiedColumns != null);
30: }
31:
32: public SortedSet getAddedColumns() {
33: return _addedColumns;
34: }
35:
36: public boolean addAddedColumn(Column column) {
37: if (_addedColumns == null)
38: _addedColumns = new TreeSet();
39: return _addedColumns.add(column);
40: }
41:
42: public ListMap getModifiedColumns() {
43: return _modifiedColumns;
44: }
45:
46: public Object putModifiedColumns(Column reference, Column modified) {
47: if (_modifiedColumns == null)
48: _modifiedColumns = new ListMap();
49: return _modifiedColumns.put(reference, modified);
50: }
51:
52: public SortedSet getRemovedColumns() {
53: return _removedColumns;
54: }
55:
56: public boolean addRemovedColumn(Column column) {
57: if (_removedColumns == null)
58: _removedColumns = new TreeSet();
59: return _removedColumns.add(column);
60: }
61: }
|