本文整理汇总了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
示例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))
示例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'
示例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
示例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')
示例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
示例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