Nuiton-j2r-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
April 2010
- 2 participants
- 22 discussions
Author: jcouteau
Date: 2010-04-19 12:50:13 +0200 (Mon, 19 Apr 2010)
New Revision: 203
Log:
Split the set method in a method per authorized type
Modified:
trunk/src/main/java/org/nuiton/j2r/types/RList.java
Modified: trunk/src/main/java/org/nuiton/j2r/types/RList.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-19 10:40:21 UTC (rev 202)
+++ trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-19 10:50:13 UTC (rev 203)
@@ -46,8 +46,6 @@
//Content of the list (eg elements of the list in R)
private List<Object> data;
private Log log = LogFactory.getLog(RDataFrame.class);
-
- //TODO JC implement the logger use !
/**
* Create a default RList linked to a R engine (the List is not initialized
* in R.)
@@ -166,6 +164,11 @@
returnString = returnString.substring(0, returnString.length() - 1);
}
returnString += ")";
+
+
+
+ System.out.println(returnString);
+
return returnString;
}
@@ -179,8 +182,106 @@
* @throws RException
* if no variable name has been given to the list
*/
- public void set(int x, Object data) throws RException {
+ public void set(int x, Double data) throws RException {
checkVariable();
+
+ setInData(x,data);
+
+ //in R, all data is numeric, no need to transformation, simple
+ //assignation
+ engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
+ this.variable, x + 1, data));
+ }
+
+ /**
+ * Method to set the xth object of the list to a value.
+ *
+ * @param x
+ * x coordinate (from 0 to size-1)
+ * @param data
+ * value to set
+ * @throws RException
+ * if no variable name has been given to the list
+ */
+ public void set(int x, Integer data) throws RException {
+ checkVariable();
+
+ setInData(x,data);
+
+ //transform the data in R integer
+ String asInteger = String.format(RInstructions.AS_INTEGER, data);
+ //assign the transformed data
+ engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
+ this.variable, x + 1, asInteger));
+ }
+
+ /**
+ * Method to set the xth object of the list to a value.
+ *
+ * @param x
+ * x coordinate (from 0 to size-1)
+ * @param data
+ * value to set
+ * @throws RException
+ * if no variable name has been given to the list
+ */
+ public void set(int x, Boolean data) throws RException {
+ checkVariable();
+
+ setInData(x,data);
+
+ if (data) {
+ engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
+ this.variable, x + 1, RInstructions.TRUE));
+ } else {
+ engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
+ this.variable, x + 1, RInstructions.FALSE));
+ }
+ }
+
+ /**
+ * Method to set the xth object of the list to a value.
+ *
+ * @param x
+ * x coordinate (from 0 to size-1)
+ * @param data
+ * value to set
+ * @throws RException
+ * if no variable name has been given to the list
+ */
+ public void set(int x, String data) throws RException {
+ checkVariable();
+
+ setInData(x,data);
+
+ engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
+ this.variable, x + 1, "\"" + data + "\""));
+ }
+
+ /**
+ * Method to set the xth object of the list to a value.
+ *
+ * @param x
+ * x coordinate (from 0 to size-1)
+ * @param data
+ * value to set
+ * @throws RException
+ * if no variable name has been given to the list
+ */
+ public void set(int x, REXP data) throws RException {
+ checkVariable();
+
+ setInData(x,data);
+
+ //Send the REXP to R
+ engine.voidEval(data.toRString());
+ //Set the REXP as list item
+ engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
+ this.variable, x + 1, data.getVariable()));
+ }
+
+
+ private void setInData(int x, Object data){
for (int i = 0; i <= x; i++) {
try {
this.data.get(i);
@@ -194,37 +295,7 @@
this.data.add(null);
}
}
-
}
- if (data instanceof Double) {
- //in R, all data is numeric, no need to transformation, simple
- //assignation
- engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
- this.variable, x + 1, data));
- } else if (data instanceof Integer) {
- //transform the data in R integer
- String asInteger = String.format(RInstructions.AS_INTEGER, data);
- //assign the transformed data
- engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
- this.variable, x + 1, asInteger));
- } else if (data instanceof Boolean) {
- if ((Boolean) data) {
- engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
- this.variable, x + 1, RInstructions.TRUE));
- } else {
- engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
- this.variable, x + 1, RInstructions.FALSE));
- }
- } else if (data instanceof String) {
- engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
- this.variable, x + 1, "\"" + data + "\""));
- } else if (data instanceof REXP) {
- //Send the REXP to R
- engine.voidEval(((REXP) data).toRString());
- //Set the REXP as list item
- engine.voidEval(String.format(RInstructions.SET_LIST_ITEM,
- this.variable, x + 1, ((REXP) data).getVariable()));
- }
}
/**
1
0
Author: jcouteau
Date: 2010-04-19 12:40:21 +0200 (Mon, 19 Apr 2010)
New Revision: 202
Log:
Remove system.out.println()
Modified:
trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
Modified: trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-19 09:28:53 UTC (rev 201)
+++ trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-19 10:40:21 UTC (rev 202)
@@ -397,7 +397,9 @@
returnString += "stringsAsFactors=FALSE)";
}
- System.out.println(returnString);
+ if(log.isDebugEnabled()){
+ log.debug(returnString);
+ }
return returnString;
}
1
0
Author: jcouteau
Date: 2010-04-19 11:28:53 +0200 (Mon, 19 Apr 2010)
New Revision: 201
Log:
Add a toString method to RDataFrame to represent it as in R. (under a table form with column and row names).
Modified:
trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
Modified: trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-16 18:12:42 UTC (rev 200)
+++ trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-19 09:28:53 UTC (rev 201)
@@ -57,8 +57,6 @@
//Vector containing the vectors of the data.frame
private List<List<?>> data;
- //TODO JC 20100415 Create a toString method that displays the DataFrame
-
/**
* Constructor
*
@@ -720,7 +718,7 @@
//get the first line of the file
BufferedReader br = new BufferedReader(new FileReader(inputFile));
tmp = br.readLine();
- String[] splitted = tmp.split("\\;");
+ String[] splitted = tmp.split(";");
//get the data size (number of columns)
if (rowNames) {
@@ -762,7 +760,7 @@
while ((tmp = br.readLine()) != null) {
//parse each line
- splitted = tmp.split("\\;");
+ splitted = tmp.split(";");
//to determine the data index on the line.
int index = 0;
@@ -814,20 +812,10 @@
br.close();
this.data = tempData;
-
if (log.isDebugEnabled()){
//Display the imported data.frame in debug mode
-
- log.debug("Imported DataFrame : ");
-
- for(List<?> column:this.data){
- String debugLine="Column " + this.data.indexOf(column)+ " : ";
- for(Object obj:column){
- debugLine += obj + " ,";
- }
- log.debug(debugLine);
- }
+ log.debug("Imported DataFrame : \n"+toString());
}
}
@@ -866,4 +854,124 @@
return (new int[]{x,y});
}
+
+ /**
+ * Method that returns a string representing the DataFrame. The output
+ * String should looks like the dataframe in R.
+ * @return a string representing the dataframe as in R.
+ */
+ @Override
+ public String toString(){
+
+ List<String> linesToDisplay = new ArrayList<String>();
+
+ Boolean displayRowNames = !rowNames.isEmpty();
+
+ Boolean displayNames = !names.isEmpty();
+
+ Integer numberOfLines = 0;
+
+ //Calculate the number of lines to display
+ if (!this.data.isEmpty()) {
+ if (!this.data.get(0).isEmpty()){
+ numberOfLines = this.data.get(0).size();
+ }
+ }
+ if (displayNames){
+ numberOfLines += 1;
+ }
+
+ // fill the lines with empty strings
+ for (int i=0;i<numberOfLines;i++){
+ linesToDisplay.add(i,"");
+ }
+
+ // Add the row names if necessary
+ if (displayRowNames){
+
+ // calculate the column size
+ int columnSize = 0;
+ for (String name:rowNames){
+ if (name.length()>columnSize){
+ columnSize = name.length();
+ }
+ }
+ columnSize +=2;
+
+ // add the row name to each line, complete with spaces to have next
+ // column aligned
+ if (displayNames) {
+ String line = linesToDisplay.get(0);
+ String str = String.format("%-"+columnSize+"s", "");
+ line +=str ;
+ linesToDisplay.set(0, line);
+ }
+ for (int i=0;i<rowNames.size();i++){
+ String str = String.format("%-"+columnSize+"s", rowNames.get(i));
+
+ if(displayNames) {
+ String line = linesToDisplay.get(i+1);
+ line += str;
+ linesToDisplay.set(i+1, line);
+ } else {
+ String line = linesToDisplay.get(i);
+ line += str;
+ linesToDisplay.set(i, line);
+ }
+
+ }
+
+ }
+
+ // for each column, calculate the column size, add the value to each
+ // line, complete with spaces to have next column aligned
+ for (List<?> column:this.data){
+
+ String columnName="";
+
+ // calculate the column size
+ int columnSize = 0;
+ if(displayNames){
+ columnName = names.get(this.data.indexOf(column));
+ columnSize = columnName.length();
+ }
+ for (Object obj:column){
+ String toString = obj.toString();
+ if (toString.length()>columnSize){
+ columnSize = toString.length();
+ }
+ }
+ columnSize +=2;
+
+ if(displayNames){
+ String str = String.format("%-"+columnSize+"s", columnName);
+ String line = linesToDisplay.get(0);
+ line += str;
+ linesToDisplay.set(0, line);
+ }
+
+ for (int i=0;i<column.size();i++){
+
+ String str = String.format("%-"+columnSize+"s", column.get(i));
+
+ if(displayNames) {
+ String line = linesToDisplay.get(i+1);
+ line += str;
+ linesToDisplay.set(i+1, line);
+ } else {
+ String line = linesToDisplay.get(i);
+ line += str;
+ linesToDisplay.set(i, line);
+ }
+ }
+ }
+
+ String returnString = "";
+
+ for (String str:linesToDisplay){
+ returnString+= str +"\n";
+ }
+
+ return returnString;
+ }
}
1
0
Author: tchemit
Date: 2010-04-16 20:12:42 +0200 (Fri, 16 Apr 2010)
New Revision: 200
Log:
Utilisation de mavenpom4redmine 2.1.1
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-15 14:29:08 UTC (rev 199)
+++ trunk/pom.xml 2010-04-16 18:12:42 UTC (rev 200)
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
- <!--
+<!--
#%L
Nuiton Java-2-R library
@@ -23,9 +23,7 @@
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -36,7 +34,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.1</version>
+ <version>2.1.1</version>
</parent>
<artifactId>nuiton-j2r</artifactId>
1
0
r199 - in trunk: . src/license src/main/java/org/nuiton/j2r src/main/java/org/nuiton/j2r/jni src/main/java/org/nuiton/j2r/net src/main/java/org/nuiton/j2r/types src/site src/site/rst src/test/java/org/nuiton/j2r
by tchemit@users.nuiton.org 15 Apr '10
by tchemit@users.nuiton.org 15 Apr '10
15 Apr '10
Author: tchemit
Date: 2010-04-15 16:29:08 +0200 (Thu, 15 Apr 2010)
New Revision: 199
Log:
remove redundant svn keywords on header
Modified:
trunk/pom.xml
trunk/src/license/project.xml
trunk/src/main/java/org/nuiton/j2r/REngine.java
trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java
trunk/src/main/java/org/nuiton/j2r/RException.java
trunk/src/main/java/org/nuiton/j2r/RInstructions.java
trunk/src/main/java/org/nuiton/j2r/RProxy.java
trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java
trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java
trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
trunk/src/main/java/org/nuiton/j2r/types/REXP.java
trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
trunk/src/main/java/org/nuiton/j2r/types/RList.java
trunk/src/site/rst/etude.rst
trunk/src/site/rst/index.rst
trunk/src/site/rst/installation.rst
trunk/src/site/rst/module.rst
trunk/src/site/site.xml
trunk/src/test/java/org/nuiton/j2r/DataframeTest.java
trunk/src/test/java/org/nuiton/j2r/JNITest.java
trunk/src/test/java/org/nuiton/j2r/JPurTest.java
trunk/src/test/java/org/nuiton/j2r/ListTest.java
trunk/src/test/java/org/nuiton/j2r/LutinTimer.java
trunk/src/test/java/org/nuiton/j2r/NetTest.java
trunk/src/test/java/org/nuiton/j2r/TestConstants.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/pom.xml 2010-04-15 14:29:08 UTC (rev 199)
@@ -3,7 +3,6 @@
#%L
Nuiton Java-2-R library
- $Author$
$Id$
$HeadURL$
%%
Modified: trunk/src/license/project.xml
===================================================================
--- trunk/src/license/project.xml 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/license/project.xml 2010-04-15 14:29:08 UTC (rev 199)
@@ -3,7 +3,6 @@
#%L
Nuiton Java-2-R library
- $Author: tchemit $
$Id$
$HeadURL$
%%
Modified: trunk/src/main/java/org/nuiton/j2r/REngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/REngine.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/REngine.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/RException.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RException.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/RException.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/RInstructions.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RInstructions.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/RInstructions.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/RProxy.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RProxy.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/RProxy.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXP.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXP.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXP.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/types/RList.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/site/rst/etude.rst
===================================================================
--- trunk/src/site/rst/etude.rst 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/site/rst/etude.rst 2010-04-15 14:29:08 UTC (rev 199)
@@ -9,7 +9,6 @@
.. * #%L
.. * Nuiton Java-2-R library
.. *
-.. * $Author$
.. * $Id$
.. * $HeadURL$
.. * %%
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/site/rst/index.rst 2010-04-15 14:29:08 UTC (rev 199)
@@ -6,7 +6,6 @@
.. * #%L
.. * Nuiton Java-2-R library
.. *
-.. * $Author$
.. * $Id$
.. * $HeadURL$
.. * %%
Modified: trunk/src/site/rst/installation.rst
===================================================================
--- trunk/src/site/rst/installation.rst 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/site/rst/installation.rst 2010-04-15 14:29:08 UTC (rev 199)
@@ -11,7 +11,6 @@
.. * #%L
.. * Nuiton Java-2-R library
.. *
-.. * $Author$
.. * $Id$
.. * $HeadURL$
.. * %%
Modified: trunk/src/site/rst/module.rst
===================================================================
--- trunk/src/site/rst/module.rst 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/site/rst/module.rst 2010-04-15 14:29:08 UTC (rev 199)
@@ -13,7 +13,6 @@
.. * #%L
.. * Nuiton Java-2-R library
.. *
-.. * $Author$
.. * $Id$
.. * $HeadURL$
.. * %%
Modified: trunk/src/site/site.xml
===================================================================
--- trunk/src/site/site.xml 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/site/site.xml 2010-04-15 14:29:08 UTC (rev 199)
@@ -3,7 +3,6 @@
#%L
Nuiton Java-2-R library
- $Author$
$Id$
$HeadURL$
%%
Modified: trunk/src/test/java/org/nuiton/j2r/DataframeTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/DataframeTest.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/test/java/org/nuiton/j2r/DataframeTest.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/JNITest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/JNITest.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/test/java/org/nuiton/j2r/JNITest.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
@@ -33,8 +32,7 @@
* @version $Revision$
*
* Mise a jour: $Date$
- * par : $Author$
- */
+ * par : */
package org.nuiton.j2r;
import static org.nuiton.j2r.TestConstants.S_NB_LOOPS;
Modified: trunk/src/test/java/org/nuiton/j2r/JPurTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/JPurTest.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/test/java/org/nuiton/j2r/JPurTest.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/ListTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/ListTest.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/test/java/org/nuiton/j2r/ListTest.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/LutinTimer.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/LutinTimer.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/test/java/org/nuiton/j2r/LutinTimer.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/NetTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/NetTest.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/test/java/org/nuiton/j2r/NetTest.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
@@ -33,8 +32,7 @@
* @version $Revision$
*
* Mise a jour: $Date$
- * par : $Author$
- */
+ * par : */
package org.nuiton.j2r;
import static org.nuiton.j2r.TestConstants.S_NB_LOOPS;
Modified: trunk/src/test/java/org/nuiton/j2r/TestConstants.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/TestConstants.java 2010-04-15 11:10:09 UTC (rev 198)
+++ trunk/src/test/java/org/nuiton/j2r/TestConstants.java 2010-04-15 14:29:08 UTC (rev 199)
@@ -2,7 +2,6 @@
* #%L
* Nuiton Java-2-R library
*
- * $Author$
* $Id$
* $HeadURL$
* %%
1
0
r198 - in trunk: . src/license src/main/java/org/nuiton/j2r src/main/java/org/nuiton/j2r/jni src/main/java/org/nuiton/j2r/net src/main/java/org/nuiton/j2r/types src/site src/site/rst src/test/java/org/nuiton/j2r
by tchemit@users.nuiton.org 15 Apr '10
by tchemit@users.nuiton.org 15 Apr '10
15 Apr '10
Author: tchemit
Date: 2010-04-15 13:10:09 +0200 (Thu, 15 Apr 2010)
New Revision: 198
Log:
remove Date and Rev svn keywords
Modified:
trunk/pom.xml
trunk/src/license/project.xml
trunk/src/main/java/org/nuiton/j2r/REngine.java
trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java
trunk/src/main/java/org/nuiton/j2r/RException.java
trunk/src/main/java/org/nuiton/j2r/RInstructions.java
trunk/src/main/java/org/nuiton/j2r/RProxy.java
trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java
trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java
trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
trunk/src/main/java/org/nuiton/j2r/types/REXP.java
trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
trunk/src/main/java/org/nuiton/j2r/types/RList.java
trunk/src/site/rst/etude.rst
trunk/src/site/rst/index.rst
trunk/src/site/rst/installation.rst
trunk/src/site/rst/module.rst
trunk/src/site/site.xml
trunk/src/test/java/org/nuiton/j2r/DataframeTest.java
trunk/src/test/java/org/nuiton/j2r/JNITest.java
trunk/src/test/java/org/nuiton/j2r/JPurTest.java
trunk/src/test/java/org/nuiton/j2r/ListTest.java
trunk/src/test/java/org/nuiton/j2r/LutinTimer.java
trunk/src/test/java/org/nuiton/j2r/NetTest.java
trunk/src/test/java/org/nuiton/j2r/TestConstants.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/pom.xml 2010-04-15 11:10:09 UTC (rev 198)
@@ -4,8 +4,6 @@
Nuiton Java-2-R library
$Author$
- $LastChangedDate$
- $LastChangedRevision$
$Id$
$HeadURL$
%%
Modified: trunk/src/license/project.xml
===================================================================
--- trunk/src/license/project.xml 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/license/project.xml 2010-04-15 11:10:09 UTC (rev 198)
@@ -1,4 +1,29 @@
<?xml version='1.0' encoding='UTF-8'?>
+ <!--
+ #%L
+ Nuiton Java-2-R library
+
+ $Author: tchemit $
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2006 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
Modified: trunk/src/main/java/org/nuiton/j2r/REngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/REngine.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/REngine.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/RException.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RException.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/RException.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/RInstructions.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RInstructions.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/RInstructions.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/RProxy.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RProxy.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/RProxy.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
@@ -52,7 +50,7 @@
* <li><code>-DR.type=...</code></li>
* </ul>
* It is possible to parametrize the network solution, for that, see the
- * {@link org.nuiton.j2r.net.RNetEngine} documentation.
+ * {@link RNetEngine} documentation.
*/
public class RProxy implements REngine {
@@ -153,7 +151,7 @@
*
* @return the result of the R instruction.
*
- * @see org.nuiton.j2r.REngine#eval(java.lang.String)
+ * @see REngine#eval(String)
*/
@Override
public Object eval(String expr) throws RException {
@@ -168,7 +166,7 @@
/**
* Get back the R engine type options to initialize the REngine.
*
- * @see org.nuiton.j2r.REngine#init()
+ * @see REngine#init()
*/
@Override
public boolean init() {
@@ -190,7 +188,7 @@
/**
* Terminate the R engine.
*
- * @see org.nuiton.j2r.REngine#terminate()
+ * @see REngine#terminate()
*/
@Override
public void terminate() throws RException {
@@ -207,7 +205,7 @@
*
* @param expr the R instruction to send.
*
- * @see org.nuiton.j2r.REngine#voidEval(java.lang.String)
+ * @see REngine#voidEval(String)
*/
@Override
public void voidEval(String expr) throws RException {
@@ -226,8 +224,8 @@
* directory where the .RData file is located
* @throws RException if an error occcur while loading the R session.
*
- * @see org.nuiton.j2r.REngine#loadRData(java.io.File)
- * @see org.nuiton.j2r.REngineAbstract#loadRData(java.io.File)
+ * @see REngine#loadRData(File)
+ * @see REngineAbstract#loadRData(File)
*/
@Override
public void loadRData(File directory) throws RException {
@@ -247,8 +245,8 @@
* where the .RData file will be saved
* @throws RException if an error occur while saving the R session.
*
- * @see org.nuiton.j2r.REngine#saveRData(java.io.File)
- * @see org.nuiton.j2r.REngineAbstract#saveRData(java.io.File)
+ * @see REngine#saveRData(File)
+ * @see REngineAbstract#saveRData(File)
*/
@Override
public void saveRData(File directory) throws RException {
@@ -268,8 +266,8 @@
*
* @throws RException if an error occur while setting the R working directory.
*
- * @see org.nuiton.j2r.REngine#setwd(java.io.File)
- * @see org.nuiton.j2r.REngineAbstract#setwd(java.io.File)
+ * @see REngine#setwd(File)
+ * @see REngineAbstract#setwd(File)
*/
@Override
public void setwd(File directory) throws RException {
@@ -289,8 +287,8 @@
*
* @throws RException if an error occur while getting the R working directory.
*
- * @see org.nuiton.j2r.REngine#getwd()
- * @see org.nuiton.j2r.REngineAbstract#getwd()
+ * @see REngine#getwd()
+ * @see REngineAbstract#getwd()
*/
@Override
public File getwd() throws RException {
@@ -313,8 +311,8 @@
* @throws RException if an error occur while saving the content of the
* object.
*
- * @see org.nuiton.j2r.REngine#dput(java.lang.String, java.lang.String)
- * @see org.nuiton.j2r.REngineAbstract#dput(java.lang.String, java.lang.String)
+ * @see REngine#dput(String, String)
+ * @see REngineAbstract#dput(String, String)
*/
@Override
public void dput(String rObject, String outputFileName) throws RException {
@@ -339,8 +337,8 @@
* @throws RException if an error occur while trying to perform this
* operation.
*
- * @see org.nuiton.j2r.REngine#dget(java.lang.String, java.lang.String)
- * @see org.nuiton.j2r.REngineAbstract#dget(java.lang.String, java.lang.String)
+ * @see REngine#dget(String, String)
+ * @see REngineAbstract#dget(String, String)
*/
@Override
public void dget(String rObject, String inputFileName) throws RException {
@@ -363,8 +361,8 @@
* the file to save
* @throws RException if an error occur while performing the operation.
*
- * @see org.nuiton.j2r.REngine#dput(java.lang.String, java.io.File)
- * @see org.nuiton.j2r.REngineAbstract#dput(java.lang.String, java.io.File)
+ * @see REngine#dput(String, File)
+ * @see REngineAbstract#dput(String, File)
*/
@Override
public void dput(String rObject, File outputFile) throws RException {
@@ -391,8 +389,8 @@
* file to load
* @throws RException if an eroor occur while performing the operation.
*
- * @see org.nuiton.j2r.REngine#dget(java.lang.String, java.io.File)
- * @see org.nuiton.j2r.REngineAbstract#dget(java.lang.String, java.io.File)
+ * @see REngine#dget(String, File)
+ * @see REngineAbstract#dget(String, File)
*/
@Override
public void dget(String rObject, File inputFile) throws RException {
@@ -414,11 +412,11 @@
*
* @param rObject name of the R object to remove.
*
- * @throws org.nuiton.j2r.RException if an error occur while removing the R
+ * @throws RException if an error occur while removing the R
* object.
*
- * @see org.nuiton.j2r.REngine#remove(java.lang.String)
- * @see org.nuiton.j2r.REngineAbstract#remove(java.lang.String)
+ * @see REngine#remove(String)
+ * @see REngineAbstract#remove(String)
*/
@Override
public void remove(String rObject) throws RException {
@@ -437,11 +435,11 @@
*
* @param destination the destination R object name
*
- * @throws org.nuiton.j2r.RException if an error occur while renaming the R
+ * @throws RException if an error occur while renaming the R
* object.
*
- * @see org.nuiton.j2r.REngine#mv(java.lang.String, java.lang.String)
- * @see org.nuiton.j2r.REngineAbstract#mv(java.lang.String, java.lang.String)
+ * @see REngine#mv(String, String)
+ * @see REngineAbstract#mv(String, String)
*/
@Override
public void mv(String source, String destination) throws RException {
@@ -461,11 +459,11 @@
*
* @param outputObject the destination R object name
*
- * @throws org.nuiton.j2r.RException if an error occur while copying the R
+ * @throws RException if an error occur while copying the R
* object.
*
- * @see org.nuiton.j2r.REngine#cp(java.lang.String, java.lang.String)
- * @see org.nuiton.j2r.REngineAbstract#cp(java.lang.String, java.lang.String)
+ * @see REngine#cp(String, String)
+ * @see REngineAbstract#cp(String, String)
*/
@Override
public void cp(String inputObject, String outputObject) throws RException {
@@ -483,11 +481,11 @@
*
* @return a table containing all the R objects present in session.
*
- * @throws org.nuiton.j2r.RException if an error occur while getting back
+ * @throws RException if an error occur while getting back
* the objects list.
*
- * @see org.nuiton.j2r.REngine#ls()
- * @see org.nuiton.j2r.REngineAbstract#ls()
+ * @see REngine#ls()
+ * @see REngineAbstract#ls()
*/
@Override
public String[] ls() throws RException {
@@ -502,11 +500,11 @@
/**
* Method to remove all objects from the R session.
*
- * @throws org.nuiton.j2r.RException if an error occur while clearing the R
+ * @throws RException if an error occur while clearing the R
* session.
*
- * @see org.nuiton.j2r.REngine#clearSession()
- * @see org.nuiton.j2r.REngineAbstract#clearSession()
+ * @see REngine#clearSession()
+ * @see REngineAbstract#clearSession()
*/
@Override
public void clearSession() throws RException {
@@ -522,11 +520,11 @@
* Method to launch the evaluation of all the R expressions stored when in
* non-autocommit mode.
*
- * @throws org.nuiton.j2r.RException if an error occur while evaluating one
+ * @throws RException if an error occur while evaluating one
* of the R expressions.
*
- * @see org.nuiton.j2r.REngine#commit()
- * @see org.nuiton.j2r.REngineAbstract#commit()
+ * @see REngine#commit()
+ * @see REngineAbstract#commit()
*/
@Override
public void commit() throws RException {
@@ -545,11 +543,11 @@
*
* @param autocommit the autocommit mode
*
- * @throws org.nuiton.j2r.RException if an error occur while switching
+ * @throws RException if an error occur while switching
* modes.
*
- * @see org.nuiton.j2r.REngine#setAutoCommit(java.lang.Boolean)
- * @see org.nuiton.j2r.REngine#setAutoCommit(java.lang.Boolean)
+ * @see REngine#setAutoCommit(Boolean)
+ * @see REngine#setAutoCommit(Boolean)
*/
@Override
public void setAutoCommit(Boolean autocommit) throws RException {
@@ -568,8 +566,8 @@
*
* @return the autocommit mode
*
- * @see org.nuiton.j2r.REngine#isAutoCommit()
- * @see org.nuiton.j2r.REngineAbstract#isAutoCommit()
+ * @see REngine#isAutoCommit()
+ * @see REngineAbstract#isAutoCommit()
*/
@Override
public Boolean isAutoCommit() {
@@ -589,11 +587,11 @@
* @param fileName name of the file to save (will save in the fileName.RData
* file)
*
- * @throws org.nuiton.j2r.RException if an error occur while saving the R
+ * @throws RException if an error occur while saving the R
* session.
*
- * @see org.nuiton.j2r.REngine#saveRData(java.io.File, java.lang.String)
- * @see org.nuiton.j2r.REngineAbstract#saveRData(java.io.File, java.lang.String)
+ * @see REngine#saveRData(File, String)
+ * @see REngineAbstract#saveRData(File, String)
*/
@Override
public void saveRData(File directory, String fileName) throws RException {
@@ -613,11 +611,11 @@
* @param fileName name of the file to load (will load the fileName.RData
* file)
*
- * @throws org.nuiton.j2r.RException if an error occur while loading the R
+ * @throws RException if an error occur while loading the R
* session file.
*
- * @see org.nuiton.j2r.REngine#loadRData(java.io.File, java.lang.String)
- * @see org.nuiton.j2r.REngineAbstract#loadRData(java.io.File, java.lang.String)
+ * @see REngine#loadRData(File, String)
+ * @see REngineAbstract#loadRData(File, String)
*/
@Override
public void loadRData(File directory, String fileName) throws RException {
Modified: trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXP.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXP.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXP.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/main/java/org/nuiton/j2r/types/RList.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/site/rst/etude.rst
===================================================================
--- trunk/src/site/rst/etude.rst 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/site/rst/etude.rst 2010-04-15 11:10:09 UTC (rev 198)
@@ -10,8 +10,6 @@
.. * Nuiton Java-2-R library
.. *
.. * $Author$
-.. * $LastChangedDate$
-.. * $LastChangedRevision$
.. * $Id$
.. * $HeadURL$
.. * %%
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/site/rst/index.rst 2010-04-15 11:10:09 UTC (rev 198)
@@ -7,8 +7,6 @@
.. * Nuiton Java-2-R library
.. *
.. * $Author$
-.. * $LastChangedDate$
-.. * $LastChangedRevision$
.. * $Id$
.. * $HeadURL$
.. * %%
Modified: trunk/src/site/rst/installation.rst
===================================================================
--- trunk/src/site/rst/installation.rst 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/site/rst/installation.rst 2010-04-15 11:10:09 UTC (rev 198)
@@ -2,7 +2,6 @@
Installation
============
-
Le présent document a pour but de faciliter les différentes installations nécessaires en vue d'utiliser la librairie LutinJ2R.
@@ -13,8 +12,6 @@
.. * Nuiton Java-2-R library
.. *
.. * $Author$
-.. * $LastChangedDate$
-.. * $LastChangedRevision$
.. * $Id$
.. * $HeadURL$
.. * %%
Modified: trunk/src/site/rst/module.rst
===================================================================
--- trunk/src/site/rst/module.rst 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/site/rst/module.rst 2010-04-15 11:10:09 UTC (rev 198)
@@ -2,7 +2,6 @@
Documentation du module
=======================
-
.. contents::
@@ -15,8 +14,6 @@
.. * Nuiton Java-2-R library
.. *
.. * $Author$
-.. * $LastChangedDate$
-.. * $LastChangedRevision$
.. * $Id$
.. * $HeadURL$
.. * %%
Modified: trunk/src/site/site.xml
===================================================================
--- trunk/src/site/site.xml 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/site/site.xml 2010-04-15 11:10:09 UTC (rev 198)
@@ -4,8 +4,6 @@
Nuiton Java-2-R library
$Author$
- $LastChangedDate$
- $LastChangedRevision$
$Id$
$HeadURL$
%%
Modified: trunk/src/test/java/org/nuiton/j2r/DataframeTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/DataframeTest.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/test/java/org/nuiton/j2r/DataframeTest.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/JNITest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/JNITest.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/test/java/org/nuiton/j2r/JNITest.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/JPurTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/JPurTest.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/test/java/org/nuiton/j2r/JPurTest.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/ListTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/ListTest.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/test/java/org/nuiton/j2r/ListTest.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/LutinTimer.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/LutinTimer.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/test/java/org/nuiton/j2r/LutinTimer.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/NetTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/NetTest.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/test/java/org/nuiton/j2r/NetTest.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
Modified: trunk/src/test/java/org/nuiton/j2r/TestConstants.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/TestConstants.java 2010-04-15 09:21:38 UTC (rev 197)
+++ trunk/src/test/java/org/nuiton/j2r/TestConstants.java 2010-04-15 11:10:09 UTC (rev 198)
@@ -3,8 +3,6 @@
* Nuiton Java-2-R library
*
* $Author$
- * $LastChangedDate$
- * $LastChangedRevision$
* $Id$
* $HeadURL$
* %%
1
0
Author: jcouteau
Date: 2010-04-15 11:21:38 +0200 (Thu, 15 Apr 2010)
New Revision: 197
Log:
Clean code, improve toRString method for RDataFrames (deal with empty dataframe)
Modified:
trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
trunk/src/main/java/org/nuiton/j2r/types/REXP.java
trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
trunk/src/main/java/org/nuiton/j2r/types/RList.java
Modified: trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-15 07:44:34 UTC (rev 196)
+++ trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-15 09:21:38 UTC (rev 197)
@@ -60,6 +60,8 @@
//Vector containing the vectors of the data.frame
private List<List<?>> data;
+ //TODO JC 20100415 Create a toString method that displays the DataFrame
+
/**
* Constructor
*
@@ -336,42 +338,54 @@
@Override
public String toRString() throws RException {
checkVariable();
+
String returnString = this.variable + "<-data.frame(";
- if (!(this.data.isEmpty())) {
- for (int i = 0; i < data.size(); i++) {
+
+ for (List<?> column:this.data){
+
+ if (!column.isEmpty()){
+
if (!(this.names.isEmpty())) {
- returnString += this.names.get(i) + "=c(";
+ int index = this.data.indexOf(column);
+ returnString += this.names.get(index) + "=c(";
} else {
returnString += "c(";
}
- if (data.get(i).get(0) instanceof String) {
- for (int j = 0; j < data.get(i).size(); j++) {
- returnString += "\"" + data.get(i).get(j) + "\",";
+
+ Object firstElement = column.get(0);
+
+
+ if (firstElement instanceof String) {
+ for (Object obj:column) {
+ returnString += "\"" + obj + "\",";
}
- } else if (data.get(i).get(0) instanceof Boolean) {
- for (int j = 0; j < data.get(i).size(); j++) {
- if ((Boolean) data.get(i).get(j)) {
+ } else if (firstElement instanceof Boolean) {
+ for (Object obj:column) {
+ if ((Boolean) obj) {
returnString += RInstructions.TRUE + ",";
} else {
returnString += RInstructions.FALSE + ",";
}
}
- } else if (data.get(i).get(0) instanceof Integer) {
- for (int j = 0; j < data.get(i).size(); j++) {
+ } else if (firstElement instanceof Integer) {
+ for (Object obj:column) {
returnString += String.format(RInstructions.AS_INTEGER,
- data.get(i).get(j)) + ",";
+ obj) + ",";
}
} else {
- for (int j = 0; j < data.get(i).size(); j++) {
- returnString += data.get(i).get(j) + ",";
+ for (Object obj:column) {
+ returnString += obj + ",";
}
}
+
returnString = returnString.substring(0,
returnString.length() - 1);
returnString = returnString + "),";
+
+ }
- }
+
}
if (!(this.rowNames.isEmpty())) {
returnString += "row.names=c(";
@@ -387,6 +401,9 @@
} else {
returnString += "stringsAsFactors=FALSE)";
}
+
+ System.out.println(returnString);
+
return returnString;
}
@@ -491,7 +508,7 @@
* @return a ArrayList containing the ArrayLists of the R data.frame
*/
public List<List<?>> getData() {
- //TODO manage the autocommit mode here.
+ //TODO JC manage the autocommit mode here.
return data;
}
@@ -697,88 +714,125 @@
*/
public void importCsv(File inputFile, boolean rowNames, boolean names,
List<Object> importTypes) throws IOException {
+
//temporary String to read lines.
String tmp;
+
Integer dataSize;
+
//get the first line of the file
BufferedReader br = new BufferedReader(new FileReader(inputFile));
tmp = br.readLine();
String[] splitted = tmp.split("\\;");
+
//get the data size (number of columns)
if (rowNames) {
dataSize = splitted.length - 1;
} else {
dataSize = splitted.length;
}
+
//if data has already been initialized, clear it.
if (this.data != null) {
this.data.clear();
}
- if ((rowNames) && (this.rowNames != null)) {
+
+ //Clear rowNames
+ if ((this.rowNames != null)) {
this.rowNames.clear();
+ }
+ //if names has already been initialized, clear it.
+ if (this.names != null) {
+ this.names.clear();
}
+
if (names) {
//if names are present in the file, parse the first line to get
//the names.
- if (this.names != null) {
- //if names has already been initialized, clear it.
- this.names.clear();
- }
- //get every name from the first line
this.names.addAll(Arrays.asList(splitted).subList(1, splitted.length));
}
//temporary data list.
- List<List<?>> tempData =
- new ArrayList<List<?>>();
+ List<List<?>> tempData = new ArrayList<List<?>>();
- //Initialize all the data columns
+ //Initialize all the data columns with empty lists
for (int i = 0; i < dataSize; i++) {
List<Object> column = new ArrayList<Object>();
tempData.add(column);
}
while ((tmp = br.readLine()) != null) {
+
//parse each line
splitted = tmp.split("\\;");
+
//to determine the data index on the line.
int index = 0;
+
+ //if there are row names, extract the first item as the row name
if (rowNames) {
- //if there are row names, extract the first item as the row name
this.rowNames.add(splitted[0]);
index = 1;
}
+
for (int i = index; i < splitted.length; i++) {
//cast the data imported to the specified type.
//test the size of the inputType list. If 1 import all the
//columns as the type of the first element.
- if (importTypes.size() == 1) {
- if (importTypes.get(0) instanceof String) {
- ((ArrayList<Object>) tempData.get(i - index)).add(
- splitted[i]);
- } else if (importTypes.get(0) instanceof Double) {
- ((ArrayList<Object>) tempData.get(i - index)).add(Double.valueOf(
- splitted[i]));
- } else if (importTypes.get(0) instanceof Integer) {
- ((ArrayList<Object>) tempData.get(i - index)).add(Integer.valueOf(
- splitted[i]));
- }
- } else if (importTypes.get(i - index) instanceof String) {
- ((ArrayList<Object>) tempData.get(i - index)).add(
- splitted[i]);
- } else if (importTypes.get(i - index) instanceof Double) {
- ((ArrayList<Object>) tempData.get(i - index)).add(Double.valueOf(
- splitted[i]));
- } else if (importTypes.get(i - index) instanceof Integer) {
- ((ArrayList<Object>) tempData.get(i - index)).add(Integer.valueOf(
- splitted[i]));
+ //Get the column for index
+ ArrayList<Object> objects = (ArrayList<Object>)tempData.get(i - index);
+
+ //add to the column the converted value. If importTypes contains
+ //only one element, cast into this type, else cast into the
+ //column type.
+ if (((importTypes.size() == 1) &&
+ (importTypes.get(0) instanceof String) ) ||
+ ((importTypes.size() > (i -index )) &&
+ (importTypes.get(i - index) instanceof String)) ) {
+
+ //We import strings so no cast in case of string
+ objects.add(splitted[i]);
+
+ } else if (((importTypes.size() == 1) &&
+ (importTypes.get(0) instanceof Double) ) ||
+ ((importTypes.size() > (i -index )) &&
+ (importTypes.get(i - index) instanceof Double))) {
+
+ //in case of Double
+ objects.add(Double.valueOf(splitted[i]));
+
+ } else if (((importTypes.size() == 1) &&
+ (importTypes.get(0) instanceof Integer) ) ||
+ ((importTypes.size() > (i -index )) &&
+ (importTypes.get(i - index) instanceof Integer))) {
+
+ //in case of Integer
+ objects.add(Integer.valueOf(splitted[i]));
+
}
}
}
br.close();
this.data = tempData;
+
+
+ if (log.isDebugEnabled()){
+
+ //Display the imported data.frame in debug mode
+
+ log.debug("Imported DataFrame : ");
+
+ for(List<?> column:this.data){
+ String debugLine="Column " + this.data.indexOf(column)+ " : ";
+ for(Object obj:column){
+ debugLine += obj + " ,";
+ }
+ log.debug(debugLine);
+ }
+ }
+
}
private void checkY(int y) {
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXP.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXP.java 2010-04-15 07:44:34 UTC (rev 196)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXP.java 2010-04-15 09:21:38 UTC (rev 197)
@@ -51,8 +51,6 @@
*
* @param variable
* name of the data.frame in R
- * @param engine
- * a REngine where the R session is located.
* @throws RException
*/
void getFrom(String variable) throws RException;
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-15 07:44:34 UTC (rev 196)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-15 09:21:38 UTC (rev 197)
@@ -68,7 +68,7 @@
@Override
public void setAttributes(Map<String, Object> attributes) throws RException {
- //TODO should be useful to test the validity of attributes before assigning it.
+ //TODO JC should be useful to test the validity of attributes before assigning it.
this.attributes = attributes;
if ((this.attributes != null) && (!this.attributes.isEmpty())) {
Modified: trunk/src/main/java/org/nuiton/j2r/types/RList.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-15 07:44:34 UTC (rev 196)
+++ trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-15 09:21:38 UTC (rev 197)
@@ -29,6 +29,7 @@
package org.nuiton.j2r.types;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -49,7 +50,7 @@
private List<Object> data;
private Log log = LogFactory.getLog(RDataFrame.class);
- //TODO implement the logger use !
+ //TODO JC implement the logger use !
/**
* Create a default RList linked to a R engine (the List is not initialized
* in R.)
@@ -79,7 +80,7 @@
String variable) throws RException {
super();
this.names = names;
- this.data = (ArrayList<Object>) data;
+ this.data = data;
this.variable = variable;
this.attributes = new HashMap<String, Object>();
this.engine = engine;
@@ -102,12 +103,19 @@
*/
public RList(String[] names, List<Object> data, REngine engine,
String variable) throws RException {
+
super();
+
+ String[] tempNames = {};
+
+ if(names!=null){
+ tempNames = names.clone();
+ }
+
+
this.names = new ArrayList<String>();
- for (int i = 0; i < names.length; i++) {
- this.names.add(names[i]);
- }
- this.data = (ArrayList<Object>) data;
+ this.names.addAll(Arrays.asList(tempNames));
+ this.data = data;
this.variable = variable;
this.attributes = new HashMap<String, Object>();
this.engine = engine;
@@ -237,13 +245,13 @@
Object returnObject = engine.eval(String.format(
RInstructions.GET_LIST_ITEM, this.variable, x + 1));
if (returnObject instanceof String) {
- this.data.set(x, (String) returnObject);
+ this.data.set(x, returnObject);
} else if (returnObject instanceof Double) {
- this.data.set(x, (Double) returnObject);
+ this.data.set(x, returnObject);
} else if (returnObject instanceof Integer) {
- this.data.set(x, (Integer) returnObject);
+ this.data.set(x, returnObject);
} else if (returnObject instanceof Boolean) {
- this.data.set(x, (Boolean) returnObject);
+ this.data.set(x, returnObject);
}
}
return this.data.get(x);
@@ -264,7 +272,7 @@
*
* @param data
* a List of Objects, containing each element of the R list
- * @throws RException
+ * @throws RException if cannot communicate with R
*/
public void setData(List<Object> data) throws RException {
this.data = data;
@@ -300,9 +308,7 @@
//update names
String[] namesArray = (String[]) engine.eval(String.format(
RInstructions.GET_NAMES, this.variable));
- for (int i = 0; i < namesArray.length; i++) {
- names.add(namesArray[i]);
- }
+ names.addAll(Arrays.asList(namesArray));
//update data
int length = (Integer) engine.eval(String.format(RInstructions.LENGTH,
1
0
Author: tchemit
Date: 2010-04-15 09:44:34 +0200 (Thu, 15 Apr 2010)
New Revision: 196
Log:
do EVER commit idea files
Modified:
trunk/
Property changes on: trunk
___________________________________________________________________
Modified: svn:ignore
- target
.classpath
.project
.settings
*.iml
*.ipr
+ target
.classpath
.project
.settings
*.iml
*.ipr
nbactions.xml
nb-configuration.xml
1
0
r195 - in trunk: . src src/license src/main/java/org/nuiton/j2r src/main/java/org/nuiton/j2r/jni src/main/java/org/nuiton/j2r/net src/main/java/org/nuiton/j2r/types src/site src/site/rst src/test/java/org/nuiton/j2r
by tchemit@users.nuiton.org 15 Apr '10
by tchemit@users.nuiton.org 15 Apr '10
15 Apr '10
Author: tchemit
Date: 2010-04-15 09:37:58 +0200 (Thu, 15 Apr 2010)
New Revision: 195
Log:
Evolution #518: Use maven-license-plugin 2.1
Added:
trunk/src/license/
trunk/src/license/project.xml
Removed:
trunk/nb-configuration.xml
trunk/nbactions.xml
Modified:
trunk/pom.xml
trunk/src/main/java/org/nuiton/j2r/REngine.java
trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java
trunk/src/main/java/org/nuiton/j2r/RException.java
trunk/src/main/java/org/nuiton/j2r/RInstructions.java
trunk/src/main/java/org/nuiton/j2r/RProxy.java
trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java
trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java
trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
trunk/src/main/java/org/nuiton/j2r/types/REXP.java
trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
trunk/src/main/java/org/nuiton/j2r/types/RList.java
trunk/src/site/rst/etude.rst
trunk/src/site/rst/index.rst
trunk/src/site/rst/installation.rst
trunk/src/site/rst/module.rst
trunk/src/site/site.xml
trunk/src/test/java/org/nuiton/j2r/DataframeTest.java
trunk/src/test/java/org/nuiton/j2r/JNITest.java
trunk/src/test/java/org/nuiton/j2r/JPurTest.java
trunk/src/test/java/org/nuiton/j2r/ListTest.java
trunk/src/test/java/org/nuiton/j2r/LutinTimer.java
trunk/src/test/java/org/nuiton/j2r/NetTest.java
trunk/src/test/java/org/nuiton/j2r/TestConstants.java
Deleted: trunk/nb-configuration.xml
===================================================================
--- trunk/nb-configuration.xml 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/nb-configuration.xml 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project-shared-configuration>
- <!--
-This file contains additional configuration written by modules in the NetBeans IDE.
-The configuration is intended to be shared among all the users of project and
-therefore it is assumed to be part of version control checkout.
-Without this configuration present, some functionality in the IDE may be limited or fail altogether.
--->
- <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
- <!--
-Properties that influence various parts of the IDE, especially code formatting and the like.
-You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
-That way multiple projects can share the same settings (useful for formatting rules for example).
-Any value defined here will override the pom.xml file value but is only applicable to the current project.
--->
- <netbeans.compile.on.save>all</netbeans.compile.on.save>
- </properties>
-</project-shared-configuration>
Deleted: trunk/nbactions.xml
===================================================================
--- trunk/nbactions.xml 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/nbactions.xml 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<actions>
- <action>
- <actionName>run</actionName>
- <goals>
- <goal>process-classes</goal>
- <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
- </goals>
- <properties>
- <exec.classpathScope>runtime</exec.classpathScope>
- <exec.args>-Djava.library.path=/usr/local/lib -classpath %classpath ${packageClassName}</exec.args>
- <exec.executable>java</exec.executable>
- </properties>
- </action>
- <action>
- <actionName>debug</actionName>
- <goals>
- <goal>process-classes</goal>
- <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
- </goals>
- <properties>
- <exec.classpathScope>runtime</exec.classpathScope>
- <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -Djava.library.path=/usr/local/lib -classpath %classpath ${packageClassName}</exec.args>
- <jpda.listen>true</jpda.listen>
- <exec.executable>java</exec.executable>
- </properties>
- </action>
- <action>
- <actionName>profile</actionName>
- <goals>
- <goal>process-classes</goal>
- <goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
- </goals>
- <properties>
- <exec.args>${profiler.args} -Djava.library.path=/usr/local/lib -classpath %classpath ${packageClassName}</exec.args>
- <profiler.action>profile</profiler.action>
- <exec.executable>${profiler.java}</exec.executable>
- </properties>
- </action>
- <action>
- <actionName>build</actionName>
- <goals>
- <goal>install</goal>
- </goals>
- <properties>
- <java.library.path>/usr/local/lib</java.library.path>
- </properties>
- </action>
- <action>
- <actionName>test</actionName>
- <goals>
- <goal>test</goal>
- </goals>
- <properties>
- <java.library.path>/usr/local/lib</java.library.path>
- </properties>
- </action>
- </actions>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/pom.xml 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,6 +1,35 @@
<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <!--
+ #%L
+ Nuiton Java-2-R library
+ $Author$
+ $LastChangedDate$
+ $LastChangedRevision$
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2006 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
<modelVersion>4.0.0</modelVersion>
<!-- ************************************************************* -->
@@ -46,7 +75,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.7</version>
+ <version>4.8.1</version>
<scope>test</scope>
</dependency>
Added: trunk/src/license/project.xml
===================================================================
--- trunk/src/license/project.xml (rev 0)
+++ trunk/src/license/project.xml 2010-04-15 07:37:58 UTC (rev 195)
@@ -0,0 +1,45 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-…">
+ <mainLicense>lgpl_v3</mainLicense>
+
+ <headers>
+
+ <header>
+ <commentStyle>java</commentStyle>
+ <fileSets>
+ <fileSet>
+ <basedir>src/main/java</basedir>
+ <include>**/*.java</include>
+ </fileSet>
+ <fileSet>
+ <basedir>src/test/java</basedir>
+ <include>**/*.java</include>
+ </fileSet>
+ </fileSets>
+ </header>
+
+ <header>
+ <commentStyle>rst</commentStyle>
+ <fileSet>
+ <basedir>src/site</basedir>
+ <include>**/*.rst</include>
+ </fileSet>
+ </header>
+
+ <header>
+ <commentStyle>xml</commentStyle>
+ <fileSets>
+
+ <fileSet>
+ <basedir>src/site</basedir>
+ <include>**/*.xml</include>
+ </fileSet>
+
+ </fileSets>
+ </header>
+
+ </headers>
+
+</project>
Property changes on: trunk/src/license/project.xml
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/src/main/java/org/nuiton/j2r/REngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/REngine.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/REngine.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* RInterface.java
Modified: trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/REngineAbstract.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,31 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
package org.nuiton.j2r;
import java.io.File;
Modified: trunk/src/main/java/org/nuiton/j2r/RException.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RException.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/RException.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* RException.java
@@ -36,7 +47,6 @@
* Exception constructor.
*/
public RException() {
- super();
}
/**
Modified: trunk/src/main/java/org/nuiton/j2r/RInstructions.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RInstructions.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/RInstructions.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,3 +1,31 @@
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
package org.nuiton.j2r;
/**
Modified: trunk/src/main/java/org/nuiton/j2r/RProxy.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RProxy.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/RProxy.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* RProxy.java
Modified: trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/jni/RJniEngine.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,31 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
package org.nuiton.j2r.jni;
import java.util.ArrayList;
Modified: trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/net/RNetEngine.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* RNetEngine.java
Modified: trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,31 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
package org.nuiton.j2r.types;
import java.io.BufferedReader;
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXP.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXP.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXP.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,31 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
package org.nuiton.j2r.types;
import java.util.Map;
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,31 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
package org.nuiton.j2r.types;
import java.util.Arrays;
Modified: trunk/src/main/java/org/nuiton/j2r/types/RList.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/main/java/org/nuiton/j2r/types/RList.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,31 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
package org.nuiton.j2r.types;
import java.util.ArrayList;
Modified: trunk/src/site/rst/etude.rst
===================================================================
--- trunk/src/site/rst/etude.rst 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/site/rst/etude.rst 2010-04-15 07:37:58 UTC (rev 195)
@@ -5,6 +5,33 @@
.. contents::
+.. -
+.. * #%L
+.. * Nuiton Java-2-R library
+.. *
+.. * $Author$
+.. * $LastChangedDate$
+.. * $LastChangedRevision$
+.. * $Id$
+.. * $HeadURL$
+.. * %%
+.. * Copyright (C) 2006 - 2010 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
Introduction
============
Modified: trunk/src/site/rst/index.rst
===================================================================
--- trunk/src/site/rst/index.rst 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/site/rst/index.rst 2010-04-15 07:37:58 UTC (rev 195)
@@ -2,6 +2,33 @@
Nuiton-J2R
==========
+.. -
+.. * #%L
+.. * Nuiton Java-2-R library
+.. *
+.. * $Author$
+.. * $LastChangedDate$
+.. * $LastChangedRevision$
+.. * $Id$
+.. * $HeadURL$
+.. * %%
+.. * Copyright (C) 2006 - 2010 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
La librairie Nuiton-J2R a pour but de fournir une passerrelle unifiée d'accès à R.
Modified: trunk/src/site/rst/installation.rst
===================================================================
--- trunk/src/site/rst/installation.rst 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/site/rst/installation.rst 2010-04-15 07:37:58 UTC (rev 195)
@@ -8,6 +8,33 @@
.. contents::
+.. -
+.. * #%L
+.. * Nuiton Java-2-R library
+.. *
+.. * $Author$
+.. * $LastChangedDate$
+.. * $LastChangedRevision$
+.. * $Id$
+.. * $HeadURL$
+.. * %%
+.. * Copyright (C) 2006 - 2010 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
Installation
============
Modified: trunk/src/site/rst/module.rst
===================================================================
--- trunk/src/site/rst/module.rst 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/site/rst/module.rst 2010-04-15 07:37:58 UTC (rev 195)
@@ -10,6 +10,33 @@
l'utilisation, il n'est pas nécessaire de se soucier de la technologie à employer
pour contacter R.
+.. -
+.. * #%L
+.. * Nuiton Java-2-R library
+.. *
+.. * $Author$
+.. * $LastChangedDate$
+.. * $LastChangedRevision$
+.. * $Id$
+.. * $HeadURL$
+.. * %%
+.. * Copyright (C) 2006 - 2010 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
Utilisation
===========
Modified: trunk/src/site/site.xml
===================================================================
--- trunk/src/site/site.xml 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/site/site.xml 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,4 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Nuiton Java-2-R library
+
+ $Author$
+ $LastChangedDate$
+ $LastChangedRevision$
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2006 - 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
<project name="${project.name}">
<bannerLeft>
Modified: trunk/src/test/java/org/nuiton/j2r/DataframeTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/DataframeTest.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/test/java/org/nuiton/j2r/DataframeTest.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package org.nuiton.j2r;
Modified: trunk/src/test/java/org/nuiton/j2r/JNITest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/JNITest.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/test/java/org/nuiton/j2r/JNITest.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* NetTest.java
Modified: trunk/src/test/java/org/nuiton/j2r/JPurTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/JPurTest.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/test/java/org/nuiton/j2r/JPurTest.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* JPurTest.java
Modified: trunk/src/test/java/org/nuiton/j2r/ListTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/ListTest.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/test/java/org/nuiton/j2r/ListTest.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package org.nuiton.j2r;
Modified: trunk/src/test/java/org/nuiton/j2r/LutinTimer.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/LutinTimer.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/test/java/org/nuiton/j2r/LutinTimer.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* Timer.java
Modified: trunk/src/test/java/org/nuiton/j2r/NetTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/NetTest.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/test/java/org/nuiton/j2r/NetTest.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* NetTest.java
Modified: trunk/src/test/java/org/nuiton/j2r/TestConstants.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/TestConstants.java 2010-04-14 09:51:16 UTC (rev 194)
+++ trunk/src/test/java/org/nuiton/j2r/TestConstants.java 2010-04-15 07:37:58 UTC (rev 195)
@@ -1,19 +1,30 @@
-/* *##% Nuiton Java-2-R library
- * Copyright (C) 2006 - 2009 CodeLutin
- *
+/*
+ * #%L
+ * Nuiton Java-2-R library
+ *
+ * $Author$
+ * $LastChangedDate$
+ * $LastChangedRevision$
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2006 - 2010 CodeLutin
+ * %%
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
+ *
+ * You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
/* *
* TestConstants.java
1
0
r194 - in trunk/src: main/java/org/nuiton/j2r main/java/org/nuiton/j2r/types test/java/org/nuiton/j2r
by jcouteau@users.nuiton.org 14 Apr '10
by jcouteau@users.nuiton.org 14 Apr '10
14 Apr '10
Author: jcouteau
Date: 2010-04-14 11:51:16 +0200 (Wed, 14 Apr 2010)
New Revision: 194
Log:
Clean code
Modified:
trunk/src/main/java/org/nuiton/j2r/RProxy.java
trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
trunk/src/test/java/org/nuiton/j2r/DataframeTest.java
trunk/src/test/java/org/nuiton/j2r/ListTest.java
trunk/src/test/java/org/nuiton/j2r/NetTest.java
Modified: trunk/src/main/java/org/nuiton/j2r/RProxy.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/RProxy.java 2010-04-12 12:15:23 UTC (rev 193)
+++ trunk/src/main/java/org/nuiton/j2r/RProxy.java 2010-04-14 09:51:16 UTC (rev 194)
@@ -55,7 +55,7 @@
*/
public RProxy() throws RException {
Boolean init = init();
- if (init == false) {
+ if (!init) {
throw new RException(
"R initialisation failed, please check your installation");
}
Modified: trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-12 12:15:23 UTC (rev 193)
+++ trunk/src/main/java/org/nuiton/j2r/types/RDataFrame.java 2010-04-14 09:51:16 UTC (rev 194)
@@ -19,12 +19,12 @@
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -70,28 +70,30 @@
* @param datatypes a table object determining the type of each column of
* the data.frame.
* @param y the length of each vector that compound the data.frame.
+ *
+ * @throws RException if a datatype is not supported
*/
public RDataFrame(REngine engine, Object[] datatypes, int y) throws
RException {
super();
this.names = new ArrayList<String>();
this.rowNames = new ArrayList<String>();
- this.data = new ArrayList<List<? extends Object>>();
- for (int i = 0; i < datatypes.length; i++) {
+ this.data = new ArrayList<List<?>>();
+ for (Object datatype : datatypes) {
//create one column for each datatype element
//check if type is supported
- checkType(datatypes[i]);
+ checkType(datatype);
//create the list of objects
List<Object> column = new ArrayList<Object>();
//Fill it with instances of the datatype
for (int j = 0; j < y; j++) {
- if (datatypes[i] instanceof Double) {
+ if (datatype instanceof Double) {
column.add(0.0);
- } else if (datatypes[i] instanceof Integer) {
+ } else if (datatype instanceof Integer) {
column.add(0);
- } else if (datatypes[i] instanceof Boolean) {
+ } else if (datatype instanceof Boolean) {
column.add(true);
- } else if (datatypes[i] instanceof String) {
+ } else if (datatype instanceof String) {
column.add("");
}
}
@@ -141,7 +143,7 @@
* @param variable the name of the data.frame in R.
*/
public RDataFrame(REngine engine, String[] names,
- String[] rowNames, List<List<? extends Object>> data,
+ String[] rowNames, List<List<?>> data,
String variable) {
//Create the name ArrayList and fill it with the content of the name String[]
String[] tempNames = {};
@@ -153,15 +155,11 @@
tempRowNames = rowNames.clone();
}
this.names = new ArrayList<String>();
- for (int i = 0; i < tempNames.length; i++) {
- this.names.add(tempNames[i]);
- }
+ this.names.addAll(Arrays.asList(tempNames));
//Create the rowNames ArrayList and fill it with the content of the rowNames
//String[]
this.rowNames = new ArrayList<String>();
- for (int i = 0; i < tempRowNames.length; i++) {
- this.rowNames.add(tempRowNames[i]);
- }
+ this.rowNames.addAll(Arrays.asList(tempRowNames));
this.data = data;
this.variable = variable;
this.engine = engine;
@@ -200,9 +198,7 @@
//Check if size is correct, if yes, modify local data.
if (rowNamesArray.length <= this.data.get(0).size()) {
this.rowNames.clear();
- for (int i = 0; i < rowNamesArray.length; i++) {
- rowNames.add(rowNamesArray[i]);
- }
+ rowNames.addAll(Arrays.asList(rowNamesArray));
return rowNames;
} else {
//if size is not correct, throw a RException.
@@ -367,8 +363,8 @@
}
if (!(this.rowNames.isEmpty())) {
returnString += "row.names=c(";
- for (int i = 0; i < rowNames.size(); i++) {
- returnString += "\"" + rowNames.get(i) + "\",";
+ for (String rowName : rowNames) {
+ returnString += "\"" + rowName + "\",";
}
returnString =
returnString.substring(0, returnString.length() - 1) +
@@ -482,7 +478,7 @@
*
* @return a ArrayList containing the ArrayLists of the R data.frame
*/
- public List<List<? extends Object>> getData() {
+ public List<List<?>> getData() {
//TODO manage the autocommit mode here.
return data;
}
@@ -494,9 +490,9 @@
* @param data
* a ArrayList of ArrayLists, containing each ArrayList of the R
* data.frame
- * @throws RException
+ * @throws RException if an error occur while trying to assign the values
*/
- public void setData(List<List<? extends Object>> data) throws RException {
+ public void setData(List<List<?>> data) throws RException {
this.data = data;
engine.voidEval(toRString());
}
@@ -525,7 +521,7 @@
if (data != null) {
data.clear();
} else {
- data = new ArrayList<List<? extends Object>>();
+ data = new ArrayList<List<?>>();
}
if (attributes != null) {
attributes.clear();
@@ -536,16 +532,12 @@
//update row names
String[] rowNamesArray = (String[]) engine.eval(String.format(
RInstructions.GET_ROW_NAMES, this.variable));
- for (int i = 0; i < rowNamesArray.length; i++) {
- rowNames.add(rowNamesArray[i]);
- }
+ rowNames.addAll(Arrays.asList(rowNamesArray));
//update names
String[] namesArray = (String[]) engine.eval(String.format(
RInstructions.GET_NAMES, this.variable));
- for (int i = 0; i < namesArray.length; i++) {
- names.add(namesArray[i]);
- }
+ names.addAll(Arrays.asList(namesArray));
//update data
Integer dataframelength = (Integer) engine.eval(String.format(
@@ -589,6 +581,7 @@
* the export.
* @param names true/false to determine if the column names will be put on
* the export.
+ * @throws IOException if cannot export to the outputFile
*/
public void exportCsv(File outputFile, boolean rowNames, boolean names)
throws IOException {
@@ -598,8 +591,8 @@
if (rowNames) {
file.write(";");
}
- for (int i = 0; i < this.names.size(); i++) {
- file.write(this.names.get(i) + ";");
+ for (String name : this.names) {
+ file.write(name + ";");
}
file.newLine();
}
@@ -608,8 +601,8 @@
if (rowNames) {
file.write(this.rowNames.get(i) + ";");
}
- for (int j = 0; j < this.data.size(); j++) {
- file.write(this.data.get(j).get(i) + ";");
+ for (List<?> aData : this.data) {
+ file.write(aData.get(i) + ";");
}
file.newLine();
}
@@ -628,12 +621,14 @@
* Does the csv file contains names of the rows.
* @param names
* Does the csv file contain names of the columns.
+ * @throws IOException
+ * If cannot read the inputFile
*/
public void importCsv(File inputFile, boolean rowNames, boolean names)
- throws FileNotFoundException, IOException {
+ throws IOException {
List<Object> tmp = new ArrayList<Object>();
tmp.add("string");
- importCsv(inputFile, rowNames, names, (List) tmp);
+ importCsv(inputFile, rowNames, names, tmp);
}
@@ -651,18 +646,20 @@
* @param importType
* Object of the class of the data imported (all the data have
* the same type). (Supported types : String, Double and Integer)
+ * @throws IOException
+ * if cannot read the inputFile
*/
public void importCsv(File inputFile, boolean rowNames, boolean names,
- Object importType) throws FileNotFoundException, IOException {
+ Object importType) throws IOException {
List<Object> tmp = new ArrayList<Object>();
if (importType instanceof String) {
- tmp.add((String) importType);
- importCsv(inputFile, rowNames, names, (List) tmp);
+ tmp.add(importType);
+ importCsv(inputFile, rowNames, names, tmp);
} else if (importType instanceof Double) {
- tmp.add((Double) importType);
+ tmp.add(importType);
importCsv(inputFile, rowNames, names, tmp);
} else if (importType instanceof Integer) {
- tmp.add((Integer) importType);
+ tmp.add(importType);
importCsv(inputFile, rowNames, names, tmp);
}
}
@@ -683,12 +680,14 @@
* ArrayList of Object of the class of the data imported (the
* ArrayList match the data type of the columns). (Supported
* types : String, Double and Integer)
+ * @throws IOException
+ * if cannot read the inputFile
*/
public void importCsv(File inputFile, boolean rowNames, boolean names,
- List<Object> importTypes) throws FileNotFoundException, IOException {
+ List<Object> importTypes) throws IOException {
//temporary String to read lines.
String tmp;
- Integer dataSize = 0;
+ Integer dataSize;
//get the first line of the file
BufferedReader br = new BufferedReader(new FileReader(inputFile));
tmp = br.readLine();
@@ -715,14 +714,12 @@
this.names.clear();
}
//get every name from the first line
- for (int i = 1; i < splitted.length; i++) {
- this.names.add(splitted[i]);
- }
+ this.names.addAll(Arrays.asList(splitted).subList(1, splitted.length));
}
//temporary data list.
- List<List<? extends Object>> tempData =
- new ArrayList<List<? extends Object>>();
+ List<List<?>> tempData =
+ new ArrayList<List<?>>();
//Initialize all the data columns
for (int i = 0; i < dataSize; i++) {
@@ -740,14 +737,14 @@
this.rowNames.add(splitted[0]);
index = 1;
}
- for (int i = 0 + index; i < splitted.length; i++) {
+ for (int i = index; i < splitted.length; i++) {
//cast the data imported to the specified type.
//test the size of the inputType list. If 1 import all the
//columns as the type of the first element.
if (importTypes.size() == 1) {
if (importTypes.get(0) instanceof String) {
((ArrayList<Object>) tempData.get(i - index)).add(
- (Serializable) splitted[i]);
+ splitted[i]);
} else if (importTypes.get(0) instanceof Double) {
((ArrayList<Object>) tempData.get(i - index)).add(Double.valueOf(
splitted[i]));
@@ -758,7 +755,7 @@
} else if (importTypes.get(i - index) instanceof String) {
((ArrayList<Object>) tempData.get(i - index)).add(
- (Serializable) splitted[i]);
+ splitted[i]);
} else if (importTypes.get(i - index) instanceof Double) {
((ArrayList<Object>) tempData.get(i - index)).add(Double.valueOf(
splitted[i]));
@@ -806,4 +803,4 @@
return (new int[]{x,y});
}
-}
\ No newline at end of file
+}
Modified: trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java
===================================================================
--- trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-12 12:15:23 UTC (rev 193)
+++ trunk/src/main/java/org/nuiton/j2r/types/REXPAbstract.java 2010-04-14 09:51:16 UTC (rev 194)
@@ -16,6 +16,7 @@
* <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
package org.nuiton.j2r.types;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -55,54 +56,52 @@
@Override
public void setAttributes(Map<String, Object> attributes) throws RException {
- //TODO should be useful to test the validity of attributes before
- //assigning it.
+ //TODO should be useful to test the validity of attributes before assigning it.
this.attributes = attributes;
if ((this.attributes != null) && (!this.attributes.isEmpty())) {
Set<String> keyset = attributes.keySet();
- String[] keys = keyset.toArray(new String[0]);
- for (int i = 0; i < keys.length; i++) {
+ for (String key : keyset) {
//foreach type of attribute, adapt the R instruction.
- if (this.attributes.get(keys[i]) instanceof String) {
+ if (this.attributes.get(key) instanceof String) {
engine.eval(String.format(RInstructions.SET_ATTRIBUTE,
- this.variable, keys[i],
- "\"" + this.attributes.get(keys[i]) + "\""));
- //String, value between quotes
- } else if (this.attributes.get(keys[i]) instanceof Double) {
+ this.variable, key,
+ "\"" + this.attributes.get(key) + "\""));
+ //String, value between quotes
+ } else if (this.attributes.get(key) instanceof Double) {
engine.eval(String.format(RInstructions.SET_ATTRIBUTE,
this.variable,
- keys[i], this.attributes.get(keys[i])));
- } else if (this.attributes.get(keys[i]) instanceof Integer) {
+ key, this.attributes.get(key)));
+ } else if (this.attributes.get(key) instanceof Integer) {
engine.eval(String.format(RInstructions.SET_ATTRIBUTE,
this.variable,
- keys[i], String.format(RInstructions.AS_INTEGER,
- this.attributes.get(keys[i]))));
- //Integer, value formated by the R function : as.integer()
- } else if (this.attributes.get(keys[i]) instanceof Boolean) {
- if ((Boolean) this.attributes.get(keys[i])) {
+ key, String.format(RInstructions.AS_INTEGER,
+ this.attributes.get(key))));
+ //Integer, value formated by the R function : as.integer()
+ } else if (this.attributes.get(key) instanceof Boolean) {
+ if ((Boolean) this.attributes.get(key)) {
engine.eval(String.format(RInstructions.SET_ATTRIBUTE,
this.variable,
- keys[i], RInstructions.TRUE));
- //Boolean true replaced by TRUE
+ key, RInstructions.TRUE));
+ //Boolean true replaced by TRUE
} else {
engine.eval(String.format(RInstructions.SET_ATTRIBUTE,
this.variable,
- keys[i], RInstructions.FALSE));
- //Boolean false replaced by REPLACE
+ key, RInstructions.FALSE));
+ //Boolean false replaced by REPLACE
}
- } else if (this.attributes.get(keys[i]) instanceof REXP) {
+ } else if (this.attributes.get(key) instanceof REXP) {
engine.eval(String.format(RInstructions.SET_ATTRIBUTE,
this.variable,
- keys[i],
- ((REXP) this.attributes.get(keys[i])).toRString()));
- //REXP replaced by the result of their toRString() method.
+ key,
+ ((REXP) this.attributes.get(key)).toRString()));
+ //REXP replaced by the result of their toRString() method.
} else {
if (log.isWarnEnabled()) {
- log.warn("This attribute is not valid : " + keys[i] +
- " ; " + this.attributes.get(keys[i]) +
+ log.warn("This attribute is not valid : " + key +
+ " ; " + this.attributes.get(key) +
". It will not be sent to R");
- //if the attribute is not recognised.
+ //if the attribute is not recognised.
}
}
}
@@ -267,9 +266,7 @@
//Check if size is correct, if yes, modify local data.
checkX(namesArray.length);
this.names.clear();
- for (int i = 0; i < namesArray.length; i++) {
- names.add(namesArray[i]);
- }
+ names.addAll(Arrays.asList(namesArray));
return names;
} else {
@@ -323,7 +320,7 @@
* @throws org.nuiton.j2r.RException if the variable name have not been set.
*/
protected void checkVariable() throws RException {
- if ((this.variable.equals("")) || (this.variable == null)) {
+ if ((this.variable == null) || (this.variable.equals(""))) {
throw new RException(
noVariable);
}
Modified: trunk/src/test/java/org/nuiton/j2r/DataframeTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/DataframeTest.java 2010-04-12 12:15:23 UTC (rev 193)
+++ trunk/src/test/java/org/nuiton/j2r/DataframeTest.java 2010-04-14 09:51:16 UTC (rev 194)
@@ -51,11 +51,6 @@
engine.terminate();
}
- /**
- * This test data.frame creation method 1 and data assignment.
- *
- * @throws Exception
- */
@Test
public void testDataFrameCreationMethod1() throws Exception {
/*
@@ -85,7 +80,7 @@
column4.add(2);
column4.add(3);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
data.add(column3);
@@ -108,32 +103,27 @@
dataframe1.setRowNames(rowNames);
//Test data
- Assert.assertEquals(new Double(3.0), (Double) engine.eval("a[1,1]"));
- Assert.assertEquals(new Double(4.5), (Double) engine.eval("a[2,1]"));
- Assert.assertEquals(new Double(0.01), (Double) engine.eval("a[3,1]"));
- Assert.assertEquals("titi", (String) engine.eval("a[1,2]"));
- Assert.assertEquals("tata", (String) engine.eval("a[2,2]"));
- Assert.assertEquals("toto", (String) engine.eval("a[3,2]"));
- Assert.assertEquals(true, (Boolean) engine.eval("a[1,3]"));
- Assert.assertEquals(true, (Boolean) engine.eval("a[2,3]"));
- Assert.assertEquals(false, (Boolean) engine.eval("a[3,3]"));
- Assert.assertEquals(new Integer(1), (Integer) engine.eval("a[1,4]"));
- Assert.assertEquals(new Integer(2), (Integer) engine.eval("a[2,4]"));
- Assert.assertEquals(new Integer(3), (Integer) engine.eval("a[3,4]"));
+ Assert.assertEquals(3.0, engine.eval("a[1,1]"));
+ Assert.assertEquals(4.5, engine.eval("a[2,1]"));
+ Assert.assertEquals(0.01, engine.eval("a[3,1]"));
+ Assert.assertEquals("titi", engine.eval("a[1,2]"));
+ Assert.assertEquals("tata", engine.eval("a[2,2]"));
+ Assert.assertEquals("toto", engine.eval("a[3,2]"));
+ Assert.assertEquals(true, engine.eval("a[1,3]"));
+ Assert.assertEquals(true, engine.eval("a[2,3]"));
+ Assert.assertEquals(false, engine.eval("a[3,3]"));
+ Assert.assertEquals(1, engine.eval("a[1,4]"));
+ Assert.assertEquals(2, engine.eval("a[2,4]"));
+ Assert.assertEquals(3, engine.eval("a[3,4]"));
//Test names
- Assert.assertEquals("column1", (String) engine.eval("names(a)[1]"));
- Assert.assertEquals("column2", (String) engine.eval("names(a)[2]"));
+ Assert.assertEquals("column1", engine.eval("names(a)[1]"));
+ Assert.assertEquals("column2", engine.eval("names(a)[2]"));
//Test row names
- Assert.assertEquals("row 1", (String) engine.eval("row.names(a)[1]"));
- Assert.assertEquals("row 2", (String) engine.eval("row.names(a)[2]"));
- Assert.assertEquals("row 3", (String) engine.eval("row.names(a)[3]"));
+ Assert.assertEquals("row 1", engine.eval("row.names(a)[1]"));
+ Assert.assertEquals("row 2", engine.eval("row.names(a)[2]"));
+ Assert.assertEquals("row 3", engine.eval("row.names(a)[3]"));
}
- /**
- * This test data.frame creation method 2 and data assignment.
- *
- * @throws Exception
- */
@Test
public void testDataFrameCreationMethod2() throws Exception {
/*
@@ -141,24 +131,24 @@
* RDataFrame(REngine, Object[], int) + all setters
*/
- Object[] datatypes = { (Double)1.0, "a", (Boolean)true, (Integer)1 };
+ Object[] datatypes = { 1.0, "a", true, 1 };
RDataFrame dataframe1 = new RDataFrame(engine, datatypes, 3);
dataframe1.setVariable("a");
- dataframe1.set(0, 0, (Double)3.0);
- dataframe1.set(0, 1, (Double)4.5);
- dataframe1.set(0, 2, (Double)0.01);
+ dataframe1.set(0, 0, 3.0);
+ dataframe1.set(0, 1, 4.5);
+ dataframe1.set(0, 2, 0.01);
dataframe1.set(1, 0, "titi");
dataframe1.set(1, 1, "tata");
dataframe1.set(1, 2, "toto");
- dataframe1.set(2, 0, (Boolean)true);
- dataframe1.set(2, 1, (Boolean)true);
- dataframe1.set(2, 2, (Boolean)false);
- dataframe1.set(3, 0, (Integer)1);
- dataframe1.set(3, 1, (Integer)2);
- dataframe1.set(3, 2, (Integer)3);
+ dataframe1.set(2, 0, true);
+ dataframe1.set(2, 1, true);
+ dataframe1.set(2, 2, false);
+ dataframe1.set(3, 0, 1);
+ dataframe1.set(3, 1, 2);
+ dataframe1.set(3, 2, 3);
List<String> names = new ArrayList<String>();
names.add("column1");
@@ -173,32 +163,27 @@
dataframe1.setRowNames(rowNames);
//Test data
- Assert.assertEquals(new Double(3.0), (Double) engine.eval("a[1,1]"));
- Assert.assertEquals(new Double(4.5), (Double) engine.eval("a[2,1]"));
- Assert.assertEquals(new Double(0.01), (Double) engine.eval("a[3,1]"));
- Assert.assertEquals("titi", (String) engine.eval("a[1,2]"));
- Assert.assertEquals("tata", (String) engine.eval("a[2,2]"));
- Assert.assertEquals("toto", (String) engine.eval("a[3,2]"));
- Assert.assertEquals(true, (Boolean) engine.eval("a[1,3]"));
- Assert.assertEquals(true, (Boolean) engine.eval("a[2,3]"));
- Assert.assertEquals(false, (Boolean) engine.eval("a[3,3]"));
- Assert.assertEquals(new Integer(1), (Integer) engine.eval("a[1,4]"));
- Assert.assertEquals(new Integer(2), (Integer) engine.eval("a[2,4]"));
- Assert.assertEquals(new Integer(3), (Integer) engine.eval("a[3,4]"));
+ Assert.assertEquals(3.0, engine.eval("a[1,1]"));
+ Assert.assertEquals(4.5, engine.eval("a[2,1]"));
+ Assert.assertEquals(0.01, engine.eval("a[3,1]"));
+ Assert.assertEquals("titi", engine.eval("a[1,2]"));
+ Assert.assertEquals("tata", engine.eval("a[2,2]"));
+ Assert.assertEquals("toto", engine.eval("a[3,2]"));
+ Assert.assertEquals(true, engine.eval("a[1,3]"));
+ Assert.assertEquals(true, engine.eval("a[2,3]"));
+ Assert.assertEquals(false, engine.eval("a[3,3]"));
+ Assert.assertEquals(1, engine.eval("a[1,4]"));
+ Assert.assertEquals(2, engine.eval("a[2,4]"));
+ Assert.assertEquals(3, engine.eval("a[3,4]"));
//Test names
- Assert.assertEquals("column1", (String) engine.eval("names(a)[1]"));
- Assert.assertEquals("column2", (String) engine.eval("names(a)[2]"));
+ Assert.assertEquals("column1", engine.eval("names(a)[1]"));
+ Assert.assertEquals("column2", engine.eval("names(a)[2]"));
//Test row names
- Assert.assertEquals("row 1", (String) engine.eval("row.names(a)[1]"));
- Assert.assertEquals("row 2", (String) engine.eval("row.names(a)[2]"));
- Assert.assertEquals("row 3", (String) engine.eval("row.names(a)[3]"));
+ Assert.assertEquals("row 1", engine.eval("row.names(a)[1]"));
+ Assert.assertEquals("row 2", engine.eval("row.names(a)[2]"));
+ Assert.assertEquals("row 3", engine.eval("row.names(a)[3]"));
}
- /**
- * This test data.frame creation method 2 and data assignment.
- *
- * @throws Exception
- */
@Test
public void testDataFrameCreationMethod3() throws Exception {
/*
@@ -225,28 +210,26 @@
column2.add(5555555555555555555555.0);
column2.add(3.0);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
- RDataFrame dataframe1 = new RDataFrame(engine, names, rowNames, data,
- "a");
+ new RDataFrame(engine, names, rowNames, data, "a");
//Test data
- Assert.assertEquals(new Double(3.0), (Double) engine.eval("a[1,1]"));
- Assert.assertEquals(new Double(4.5), (Double) engine.eval("a[2,1]"));
- Assert.assertEquals(new Double(0.01), (Double) engine.eval("a[3,1]"));
- Assert.assertEquals(new Double(1.0), (Double) engine.eval("a[1,2]"));
- Assert.assertEquals(new Double(5555555555555555555555.0),
- (Double) engine.eval("a[2,2]"));
- Assert.assertEquals(new Double(3.0), (Double) engine.eval("a[3,2]"));
+ Assert.assertEquals(3.0, engine.eval("a[1,1]"));
+ Assert.assertEquals(4.5, engine.eval("a[2,1]"));
+ Assert.assertEquals(0.01, engine.eval("a[3,1]"));
+ Assert.assertEquals(1.0, engine.eval("a[1,2]"));
+ Assert.assertEquals(5555555555555555555555.0, engine.eval("a[2,2]"));
+ Assert.assertEquals(3.0, engine.eval("a[3,2]"));
//Test names
- Assert.assertEquals("column1", (String) engine.eval("names(a)[1]"));
- Assert.assertEquals("column2", (String) engine.eval("names(a)[2]"));
+ Assert.assertEquals("column1", engine.eval("names(a)[1]"));
+ Assert.assertEquals("column2", engine.eval("names(a)[2]"));
//Test row names
- Assert.assertEquals("row 1", (String) engine.eval("row.names(a)[1]"));
- Assert.assertEquals("row 2", (String) engine.eval("row.names(a)[2]"));
- Assert.assertEquals("row 3", (String) engine.eval("row.names(a)[3]"));
+ Assert.assertEquals("row 1", engine.eval("row.names(a)[1]"));
+ Assert.assertEquals("row 2", engine.eval("row.names(a)[2]"));
+ Assert.assertEquals("row 3", engine.eval("row.names(a)[3]"));
}
@Test
@@ -263,7 +246,7 @@
column2.add(5555555555555555555555.0);
column2.add(3.0);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
@@ -303,7 +286,7 @@
//Test normally thrown exception when getting name(int)
try {
- String test = dataframe1.getName(2);
+ dataframe1.getName(2);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
@@ -311,7 +294,7 @@
//Test normally thrown exception when getting rowname(int)
try {
- String test = dataframe1.getRowName(3);
+ dataframe1.getRowName(3);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
@@ -335,7 +318,7 @@
//Test normally thrown exception when getting name(int)
try {
- String test = dataframe1.getRowName(3);
+ dataframe1.getRowName(3);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
@@ -368,18 +351,21 @@
//Modify the remote data.frame so we can test normally thrown exceptions
//when getting names and row names
- engine
- .voidEval("a<-data.frame(a=c(1,2,3,4),b=c(4,5,6,7),d=c(7,8,9,10),row.names=c(\"a\",\"b\",\"c\",\"d\"))");
+ engine.voidEval("a<-data.frame(" +
+ "a=c(1,2,3,4)," +
+ "b=c(4,5,6,7)," +
+ "d=c(7,8,9,10)," +
+ "row.names=c(\"a\",\"b\",\"c\",\"d\"))");
try {
- List<String> test = dataframe1.getNames();
+ dataframe1.getNames();
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
}
try {
- List<String> test = dataframe1.getRowNames();
+ dataframe1.getRowNames();
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
@@ -410,7 +396,7 @@
column4.add("toto");
column4.add("tata");
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
data.add(column3);
@@ -438,31 +424,31 @@
//Test exceptions normally thrown using getters
try {
- Object test = dataframe1.get(5, 7);
+ dataframe1.get(5, 7);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
}
try {
- Object test = dataframe1.get(1, 7);
+ dataframe1.get(1, 7);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
}
try {
- Object test = dataframe1.get(5, 1);
+ dataframe1.get(5, 1);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
}
//Test setters
- dataframe1.set(0, 0, (Double)45.6);
- dataframe1.set(1, 0, (Integer)45);
- dataframe1.set(2, 0, (Boolean)false);
- dataframe1.set(2, 2, (Boolean)true);
+ dataframe1.set(0, 0, 45.6);
+ dataframe1.set(1, 0, 45);
+ dataframe1.set(2, 0, false);
+ dataframe1.set(2, 2, true);
dataframe1.set(3, 0, "tonton");
Assert.assertEquals(45.6, dataframe1.get(0, 0));
@@ -509,7 +495,7 @@
//Set a Double instead of Integer
try {
- dataframe1.set(1, 0, (Double)45.6);
+ dataframe1.set(1, 0, 45.6);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -517,7 +503,7 @@
//Set a Double instead of a Boolean
try {
- dataframe1.set(2, 0, (Double)45.6);
+ dataframe1.set(2, 0, 45.6);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -525,7 +511,7 @@
//Set a Double instead of a String
try {
- dataframe1.set(3, 0, (Double)45.6);
+ dataframe1.set(3, 0, 45.6);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -533,7 +519,7 @@
//Set an Integer instead of a Double
try {
- dataframe1.set(0, 0, (Integer)45);
+ dataframe1.set(0, 0, 45);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -541,7 +527,7 @@
//Set an Integer instead of a Boolean
try {
- dataframe1.set(2, 0, (Integer)45);
+ dataframe1.set(2, 0, 45);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -549,28 +535,28 @@
//Set an Integer instead of a String
try {
- dataframe1.set(3, 0, (Integer)45);
+ dataframe1.set(3, 0, 45);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
}
//Set a Boolean instead of a Double
try {
- dataframe1.set(0, 0, (Boolean)false);
+ dataframe1.set(0, 0, false);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
}
//Set a Boolean instead of an Integer
try {
- dataframe1.set(1, 0, (Boolean)false);
+ dataframe1.set(1, 0, false);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
}
//Set a Boolean instead of a String
try {
- dataframe1.set(3, 0, (Boolean)false);
+ dataframe1.set(3, 0, false);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
}
@@ -637,7 +623,7 @@
column4.add("toto");
column4.add("tata");
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
data.add(column3);
@@ -698,7 +684,7 @@
column4.add("toto");
column4.add("tata");
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
data.add(column3);
@@ -711,19 +697,19 @@
dataframe1.setAttribute("second_test_attribute", "second_value");
Assert.assertTrue((Boolean) engine.eval("is.data.frame(a)"));
- Assert.assertEquals("test_value", (String) engine
- .eval("attributes(a)$test_attribute"));
- Assert.assertEquals("second_value", (String) engine
- .eval("attributes(a)$second_test_attribute"));
- Assert.assertEquals("test_value", dataframe1
- .getAttribute("test_attribute"));
- Assert.assertEquals("second_value", dataframe1
- .getAttribute("second_test_attribute"));
+ Assert.assertEquals("test_value",
+ engine.eval("attributes(a)$test_attribute"));
+ Assert.assertEquals("second_value",
+ engine.eval("attributes(a)$second_test_attribute"));
+ Assert.assertEquals("test_value",
+ dataframe1.getAttribute("test_attribute"));
+ Assert.assertEquals("second_value",
+ dataframe1.getAttribute("second_test_attribute"));
dataframe1.setAttribute("test_attribute", "third_value");
- Assert.assertEquals("third_value", (String) engine
- .eval("attributes(a)$test_attribute"));
+ Assert.assertEquals("third_value",
+ engine.eval("attributes(a)$test_attribute"));
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("attr1", "this is an attribute");
@@ -731,16 +717,16 @@
dataframe1.setAttributes(attributes);
Assert.assertTrue((Boolean) engine.eval("is.data.frame(a)"));
- Assert.assertEquals("this is an attribute", dataframe1
- .getAttribute("attr1"));
- Assert.assertEquals("this is an attribute", dataframe1
- .getAttribute("attr1"));
- Assert.assertEquals("this is another attribute", dataframe1
- .getAttribute("attr2"));
- Assert.assertEquals("this is an attribute", dataframe1.getAttributes()
- .get("attr1"));
- Assert.assertEquals("this is another attribute", dataframe1
- .getAttributes().get("attr2"));
+ Assert.assertEquals("this is an attribute",
+ dataframe1.getAttribute("attr1"));
+ Assert.assertEquals("this is an attribute",
+ dataframe1.getAttribute("attr1"));
+ Assert.assertEquals("this is another attribute",
+ dataframe1.getAttribute("attr2"));
+ Assert.assertEquals("this is an attribute",
+ dataframe1.getAttributes().get("attr1"));
+ Assert.assertEquals("this is another attribute",
+ dataframe1.getAttributes().get("attr2"));
try {
dataframe1.getAttribute("toto");
@@ -775,7 +761,7 @@
column2.add(5555555555555555555555.0);
column2.add(3.0);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
@@ -789,8 +775,7 @@
testDataFrame.exportCsv(new File("/tmp/test.csv"), true, true);
RDataFrame dataframe2 = new RDataFrame(engine);
- dataframe2.importCsv(new File("/tmp/test.csv"), true, true, new Double(
- 3.0));
+ dataframe2.importCsv(new File("/tmp/test.csv"), true, true, 3.0);
dataframe2.setVariable("a");
//Test import with same type for each column (String).
@@ -814,7 +799,7 @@
column6.add("tata");
column6.add("toto");
- data = new ArrayList<List<? extends Object>>();
+ data = new ArrayList<List<?>>();
data.add(column5);
data.add(column6);
@@ -861,7 +846,7 @@
column8.add(5);
column8.add(6);
- data = new ArrayList<List<? extends Object>>();
+ data = new ArrayList<List<?>>();
data.add(column7);
data.add(column8);
@@ -914,15 +899,15 @@
column4.add("blabla");
column4.add("blablabla");
- data = new ArrayList<List<? extends Object>>();
+ data = new ArrayList<List<?>>();
data.add(column1);
data.add(column3);
data.add(column4);
List<Object> types = new ArrayList<Object>();
- types.add(new Double(4.0));
- types.add(new Integer(4));
- types.add(new String());
+ types.add(4.0);
+ types.add(4);
+ types.add("");
testDataFrame = new RDataFrame(engine);
try {
@@ -938,17 +923,12 @@
dataframe3.setVariable("a");
//Test data
- Assert
- .assertEquals(new Double(3.0), dataframe3.getData().get(0).get(
- 0));
- Assert
- .assertEquals(new Double(4.5), dataframe3.getData().get(0).get(
- 1));
- Assert.assertEquals(new Double(0.01), dataframe3.getData().get(0)
- .get(2));
- Assert.assertEquals(new Integer(1), dataframe3.getData().get(1).get(0));
- Assert.assertEquals(new Integer(5), dataframe3.getData().get(1).get(1));
- Assert.assertEquals(new Integer(3), dataframe3.getData().get(1).get(2));
+ Assert.assertEquals(3.0, dataframe3.getData().get(0).get(0));
+ Assert.assertEquals(4.5, dataframe3.getData().get(0).get(1));
+ Assert.assertEquals(0.01, dataframe3.getData().get(0).get(2));
+ Assert.assertEquals(1, dataframe3.getData().get(1).get(0));
+ Assert.assertEquals(5, dataframe3.getData().get(1).get(1));
+ Assert.assertEquals(3, dataframe3.getData().get(1).get(2));
Assert.assertEquals("bla", dataframe3.getData().get(2).get(0));
Assert.assertEquals("blabla", dataframe3.getData().get(2).get(1));
Assert.assertEquals("blablabla", dataframe3.getData().get(2).get(2));
@@ -990,8 +970,13 @@
@Test
public void testGetFrom() throws Exception {
- engine
- .voidEval("a<-data.frame(column1=c(3.0,4.5,0.01),column2=c(as.integer(1),as.integer(5),as.integer(3)),column3=c(TRUE,TRUE,FALSE),column4=c(\"bla\",\"blabla\",\"blablabla\"),row.names=c(\"row 1\",\"row 2\",\"row 3\"),stringsAsFactors=FALSE)");
+ engine.voidEval("a<-data.frame(" +
+ "column1=c(3.0,4.5,0.01)," +
+ "column2=c(as.integer(1),as.integer(5),as.integer(3))," +
+ "column3=c(TRUE,TRUE,FALSE)," +
+ "column4=c(\"bla\",\"blabla\",\"blablabla\")," +
+ "row.names=c(\"row 1\",\"row 2\",\"row 3\")," +
+ "stringsAsFactors=FALSE)");
RDataFrame dataframe1 = new RDataFrame(engine);
dataframe1.getFrom("a");
@@ -1023,11 +1008,6 @@
Assert.assertEquals("row 3", dataframe1.getRowNames().get(2));
}
- /**
- * This test data.frame creation method 1 and data assignment.
- *
- * @throws Exception
- */
@Test
public void testDataFrameCreationMethod1WithoutAutoCommit()
throws Exception {
@@ -1059,7 +1039,7 @@
column4.add(2);
column4.add(3);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
data.add(column3);
@@ -1085,32 +1065,27 @@
engine.setAutoCommit(true);
//Test data
- Assert.assertEquals(new Double(3.0), (Double) engine.eval("a[1,1]"));
- Assert.assertEquals(new Double(4.5), (Double) engine.eval("a[2,1]"));
- Assert.assertEquals(new Double(0.01), (Double) engine.eval("a[3,1]"));
- Assert.assertEquals("titi", (String) engine.eval("a[1,2]"));
- Assert.assertEquals("tata", (String) engine.eval("a[2,2]"));
- Assert.assertEquals("toto", (String) engine.eval("a[3,2]"));
- Assert.assertEquals(true, (Boolean) engine.eval("a[1,3]"));
- Assert.assertEquals(true, (Boolean) engine.eval("a[2,3]"));
- Assert.assertEquals(false, (Boolean) engine.eval("a[3,3]"));
- Assert.assertEquals(new Integer(1), (Integer) engine.eval("a[1,4]"));
- Assert.assertEquals(new Integer(2), (Integer) engine.eval("a[2,4]"));
- Assert.assertEquals(new Integer(3), (Integer) engine.eval("a[3,4]"));
+ Assert.assertEquals(3.0, engine.eval("a[1,1]"));
+ Assert.assertEquals(4.5, engine.eval("a[2,1]"));
+ Assert.assertEquals(0.01, engine.eval("a[3,1]"));
+ Assert.assertEquals("titi", engine.eval("a[1,2]"));
+ Assert.assertEquals("tata", engine.eval("a[2,2]"));
+ Assert.assertEquals("toto", engine.eval("a[3,2]"));
+ Assert.assertEquals(true, engine.eval("a[1,3]"));
+ Assert.assertEquals(true, engine.eval("a[2,3]"));
+ Assert.assertEquals(false, engine.eval("a[3,3]"));
+ Assert.assertEquals(1, engine.eval("a[1,4]"));
+ Assert.assertEquals(2, engine.eval("a[2,4]"));
+ Assert.assertEquals(3, engine.eval("a[3,4]"));
//Test names
- Assert.assertEquals("column1", (String) engine.eval("names(a)[1]"));
- Assert.assertEquals("column2", (String) engine.eval("names(a)[2]"));
+ Assert.assertEquals("column1", engine.eval("names(a)[1]"));
+ Assert.assertEquals("column2", engine.eval("names(a)[2]"));
//Test row names
- Assert.assertEquals("row 1", (String) engine.eval("row.names(a)[1]"));
- Assert.assertEquals("row 2", (String) engine.eval("row.names(a)[2]"));
- Assert.assertEquals("row 3", (String) engine.eval("row.names(a)[3]"));
+ Assert.assertEquals("row 1", engine.eval("row.names(a)[1]"));
+ Assert.assertEquals("row 2", engine.eval("row.names(a)[2]"));
+ Assert.assertEquals("row 3", engine.eval("row.names(a)[3]"));
}
- /**
- * This test data.frame creation method 2 and data assignment.
- *
- * @throws Exception
- */
@Test
public void testDataFrameCreationMethod2WithoutAutoCommit()
throws Exception {
@@ -1155,32 +1130,27 @@
engine.setAutoCommit(true);
//Test data
- Assert.assertEquals(new Double(3.0), (Double) engine.eval("a[1,1]"));
- Assert.assertEquals(new Double(4.5), (Double) engine.eval("a[2,1]"));
- Assert.assertEquals(new Double(0.01), (Double) engine.eval("a[3,1]"));
- Assert.assertEquals("titi", (String) engine.eval("a[1,2]"));
- Assert.assertEquals("tata", (String) engine.eval("a[2,2]"));
- Assert.assertEquals("toto", (String) engine.eval("a[3,2]"));
- Assert.assertEquals(true, (Boolean) engine.eval("a[1,3]"));
- Assert.assertEquals(true, (Boolean) engine.eval("a[2,3]"));
- Assert.assertEquals(false, (Boolean) engine.eval("a[3,3]"));
- Assert.assertEquals(new Integer(1), (Integer) engine.eval("a[1,4]"));
- Assert.assertEquals(new Integer(2), (Integer) engine.eval("a[2,4]"));
- Assert.assertEquals(new Integer(3), (Integer) engine.eval("a[3,4]"));
+ Assert.assertEquals(3.0, engine.eval("a[1,1]"));
+ Assert.assertEquals(4.5, engine.eval("a[2,1]"));
+ Assert.assertEquals(0.01, engine.eval("a[3,1]"));
+ Assert.assertEquals("titi", engine.eval("a[1,2]"));
+ Assert.assertEquals("tata", engine.eval("a[2,2]"));
+ Assert.assertEquals("toto", engine.eval("a[3,2]"));
+ Assert.assertEquals(true, engine.eval("a[1,3]"));
+ Assert.assertEquals(true, engine.eval("a[2,3]"));
+ Assert.assertEquals(false, engine.eval("a[3,3]"));
+ Assert.assertEquals(1, engine.eval("a[1,4]"));
+ Assert.assertEquals(2, engine.eval("a[2,4]"));
+ Assert.assertEquals(3, engine.eval("a[3,4]"));
//Test names
- Assert.assertEquals("column1", (String) engine.eval("names(a)[1]"));
- Assert.assertEquals("column2", (String) engine.eval("names(a)[2]"));
+ Assert.assertEquals("column1", engine.eval("names(a)[1]"));
+ Assert.assertEquals("column2", engine.eval("names(a)[2]"));
//Test row names
- Assert.assertEquals("row 1", (String) engine.eval("row.names(a)[1]"));
- Assert.assertEquals("row 2", (String) engine.eval("row.names(a)[2]"));
- Assert.assertEquals("row 3", (String) engine.eval("row.names(a)[3]"));
+ Assert.assertEquals("row 1", engine.eval("row.names(a)[1]"));
+ Assert.assertEquals("row 2", engine.eval("row.names(a)[2]"));
+ Assert.assertEquals("row 3", engine.eval("row.names(a)[3]"));
}
- /**
- * This test data.frame creation method 2 and data assignment.
- *
- * @throws Exception
- */
@Test
public void testDataFrameCreationMethod3WithoutAutoCommit()
throws Exception {
@@ -1210,31 +1180,29 @@
column2.add(5555555555555555555555.0);
column2.add(3.0);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
- RDataFrame dataframe1 = new RDataFrame(engine, names, rowNames, data,
- "a");
+ new RDataFrame(engine, names, rowNames, data, "a");
engine.commit();
engine.setAutoCommit(true);
//Test data
- Assert.assertEquals(new Double(3.0), (Double) engine.eval("a[1,1]"));
- Assert.assertEquals(new Double(4.5), (Double) engine.eval("a[2,1]"));
- Assert.assertEquals(new Double(0.01), (Double) engine.eval("a[3,1]"));
- Assert.assertEquals(new Double(1.0), (Double) engine.eval("a[1,2]"));
- Assert.assertEquals(new Double(5555555555555555555555.0),
- (Double) engine.eval("a[2,2]"));
- Assert.assertEquals(new Double(3.0), (Double) engine.eval("a[3,2]"));
+ Assert.assertEquals(3.0, engine.eval("a[1,1]"));
+ Assert.assertEquals(4.5, engine.eval("a[2,1]"));
+ Assert.assertEquals(0.01, engine.eval("a[3,1]"));
+ Assert.assertEquals(1.0, engine.eval("a[1,2]"));
+ Assert.assertEquals(5555555555555555555555.0, engine.eval("a[2,2]"));
+ Assert.assertEquals(3.0, engine.eval("a[3,2]"));
//Test names
- Assert.assertEquals("column1", (String) engine.eval("names(a)[1]"));
- Assert.assertEquals("column2", (String) engine.eval("names(a)[2]"));
+ Assert.assertEquals("column1", engine.eval("names(a)[1]"));
+ Assert.assertEquals("column2", engine.eval("names(a)[2]"));
//Test row names
- Assert.assertEquals("row 1", (String) engine.eval("row.names(a)[1]"));
- Assert.assertEquals("row 2", (String) engine.eval("row.names(a)[2]"));
- Assert.assertEquals("row 3", (String) engine.eval("row.names(a)[3]"));
+ Assert.assertEquals("row 1", engine.eval("row.names(a)[1]"));
+ Assert.assertEquals("row 2", engine.eval("row.names(a)[2]"));
+ Assert.assertEquals("row 3", engine.eval("row.names(a)[3]"));
}
@Test
@@ -1254,7 +1222,7 @@
column2.add(5555555555555555555555.0);
column2.add(3.0);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
@@ -1294,7 +1262,7 @@
//Test normally thrown exception when getting name(int)
try {
- String test = dataframe1.getName(2);
+ dataframe1.getName(2);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
@@ -1302,7 +1270,7 @@
//Test normally thrown exception when getting rowname(int)
try {
- String test = dataframe1.getRowName(3);
+ dataframe1.getRowName(3);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
@@ -1326,7 +1294,7 @@
//Test normally thrown exception when getting name(int)
try {
- String test = dataframe1.getRowName(3);
+ dataframe1.getRowName(3);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
@@ -1386,7 +1354,7 @@
column4.add("toto");
column4.add("tata");
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
data.add(column3);
@@ -1414,31 +1382,31 @@
//Test exceptions normally thrown using getters
try {
- Object test = dataframe1.get(5, 7);
+ dataframe1.get(5, 7);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
}
try {
- Object test = dataframe1.get(1, 7);
+ dataframe1.get(1, 7);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
}
try {
- Object test = dataframe1.get(5, 1);
+ dataframe1.get(5, 1);
Assert.fail("Error was not thrown although it should have been");
} catch (IndexOutOfBoundsException eee) {
log.debug("Exception normally thrown ", eee);
}
//Test setters
- dataframe1.set(0, 0, (Double)45.6);
- dataframe1.set(1, 0, (Integer)45);
- dataframe1.set(2, 0, (Boolean)false);
- dataframe1.set(2, 2, (Boolean)true);
+ dataframe1.set(0, 0, 45.6);
+ dataframe1.set(1, 0, 45);
+ dataframe1.set(2, 0, false);
+ dataframe1.set(2, 2, true);
dataframe1.set(3, 0, "tonton");
Assert.assertEquals(45.6, dataframe1.get(0, 0));
@@ -1485,7 +1453,7 @@
//Set a Double instead of Integer
try {
- dataframe1.set(1, 0, (Double)45.6);
+ dataframe1.set(1, 0, 45.6);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -1493,7 +1461,7 @@
//Set a Double instead of a Boolean
try {
- dataframe1.set(2, 0, (Double)45.6);
+ dataframe1.set(2, 0, 45.6);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -1501,7 +1469,7 @@
//Set a Double instead of a String
try {
- dataframe1.set(3, 0, (Double)45.6);
+ dataframe1.set(3, 0, 45.6);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -1509,7 +1477,7 @@
//Set an Integer instead of a Double
try {
- dataframe1.set(0, 0, (Integer)45);
+ dataframe1.set(0, 0, 45);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -1517,7 +1485,7 @@
//Set an Integer instead of a Boolean
try {
- dataframe1.set(2, 0, (Integer)45);
+ dataframe1.set(2, 0, 45);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
log.debug("Exception normally thrown ", eee);
@@ -1525,28 +1493,28 @@
//Set an Integer instead of a String
try {
- dataframe1.set(3, 0, (Integer)45);
+ dataframe1.set(3, 0, 45);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
}
//Set a Boolean instead of a Double
try {
- dataframe1.set(0, 0, (Boolean)false);
+ dataframe1.set(0, 0, false);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
}
//Set a Boolean instead of an Integer
try {
- dataframe1.set(1, 0, (Boolean)false);
+ dataframe1.set(1, 0, false);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
}
//Set a Boolean instead of a String
try {
- dataframe1.set(3, 0, (Boolean)false);
+ dataframe1.set(3, 0, false);
Assert.fail("Error was not thrown although it should have been");
} catch (RException eee) {
}
@@ -1618,7 +1586,7 @@
column4.add("toto");
column4.add("tata");
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
data.add(column3);
@@ -1681,7 +1649,7 @@
column4.add("toto");
column4.add("tata");
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
data.add(column3);
@@ -1695,22 +1663,22 @@
engine.setAutoCommit(true);
Assert.assertTrue((Boolean) engine.eval("is.data.frame(a)"));
- Assert.assertEquals("test_value", (String) engine
- .eval("attributes(a)$test_attribute"));
- Assert.assertEquals("second_value", (String) engine
- .eval("attributes(a)$second_test_attribute"));
+ Assert.assertEquals("test_value",
+ engine.eval("attributes(a)$test_attribute"));
+ Assert.assertEquals("second_value",
+ engine.eval("attributes(a)$second_test_attribute"));
engine.setAutoCommit(false);
- Assert.assertEquals("test_value", dataframe1
- .getAttribute("test_attribute"));
- Assert.assertEquals("second_value", dataframe1
- .getAttribute("second_test_attribute"));
+ Assert.assertEquals("test_value",
+ dataframe1.getAttribute("test_attribute"));
+ Assert.assertEquals("second_value",
+ dataframe1.getAttribute("second_test_attribute"));
dataframe1.setAttribute("test_attribute", "third_value");
engine.setAutoCommit(true);
Assert.assertTrue((Boolean) engine.eval("is.data.frame(a)"));
- Assert.assertEquals("third_value", (String) engine
- .eval("attributes(a)$test_attribute"));
+ Assert.assertEquals("third_value",
+ engine.eval("attributes(a)$test_attribute"));
engine.setAutoCommit(false);
Map<String, Object> attributes = new HashMap<String, Object>();
@@ -1719,16 +1687,16 @@
dataframe1.setAttributes(attributes);
Assert.assertTrue((Boolean) engine.eval("is.data.frame(a)"));
- Assert.assertEquals("this is an attribute", dataframe1
- .getAttribute("attr1"));
- Assert.assertEquals("this is an attribute", dataframe1
- .getAttribute("attr1"));
- Assert.assertEquals("this is another attribute", dataframe1
- .getAttribute("attr2"));
- Assert.assertEquals("this is an attribute", dataframe1.getAttributes()
- .get("attr1"));
- Assert.assertEquals("this is another attribute", dataframe1
- .getAttributes().get("attr2"));
+ Assert.assertEquals("this is an attribute",
+ dataframe1.getAttribute("attr1"));
+ Assert.assertEquals("this is an attribute",
+ dataframe1.getAttribute("attr1"));
+ Assert.assertEquals("this is another attribute",
+ dataframe1.getAttribute("attr2"));
+ Assert.assertEquals("this is an attribute",
+ dataframe1.getAttributes().get("attr1"));
+ Assert.assertEquals("this is another attribute",
+ dataframe1.getAttributes().get("attr2"));
engine.setAutoCommit(true);
}
@@ -1756,7 +1724,7 @@
column2.add(5555555555555555555555.0);
column2.add(3.0);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
@@ -1770,8 +1738,7 @@
testDataFrame.exportCsv(new File("/tmp/test.csv"), true, true);
RDataFrame dataframe2 = new RDataFrame(engine);
- dataframe2.importCsv(new File("/tmp/test.csv"), true, true, new Double(
- 3.0));
+ dataframe2.importCsv(new File("/tmp/test.csv"), true, true, 3.0);
dataframe2.setVariable("a");
//Test data
@@ -1810,7 +1777,7 @@
column6.add("tata");
column6.add("toto");
- data = new ArrayList<List<? extends Object>>();
+ data = new ArrayList<List<?>>();
data.add(column5);
data.add(column6);
@@ -1857,7 +1824,7 @@
column8.add(5);
column8.add(6);
- data = new ArrayList<List<? extends Object>>();
+ data = new ArrayList<List<?>>();
data.add(column7);
data.add(column8);
@@ -1910,15 +1877,15 @@
column4.add("blabla");
column4.add("blablabla");
- data = new ArrayList<List<? extends Object>>();
+ data = new ArrayList<List<?>>();
data.add(column1);
data.add(column3);
data.add(column4);
List<Object> types = new ArrayList<Object>();
- types.add(new Double(4.0));
- types.add(new Integer(4));
- types.add(new String());
+ types.add(4.0);
+ types.add(4);
+ types.add("");
testDataFrame = new RDataFrame(engine);
try {
@@ -1934,12 +1901,12 @@
dataframe3.setVariable("a");
//Test data
- Assert.assertEquals(new Double(3.0), dataframe3.get(0, 0));
- Assert.assertEquals(new Double(4.5), dataframe3.get(0, 1));
- Assert.assertEquals(new Double(0.01), dataframe3.get(0, 2));
- Assert.assertEquals(new Integer(1), dataframe3.get(1, 0));
- Assert.assertEquals(new Integer(5), dataframe3.get(1, 1));
- Assert.assertEquals(new Integer(3), dataframe3.get(1, 2));
+ Assert.assertEquals(3.0, dataframe3.get(0, 0));
+ Assert.assertEquals(4.5, dataframe3.get(0, 1));
+ Assert.assertEquals(0.01, dataframe3.get(0, 2));
+ Assert.assertEquals(1, dataframe3.get(1, 0));
+ Assert.assertEquals(5, dataframe3.get(1, 1));
+ Assert.assertEquals(3, dataframe3.get(1, 2));
Assert.assertEquals("bla", dataframe3.get(2, 0));
Assert.assertEquals("blabla", dataframe3.get(2, 1));
Assert.assertEquals("blablabla", dataframe3.get(2, 2));
@@ -2000,11 +1967,11 @@
column2.add(5555555555555555555555.0);
column2.add(3.0);
- List<List<? extends Object>> data = new ArrayList<List<? extends Object>>();
+ List<List<?>> data = new ArrayList<List<?>>();
data.add(column1);
data.add(column2);
- RDataFrame testDataFrame = new RDataFrame(engine);
+ RDataFrame testDataFrame;
try {
testDataFrame = new RDataFrame(engine, names, rowNames, data,
"test");
Modified: trunk/src/test/java/org/nuiton/j2r/ListTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/ListTest.java 2010-04-12 12:15:23 UTC (rev 193)
+++ trunk/src/test/java/org/nuiton/j2r/ListTest.java 2010-04-14 09:51:16 UTC (rev 194)
@@ -242,12 +242,6 @@
data.add(3.6);
data.add(true);
- List<String> names = new ArrayList<String>();
- names.add("a");
- names.add("b");
- names.add("c");
- names.add("d");
-
RList list1 = new RList(engine);
list1.setVariable("a");
list1.setData(data);
@@ -689,12 +683,6 @@
data.add(3.6);
data.add(true);
- List<String> names = new ArrayList<String>();
- names.add("a");
- names.add("b");
- names.add("c");
- names.add("d");
-
RList list1 = new RList(engine);
list1.setVariable("a");
list1.setData(data);
@@ -721,12 +709,6 @@
data.add(3.6);
data.add(true);
- List<String> names = new ArrayList<String>();
- names.add("a");
- names.add("b");
- names.add("c");
- names.add("d");
-
RList list1 = new RList(engine);
list1.setVariable("a");
list1.setData(data);
@@ -895,8 +877,8 @@
Assert.assertEquals(false, list1.getAttribute("booleanFalseAttribute"));
list1.setAttribute("test_attribute", "third_value");
- Assert.assertEquals("third_value", (String) engine
- .eval("attributes(a)$test_attribute"));
+ Assert.assertEquals("third_value",
+ engine.eval("attributes(a)$test_attribute"));
try {
list1.getAttribute("toto");
@@ -922,14 +904,14 @@
attributes.put("booleanFalseAttribute", false);
list1.setAttributes(attributes);
- Assert.assertEquals("test_value", list1.getAttributes().get(
- "stringAttribute"));
+ Assert.assertEquals("test_value",
+ list1.getAttributes().get("stringAttribute"));
Assert.assertEquals(3.6, list1.getAttributes().get("doubleAttribute"));
Assert.assertEquals(3, list1.getAttributes().get("integerAttribute"));
- Assert.assertEquals(true, list1.getAttributes().get(
- "booleanTrueAttribute"));
- Assert.assertEquals(false, list1.getAttributes().get(
- "booleanFalseAttribute"));
+ Assert.assertEquals(true,
+ list1.getAttributes().get("booleanTrueAttribute"));
+ Assert.assertEquals(false,
+ list1.getAttributes().get("booleanFalseAttribute"));
engine.setAutoCommit(true);
}
Modified: trunk/src/test/java/org/nuiton/j2r/NetTest.java
===================================================================
--- trunk/src/test/java/org/nuiton/j2r/NetTest.java 2010-04-12 12:15:23 UTC (rev 193)
+++ trunk/src/test/java/org/nuiton/j2r/NetTest.java 2010-04-14 09:51:16 UTC (rev 194)
@@ -240,9 +240,7 @@
engine.saveRData(workingdir);
engine.remove("a");
engine.loadRData(workingdir);
- Double testDouble = (Double) engine.eval("a");
- Double compareTo = new Double(5.0);
- Assert.assertEquals(compareTo, testDouble);
+ Assert.assertEquals(5.0, engine.eval("a"));
}
@Test
@@ -256,9 +254,7 @@
engine.dput("a", "testDputDgetfile");
engine.remove("a");
engine.dget("a", "testDputDgetfile");
- Double testDouble = (Double) engine.eval("a");
- Double compareTo = new Double(5.0);
- Assert.assertEquals(compareTo, testDouble);
+ Assert.assertEquals(5.0, engine.eval("a"));
workingdir = new File("/");
//test method using absolute path
@@ -267,9 +263,7 @@
engine.dput("a", testingFile);
engine.remove("a");
engine.dget("a", testingFile);
- Double testDouble2 = (Double) engine.eval("a");
- Double compareTo2 = new Double(6.0);
- Assert.assertEquals(compareTo2, testDouble2);
+ Assert.assertEquals(6.0, engine.eval("a"));
File testWorkingDirectory = engine.getwd();
Assert.assertEquals(workingdir.getAbsolutePath(),
testWorkingDirectory.getAbsolutePath());
@@ -278,7 +272,7 @@
@Test
public void testRemove() throws Exception {
engine.voidEval("a<-6.0");
- Assert.assertEquals(new Double(6.0), engine.eval("a"));
+ Assert.assertEquals(6.0, engine.eval("a"));
engine.remove("a");
Assert.assertFalse((Boolean) engine.eval("exists(\"a\")"));
}
@@ -289,7 +283,7 @@
engine.voidEval("a<-5.0");
engine.remove("b");
engine.mv("a", "b");
- Assert.assertEquals(new Double(5.0), engine.eval("b"));
+ Assert.assertEquals(5.0, engine.eval("b"));
Assert.assertFalse((Boolean) engine.eval("exists(\"a\")"));
}
@@ -320,11 +314,11 @@
engine.voidEval("e<-5.0");
engine.voidEval("f<-5.0");
engine.commit();
- Assert.assertEquals(new Double(10.0), engine.eval("a"));
- Assert.assertEquals(new Double(5.0), engine.eval("b"));
- Assert.assertEquals(new Double(5.0), engine.eval("d"));
- Assert.assertEquals(new Double(5.0), engine.eval("e"));
- Assert.assertEquals(new Double(5.0), engine.eval("f"));
+ Assert.assertEquals(10.0, engine.eval("a"));
+ Assert.assertEquals(5.0, engine.eval("b"));
+ Assert.assertEquals(5.0, engine.eval("d"));
+ Assert.assertEquals(5.0, engine.eval("e"));
+ Assert.assertEquals(5.0, engine.eval("f"));
}
@Test
1
0