/
NodeShapeImpl.java
51 lines (40 loc) · 1000 Bytes
/
NodeShapeImpl.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.ojn.gexf4j.core.impl.viz;
import static com.google.common.base.Preconditions.*;
import com.ojn.gexf4j.core.viz.NodeShape;
import com.ojn.gexf4j.core.viz.NodeShapeEntity;
public class NodeShapeImpl implements NodeShapeEntity {
private NodeShape shape = NodeShape.NOTSET;
private String uri = null;
public NodeShapeImpl() {
// do nothing
}
@Override
public NodeShapeEntity clearUri() {
uri = null;
return this;
}
@Override
public NodeShape getNodeShape() {
return shape;
}
@Override
public String getUri() {
checkState(hasUri(), "URI has not been set.");
return uri;
}
@Override
public boolean hasUri() {
return (uri != null);
}
@Override
public NodeShapeEntity setNodeShape(NodeShape shape) {
checkArgument(shape != NodeShape.NOTSET, "Node Shape cannot be NOTSET.");
this.shape = shape;
return this;
}
@Override
public NodeShapeEntity setUri(String uri) {
checkArgument(uri != null, "URI cannot be set to null.");
return this;
}
}