aboutsummaryrefslogtreecommitdiff
path: root/behaviors/VerticalBar.py
blob: e1a67fe0078953ff9e166a191e9cbeac49adaea4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from operationscore.Behavior import *
class VerticalBar(Behavior):

    def processResponse(self, inputs, recurs):

        ret = []
        for inputset in inputs:
            #import pdb; pdb.set_trace()
            
            if 'xLoc' not in inputset:
                inputset['xLoc'] = inputset['Location'][0]
            xLoc = inputset['xLoc']

            condition = '{x} == ' + str(xLoc)
            
            if self['Combine']:
                inputset['Location'] += ',' + condition
            else:
                inputset['Location'] = condition 

            ret.append(inputset)

        return (ret, [])

    def setLastOutput(self, output):

        coutput = Behavior.deepCopyPacket(output)
        for data in coutput:
            data['Location'] = data['xLoc']
        return coutput