]> gerrit.simantics Code Review - simantics/platform.git/blob
3c1a4ff255862150bd0b6eceec91262bb3fde82b
[simantics/platform.git] /
1 package org.simantics.spreadsheet.graph;
2
3 import java.util.Collections;
4 import java.util.Map;
5
6 public class SpreadsheetCellContent implements SheetNode {
7
8         public final SpreadsheetCell cell;
9         
10         public SpreadsheetCellContent(SpreadsheetCell cell) {
11                 this.cell = cell;
12         }
13         
14         @Override
15         public String getName() {
16                 return "content";
17         }
18
19         @Override
20         public Map getChildren() {
21                 return Collections.emptyMap();
22         }
23
24         @Override
25         public Map getProperties() {
26                 if(cell.hasExpression()) {
27                         return Collections.singletonMap("expression", new SpreadsheetCellContentExpression(cell));
28                 } else {
29                         return Collections.emptyMap();
30                 }
31         }
32
33     @Override
34     public int hashCode() {
35         final int prime = 31;
36         int result = 1;
37         result = prime * result + ((cell == null) ? 0 : cell.hashCode());
38         return result;
39     }
40
41     @Override
42     public boolean equals(Object obj) {
43         if (this == obj)
44             return true;
45         if (obj == null)
46             return false;
47         if (getClass() != obj.getClass())
48             return false;
49         SpreadsheetCellContent other = (SpreadsheetCellContent) obj;
50         if (cell == null) {
51             if (other.cell != null)
52                 return false;
53         } else if (!cell.equals(other.cell))
54             return false;
55         return true;
56     }
57
58 }