冗余代码调整
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)
|
nodeb = repo1.getOrBuildLinkNode(tb)
|
||||||
pla = nil
|
pla = nil
|
||||||
plb = model.NewPipeLink(nodeb, tbp)
|
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 {
|
} else if tb == nil {
|
||||||
nodea = repo1.getOrBuildLinkNode(ta)
|
nodea = repo1.getOrBuildLinkNode(ta)
|
||||||
nodeb = nil
|
nodeb = nil
|
||||||
pla = model.NewPipeLink(nodea, tap)
|
pla = model.NewPipeLink(nodea, tap)
|
||||||
plb = nil
|
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 {
|
} else {
|
||||||
nodea = repo1.getOrBuildLinkNode(ta)
|
nodea = repo1.getOrBuildLinkNode(ta)
|
||||||
nodeb = repo1.getOrBuildLinkNode(tb)
|
nodeb = repo1.getOrBuildLinkNode(tb)
|
||||||
pla = model.NewPipeLink(nodea, tap)
|
pla = model.NewPipeLink(nodea, tap)
|
||||||
plb = model.NewPipeLink(nodeb, tbp)
|
plb = model.NewPipeLink(nodeb, tbp)
|
||||||
exist, link = repo1.isLinkExist(pla, plb)
|
}
|
||||||
if exist {
|
exist, link = repo1.isLinkExist(pla, plb)
|
||||||
return
|
if exist {
|
||||||
}
|
return
|
||||||
link = model.NewLink(pla, plb)
|
}
|
||||||
link.SetLinkedElement(model.PipePortA, pla)
|
link = model.NewLink(pla, plb)
|
||||||
link.SetLinkedElement(model.PipePortB, plb)
|
link.SetLinkedElement(model.PipePortA, pla)
|
||||||
|
link.SetLinkedElement(model.PipePortB, plb)
|
||||||
|
if nodea != nil {
|
||||||
nodea.SetLinkedElement(tap, model.NewPipeLink(link, model.PipePortA))
|
nodea.SetLinkedElement(tap, model.NewPipeLink(link, model.PipePortA))
|
||||||
|
}
|
||||||
|
if nodeb != nil {
|
||||||
nodeb.SetLinkedElement(tbp, model.NewPipeLink(link, model.PipePortB))
|
nodeb.SetLinkedElement(tbp, model.NewPipeLink(link, model.PipePortB))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user