本文整理匯總了Golang中github.com/axel-freesp/sge/interface/behaviour.PortIf.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang PortIf.Name方法的具體用法?Golang PortIf.Name怎麽用?Golang PortIf.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/axel-freesp/sge/interface/behaviour.PortIf
的用法示例。
在下文中一共展示了PortIf.Name方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Connection
func (p *port) Connection(c bh.PortIf) bh.ConnectionIf {
_, ok, index := p.connected.Find(c.Node().Name(), c.Name())
if !ok {
log.Fatalf("port.bh.ConnectionIf error: port %v not in connected list of port %v\n", c, p)
}
return p.conn[index]
}
示例2: AddNewObject
func (t *signalGraphType) AddNewObject(tree tr.TreeIf, cursor tr.Cursor, obj tr.TreeElementIf) (newCursor tr.Cursor, err error) {
switch obj.(type) {
case bh.NodeIf:
// TODO: Check if IO node and exists: copy position only and return
n := obj.(bh.NodeIf)
err = t.AddNode(n)
if err != nil {
err = fmt.Errorf("signalGraphType.AddNewObject error: %s", err)
nt := n.ItsType().(*nodeType)
if nt != nil {
ok, _ := nt.instances.Find(n)
if ok {
nt.instances.Remove(n)
}
}
return
}
newCursor = t.treeAddNewObject(tree, cursor, n)
parent := tree.Object(cursor)
switch parent.(type) {
case bh.SignalGraphIf:
case bh.ImplementationIf:
// propagate new node to all instances of embracing type
pCursor := tree.Parent(cursor)
nt := tree.Object(pCursor)
for _, nn := range nt.(bh.NodeTypeIf).Instances() {
nCursor := tree.Cursor(nn)
tCursor := tree.CursorAt(nCursor, parent)
tCursor.Position = cursor.Position
t.treeAddNewObject(tree, tCursor, n)
}
default:
log.Fatalf("signalGraphType.AddNewObject error: wrong parent type %T: %v\n", parent, parent)
}
case bh.ConnectionIf:
conn := obj.(bh.ConnectionIf)
var n bh.NodeIf
var p bh.PortIf
for _, n = range t.Nodes() {
if n.Name() == conn.From().Node().Name() {
nCursor := tree.CursorAt(cursor, n)
for _, p = range n.OutPorts() {
if conn.From().Name() == p.Name() {
pCursor := tree.CursorAt(nCursor, p)
return p.AddNewObject(tree, pCursor, obj)
}
}
}
}
default:
log.Fatalf("signalGraphType.AddNewObject error: wrong type %t: %v\n", obj, obj)
}
return
}
示例3: RemoveConnection
func (p *port) RemoveConnection(c bh.PortIf) {
_, ok, index := p.connected.Find(c.Node().Name(), c.Name())
if !ok {
log.Fatalf("port.bh.ConnectionIf error: port %v not in connected list of port %v\n", c, p)
}
p.connected.Remove(c)
for index++; index < len(p.conn); index++ {
p.conn[index-1] = p.conn[index]
}
p.conn = p.conn[:len(p.conn)-1]
}
示例4: treeRemoveInstObject
// Remove object mirrored in all instance node type
func (t *nodeType) treeRemoveInstObject(tree tr.TreeIf, cursor tr.Cursor) (removed []tr.IdWithObject) {
parentId := tree.Parent(cursor)
if t != tree.Object(parentId) {
log.Fatal("nodeType.RemoveObject error: not removing child of mine.")
}
obj := tree.Object(cursor)
switch obj.(type) {
case bh.ImplementationIf:
for _, n := range t.Instances() {
nCursor := tree.Cursor(n)
tCursor := tree.CursorAt(nCursor, t)
iCursor := tree.CursorAt(tCursor, obj)
iCursor.Position = cursor.Position
tree.Remove(iCursor)
}
case bh.PortTypeIf:
nt := obj.(bh.PortTypeIf)
for _, n := range t.Instances() {
var p bh.PortIf
var list []bh.PortIf
nCursor := tree.Cursor(n)
if nt.Direction() == gr.InPort {
list = n.InPorts()
} else {
list = n.OutPorts()
}
for _, p = range list {
if p.Name() == nt.Name() {
break
}
}
_ = p.(*port)
pCursor := tree.CursorAt(nCursor, p)
prefix, index := tree.Remove(pCursor)
removed = append(removed, tr.IdWithObject{prefix, index, p})
tCursor := tree.CursorAt(nCursor, obj)
del := t.treeRemoveObject(tree, tCursor)
for _, d := range del {
removed = append(removed, d)
}
tree.Remove(tCursor)
}
default:
log.Fatalf("nodeType.RemoveObject error: invalid type %T\n", obj)
}
return
}
示例5: Remove
func (l *portList) Remove(p bh.PortIf) {
var i int
for i = range l.ports {
if p.Node().Name() == l.ports[i].Node().Name() && p.Name() == l.ports[i].Name() {
break
}
}
if i >= len(l.ports) {
for _, v := range l.ports {
log.Printf("portList.RemovePort have bh.PortIf %v\n", v)
}
log.Fatalf("portList.RemovePort error: bh.PortIf %v not in this list\n", p)
}
for i++; i < len(l.ports); i++ {
l.ports[i-1] = l.ports[i]
}
l.ports = l.ports[:len(l.ports)-1]
}
示例6: SelectPort
func (n *Node) SelectPort(port bh.PortIf) {
var index int
if port.Direction() == gr.InPort {
index = n.InPortIndex(port.Name())
} else {
index = n.OutPortIndex(port.Name())
if index >= 0 {
index += n.NumInPorts()
}
}
for i, p := range n.ports {
if i == index {
p.Select()
} else {
p.Deselect()
}
}
n.selectedPort = index
}
示例7: CreateXmlOutPort
func CreateXmlOutPort(p bh.PortIf) (xmlp *backend.XmlOutPort) {
xmlp = backend.XmlOutPortNew(p.Name(), p.SignalType().TypeName())
xmlp.Entry = freesp.CreateXmlModePosition(p).Entry
return
}