Skip to content

Package: Internet

Internet

nameinstructionbranchcomplexitylinemethod
Internet(Point, ConnectingType)
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
Internet(Point, ConnectingType, VariableAssignment)
M: 0 C: 36
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
accept(ItemVisitor)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
acceptConnectVisitor(ConnectVisitor)
M: 0 C: 1
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
acceptConnectingTypeVisitor(ConnectingTypeVisitor)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getConnectingType()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
giveImage()
M: 18 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
setConnectingType(ConnectingType)
M: 0 C: 20
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%

Coverage

1: package networkconfigurator.item;
2:
3: import java.awt.Point;
4: import java.awt.image.BufferedImage;
5: import java.io.File;
6: import java.io.IOException;
7:
8: import javax.imageio.ImageIO;
9:
10: import model.assignment.VariableAssignment;
11: import networkconfigurator.DetailBarLabel;
12: import networkconfigurator.DetailBarPropertyEntry;
13: import networkconfigurator.DetailDrawPropertyEntry;
14:
15: /**
16: * Internet node.
17: *
18: * @author Erik Arand
19: */
20: public class Internet extends NonRoutable {
21:         /**
22:          * Type of connection.
23:          */
24:         private ConnectingType connectingType;
25:
26:         /**
27:          * normal getter.
28:          *
29:          * @return the type of connection.
30:          */
31:         public ConnectingType getConnectingType() {
32:                 return connectingType;
33:         }
34:
35:         /**
36:          * Constructor.
37:          *
38:          * @param p
39:          * the point
40:          * @param type
41:          * the connecting type.
42:          */
43:         public Internet(final Point p, final ConnectingType type) {
44:                 super();
45:                 this.setPoint(p);
46:                 setBoundary();
47:                 this.setName(NcNodeConstants.INTERNET);
48:                 this.setConnectingType(type);
49:         }
50:
51:         /**
52:          * normal setter.
53:          *
54:          * @param connectingType
55:          * the new type of connection.
56:          */
57:         public void setConnectingType(final ConnectingType connectingType) {
58:                 this.getPropertyDraw().clear();
59:                 this.connectingType = connectingType;
60:                 this.getPropertyDraw().add(new DetailDrawPropertyEntry(this.connectingType, "", 0,
61:                                 NcNodeConstants.NUMBER_PRIMARY, NcNodeConstants.RED));
62:         }
63:
64:         /**
65:          * Constructor with name.
66:          *
67:          * @param p
68:          * the point.
69:          * @param type
70:          * the connecting type.
71:          * @param name
72:          * the name of the internet.
73:          */
74:         public Internet(final Point p, final ConnectingType type, final VariableAssignment name) {
75:                 this(p, type);
76:                 this.setName(name.getValue());
77:                 this.getPropertyBar().add(new DetailBarPropertyEntry(new DetailBarLabel("Name")));
78:                 this.getPropertyBar().add(new DetailBarPropertyEntry(name));
79:                 this.getPropertyDraw().add(new DetailDrawPropertyEntry(name));
80:         }
81:
82:         @Override
83:         public void accept(final ItemVisitor visitor) {
84:                 visitor.internet(this);
85:         }
86:
87:         @Override
88:         public BufferedImage giveImage() {
89:                 try {
90:                         return ImageIO.read(new File(NcNodeConstants.PACKAGE_ICONS + "internet.png"));
91:                 } catch (final IOException e) {
92:                         e.printStackTrace();
93:                 }
94:                 return null;
95:         }
96:
97:         @Override
98:         public void acceptConnectingTypeVisitor(final ConnectingTypeVisitor visitor) {
99:                 visitor.internet(this);
100:         }
101:
102:         @Override
103:         public void acceptConnectVisitor(final ConnectVisitor visitor) {
104:         }
105:
106: }