当前位置: 首页>>代码示例>>Python>>正文


Python Integer.cast_方法代码示例

本文整理汇总了Python中java.lang.Integer.cast_方法的典型用法代码示例。如果您正苦于以下问题:Python Integer.cast_方法的具体用法?Python Integer.cast_怎么用?Python Integer.cast_使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.Integer的用法示例。


在下文中一共展示了Integer.cast_方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bigtest05

# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import cast_ [as 别名]
    def test_bigtest05(self):
        '''Get recids_hm_intint'''

        message = self.bridge.createMessage('bigtest') \
                    .setParam('action', 'recids_hm_intint') \
                    .setParam('size', self.size)
        self.bridge.sendMessage(message)
        res = HashMap.cast_(message.getResults())
        assert res.size() == self.size
        assert Integer.cast_(res.get(0)).equals(0)
        assert Integer.cast_(res.get(5)).equals(5)
开发者ID:lbjay,项目名称:montysolr,代码行数:13,代码来源:unittest_examples_bigtest.py

示例2: get_recids_changes

# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import cast_ [as 别名]
def get_recids_changes(message):
    """Retrieves the recids of the last changed documents"""
    last_recid = None
    table = 'bibrec'
    if message.getParam("table"):
        table = str(message.getParam("table"))
    if message.getParam("last_recid"):
        #last_recid = int(Integer.cast_(message.getParam("last_recid")).intValue())
        last_recid = int(str(message.getParam("last_recid")))
    mod_date = None
    if message.getParam("mod_date"):
        mod_date = str(message.getParam("mod_date"))
    max_records = 10000
    if message.getParam('max_records'):
        max_records = int(Integer.cast_(message.getParam("max_records")).intValue())
    if last_recid and last_recid == -1:
        mod_date = None
    (wid, results) = api_calls.dispatch("get_recids_changes", last_recid, max_recs=max_records, 
                                        mod_date=mod_date, table=table)
    if results:
        data, last_recid, mod_date = results
        out = HashMap() #.of_(String, JArray_int)
        for k,v in data.items():
            out.put(k, JArray_int(v))
        message.setResults(out)
        message.setParam('mod_date', mod_date)
        message.setParam('last_recid', last_recid)
开发者ID:lbjay,项目名称:montysolr,代码行数:29,代码来源:targets.py

示例3: diagnostic_test

# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import cast_ [as 别名]
def diagnostic_test(message):
    out = []
    message.setParam("query", "boson")
    perform_request_search_ints(message)
    res = JArray_int.cast_(message.getResults())
    out.append('Search for "boson" retrieved: %s hits' % len(res) )
    out.append('Total hits: %s' % Integer.cast_(message.getParam("total")))
    message.setResults('\n'.join(out))
开发者ID:lbjay,项目名称:montysolr,代码行数:10,代码来源:targets.py

示例4: xtest_bigtest05

# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import cast_ [as 别名]
    def xtest_bigtest05(self):
        '''Get recids_hm_intint -- TODO: move to demotest,
        it will not work, because it needs solr instance'''

        #req = QueryRequest()
        size = self.size
        hm = HashMap().of_(String, String)
        hm.put('action', 'recids_hm_intint')
        hm.put('size', str(size))
        params = MapSolrParams(hm)
        req = LocalSolrQueryRequest(self.core, params)
        rsp = SolrQueryResponse()

        message = self.bridge.createMessage('bigtest_www') \
                    .setParam('response', rsp) \
                    .setParam('request', req)

        self.bridge.sendMessage(message)

        res = HashMap.cast_(message.getResults())
        assert res.size() == self.size
        assert Integer.cast_(res.get(0)).equals(0)
        assert Integer.cast_(res.get(5)).equals(5)
开发者ID:lbjay,项目名称:montysolr,代码行数:25,代码来源:unittest_examples_bigtest.py

示例5: delete_record

# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import cast_ [as 别名]
def delete_record(message):
    """deletes record"""
    diff = message.getParam('diff')
    if diff:
        diff = int(str(diff))
    else:
        diff = 5 # 5 secs older
    recid = int(Integer.cast_(message.getParam('recid')).intValue())
    record = search_engine.get_record(recid)
    bibrecord.record_add_field(record, "980", subfields=[("c", "DELETED")])
    ret = bibupload.bibupload(record, opt_mode='replace')
    recid = ret[1]
    message.setResults(Integer(recid))
    
    # extra query needed because invenio sets modification date=NOW()
    # and so the deleted recs have modification_date<creation_date
    #dbquery.run_sql("UPDATE bibrec SET modification_date=NOW() + %s WHERE id=%s" % (diff, recid))
    change_date(recid, diff=diff)
开发者ID:lbjay,项目名称:montysolr,代码行数:20,代码来源:demotest_updating.py

示例6: test_get_recids_deleted

# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import cast_ [as 别名]
    def test_get_recids_deleted(self):
        
        #time.sleep(1) # otherwise the new record has the same creation time as the old recs
        #message = self.bridge.createMessage('create_delete')
        #self.bridge.sendMessage(message)
        message = self.bridge.createMessage('create_record')
        self.bridge.sendMessage(message)
        created_recid = int(Integer.cast_(message.getResults()).intValue())
        
        message = self.bridge.createMessage('delete_record').setParam('recid', created_recid)
        self.bridge.sendMessage(message)
        deleted_recid = int(str(message.getResults()))
        
        
        req = QueryRequest()
        rsp = SolrQueryResponse()

        message = self.bridge.createMessage('get_recids_changes') \
                    .setSender('InvenioKeepRecidUpdated') \
                    .setParam('response', rsp) \
                    .setParam('last_recid', 30)
        self.bridge.sendMessage(message)

        results = message.getResults()
        out = HashMap.cast_(results)
        
        added = JArray_int.cast_(out.get('ADDED'))
        updated = JArray_int.cast_(out.get('UPDATED'))
        deleted = JArray_int.cast_(out.get('DELETED'))
        
        
        message = self.bridge.createMessage('wipeout_record') \
                  .setParam('recid', deleted_recid)
        self.bridge.sendMessage(message)
        assert created_recid == deleted_recid
        assert len(added) == 0
        assert len(updated) == 0
        assert len(deleted) == 1
        
        assert int(str(deleted[0])) == deleted_recid 
开发者ID:lbjay,项目名称:montysolr,代码行数:42,代码来源:demotest_updating.py

示例7: wipeout_record

# 需要导入模块: from java.lang import Integer [as 别名]
# 或者: from java.lang.Integer import cast_ [as 别名]
def wipeout_record(message):
    recid = int(Integer.cast_(message.getParam('recid')).intValue())
    bibupload_regression_tests.wipe_out_record_from_all_tables(recid)  
开发者ID:lbjay,项目名称:montysolr,代码行数:5,代码来源:demotest_updating.py


注:本文中的java.lang.Integer.cast_方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。