本文整理汇总了Python中java.util.Arrays类的典型用法代码示例。如果您正苦于以下问题:Python Arrays类的具体用法?Python Arrays怎么用?Python Arrays使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Arrays类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getExtraParametersForStep
def getExtraParametersForStep(self, configurationAttributes, step):
print "Passport. getExtraParametersForStep called"
if step == 1:
return Arrays.asList("selectedProvider", "externalProviders")
elif step == 2:
return Arrays.asList("passport_user_profile")
return None
示例2: getExtraParametersForStep
def getExtraParametersForStep(self, configurationAttributes, step):
if (step == 1):
return Arrays.asList("display_register_action")
elif (step == 2):
return Arrays.asList("oxpush2_auth_method", "oxpush2_request")
return None
示例3: getOutlierBound
def getOutlierBound(rt):
""" Analyzes the results of the 1st partcile analysis.
Since the dilation of nuclear perimeter often causes
overlap of neighboring neculeus 'terrirories', such nucleus
are discarded from the measurements.
Small nucelei are already removed, but since rejection of nuclei depends on
standard outlier detection method, outliers in both smaller and larger sizes
are discarded.
"""
area = rt.getColumn(rt.getColumnIndex('Area'))
circ = rt.getColumn(rt.getColumnIndex("Circ."))
arealist = ArrayList(Arrays.asList(area.tolist()))
circlist = ArrayList(Arrays.asList(circ.tolist()))
bwc = InstBWC()
ans = bwc.calculateBoxAndWhiskerStatistics(arealist)
#anscirc = bwc.calculateBoxAndWhiskerStatistics(circlist)
if (VERBOSE):
print ans.toString()
print ans.getOutliers()
q1 = ans.getQ1()
q3 = ans.getQ3()
intrange = q3 - q1
outlier_offset = intrange * 1.5
# circularity better be fixed.
#circq1 = anscirc.getQ1()
#circq3 = anscirc.getQ3()
#circintrange = circq3 - circq1
#circoutlier_offset = circintrange * 1.5
return q1, q3, outlier_offset
示例4: setActiveChannel
def setActiveChannel(self, channel):
self.channel = channel
# convert from List to Array
items = self.channel.getItems().toArray()
# sort news items
Arrays.sort(items, ItemComparator(1))
self.items = items
self.fireTableDataChanged()
示例5: getExtraParametersForStep
def getExtraParametersForStep(self, configurationAttributes, step):
if step == 1:
if self.oneStep:
return Arrays.asList("super_gluu_request")
elif self.twoStep:
return Arrays.asList("display_register_action")
elif step == 2:
return Arrays.asList("super_gluu_auth_method", "super_gluu_request")
return None
示例6: __queryNewestRefTime
def __queryNewestRefTime(self):
from com.raytheon.uf.viz.core.catalog import CatalogQuery
from java.util import Arrays
from com.raytheon.uf.common.time import DataTime
results = CatalogQuery.performQuery('dataTime.refTime', self._buildConstraints(None))
Arrays.sort(results)
if len(results) == 0:
if self.site:
raise NoDataException.NoDataException("No data available for site " + self.site)
else:
raise NoDataException.NoDataException("No data available")
dt = DataTime(results[len(results)-1])
return dt.getRefTime().getTime() / 1000
示例7: test_vararg
def test_vararg(self):
from java.util import Arrays
self.assertSequenceEqual((), Arrays.asList())
self.assertSequenceEqual(("1"), Arrays.asList("1"))
self.assertSequenceEqual(("1","2"), Arrays.asList("1","2"))
# Passing a tuple should convert the tuple elemnts to the varargs array.
self.assertSequenceEqual(("1","2"), Arrays.asList(("1","2")))
# instance method as opposed to static method above
self.assertSequenceEqual(("1","2"), self.test.testAllVarArgs("1","2"))
# Multiple varargs goes through a different path then just one vararg so be sure to hit both.
self.assertSequenceEqual(("1"), self.test.testAllVarArgs("1"))
# mixing normal args with varargs
self.assertSequenceEqual(("1","2", "3"), self.test.testMixedVarArgs("1","2", "3"))
self.assertSequenceEqual(("1","2", "3", "4"), self.test.testMixedVarArgs("1","2", "3", "4"))
示例8: run
def run(self, ctx):
engctx = ctx.getEnginesContext()
if not engctx:
print('Back-end engines not initialized')
return
projects = engctx.getProjects()
if not projects:
print('There is no opened project')
return
# get the first unit available
units = RuntimeProjectUtil.findUnitsByType(projects[0], None, False)
if not units:
print('No unit available')
return
unit = units[0]
print('Unit: %s' % unit)
# retrieve the formatter, which is a producer of unit representations
formatter = unit.getFormatter()
# create a table document
columnLabels = Arrays.asList('Key', 'Value', 'Comment')
rows = ArrayList()
rows.add(TableRow(Arrays.asList(Cell('foo'), Cell('bar'), Cell('none'))))
rows.add(TableRow(Arrays.asList(Cell('type'), Cell('integer'), Cell('unset'))))
extraDoc = StaticTableDocument(columnLabels, rows)
extraPres0 = UnitRepresentationAdapter(101, 'Demo Table', False, extraDoc)
# create a tree document
columnLabels = Arrays.asList('Key', 'Value')
root = KVNode('foo', 'bar')
roots = Arrays.asList(root)
root.addChild(KVNode('quantified', 'self'))
root.addChild(KVNode('galaxy', 'milky way'))
node = KVNode('black hole', '42')
node.setClassId(ItemClassIdentifiers.INFO_DANGEROUS)
root.addChild(node)
extraDoc = StaticTreeDocument(roots, columnLabels, -1)
extraPres1 = UnitRepresentationAdapter(102, 'Demo Tree', False, extraDoc)
# add the newly created presentations to our unit, and notify clients
# the second argument indicates that the presentation should be persisted when saving the project
formatter.addPresentation(extraPres0, True)
formatter.addPresentation(extraPres1, True)
unit.notifyListeners(JebEvent(J.UnitChange));
示例9: createLdapExtendedConfigurations
def createLdapExtendedConfigurations(self, authConfiguration):
ldapExtendedConfigurations = []
for ldapConfiguration in authConfiguration["ldap_configuration"]:
configId = ldapConfiguration["configId"]
servers = ldapConfiguration["servers"]
bindDN = None
bindPassword = None
useAnonymousBind = True
if (self.containsAttributeString(ldapConfiguration, "bindDN")):
useAnonymousBind = False
bindDN = ldapConfiguration["bindDN"]
bindPassword = ldapConfiguration["bindPassword"]
useSSL = ldapConfiguration["useSSL"]
maxConnections = ldapConfiguration["maxConnections"]
baseDNs = ldapConfiguration["baseDNs"]
loginAttributes = ldapConfiguration["loginAttributes"]
localLoginAttributes = ldapConfiguration["localLoginAttributes"]
ldapConfiguration = GluuLdapConfiguration(configId, bindDN, bindPassword, Arrays.asList(servers),
maxConnections, useSSL, Arrays.asList(baseDNs),
loginAttributes[0], localLoginAttributes[0], useAnonymousBind)
ldapExtendedConfigurations.append({ "ldapConfiguration" : ldapConfiguration, "loginAttributes" : loginAttributes, "localLoginAttributes" : localLoginAttributes })
return ldapExtendedConfigurations
示例10: outlierDetection
def outlierDetection(pattern, measA):
filtsdevA = []
for ind, sd in enumerate(measA[2]):
if not measA[4][ind]:
filtsdevA.append(sd)
#sdevlist = ArrayList(Arrays.asList(measA[2]))
sdevlist = ArrayList(Arrays.asList(filtsdevA))
bwc = InstBWC()
ans = bwc.calculateBoxAndWhiskerStatistics(sdevlist)
q1 = ans.getQ1()
q3 = ans.getQ3()
intrange = q3 - q1
outlier_offset = intrange * 1.5
outlow = q1 - outlier_offset
outup = q3 + outlier_offset
filtersummary = { 'n': len(measA[2]),'Mean': ans.getMean(), 'Median': ans.getMedian(), 'Outlier-Low': outlow, 'Outlier-Up': outup }
for i, filep in enumerate(measA[0]):
#res = re.search(pattern, filep)
if (measA[2][i] < outlow) or (measA[2][i] > outup):
#print 'xxxW', res.group(2), measA[2][i]
measA[4][i] = 1
# else:
#print 'W', res.group(2), measA[2][i]
#measA[4].append(0)
return filtersummary
示例11: disjunct
def disjunct(cls, multiplier, *queries, **terms):
"Return lucene DisjunctionMaxQuery from queries and terms."
self = cls(search.DisjunctionMaxQuery, Arrays.asList(queries), multiplier)
for name, values in terms.items():
for value in ([values] if isinstance(values, basestring) else values):
self.add(cls.term(name, value))
return self
示例12: __init__
def __init__(self, searcher, query, field, terms=False, fields=False, tag='', formatter=None, encoder=None):
if tag:
formatter = highlight.SimpleHTMLFormatter('<{}>'.format(tag), '</{}>'.format(tag))
scorer = (highlight.QueryTermScorer if terms else highlight.QueryScorer)(query, *(searcher.indexReader, field) * (not fields))
highlight.Highlighter.__init__(self, *filter(None, [formatter, encoder, scorer]))
self.searcher, self.field = searcher, field
self.selector = HashSet(Arrays.asList([field]))
示例13: getUniqueSrcIps
def getUniqueSrcIps(self, protocol=6):
uniqueIps = HashSet()
srcAddrSqlBuilder = SelectSqlBuilder('Agg_V5', 'srcAddr as ip', distinct=1)
srcAddrSqlBuilder.where('prot=%d' % protocol)
srcIps = self._sqlClient.execute(srcAddrSqlBuilder)
if srcIps:
uniqueIps.addAll(Arrays.asList([ipEntry.ip for ipEntry in srcIps]))
return uniqueIps.toArray()
示例14: test_java_object_arrays
def test_java_object_arrays():
jStringArr = array(String, [String("a"), String("b"), String("c")])
verify(Arrays.equals(jStringArr.typecode, str(String)),
"String array typecode of wrong type, expected %s, found %s" %
(jStringArr.typecode, str(String)))
verify(zeros(String, 5) == Array.newInstance(String, 5))
import java # require for eval to work
if jStringArr != eval(str(jStringArr)):
raise TestFailed, "eval(str(%s)) <> %s" % (jStringArr,)*2
示例15: test_java_object_arrays
def test_java_object_arrays(self):
jStringArr = array(String, [String("a"), String("b"), String("c")])
self.assert_(
Arrays.equals(jStringArr.typecode, 'java.lang.String'),
"String array typecode of wrong type, expected %s, found %s" %
(jStringArr.typecode, str(String)))
self.assertEqual(zeros(String, 5), Array.newInstance(String, 5))
import java.lang.String # require for eval to work
self.assertEqual(jStringArr, eval(str(jStringArr)))