本文整理汇总了Python中java.lang.Math.round方法的典型用法代码示例。如果您正苦于以下问题:Python Math.round方法的具体用法?Python Math.round怎么用?Python Math.round使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.Math
的用法示例。
在下文中一共展示了Math.round方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initTabs
# 需要导入模块: from java.lang import Math [as 别名]
# 或者: from java.lang.Math import round [as 别名]
def initTabs(self):
#
## init autorize tabs
#
self.logTable = Table(self)
self.logTable.setAutoCreateRowSorter(True)
tableWidth = self.logTable.getPreferredSize().width
self.logTable.getColumn("ID").setPreferredWidth(Math.round(tableWidth / 50 * 2))
self.logTable.getColumn("URL").setPreferredWidth(Math.round(tableWidth / 50 * 24))
self.logTable.getColumn("Orig. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self.logTable.getColumn("Modif. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self.logTable.getColumn("Unauth. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self.logTable.getColumn("Authorization Enforcement Status").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self.logTable.getColumn("Authorization Unauth. Status").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self._splitpane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT)
self._splitpane.setResizeWeight(1)
self.scrollPane = JScrollPane(self.logTable)
self._splitpane.setLeftComponent(self.scrollPane)
self.scrollPane.getVerticalScrollBar().addAdjustmentListener(autoScrollListener(self))
self.menuES0 = JCheckBoxMenuItem(self._enfocementStatuses[0],True)
self.menuES1 = JCheckBoxMenuItem(self._enfocementStatuses[1],True)
self.menuES2 = JCheckBoxMenuItem(self._enfocementStatuses[2],True)
self.menuES0.addItemListener(menuTableFilter(self))
self.menuES1.addItemListener(menuTableFilter(self))
self.menuES2.addItemListener(menuTableFilter(self))
copyURLitem = JMenuItem("Copy URL");
copyURLitem.addActionListener(copySelectedURL(self))
self.menu = JPopupMenu("Popup")
self.menu.add(copyURLitem)
self.menu.add(self.menuES0)
self.menu.add(self.menuES1)
self.menu.add(self.menuES2)
self.tabs = JTabbedPane()
self._requestViewer = self._callbacks.createMessageEditor(self, False)
self._responseViewer = self._callbacks.createMessageEditor(self, False)
self._originalrequestViewer = self._callbacks.createMessageEditor(self, False)
self._originalresponseViewer = self._callbacks.createMessageEditor(self, False)
self._unauthorizedrequestViewer = self._callbacks.createMessageEditor(self, False)
self._unauthorizedresponseViewer = self._callbacks.createMessageEditor(self, False)
self.tabs.addTab("Modified Request", self._requestViewer.getComponent())
self.tabs.addTab("Modified Response", self._responseViewer.getComponent())
self.tabs.addTab("Original Request", self._originalrequestViewer.getComponent())
self.tabs.addTab("Original Response", self._originalresponseViewer.getComponent())
self.tabs.addTab("Unauthenticated Request", self._unauthorizedrequestViewer.getComponent())
self.tabs.addTab("Unauthenticated Response", self._unauthorizedresponseViewer.getComponent())
self.tabs.addTab("Configuration", self.pnl)
self.tabs.setSelectedIndex(6)
self._splitpane.setRightComponent(self.tabs)
示例2: NeighborChecker
# 需要导入模块: from java.lang import Math [as 别名]
# 或者: from java.lang.Math import round [as 别名]
rt = ResultsTable.getResultsTable()
xindex = rt.getColumnIndex("x")
yindex = rt.getColumnIndex("y")
zindex = rt.getColumnIndex("z")
xA = rt.getColumn(xindex)
yA = rt.getColumn(yindex)
zA = rt.getColumn(zindex)
neighbornumA = NeighborChecker(xA, yA, zA, True)
for i in range(len(xA)):
print xA[i], yA[i], zA[i], " .. Neighbor", neighbornumA[i]
# if xA[i] > 0:
if neighbornumA[i] == 0:
cslice=Math.round(zA[i])+1
if cslice > 0 and cslice <= nSlices:
ip = imp2.getStack().getProcessor(cslice)
ip.set(Math.round(yA[i]), Math.round(xA[i]), 255)
#imp2.show()
#MEASUREMENT
#XYpositions is inverted (like the plot) and shift in z position
xyoffset = math.floor(thdist/2)
options = IS.INTEGRATED_DENSITY | IS.AREA | IS.MEAN | IS.STD_DEV
cal = Calibration()
rt = ResultsTable()
ct = 0
for i in range(len(xA)):
示例3: JythonCalc
# 需要导入模块: from java.lang import Math [as 别名]
# 或者: from java.lang.Math import round [as 别名]
from org.jython.book.chap10_2 import Calculator
from java.lang import Math
class JythonCalc(Calculator):
def __init__(self):
pass
def calculateTotal(self, cost, tip, tax):
return cost + self.calculateTip(cost, tip) + self.calculateTax(cost, tax)
if __name__ == "__main__":
calc = JythonCalc()
cost = 23.75
tip = .15
tax = .07
print "Starting Cost: ", cost
print "Tip Percentage: ", tip
print "Tax Percentage: ", tax
print Math.round(calc.calculateTotal(cost, tip, tax))
示例4: range
# 需要导入模块: from java.lang import Math [as 别名]
# 或者: from java.lang.Math import round [as 别名]
# Set the intensity range
highCut=5.6
lowCut=1e-4
# highCut=0.74
# lowCut=-2
myPlot[0].highCut=highCut
myPlot[0].lowCut=lowCut
#### Coordinate grid ####
# We can draw a coordinate grid on the image. PlotXY doesn't provide a built-in
# way to generate a coordinate grid, so we need to compute in the script the
# positions of a number of meridians and parallels and draw them as LayerXY.
# Parallels every 15", meridians every 1s
deltaDec=15.0/3600.0
deltaRa=1.0*15.0/3600.0*2.0
# Compute the nearest parallel and meridian to the projection center
decCenter=(Math.round(crval2/deltaDec))*deltaDec
raCenter=(Math.round(crval1/deltaRa))*deltaRa
# Estimate how many parallels and meridians shall be drawn on each side
ndec=Integer(Math.round((yrange[1]-yrange[0])/deltaDec)).intValue()
ndec=1+ndec/2
nra=Integer(Math.round((xrange[0]-xrange[1])/deltaRa)).intValue()
nra=1+nra/2
# Draw parallels
dd=10
nn=(2*nra)*dd+1
for i in range(2*ndec+1):
# Coordinates of parallels in the sky coordinates
raPara=raCenter+(Float1d.range(nn)-nra*dd)*deltaRa/dd
decPara=Float1d(nn)+decCenter+(i-ndec)*deltaDec
# Coordinates of parallels in the pixels coordinates
xpixPara=Float1d(nn)