diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-27 12:58:07 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-29 22:02:59 +0200 |
commit | 3be987460db9938977c9ff7ed59b7e43b64f430e (patch) | |
tree | 83a1c99d0f0f9e189acf6418eba7749ae6500902 /wizards | |
parent | dab59ab4bcadb14bef9ad7d185d58610fda22012 (diff) |
Java cleanup - remove unnecessary casts
Change-Id: I9fc995d9b3f971b9b8869cb3f21ddf69b4f90e08
Diffstat (limited to 'wizards')
14 files changed, 47 insertions, 47 deletions
diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java index 50df0f7197bf..1264873b80d3 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.java +++ b/wizards/com/sun/star/wizards/common/Configuration.java @@ -68,7 +68,7 @@ public abstract class Configuration Object o = getNode(name, parent); if (AnyConverter.isVoid(o)) { - return (float) 0; + return 0; } return AnyConverter.toFloat(o); } @@ -78,7 +78,7 @@ public abstract class Configuration Object o = getNode(name, parent); if (AnyConverter.isVoid(o)) { - return (double) 0; + return 0; } return AnyConverter.toDouble(o); } diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java index cd8a410b0a4e..d5a198f65693 100644 --- a/wizards/com/sun/star/wizards/common/NumericalHelper.java +++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java @@ -218,7 +218,7 @@ public class NumericalHelper switch (aTypeObject.iType) { case BYTE_TYPE: - retValue = (short) getByte(aTypeObject); + retValue = getByte(aTypeObject); break; case CHAR_TYPE: retValue = (byte) getChar(aTypeObject); @@ -501,13 +501,13 @@ public class NumericalHelper switch (aTypeObject.iType) { case BYTE_TYPE: - retValue = (int) getByte(aTypeObject); + retValue = getByte(aTypeObject); break; case CHAR_TYPE: - retValue = (int) getChar(aTypeObject); + retValue = getChar(aTypeObject); break; case SHORT_TYPE: - retValue = (int) getShort(aTypeObject); + retValue = getShort(aTypeObject); break; case INT_TYPE: retValue = getInt(aTypeObject); @@ -557,16 +557,16 @@ public class NumericalHelper switch (aTypeObject.iType) { case BYTE_TYPE: - retValue = (long) getByte(aTypeObject); + retValue = getByte(aTypeObject); break; case CHAR_TYPE: - retValue = (long) getChar(aTypeObject); + retValue = getChar(aTypeObject); break; case SHORT_TYPE: - retValue = (long) getShort(aTypeObject); + retValue = getShort(aTypeObject); break; case INT_TYPE: - retValue = (long) getInt(aTypeObject); + retValue = getInt(aTypeObject); break; case LONG_TYPE: retValue = getLong(aTypeObject); @@ -613,19 +613,19 @@ public class NumericalHelper switch (aTypeObject.iType) { case BYTE_TYPE: - retValue = (float) getByte(aTypeObject); + retValue = getByte(aTypeObject); break; case CHAR_TYPE: - retValue = (float) getChar(aTypeObject); + retValue = getChar(aTypeObject); break; case SHORT_TYPE: - retValue = (float) getShort(aTypeObject); + retValue = getShort(aTypeObject); break; case INT_TYPE: - retValue = (float) getInt(aTypeObject); + retValue = getInt(aTypeObject); break; case LONG_TYPE: - retValue = (float) getLong(aTypeObject); + retValue = getLong(aTypeObject); break; case FLOAT_TYPE: retValue = getFloat(aTypeObject); @@ -669,22 +669,22 @@ public class NumericalHelper switch (aTypeObject.iType) { case BYTE_TYPE: - retValue = (double) getByte(aTypeObject); + retValue = getByte(aTypeObject); break; case CHAR_TYPE: - retValue = (double) getChar(aTypeObject); + retValue = getChar(aTypeObject); break; case SHORT_TYPE: - retValue = (double) getShort(aTypeObject); + retValue = getShort(aTypeObject); break; case INT_TYPE: - retValue = (double) getInt(aTypeObject); + retValue = getInt(aTypeObject); break; case LONG_TYPE: - retValue = (double) getLong(aTypeObject); + retValue = getLong(aTypeObject); break; case FLOAT_TYPE: - retValue = (double) getFloat(aTypeObject); + retValue = getFloat(aTypeObject); break; case DOUBLE_TYPE: retValue = getDouble(aTypeObject); @@ -1557,7 +1557,7 @@ public class NumericalHelper for (int i = number.length() - 1; i >= 0; i--) { StringBuffer romanDigit = new StringBuffer(); - int b = (int) number.charAt(i) - ASCII_CODE_0; + int b = number.charAt(i) - ASCII_CODE_0; if (b == FOUR) { // special case IV romanDigit.append(ROMAN_EQUIV[symbolIndex]); @@ -1597,7 +1597,7 @@ public class NumericalHelper public static boolean representsIntegerNumber(double _dblvalue) { - double dblsecvalue = (double) ((int) _dblvalue); + double dblsecvalue = ((int) _dblvalue); return Double.compare(_dblvalue, dblsecvalue) == 0; } @@ -1608,7 +1608,7 @@ public class NumericalHelper public static double roundDouble(double _dblvalue, int _ndecimals) { - double dblfactor = java.lang.Math.pow(10.0, (double) _ndecimals); - return ((double) ((int) (_dblvalue * dblfactor))) / dblfactor; + double dblfactor = java.lang.Math.pow(10.0, _ndecimals); + return ((int) (_dblvalue * dblfactor)) / dblfactor; } } diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index 205409c8098d..2d97ddeb10a3 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -107,7 +107,7 @@ public class RecordParser extends QueryMetaData Double DblValue; if (bisDate) { - DblValue = new Double(xResultSetRow.getDouble(ColIndex) + (double) super.getNullDateCorrection()); + DblValue = new Double(xResultSetRow.getDouble(ColIndex) + super.getNullDateCorrection()); } else { diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index 613e40b30109..9fcd1ef94388 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -114,8 +114,8 @@ public class TimeStampControl extends DatabaseControl { try { - int ndatewidth = (int) (nreldatewidth * (double) _aSize.Width); - int ntimewidth = (int) (nreltimewidth * (double) _aSize.Width); + int ndatewidth = (int) (nreldatewidth * _aSize.Width); + int ntimewidth = (int) (nreltimewidth * _aSize.Width); oDateControl.xShape.setSize(new Size(ndatewidth, _aSize.Height)); oTimeControl.xShape.setSize(new Size(ntimewidth, _aSize.Height)); } diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index 2ae46232c9e8..41095da3bc9b 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -135,8 +135,8 @@ public class FormDocument extends TextDocument xPropPageStyle.setPropertyValue("TopMargin", new Integer(nMargin)); xPropPageStyle.setPropertyValue("BottomMargin", new Integer(nMargin)); aMainFormPoint = new Point(nMargin, nMargin); - nFormWidth = (int) (0.8 * (double) nPageWidth) - 2 * nMargin; - nFormHeight = (int) (0.65 * (double) nPageHeight) - 2 * nMargin; + nFormWidth = (int) (0.8 * nPageWidth) - 2 * nMargin; + nFormHeight = (int) (0.65 * nPageHeight) - 2 * nMargin; } catch (Exception e) { diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index 08efc4dea404..ef0596431639 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -398,7 +398,7 @@ public class UIControlArranger m_aButtonList.setSelectionGap(new Size(2, 2)); m_aButtonList.setGap(new Size(3, 3)); // m_aButtonList.scaleImages = Boolean.FALSE; - m_aButtonList.tabIndex = (int) curtabindex++; + m_aButtonList.tabIndex = curtabindex++; m_aButtonList.helpURL = 34453 + (formindex * 4); m_aButtonList.setListModel(model); diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index a9da14ff6e16..69321d5cb8e3 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -311,11 +311,11 @@ public class DBColumn { if (AnyConverter.isBoolean(CurGroupValue)) { - dblValue = (double) AnyConverter.toInt(CurGroupValue); + dblValue = AnyConverter.toInt(CurGroupValue); } if (AnyConverter.isByte(CurGroupValue)) { - dblValue = (double) AnyConverter.toByte(CurGroupValue); + dblValue = AnyConverter.toByte(CurGroupValue); } else if (AnyConverter.isDouble(CurGroupValue)) { @@ -323,19 +323,19 @@ public class DBColumn } else if (AnyConverter.isFloat(CurGroupValue)) { - dblValue = (double) AnyConverter.toFloat(CurGroupValue); + dblValue = AnyConverter.toFloat(CurGroupValue); } else if (AnyConverter.isInt(CurGroupValue)) { - dblValue = (double) AnyConverter.toInt(CurGroupValue); + dblValue = AnyConverter.toInt(CurGroupValue); } else if (AnyConverter.isLong(CurGroupValue)) { - dblValue = (double) AnyConverter.toLong(CurGroupValue); + dblValue = AnyConverter.toLong(CurGroupValue); } else if (AnyConverter.isShort(CurGroupValue)) { - dblValue = (double) AnyConverter.toShort(CurGroupValue); + dblValue = AnyConverter.toShort(CurGroupValue); } xValCell.setValue(dblValue); } diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java index 9c7c880961fb..a3ba9380000a 100644 --- a/wizards/com/sun/star/wizards/report/ReportLayouter.java +++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java @@ -98,7 +98,7 @@ public class ReportLayouter { iSelPos = 0; } - iOldContentPos = (int) iSelPos; + iOldContentPos = iSelPos; xContentListBox = CurUnoDialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(), new String[] { @@ -146,7 +146,7 @@ public class ReportLayouter iSelLayoutPos }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), 99 }); - iOldLayoutPos = (int) iSelPos; + iOldLayoutPos = iSelPos; CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation", new String[] { diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java index 53d8c6c8be6e..9da13aecc37f 100644 --- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java +++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java @@ -291,7 +291,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X */ public void itemStateChanged(ItemEvent arg0) { - initializeTable((int) xTableListBox.getSelectedItemPos()); + initializeTable(xTableListBox.getSelectedItemPos()); } /* (non-Javadoc) diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index 5020a7a9efb6..a9af6fb390ec 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -259,7 +259,7 @@ public class FilterComponent if (currentControlRow.isEnabled() && currentControlRow.isConditionComplete()) { String sFieldName = currentControlRow.getSelectedFieldName(); - int nOperator = (int) currentControlRow.getSelectedOperator(); + int nOperator = currentControlRow.getSelectedOperator(); FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName); columnSet.setPropertyValue(PropertyNames.PROPERTY_NAME, aFieldColumn.getFieldName()); columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type")); diff --git a/wizards/com/sun/star/wizards/ui/TitlesComponent.java b/wizards/com/sun/star/wizards/ui/TitlesComponent.java index bcdc8552d9c3..8aa15c29b3d5 100644 --- a/wizards/com/sun/star/wizards/ui/TitlesComponent.java +++ b/wizards/com/sun/star/wizards/ui/TitlesComponent.java @@ -229,8 +229,8 @@ public class TitlesComponent extends ControlScroller private int getFieldNameWidth(int iMAPControlWidth, double dblMAPConversion) { - int iFieldNameWidth = (int) (1.15 * ((double) (iMAPControlWidth)) / dblMAPConversion); - double dblAvailableWidth = (double) (iCompWidth - iScrollBarWidth - iRelLabelPosXDist); + int iFieldNameWidth = (int) (1.15 * (iMAPControlWidth) / dblMAPConversion); + double dblAvailableWidth = (iCompWidth - iScrollBarWidth - iRelLabelPosXDist); if (iFieldNameWidth > (0.5 * (dblAvailableWidth))) { iFieldNameWidth = (int) (0.5 * (dblAvailableWidth)); diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index 177cdd5a5afc..d9cfffd7fffc 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -229,8 +229,8 @@ public class UnoDialog implements EventNames XControl xControl2 = xDlgContainer.getControl(ControlName); XView xView = UnoRuntime.queryInterface(XView.class, xControl2); Size aSize = xView.getSize(); - double dblMAPWidth = (double) (((Integer) Helper.getUnoPropertyValue(xControl2.getModel(), PropertyNames.PROPERTY_WIDTH)).intValue()); - return (((double) (aSize.Width)) / dblMAPWidth); + double dblMAPWidth = (((Integer) Helper.getUnoPropertyValue(xControl2.getModel(), PropertyNames.PROPERTY_WIDTH)).intValue()); + return ((aSize.Width) / dblMAPWidth); } public Size getpreferredLabelSize(String LabelName, String sLabel) diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java index 86f4eb2a4f99..36a8172beffd 100644 --- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java +++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java @@ -101,7 +101,7 @@ public class ListModelBinder implements ListDataListener protected String getItemString(short i) { - return getItemString(listModel.getElementAt((int) i)); + return getItemString(listModel.getElementAt(i)); } protected String getItemString(Object item) diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.java b/wizards/com/sun/star/wizards/web/data/CGSettings.java index efe9244c1565..6c72304549e4 100644 --- a/wizards/com/sun/star/wizards/web/data/CGSettings.java +++ b/wizards/com/sun/star/wizards/web/data/CGSettings.java @@ -198,7 +198,7 @@ public class CGSettings extends ConfigGroup public String formatFileSize(int size) { - float sizeInKB = ((float) size) / 1024f; + float sizeInKB = size / 1024f; String sSize = dateUtils.getFormatter().convertNumberToString(numberFormat, sizeInKB); return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_SIZE_TEMPLATE], sSize, "%NUMBER"); } |