Revision 1546
Added by Jing Tao over 21 years ago
src/edu/ucsb/nceas/metacat/NodeRecord.java | ||
---|---|---|
31 | 31 |
* A utility class that encapsulates a node and its data |
32 | 32 |
*/ |
33 | 33 |
public class NodeRecord { |
34 |
public long nodeid; |
|
35 |
public long parentnodeid; |
|
36 |
public long nodeindex; |
|
34 |
public long nodeid = -1;
|
|
35 |
public long parentnodeid = -1;
|
|
36 |
public long nodeindex = -1;
|
|
37 | 37 |
public String nodename = null; |
38 | 38 |
public String nodeprefix = null; |
39 | 39 |
public String nodetype = null; |
... | ... | |
89 | 89 |
{ |
90 | 90 |
return nodedata; |
91 | 91 |
} |
92 |
|
|
93 |
/** Method compare two records */ |
|
94 |
public boolean contentEquals(NodeRecord record) |
|
95 |
{ |
|
96 |
boolean flag = true; |
|
97 |
|
|
98 |
if ((this.nodename == null && record.getNodeName() != null) || |
|
99 |
(this.nodename != null && record.getNodeName() == null) || |
|
100 |
(this.nodename != null && record.getNodeName() != null && |
|
101 |
!(this.nodename).equals(record.getNodeName()))) |
|
102 |
{ |
|
103 |
//compare nodename |
|
104 |
flag = false; |
|
105 |
} |
|
106 |
else if ((this.nodetype == null && record.getNodeType() != null) || |
|
107 |
(this.nodetype != null && record.getNodeType() == null) || |
|
108 |
(this.nodetype != null && record.getNodeType() != null && |
|
109 |
!(this.nodetype).equals(record.getNodeType()))) |
|
110 |
{ |
|
111 |
// compare node type |
|
112 |
flag = false; |
|
113 |
} |
|
114 |
else if ((this.nodeprefix == null && record.getNodePrefix() != null) || |
|
115 |
(this.nodeprefix != null && record.getNodePrefix() == null) || |
|
116 |
(this.nodeprefix != null && record.getNodePrefix() != null && |
|
117 |
!(this.nodeprefix).equals(record.getNodePrefix()))) |
|
118 |
{ |
|
119 |
// compare node prefix |
|
120 |
flag = false; |
|
121 |
} |
|
122 |
else if ((this.nodedata == null && record.getNodeData() != null) || |
|
123 |
(this.nodedata != null && record.getNodeData() == null) || |
|
124 |
(this.nodedata != null && record.getNodeData() != null && |
|
125 |
!(this.nodedata).equals(record.getNodeData()))) |
|
126 |
{ |
|
127 |
// compare node data |
|
128 |
flag = false; |
|
129 |
} |
|
130 |
return flag; |
|
131 |
|
|
132 |
}//contentEquals |
|
92 | 133 |
} |
Also available in: Unified diff
Add a contenEquals method.