def chat(self,
          lat="00.00000000",
          lon='00.00000000',
          le="9999999.0",
          ce="9999999.0",
          hae="00.00000000",
          isChat=1,
          chatType=None,
          senderCallsign=None,
          chatroom=None,
          groupOwner=None,
          id=None,
          parent=None,
          uid0=None,
          uid1=None):
     event = Event(connType='chat',
                   chatType=chatType,
                   senderCallsign=senderCallsign,
                   chatroom=chatroom,
                   groupOwner=groupOwner,
                   id=id,
                   parent=parent,
                   uid0=uid0,
                   uid1=uid1,
                   chatgrpid=chatgrpid,
                   lat=lat,
                   lon=lon,
                   le=le,
                   ce=ce,
                   hae=hae)
     return event
 def timeout(self,
             lat="00.00000000",
             lon='00.00000000',
             le="9999999.0",
             ce="9999999.0",
             hae="00.00000000",
             linkuid='abc',
             linktype='a-f-G-U-C',
             linkrelation='p-p',
             eventhow='h-g-i-g-o',
             eventuid=None):
     event = Event(eventhow=eventhow,
                   eventuid=eventuid,
                   eventType='timeout',
                   eventconnType='timeout',
                   linkType='timeout',
                   pointlat=lat,
                   pointlon=lon,
                   pointle=le,
                   pointce=ce,
                   pointhae=hae,
                   linkuid=linkuid,
                   linktype=linktype,
                   linkrelation=linkrelation)
     return event
Exemple #3
0
def parse_event(event_elem, symbol_table, file_name, counter):
    event_type = event_elem.find('type')
    event_name = event_elem.find('name')
    event_value = event_elem.find('value')
    event_date = event_elem.find('date')
    if event_type is None or event_name is None or event_value is None or event_date is None:
        raise ValueError(
            "An event must consist of name, type, value, date elements, one is missing in "
            + file_name + " at " + str(counter) + " , Sir")
    if event_type.text == "" or event_name.text == "" or event_value.text == "" or event_date.text == "":
        raise ValueError(
            "An event must consist of name, type, value, date elements, one is empty in "
            + file_name + " at " + str(counter) + " , Sir")
    symbol_id = None
    if event_type.text == EventType.CURRENCY.name:
        symbol_id = symbol_table.get_currency(event_name.text)
    elif event_type.text == EventType.STOCK.name:
        symbol_id = symbol_table.get_stock(event_name.text)
    else:
        raise ValueError(
            "Terribly sorry Sir, but type must be CURRENCY or STOCK in " +
            file_name + " at " + str(counter))
    if not dateConv.is_date_str_valid_format(event_date.text):
        raise ValueError(
            "Terribly sorry Sir, but date format is incorrect. It should be yyyy.MM.dd in "
            + file_name + " at " + str(counter))
    return Event(event_type.text, event_date.text, symbol_id,
                 float(event_value.text))
 def ping(self,
          lat="00.00000000",
          lon='00.00000000',
          le="9999999.0",
          ce="9999999.0",
          hae="00.00000000"):
     event = Event(eventconnType=conn.PING,
                   eventisPing=1,
                   pointlat=lat,
                   pointlon=lon,
                   pointle=le,
                   pointce=ce,
                   pointhae=hae)
     return event
Exemple #5
0
 def test_getCorrectEvents(self):
     symbol_table = SymbolsTable()
     symbol_table.add_currency('YUA')
     symbol_table.add_currency('USD')
     symbol_table.add_stock('CocaCola')
     symbol_table.add_stock('NukaCola')
     parsed_file = open("rule.txt")
     lexer = Lexer(parsed_file)
     controller = RealityController()
     controller.world.current_day = dC.to_date('2016.05.16')
     controller.world.add_currency(Currency('yuan', 'YUA', 0))
     controller.world.add_currency(Currency('usa dollar', 'USD', 1))
     controller.world.add_stock(Stock('CocaCola', 1, 0))
     controller.world.add_stock(Stock('NukaCola', 1, 1))
     controller.add_event(Event(EventType.CURRENCY, '2016.05.16', 0, 500))
     controller.add_event(Event(EventType.CURRENCY, '2016.05.15', 0, 400))
     controller.add_event(Event(EventType.STOCK, '2016.05.16', 0, 500))
     controller.add_event(Event(EventType.STOCK, '2016.05.15', 0, 400))
     controller.add_event(Event(EventType.STOCK, '2016.05.14', 0, 400))
     controller.add_event(Event(EventType.STOCK, '2016.05.13', 0, 400))
     Parser.RuleParser.parse_from_lexer(lexer, symbol_table, controller)
     rule = controller.rules.get(1)
     print(rule.priority)
Exemple #6
0
 def saveToDb(self, name, description, startDate, endDate):
     account = Event(name, description, startDate, endDate)
     self.dao.write(account)
 def sendGeoChatToTeam(self):
     """this will send the geochat to team
     """
     event = Event('GeoToTeam', messagetext, callsign)
 def sendGeoChatToGroup(self):
     event = Event('GeoToGroup', messagetext, callsign)
 def sendGeoChatToAllChatRooms(self):
     event = Event('GeoToAllRooms', messagetext, callsign)
 def dropPin(self):
    event = Event('dropPin', 123, 123)
Exemple #11
0
 def chat(self, chatType = None, senderCallsign = None, chatroom = None, groupOwner = None, id = None, parent = None, chatgrpuid0 = None, chatgrpuid1 = None, chatgrpid = None):
     event = Event(connType = 'chat', chatType = chatType, senderCallsign = senderCallsign, chatroom = chatroom, groupOwner = groupOwner, id = id, parent = parent, chatgrpuid0 = chatgrpuid0, chatgrpuid1 = chatgrpuid1, chatgrpid = chatgrpid)
     return event
Exemple #12
0
 def ping(self, lat, lon):
    event = Event(conn.PING, lat, lon) 
    return event