mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
优化执行结点
This commit is contained in:
@@ -12,7 +12,7 @@ func TestExecMgr(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
graphTest1 := bp.Create("testSwitch")
|
graphTest1 := bp.Create("testSwitch")
|
||||||
err = graphTest1.Do(EntranceID_IntParam, 2, 1, 3)
|
err = graphTest1.Do(EntranceID_IntParam, 20, 1, 3)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Do EntranceID_IntParam failed,err:%v", err)
|
t.Fatalf("Do EntranceID_IntParam failed,err:%v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,14 @@ func (en *execNode) GetInPortDefaultIntArrayValue(index int) []int64 {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return val.([]int64)
|
var arrayInt []int64
|
||||||
|
arrayVal := val.([]any)
|
||||||
|
for i := range arrayVal {
|
||||||
|
if intVal, ok := arrayVal[i].(float64); ok {
|
||||||
|
arrayInt = append(arrayInt, int64(intVal))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arrayInt
|
||||||
}
|
}
|
||||||
|
|
||||||
func (en *execNode) GetInPortDefaultStringArrayValue(index int) []string {
|
func (en *execNode) GetInPortDefaultStringArrayValue(index int) []string {
|
||||||
|
|||||||
@@ -408,7 +408,6 @@ func (em *RangeCompare) GetName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (em *RangeCompare) Exec() (int, error) {
|
func (em *RangeCompare) Exec() (int, error) {
|
||||||
|
|
||||||
inPortA := em.GetInPort(1)
|
inPortA := em.GetInPort(1)
|
||||||
if inPortA == nil {
|
if inPortA == nil {
|
||||||
return -1, fmt.Errorf("GreaterThanInteger inParam 1 not found")
|
return -1, fmt.Errorf("GreaterThanInteger inParam 1 not found")
|
||||||
@@ -424,8 +423,8 @@ func (em *RangeCompare) Exec() (int, error) {
|
|||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range intArray {
|
for i := 0; i < len(intArray) && i < em.GetOutPortCount()-2; i++ {
|
||||||
if intArray[i] <= ret {
|
if ret <= intArray[i] {
|
||||||
return i + 2, nil
|
return i + 2, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user