예제 #1
0
파일: port.go 프로젝트: axel-freesp/sge
func (p *port) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	parentId := tree.Parent(cursor)
	if tree.Property(parentId).IsReadOnly() {
		prop = freesp.PropertyNew(false, false, false)
	} else {
		prop = freesp.PropertyNew(true, false, false)
	}
	var kind tr.Symbol
	if p.Direction() == gr.InPort {
		kind = tr.SymbolInputPort
	} else {
		kind = tr.SymbolOutputPort
	}
	err := tree.AddEntry(cursor, kind, p.Name(), p, prop)
	if err != nil {
		log.Fatalf("port.AddToTree: FilesTreeStore.AddEntry() failed: %s\n", err)
	}
	child := tree.Append(cursor)
	t := p.SignalType()
	t.AddToTree(tree, child)
	for _, c := range p.Connections() {
		child = tree.Append(cursor)
		p.Connection(c).AddToTree(tree, child)
	}
	return
}
예제 #2
0
파일: port.go 프로젝트: axel-freesp/sge
func (p *port) treeAddNewObject(tree tr.TreeIf, cursor tr.Cursor, conn bh.ConnectionIf, otherPort bh.PortIf) (newCursor tr.Cursor) {
	newCursor = tree.Insert(cursor)
	conn.AddToTree(tree, newCursor)
	contextCursor := tree.Parent(tree.Parent(cursor))
	cCursor := tree.CursorAt(contextCursor, otherPort)
	cChild := tree.Append(cCursor)
	conn.AddToTree(tree, cChild)
	return
}
예제 #3
0
파일: process.go 프로젝트: axel-freesp/sge
func (p *process) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	prop := freesp.PropertyNew(true, true, true)
	err := tree.AddEntry(cursor, tr.SymbolProcess, p.Name(), p, prop)
	if err != nil {
		log.Fatalf("process.AddToTree error: AddEntry failed: %s\n", err)
	}
	for _, c := range p.InChannels() {
		child := tree.Append(cursor)
		c.AddToTree(tree, child)
	}
	for _, c := range p.OutChannels() {
		child := tree.Append(cursor)
		c.AddToTree(tree, child)
	}
}
예제 #4
0
파일: library.go 프로젝트: axel-freesp/sge
func (l *library) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	prop := freesp.PropertyNew(true, false, false)
	err := tree.AddEntry(cursor, tr.SymbolLibrary, l.Filename(), l, prop)
	if err != nil {
		log.Fatalf("bh.LibraryIf.AddToTree error: AddEntry failed: %s\n", err)
	}
	for _, t := range l.SignalTypes() {
		child := tree.Append(cursor)
		t.AddToTree(tree, child)
	}
	for _, t := range l.NodeTypes() {
		child := tree.Append(cursor)
		t.AddToTree(tree, child)
	}
}
예제 #5
0
파일: arch.go 프로젝트: axel-freesp/sge
func (a *arch) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	//log.Printf("arch.AddToTree: %s\n", a.Name())
	prop := freesp.PropertyNew(true, true, true)
	err := tree.AddEntry(cursor, tr.SymbolArch, a.Name(), a, prop)
	if err != nil {
		log.Fatalf("arch.AddToTree error: AddEntry failed: %s", err)
	}
	for _, t := range a.IOTypes() {
		child := tree.Append(cursor)
		t.AddToTree(tree, child)
	}
	for _, p := range a.Processes() {
		child := tree.Append(cursor)
		p.AddToTree(tree, child)
	}
}
예제 #6
0
파일: porttype.go 프로젝트: axel-freesp/sge
func (p *portType) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	parentId := tree.Parent(cursor)
	if tree.Property(parentId).IsReadOnly() {
		prop = freesp.PropertyNew(false, false, false)
	} else {
		prop = freesp.PropertyNew(true, true, true)
	}
	var kind tr.Symbol
	if p.Direction() == gr.InPort {
		kind = tr.SymbolInputPortType
	} else {
		kind = tr.SymbolOutputPortType
	}
	err := tree.AddEntry(cursor, kind, p.Name(), p, prop)
	if err != nil {
		log.Fatal("bh.PortTypeIf.AddToTree: FilesTreeStore.AddEntry() failed: %s\n", err)
	}
	child := tree.Append(cursor)
	p.SignalType().AddToTree(tree, child)
}
예제 #7
0
파일: nodetype.go 프로젝트: axel-freesp/sge
func (t *nodeType) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	parentId := tree.Parent(cursor)
	parent := tree.Object(parentId)
	switch parent.(type) {
	case bh.LibraryIf:
		prop = freesp.PropertyNew(true, true, true)
	case bh.NodeIf:
		prop = freesp.PropertyNew(false, false, false)
	default:
		log.Fatalf("nodeType.AddToTree error: invalid parent type %T\n", parent)
	}
	err := tree.AddEntry(cursor, tr.SymbolNodeType, t.TypeName(), t, prop)
	if err != nil {
		log.Fatalf("nodeType.AddToTree error: AddEntry failed: %s\n", err)
	}
	for _, impl := range t.Implementation() {
		child := tree.Append(cursor)
		impl.AddToTree(tree, child)
	}
	for _, pt := range t.InPorts() {
		child := tree.Append(cursor)
		pt.AddToTree(tree, child)
	}
	for _, pt := range t.OutPorts() {
		child := tree.Append(cursor)
		pt.AddToTree(tree, child)
	}
}
예제 #8
0
파일: node.go 프로젝트: axel-freesp/sge
func (n *node) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var prop tr.Property
	if isParentReadOnly(tree, cursor) {
		prop = freesp.PropertyNew(false, false, false)
	} else {
		prop = freesp.PropertyNew(true, true, true)
	}
	var image tr.Symbol
	if len(n.InPorts()) == 0 {
		image = tr.SymbolInputNode
	} else if len(n.OutPorts()) == 0 {
		image = tr.SymbolOutputNode
	} else {
		image = tr.SymbolProcessingNode
	}
	err := tree.AddEntry(cursor, image, n.Name(), n, prop)
	if err != nil {
		log.Fatalf("node.AddToTree error: AddEntry failed: %s\n", err)
	}
	child := tree.Append(cursor)
	n.ItsType().AddToTree(tree, child)
	for _, p := range n.InPorts() {
		child := tree.Append(cursor)
		p.AddToTree(tree, child)
	}
	for _, p := range n.OutPorts() {
		child := tree.Append(cursor)
		p.AddToTree(tree, child)
	}
}
예제 #9
0
func (t *signalGraphType) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	for _, n := range t.InputNodes() {
		child := tree.Append(cursor)
		n.AddToTree(tree, child)
	}
	for _, n := range t.OutputNodes() {
		child := tree.Append(cursor)
		n.AddToTree(tree, child)
	}
	for _, n := range t.ProcessingNodes() {
		child := tree.Append(cursor)
		n.AddToTree(tree, child)
	}
}
예제 #10
0
파일: mapping.go 프로젝트: axel-freesp/sge
func (m *mapping) AddToTree(tree tr.TreeIf, cursor tr.Cursor) {
	var child tr.Cursor
	err := tree.AddEntry(cursor, tr.SymbolMappings, m.Filename(), m, freesp.MayAddObject)
	if err != nil {
		log.Fatalf("mapping.AddToTree error: AddEntry failed: %s\n", err)
	}
	child = tree.Append(cursor)
	m.graph.AddToTree(tree, child)
	child = tree.Append(cursor)
	m.platform.AddToTree(tree, child)
	for _, nId := range m.MappedIds() {
		log.Printf("mapping.AddToTree: id=%s\n", nId.String())
		melem, ok := m.MappedElement(nId)
		if !ok {
			log.Fatal("mapping) AddToTree internal error: inconsistent maplist")
		}
		child = tree.Append(cursor)
		melem.AddToTree(tree, child)
	}
}