new model for links
This commit is contained in:
parent
9cd8af282f
commit
8c5e75855e
47
docs/UML/diag_class_links.puml
Normal file
47
docs/UML/diag_class_links.puml
Normal file
@ -0,0 +1,47 @@
|
||||
@startuml class_links
|
||||
|
||||
class LinkGraph {
|
||||
|
||||
+ []Link links
|
||||
|
||||
+ void AddLinkToGraph(Link link)
|
||||
+ boolean,str HasPrevious(Link)
|
||||
+ boolean,str HasNext(Link)
|
||||
|
||||
}
|
||||
|
||||
class Link {
|
||||
+ str source
|
||||
+ str destination
|
||||
+ boolean DCLink
|
||||
|
||||
+ *Link NewLink(interface{} src, interface{} dst)
|
||||
+ void AddLinkToDataCenter()
|
||||
}
|
||||
|
||||
|
||||
note left of LinkGraph::HasPrevious
|
||||
checks if the component whose ID is in src is the dst of
|
||||
any other Link of the list on Link
|
||||
end note
|
||||
|
||||
note top of Link
|
||||
Links need to be redefined in the sense that they are currently used
|
||||
both :
|
||||
- to connect a component to a DC
|
||||
- to represent the interractions between components
|
||||
end note
|
||||
|
||||
note right of Link::DCLink
|
||||
set at construction of the object and used to order the links
|
||||
end note
|
||||
|
||||
|
||||
note left of Link::NewLink
|
||||
Must test if the parameters check the type constraints
|
||||
and raise errors for the GUI if necessary
|
||||
end note
|
||||
|
||||
LinkGraph*--"links"Link
|
||||
|
||||
@enduml
|
26
models/links.go
Normal file
26
models/links.go
Normal file
@ -0,0 +1,26 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
type Link struct {
|
||||
source string
|
||||
destination string
|
||||
dcLink bool
|
||||
}
|
||||
|
||||
func NewLink(src interface{}, dst interface{}) (link Link) {
|
||||
// Check type with reflect and get ID
|
||||
typeSrc := reflect.TypeOf(src)
|
||||
typeDst := reflect.TypeOf(dst)
|
||||
|
||||
fmt.Println("src is %s\ndst is %s",typeSrc,typeDst)
|
||||
return
|
||||
}
|
||||
|
||||
func (l *Link) AddLinkToDataCenter(component interface{}) {
|
||||
// if the component has a DataCenter id attribute then add it (switch on type)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user