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


Python Collections.sort方法代码示例

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


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

示例1: main

# 需要导入模块: from java.util import Collections [as 别名]
# 或者: from java.util.Collections import sort [as 别名]
 def main(cls, args):
     """ generated source for method main """
     description = GameRepository.getDefaultRepository().getGame("conn4").getRules()
     flattener = PropNetFlattener(description)
     flattened = flattener.flatten()
     print "Flattened description for connect four contains: \n" + len(flattened) + "\n\n"
     strings = ArrayList()
     for rule in flattened:
         strings.add(rule.__str__())
     Collections.sort(strings)
     for s in strings:
         print s
开发者ID:hobson,项目名称:ggpy,代码行数:14,代码来源:PropNetFlattener.py

示例2: repopulateGameList

# 需要导入模块: from java.util import Collections [as 别名]
# 或者: from java.util.Collections import sort [as 别名]
 def repopulateGameList(self):
     """ generated source for method repopulateGameList """
     theRepository = self.getSelectedGameRepository()
     theKeyList = ArrayList(theRepository.getGameKeys())
     Collections.sort(theKeyList)
     self.theGameList.removeAllItems()
     for theKey in theKeyList:
         if theGame == None:
             continue
         if theName == None:
             theName = theKey
         if 24 > len(theName):
             theName = theName.substring(0, 24) + "..."
         self.theGameList.addItem(self.NamedItem(theKey, theName))
开发者ID:hobson,项目名称:ggpy,代码行数:16,代码来源:GameSelector.py

示例3: run

# 需要导入模块: from java.util import Collections [as 别名]
# 或者: from java.util.Collections import sort [as 别名]
def run(config):
    """Display the config as a fully resolved set of properties"""
    print '\nConfiguration properties are:'
    v = Vector(config.keySet())
    Collections.sort(v)
    it = v.iterator()
    while (it.hasNext()):
       element = it.next();
       if (String(element.lower()).endsWith('.password')):
           printValue = '****'
       else:
           printValue = config.get(element)

       print '   ' + element + "=" + printValue
    print '\n'
开发者ID:Integral-Technology-Solutions,项目名称:ConfigNOW,代码行数:17,代码来源:show_config.py

示例4: mergeBaseRelations

# 需要导入模块: from java.util import Collections [as 别名]
# 或者: from java.util.Collections import sort [as 别名]
 def mergeBaseRelations(self, rels):
     """ generated source for method mergeBaseRelations """
     merges = HashMap()
     for rel in rels:
         if not merges.containsKey(name):
             merges.put(name, ArrayList())
         addRelToMerge(rel, merge)
     rval = HashSet()
     valConst = GdlPool.getConstant("val")
     for c in merges.keySet():
         body.add(c)
         for mergeSet in merge:
             Collections.sort(ms2, SortTerms())
             body.add(GdlPool.getFunction(valConst, ms2))
         rval.add(toAdd)
     return rval
开发者ID:hobson,项目名称:ggpy,代码行数:18,代码来源:PropNetAnnotater.py

示例5: RoiManager

# 需要导入模块: from java.util import Collections [as 别名]
# 或者: from java.util.Collections import sort [as 别名]
          rm = RoiManager()
    rm.reset()
    nextRoi = 0

    for id in model.getTrackModel().trackIDs(True):

        # Fetch the track feature from the feature model.
        v = fm.getTrackFeature(id, 'TRACK_MEAN_SPEED')
        v1 = fm.getTrackFeature(id, TrackBranchingAnalyzer.NUMBER_SPLITS)

        if (v1>0):
            model.getLogger().log('')
            model.getLogger().log('Track ' + str(id) + ': branching = ' + str(v1))
            track = model.getTrackModel().trackSpots(id)
            sortedTrack = list( track )
            Collections.sort( sortedTrack, Spot.frameComparator )

            table = ResultsTable()
            rowNumber = 0
            for spot in sortedTrack:
                sid = spot.ID()
                
                # Fetch spot features directly from spot.
                x=spot.getFeature('POSITION_X')
                y=spot.getFeature('POSITION_Y')
                t=spot.getFeature('FRAME')
                q=spot.getFeature('QUALITY')
                snr=spot.getFeature('SNR')
                mean=spot.getFeature('MEAN_INTENSITY')
                std = spot.getFeature('STANDARD_DEVIATION')
                estdia = spot.getFeature('ESTIMATED_DIAMETER')
开发者ID:bramalingam,项目名称:Omero-Imagej-Scripts,代码行数:33,代码来源:Mitotic_Tracker_Final.py

示例6: __init__

# 需要导入模块: from java.util import Collections [as 别名]
# 或者: from java.util.Collections import sort [as 别名]
 def __init__(self, moves, selection):
     """ generated source for method __init__ """
     super(HumanNewMovesEvent, self).__init__()
     Collections.sort(moves, Comparator())
     self.moves = moves
     self.selection = selection
开发者ID:hobson,项目名称:ggpy,代码行数:8,代码来源:HumanNewMovesEvent.py

示例7: __activate__

# 需要导入模块: from java.util import Collections [as 别名]
# 或者: from java.util.Collections import sort [as 别名]
 def __activate__(self, context):
     self.auth = context["page"].authentication
     self.errorMsg = "" 
     self.request = context["request"]
     self.response = context["response"]
     self.formData = context["formData"]
     self.log = context["log"]
     self.reportManager = context["Services"].getService("reportManager")
     self.reportName = None
         
     if (self.auth.is_logged_in()):
         if (self.auth.is_admin()==True):
             pass
         else:
             self.errorMsg = "Requires Admin / Librarian / Reviewer access." 
     else:
         self.errorMsg = "Please login."
     if self.errorMsg == "": 
         self.reportName = self.formData.get("reportName")
         
         if (self.reportName):
             self.report = self.reportManager.getReport(self.reportName)
             
         self.func = self.formData.get("func", "")
         if self.func == "" and self.request.getParameter("func"):
             self.func = self.request.getParameter("func")
         
         if self.func == "action":
             self.action = self.request.getParameter("action")
             if self.action == "create":
                 self.createReport()
                 out = self.response.getPrintWriter("text/plain; charset=UTF-8")
                 out.println("{\"id\":\""+self.report.getReportName()+"\"}")
                 out.close()
                 return
             if self.action == "edit":
                 self.editReport()
                 out = self.response.getPrintWriter("text/plain; charset=UTF-8")
                 out.println("{\"id\":\""+self.report.getReportName()+"\"}")
                 out.close()
                 return
             if self.action == "options":
                 out = self.response.getPrintWriter("text/plain; charset=UTF-8")
                 out.println(FileUtils.readFileToString(File(FascinatorHome.getPath("reports")+"/reportCriteriaOptions.json")))
                 out.close()
                 return
             if self.action == "get-json":
                  out = self.response.getPrintWriter("text/plain; charset=UTF-8")
                  report = self.reportManager.getReports().get(self.request.getParameter("reportName"))
                  queryFilters = report.config.getObject("query", "filter")
                  jsonMap = HashMap()
                  elementIds = ArrayList()
                  
                  for elementId in queryFilters:
                      elementIds.add(elementId)
                      
                  Collections.sort(elementIds)
                  
                  for elementId in elementIds:
                      jsonMap.put(elementId,queryFilters.get(elementId).get("value"))
                  jsonMap.put("reportName",report.getLabel())
                  JsonObject.writeJSONString(jsonMap,out)
                  out.close()
                  return
开发者ID:greg-pendlebury,项目名称:redbox,代码行数:66,代码来源:reports.py


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