summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-11-02 09:52:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-11-02 12:00:34 +0100
commit41d9584179ef7b4e18eda47c2c0a955df8c087a5 (patch)
tree272551363a71f4ea34c032504cc4e058a60a91ae /odk
parentcb982f14796aa4dc4362bc6fde74161afa11777b (diff)
'new Double' is deprecated in Java
replace with Double.valueOf Change-Id: If5be8e500e31ebf9d5fb20ea7dd474677d7c74ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158785 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs2
-rw-r--r--odk/examples/DevelopersGuide/GUI/UnoDialogSample.java12
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java100
-rw-r--r--odk/examples/java/ToDo/ToDo.java10
4 files changed, 62 insertions, 62 deletions
diff --git a/odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs b/odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs
index 1dd2f8a03c9c..812121043e9f 100644
--- a/odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs
+++ b/odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs
@@ -1434,7 +1434,7 @@ public class SpreadsheetSample : SpreadsheetDocHelper
unoidl.com.sun.star.sheet.XFunctionAccess xFuncAcc =
(unoidl.com.sun.star.sheet.XFunctionAccess) aFuncInst;
// put the data in a two-dimensional array
- Double [][] aData = { new Double [] { 1.0, 2.0, 3.0 } };
+ Double [][] aData = { Double.valueOf [] { 1.0, 2.0, 3.0 } };
// construct the array of function arguments
uno.Any [] aArgs = new uno.Any [2];
aArgs[0] = new uno.Any( typeof (Double [][]), aData );
diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
index c49dbfd77ff4..5b5b0c9ac0b0 100644
--- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
+++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
@@ -350,7 +350,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis
// use the XPropertySet interface merely for reasons of demonstration
xCFModelPSet.setPropertyValue("PrependCurrencySymbol", Boolean.TRUE);
xCFModelPSet.setPropertyValue("CurrencySymbol", "$");
- xCFModelPSet.setPropertyValue("Value", new Double(2.93));
+ xCFModelPSet.setPropertyValue("Value", Double.valueOf(2.93));
// add a textlistener that is notified on each change of the controlvalue...
Object oCFControl = m_xDlgContainer.getControl(sName);
@@ -683,10 +683,10 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis
xNFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oNFModel);
// The following properties may also be set with XMultiPropertySet but we
// use the XPropertySet interface merely for reasons of demonstration
- xNFModelPSet.setPropertyValue("ValueMin", new Double(_fValueMin));
- xNFModelPSet.setPropertyValue("ValueMax", new Double(_fValueMax));
- xNFModelPSet.setPropertyValue("Value", new Double(_fValue));
- xNFModelPSet.setPropertyValue("ValueStep", new Double(_fValueStep));
+ xNFModelPSet.setPropertyValue("ValueMin", Double.valueOf(_fValueMin));
+ xNFModelPSet.setPropertyValue("ValueMax", Double.valueOf(_fValueMax));
+ xNFModelPSet.setPropertyValue("Value", Double.valueOf(_fValue));
+ xNFModelPSet.setPropertyValue("ValueStep", Double.valueOf(_fValueStep));
xNFModelPSet.setPropertyValue("ShowThousandsSeparator", Boolean.TRUE);
xNFModelPSet.setPropertyValue("DecimalAccuracy", Short.valueOf(_nDecimalAccuracy));
} catch (com.sun.star.uno.Exception ex) {
@@ -957,7 +957,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis
// Set the properties at the model - keep in mind to pass the property names in alphabetical order!
xFFModelMPSet.setPropertyValues(
new String[] {"EffectiveValue", "Height", "Name", "PositionX", "PositionY", "StrictFormat", "Spin", "Width"},
- new Object[] { new Double(12348), Integer.valueOf(12), sName, Integer.valueOf(_nPosX), Integer.valueOf(_nPosY), Boolean.TRUE, Boolean.TRUE, Integer.valueOf(_nWidth)});
+ new Object[] { Double.valueOf(12348), Integer.valueOf(12), sName, Integer.valueOf(_nPosX), Integer.valueOf(_nPosY), Boolean.TRUE, Boolean.TRUE, Integer.valueOf(_nWidth)});
xFFModelPSet = UnoRuntime.queryInterface(XPropertySet.class, oFFModel);
// to define a numberformat you always need a locale...
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java
index bbf54af0eb22..8ddfa630e007 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java
+++ b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java
@@ -381,26 +381,26 @@ public class SpreadsheetSample extends SpreadsheetDocHelper
Object[][] aValues =
{
{ "Name", "Fruit", "Quantity" },
- { "Alice", "Apples", new Double( 3.0 ) },
- { "Alice", "Oranges", new Double( 7.0 ) },
- { "Bob", "Apples", new Double( 3.0 ) },
- { "Alice", "Apples", new Double( 9.0 ) },
- { "Bob", "Apples", new Double( 5.0 ) },
- { "Bob", "Oranges", new Double( 6.0 ) },
- { "Alice", "Oranges", new Double( 3.0 ) },
- { "Alice", "Apples", new Double( 8.0 ) },
- { "Alice", "Oranges", new Double( 1.0 ) },
- { "Bob", "Oranges", new Double( 2.0 ) },
- { "Bob", "Oranges", new Double( 7.0 ) },
- { "Bob", "Apples", new Double( 1.0 ) },
- { "Alice", "Apples", new Double( 8.0 ) },
- { "Alice", "Oranges", new Double( 8.0 ) },
- { "Alice", "Apples", new Double( 7.0 ) },
- { "Bob", "Apples", new Double( 1.0 ) },
- { "Bob", "Oranges", new Double( 9.0 ) },
- { "Bob", "Oranges", new Double( 3.0 ) },
- { "Alice", "Oranges", new Double( 4.0 ) },
- { "Alice", "Apples", new Double( 9.0 ) }
+ { "Alice", "Apples", Double.valueOf( 3.0 ) },
+ { "Alice", "Oranges", Double.valueOf( 7.0 ) },
+ { "Bob", "Apples", Double.valueOf( 3.0 ) },
+ { "Alice", "Apples", Double.valueOf( 9.0 ) },
+ { "Bob", "Apples", Double.valueOf( 5.0 ) },
+ { "Bob", "Oranges", Double.valueOf( 6.0 ) },
+ { "Alice", "Oranges", Double.valueOf( 3.0 ) },
+ { "Alice", "Apples", Double.valueOf( 8.0 ) },
+ { "Alice", "Oranges", Double.valueOf( 1.0 ) },
+ { "Bob", "Oranges", Double.valueOf( 2.0 ) },
+ { "Bob", "Oranges", Double.valueOf( 7.0 ) },
+ { "Bob", "Apples", Double.valueOf( 1.0 ) },
+ { "Alice", "Apples", Double.valueOf( 8.0 ) },
+ { "Alice", "Oranges", Double.valueOf( 8.0 ) },
+ { "Alice", "Apples", Double.valueOf( 7.0 ) },
+ { "Bob", "Apples", Double.valueOf( 1.0 ) },
+ { "Bob", "Oranges", Double.valueOf( 9.0 ) },
+ { "Bob", "Oranges", Double.valueOf( 3.0 ) },
+ { "Alice", "Oranges", Double.valueOf( 4.0 ) },
+ { "Alice", "Apples", Double.valueOf( 9.0 ) }
};
xData.setDataArray( aValues );
@@ -863,20 +863,20 @@ public class SpreadsheetSample extends SpreadsheetDocHelper
// --- Scenarios ---
Object[][] aValues = new Object[2][2];
- aValues[0][0] = new Double( 11 );
- aValues[0][1] = new Double( 12 );
+ aValues[0][0] = Double.valueOf( 11 );
+ aValues[0][1] = Double.valueOf( 12 );
aValues[1][0] = "Test13";
aValues[1][1] = "Test14";
insertScenario( xSheet, "B10:C11", aValues, "First Scenario", "The first scenario." );
aValues[0][0] = "Test21";
aValues[0][1] = "Test22";
- aValues[1][0] = new Double( 23 );
- aValues[1][1] = new Double( 24 );
+ aValues[1][0] = Double.valueOf( 23 );
+ aValues[1][1] = Double.valueOf( 24 );
insertScenario( xSheet, "B10:C11", aValues, "Second Scenario", "The visible scenario." );
- aValues[0][0] = new Double( 31 );
- aValues[0][1] = new Double( 32 );
+ aValues[0][0] = Double.valueOf( 31 );
+ aValues[0][1] = Double.valueOf( 32 );
aValues[1][0] = "Test33";
aValues[1][1] = "Test34";
insertScenario( xSheet, "B10:C11", aValues, "Third Scenario", "The last scenario." );
@@ -972,8 +972,8 @@ public class SpreadsheetSample extends SpreadsheetDocHelper
Object[][] aValues =
{
{ "Apples", "Oranges" },
- { new Double( 5 ), new Double( 7 ) },
- { new Double( 6 ), new Double( 8 ) }
+ { Double.valueOf( 5 ), Double.valueOf( 7 ) },
+ { Double.valueOf( 6 ), Double.valueOf( 8 ) }
};
xData.setDataArray( aValues );
@@ -1080,27 +1080,27 @@ public class SpreadsheetSample extends SpreadsheetDocHelper
Object[][] aValues =
{
{ "Name", "Year", "Sales" },
- { "Alice", new Double( 2001 ), new Double( 4.0 ) },
- { "Carol", new Double( 1997 ), new Double( 3.0 ) },
- { "Carol", new Double( 1998 ), new Double( 8.0 ) },
- { "Bob", new Double( 1997 ), new Double( 8.0 ) },
- { "Alice", new Double( 2002 ), new Double( 9.0 ) },
- { "Alice", new Double( 1999 ), new Double( 7.0 ) },
- { "Alice", new Double( 1996 ), new Double( 3.0 ) },
- { "Bob", new Double( 2000 ), new Double( 1.0 ) },
- { "Carol", new Double( 1999 ), new Double( 5.0 ) },
- { "Bob", new Double( 2002 ), new Double( 1.0 ) },
- { "Carol", new Double( 2001 ), new Double( 5.0 ) },
- { "Carol", new Double( 2000 ), new Double( 1.0 ) },
- { "Carol", new Double( 1996 ), new Double( 8.0 ) },
- { "Bob", new Double( 1996 ), new Double( 7.0 ) },
- { "Alice", new Double( 1997 ), new Double( 3.0 ) },
- { "Alice", new Double( 2000 ), new Double( 9.0 ) },
- { "Bob", new Double( 1998 ), new Double( 1.0 ) },
- { "Bob", new Double( 1999 ), new Double( 6.0 ) },
- { "Carol", new Double( 2002 ), new Double( 8.0 ) },
- { "Alice", new Double( 1998 ), new Double( 5.0 ) },
- { "Bob", new Double( 2001 ), new Double( 6.0 ) }
+ { "Alice", Double.valueOf( 2001 ), Double.valueOf( 4.0 ) },
+ { "Carol", Double.valueOf( 1997 ), Double.valueOf( 3.0 ) },
+ { "Carol", Double.valueOf( 1998 ), Double.valueOf( 8.0 ) },
+ { "Bob", Double.valueOf( 1997 ), Double.valueOf( 8.0 ) },
+ { "Alice", Double.valueOf( 2002 ), Double.valueOf( 9.0 ) },
+ { "Alice", Double.valueOf( 1999 ), Double.valueOf( 7.0 ) },
+ { "Alice", Double.valueOf( 1996 ), Double.valueOf( 3.0 ) },
+ { "Bob", Double.valueOf( 2000 ), Double.valueOf( 1.0 ) },
+ { "Carol", Double.valueOf( 1999 ), Double.valueOf( 5.0 ) },
+ { "Bob", Double.valueOf( 2002 ), Double.valueOf( 1.0 ) },
+ { "Carol", Double.valueOf( 2001 ), Double.valueOf( 5.0 ) },
+ { "Carol", Double.valueOf( 2000 ), Double.valueOf( 1.0 ) },
+ { "Carol", Double.valueOf( 1996 ), Double.valueOf( 8.0 ) },
+ { "Bob", Double.valueOf( 1996 ), Double.valueOf( 7.0 ) },
+ { "Alice", Double.valueOf( 1997 ), Double.valueOf( 3.0 ) },
+ { "Alice", Double.valueOf( 2000 ), Double.valueOf( 9.0 ) },
+ { "Bob", Double.valueOf( 1998 ), Double.valueOf( 1.0 ) },
+ { "Bob", Double.valueOf( 1999 ), Double.valueOf( 6.0 ) },
+ { "Carol", Double.valueOf( 2002 ), Double.valueOf( 8.0 ) },
+ { "Alice", Double.valueOf( 1998 ), Double.valueOf( 5.0 ) },
+ { "Bob", Double.valueOf( 2001 ), Double.valueOf( 6.0 ) }
};
xData.setDataArray( aValues );
@@ -1285,7 +1285,7 @@ public class SpreadsheetSample extends SpreadsheetDocHelper
// construct the array of function arguments
Object[] aArgs = new Object[2];
aArgs[0] = aData;
- aArgs[1] = new Double( 2.0 );
+ aArgs[1] = Double.valueOf( 2.0 );
Object aResult = xFuncAcc.callFunction( "ZTEST", aArgs );
System.out.println("ZTEST result for data {1,2,3} and value 2 is "
+ ((Double)aResult).doubleValue() );
diff --git a/odk/examples/java/ToDo/ToDo.java b/odk/examples/java/ToDo/ToDo.java
index 312ab42d3fd0..36d0d7eece6a 100644
--- a/odk/examples/java/ToDo/ToDo.java
+++ b/odk/examples/java/ToDo/ToDo.java
@@ -736,11 +736,11 @@ public class ToDo {
// Good Friday
vectorHolidays.add(
- new Double( intEasterSunday - 2 ) );
+ Double.valueOf( intEasterSunday - 2 ) );
// Easter monday
vectorHolidays.add(
- new Double( intEasterSunday + 1 ) );
+ Double.valueOf( intEasterSunday + 1 ) );
// Labour Day
vectorHolidays.add( xfunctionaccess.callFunction(
@@ -751,10 +751,10 @@ public class ToDo {
Integer.valueOf( 1 ) } ));
// Ascension Day
- vectorHolidays.add(new Double(intEasterSunday + 39 ));
+ vectorHolidays.add(Double.valueOf(intEasterSunday + 39 ));
// Pentecost monday
- vectorHolidays.add(new Double(intEasterSunday + 50 ));
+ vectorHolidays.add(Double.valueOf(intEasterSunday + 50 ));
// German Unification
vectorHolidays.add( xfunctionaccess.callFunction(
@@ -863,7 +863,7 @@ public class ToDo {
dHolidayStart );
intHoliday <= (int) Math.round( dHolidayEnd );
intHoliday++ ) {
- vectorHolidays.add( new Double( intHoliday ) );
+ vectorHolidays.add( Double.valueOf( intHoliday ) );
}
}