本文整理汇总了Golang中github.com/axel-freesp/sge/interface/behaviour.NodeIf.Name方法的典型用法代码示例。如果您正苦于以下问题:Golang NodeIf.Name方法的具体用法?Golang NodeIf.Name怎么用?Golang NodeIf.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/axel-freesp/sge/interface/behaviour.NodeIf
的用法示例。
在下文中一共展示了NodeIf.Name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CreateXmlIONodePosHint
func CreateXmlIONodePosHint(n bh.NodeIf, path string) (xmln *backend.XmlNodePosHint) {
if len(path) == 0 {
xmln = backend.XmlNodePosHintNew(n.Name())
} else {
xmln = backend.XmlNodePosHintNew(fmt.Sprintf("%s/%s", path, n.Name()))
}
empty := image.Point{}
for _, p := range n.PathList() {
for _, m := range gr.ValidModes {
xmlp := string(gr.CreatePathMode(p, m))
pos := n.PathModePosition(p, m)
if pos != empty {
xmln.Entry = append(xmln.Entry, *backend.XmlModeHintEntryNew(xmlp, pos.X, pos.Y))
}
}
}
for _, p := range n.InPorts() {
xmlp := backend.XmlPortPosHintNew(p.Name())
xmlp.Entry = freesp.CreateXmlModePosition(p).Entry
xmln.InPorts = append(xmln.InPorts, *xmlp)
}
for _, p := range n.OutPorts() {
xmlp := backend.XmlPortPosHintNew(p.Name())
xmlp.Entry = freesp.CreateXmlModePosition(p).Entry
xmln.OutPorts = append(xmln.OutPorts, *xmlp)
}
return
}
示例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: CreateXmlProcessingNode
func CreateXmlProcessingNode(n bh.NodeIf) *backend.XmlProcessingNode {
ret := backend.XmlProcessingNodeNew(n.Name(), n.ItsType().TypeName())
for _, p := range n.InPorts() {
ret.InPort = append(ret.InPort, *CreateXmlInPort(p))
}
for _, p := range n.OutPorts() {
ret.OutPort = append(ret.OutPort, *CreateXmlOutPort(p))
}
return ret
}
示例4: CreateXmlOutputNode
func CreateXmlOutputNode(n bh.NodeIf) *backend.XmlOutputNode {
tName := n.ItsType().TypeName()
if strings.HasPrefix(tName, "autoOutputNodeType-") {
tName = ""
}
ret := backend.XmlOutputNodeNew(n.Name(), tName)
if n.(*node).portlink != nil {
ret.NPort = n.(*node).portlink.Name()
}
for _, p := range n.InPorts() {
ret.InPort = append(ret.InPort, *CreateXmlInPort(p))
}
return ret
}
示例5: addExpandedMappings
func addExpandedMappings(m mp.MappingIf, n bh.NodeIf, parentId bh.NodeIdIf) {
idlist := m.MappedIds()
nId := behaviour.NodeIdNew(parentId, n.Name())
for _, id := range idlist {
if nId.String() == id.String() {
return
}
}
melem := m.AddMapping(n, nId, nil)
melem.SetExpanded(true)
for _, impl := range n.ItsType().Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
for _, nn := range impl.Graph().ProcessingNodes() {
addExpandedMappings(m, nn, nId)
}
}
}
}
示例6: CreateXmlNodeMapList
func CreateXmlNodeMapList(m mp.MappingIf, n bh.NodeIf, path string) (xmln []backend.XmlNodeMap) {
p, ok := m.Mapped(n.Name())
if ok { // entire node is mapped to p:
pname := fmt.Sprintf("%s/%s", p.Arch().Name(), p.Name())
xmln = append(xmln, *CreateXmlNodeMap(path, pname))
}
nt := n.ItsType()
for _, impl := range nt.Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
for _, nn := range impl.Graph().ProcessingNodes() {
xmlnn := CreateXmlNodeMapList(m, nn, fmt.Sprintf("%s/%s", path, nn.Name()))
for _, x := range xmlnn {
xmln = append(xmln, x)
}
}
}
}
return
}
示例7: findNodeInIdList
func findNodeInIdList(n bh.NodeIf, parent bh.NodeIdIf, idlist []bh.NodeIdIf) bool {
nId := behaviour.NodeIdNew(parent, n.Name())
log.Printf("findNodeInIdList: n=%s, parent=%v\n", n.Name(), parent)
for _, id := range idlist {
if nId.String() == id.String() {
return true
}
}
for _, impl := range n.ItsType().Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
for _, nn := range impl.Graph().ProcessingNodes() {
if !findNodeInIdList(nn, nId, idlist) {
return false
}
}
return true
}
}
return false
}
示例8: CreateXmlNodePosHint
func CreateXmlNodePosHint(nd bh.NodeIf, path string) (xmln []backend.XmlNodePosHint) {
xmlnd := CreateXmlIONodePosHint(nd, path)
xmlnd.Expanded = nd.Expanded()
xmln = append(xmln, *xmlnd)
nt := nd.ItsType()
for _, impl := range nt.Implementation() {
if impl.ImplementationType() == bh.NodeTypeGraph {
for _, n := range impl.Graph().ProcessingNodes() {
var p string
if len(path) == 0 {
p = nd.Name()
} else {
p = fmt.Sprintf("%s/%s", path, nd.Name())
}
hintlist := CreateXmlNodePosHint(n, p)
for _, h := range hintlist {
xmln = append(xmln, h)
}
}
break
}
}
return
}
示例9: CreateObject
func (j *NewElementJob) CreateObject(fts *models.FilesTreeStore) (ret tr.TreeElementIf, err error) {
var parentObject tr.TreeElementIf
parentObject, err = fts.GetObjectById(j.parentId)
if err != nil {
log.Fatal("NewElementJob.CreateObject error: referenced parentObject run away...")
}
switch j.elemType {
case eNode, eInputNode, eOutputNode:
var context bh.SignalGraphTypeIf
switch parentObject.(type) {
case bh.NodeIf:
context = parentObject.(bh.NodeIf).Context()
j.parentId = getParentId(j.parentId)
case bh.SignalGraphIf:
context = parentObject.(bh.SignalGraphIf).ItsType()
case bh.SignalGraphTypeIf:
context = parentObject.(bh.SignalGraphTypeIf)
case bh.ImplementationIf:
if parentObject.(bh.ImplementationIf).ImplementationType() == bh.NodeTypeGraph {
context = parentObject.(bh.ImplementationIf).Graph()
} else {
log.Fatal("NewElementJob.CreateObject(eNode) error: parent implementation is no graph...")
}
default:
log.Fatal("NewElementJob.CreateObject(eNode) error: referenced parentObject wrong type...")
}
if j.elemType == eNode {
ntype, ok := freesp.GetNodeTypeByName(j.input[iNodeTypeSelect])
if !ok {
log.Fatal("NewElementJob.CreateObject(eNode) error: referenced parentObject type wrong...")
}
ret, err = behaviour.NodeNew(j.input[iNodeName], ntype, context)
} else if j.elemType == eInputNode {
ret, err = behaviour.InputNodeNew(j.input[iInputNodeName], j.input[iInputTypeSelect], context)
} else {
ret, err = behaviour.OutputNodeNew(j.input[iOutputNodeName], j.input[iOutputTypeSelect], context)
}
if len(j.extra) > 0 {
coords := strings.Split(j.extra, "|")
var x, y int
fmt.Sscanf(coords[0], "%d", &x)
fmt.Sscanf(coords[1], "%d", &y)
//pos := image.Point{x, y}
//log.Printf("NewElementJob.CreateObject(eNode) setting position %s: %v\n", j.extra, pos)
//ret.(bh.NodeIf).SetPosition(pos)
// TODO: SetModePosition...
}
case eNodeType:
var context string
switch parentObject.(type) {
case bh.NodeTypeIf:
context = parentObject.(bh.NodeTypeIf).DefinedAt()
j.parentId = getParentId(j.parentId)
case bh.SignalTypeIf:
j.parentId = getParentId(j.parentId)
parentObject, err = fts.GetObjectById(j.parentId)
context = parentObject.(bh.LibraryIf).Filename()
case bh.LibraryIf:
context = parentObject.(bh.LibraryIf).Filename()
default:
log.Fatal("NewElementJob.CreateObject(eNodeType) error: referenced parentObject wrong type...")
}
ret = behaviour.NodeTypeNew(j.input[iTypeName], context)
case eConnection:
switch parentObject.(type) {
case bh.PortIf:
case bh.SignalGraphTypeIf:
fromTo := strings.Split(j.extra, "/")
var n bh.NodeIf
for _, n = range parentObject.(bh.SignalGraphTypeIf).Nodes() {
if n.Name() == fromTo[0] {
for _, parentObject = range n.OutPorts() {
if parentObject.(bh.PortIf).Name() == fromTo[1] {
break
}
}
break
}
}
if parentObject == nil {
log.Fatalf("NewElementJob.CreateObject(eNodeType) error: no valid FROM port for edge job %v\n", j)
}
_ = parentObject.(bh.PortIf)
case bh.ImplementationIf:
fromTo := strings.Split(j.extra, "/")
var n bh.NodeIf
for _, n = range parentObject.(bh.ImplementationIf).Graph().Nodes() {
if n.Name() == fromTo[0] {
for _, parentObject = range n.OutPorts() {
if parentObject.(bh.PortIf).Name() == fromTo[1] {
break
}
}
break
}
}
if parentObject == nil {
log.Fatalf("NewElementJob.CreateObject(eNodeType) error: no valid FROM port for edge job %v\n", j)
//.........这里部分代码省略.........