mirror of
https://github.com/duanhf2012/origin.git
synced 2026-03-12 10:38:58 +08:00
优化代码
This commit is contained in:
@@ -21,33 +21,33 @@ func (g *GetVariablesNode) GetName() string {
|
||||
return g.nodeName
|
||||
}
|
||||
|
||||
func (g *GetVariablesNode) Exec() error {
|
||||
func (g *GetVariablesNode) Exec() (int, error) {
|
||||
port := g.gr.variables[g.varName]
|
||||
if port == nil {
|
||||
return fmt.Errorf("variable %s not found,node name %s", g.varName, g.nodeName)
|
||||
return -1, fmt.Errorf("variable %s not found,node name %s", g.varName, g.nodeName)
|
||||
}
|
||||
|
||||
if !g.SetOutPort(0, port) {
|
||||
return fmt.Errorf("set out port failed,node name %s", g.nodeName)
|
||||
return -1, fmt.Errorf("set out port failed,node name %s", g.nodeName)
|
||||
}
|
||||
|
||||
return nil
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (g *SetVariablesNode) GetName() string {
|
||||
return g.nodeName
|
||||
}
|
||||
|
||||
func (g *SetVariablesNode) Exec() error {
|
||||
func (g *SetVariablesNode) Exec() (int, error) {
|
||||
port := g.GetInPort(0)
|
||||
if port == nil {
|
||||
return fmt.Errorf("get in port failed,node name %s", g.nodeName)
|
||||
return -1, fmt.Errorf("get in port failed,node name %s", g.nodeName)
|
||||
}
|
||||
|
||||
g.gr.variables[g.varName] = port
|
||||
if !g.SetOutPort(0, port) {
|
||||
return fmt.Errorf("set out port failed,node name %s", g.nodeName)
|
||||
return -1, fmt.Errorf("set out port failed,node name %s", g.nodeName)
|
||||
}
|
||||
|
||||
return nil
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user