冗余代码调整
This commit is contained in:
parent
13c25c0ba8
commit
8e20a049a4
32
repo/repo.go
32
repo/repo.go
@ -174,38 +174,28 @@ func NewLinkNodeAndLinkAndBuildLinkship(ta model.Turnout, tap model.PipePort, tb
|
||||
nodeb = repo1.getOrBuildLinkNode(tb)
|
||||
pla = nil
|
||||
plb = model.NewPipeLink(nodeb, tbp)
|
||||
exist, link = repo1.isLinkExist(pla, plb)
|
||||
if exist {
|
||||
return
|
||||
}
|
||||
link = model.NewLink(pla, plb)
|
||||
link.SetLinkedElement(model.PipePortB, plb)
|
||||
nodeb.SetLinkedElement(tbp, model.NewPipeLink(link, model.PipePortB))
|
||||
} else if tb == nil {
|
||||
nodea = repo1.getOrBuildLinkNode(ta)
|
||||
nodeb = nil
|
||||
pla = model.NewPipeLink(nodea, tap)
|
||||
plb = nil
|
||||
exist, link = repo1.isLinkExist(pla, plb)
|
||||
if exist {
|
||||
return
|
||||
}
|
||||
link = model.NewLink(pla, plb)
|
||||
link.SetLinkedElement(model.PipePortA, pla)
|
||||
nodea.SetLinkedElement(tap, model.NewPipeLink(link, model.PipePortA))
|
||||
} else {
|
||||
nodea = repo1.getOrBuildLinkNode(ta)
|
||||
nodeb = repo1.getOrBuildLinkNode(tb)
|
||||
pla = model.NewPipeLink(nodea, tap)
|
||||
plb = model.NewPipeLink(nodeb, tbp)
|
||||
exist, link = repo1.isLinkExist(pla, plb)
|
||||
if exist {
|
||||
return
|
||||
}
|
||||
link = model.NewLink(pla, plb)
|
||||
link.SetLinkedElement(model.PipePortA, pla)
|
||||
link.SetLinkedElement(model.PipePortB, plb)
|
||||
}
|
||||
exist, link = repo1.isLinkExist(pla, plb)
|
||||
if exist {
|
||||
return
|
||||
}
|
||||
link = model.NewLink(pla, plb)
|
||||
link.SetLinkedElement(model.PipePortA, pla)
|
||||
link.SetLinkedElement(model.PipePortB, plb)
|
||||
if nodea != nil {
|
||||
nodea.SetLinkedElement(tap, model.NewPipeLink(link, model.PipePortA))
|
||||
}
|
||||
if nodeb != nil {
|
||||
nodeb.SetLinkedElement(tbp, model.NewPipeLink(link, model.PipePortB))
|
||||
}
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user