@@ -52,7 +52,6 @@ export abstract class Device extends Container {
5252 readonly id : DeviceId ;
5353 readonly viewgraph : ViewGraph ;
5454 ctx : GlobalContext ;
55- connections = new Set < DeviceId > ( ) ;
5655
5756 mac : MacAddress ;
5857 arpTable : Map < IpAddress , MacAddress > = new Map < IpAddress , MacAddress > ( ) ;
@@ -132,25 +131,13 @@ export abstract class Device extends Container {
132131 this . addChild ( idText ) ; // Add the ID text as a child of the device
133132 }
134133
135- getConnections ( ) : DeviceId [ ] {
136- return Array . from ( this . connections . values ( ) ) ;
137- }
138-
139134 /// Returns the data needed to create the device
140135 getCreateDevice ( ) : CreateDevice {
141136 const node = this . viewgraph . getDataGraph ( ) . getDevice ( this . id ) ;
142137 const connections = this . viewgraph . getDataGraph ( ) . getConnections ( this . id ) ;
143138 return { id : this . id , node, connections } ;
144139 }
145140
146- addConnection ( adjacentId : DeviceId ) {
147- this . connections . add ( adjacentId ) ;
148- }
149-
150- removeConnection ( id : DeviceId ) {
151- this . connections . delete ( id ) ;
152- }
153-
154141 delete ( ) : void {
155142 this . viewgraph . removeDevice ( this . id ) ;
156143 console . log ( `Device ${ this . id } deleted` ) ;
@@ -172,16 +159,11 @@ export abstract class Device extends Container {
172159 this . parent . on ( "pointerup" , onPointerUp ) ;
173160 }
174161
162+ // TODO: why is this even here??
175163 connectTo ( adjacentId : DeviceId ) : boolean {
176164 // Connects both devices with an edge.
177- // console.log("Entered connectTo");
178-
179165 const edgeId = this . viewgraph . addEdge ( this . id , adjacentId ) ;
180166 if ( edgeId ) {
181- const adjacentDevice = this . viewgraph . getDevice ( adjacentId ) ;
182- this . addConnection ( adjacentId ) ;
183- adjacentDevice . addConnection ( this . id ) ;
184-
185167 // Register move
186168 const move = new AddEdgeMove ( this . viewgraph . getLayer ( ) , {
187169 n1 : this . id ,
@@ -277,7 +259,6 @@ export abstract class Device extends Container {
277259
278260 destroy ( ) {
279261 // Clear connections
280- this . connections . clear ( ) ;
281262 deselectElement ( ) ;
282263 super . destroy ( ) ;
283264 }
0 commit comments