Merge pull request #906 from CodingCat/style

apply google-java-style indentation and impose import orders
This commit is contained in:
Tianqi Chen 2016-03-03 14:39:05 -08:00
commit 12dc92f7e0
17 changed files with 36 additions and 46 deletions

View File

@ -76,7 +76,6 @@
<property name="allowByTailComment" value="true"/> <property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/> <property name="allowNonPrintableEscapes" value="true"/>
</module> </module>
<!-- TODO: 11/09/15 disabled - the lengths are currently > 100 in many places -->
<module name="LineLength"> <module name="LineLength">
<property name="max" value="100"/> <property name="max" value="100"/>
@ -129,25 +128,19 @@
<message key="ws.notPreceded" <message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/> value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module> </module>
<!-- TODO: 11/09/15 disabled - indentation is currently inconsistent -->
<!--
<module name="Indentation"> <module name="Indentation">
<property name="basicOffset" value="4"/> <property name="basicOffset" value="2"/>
<property name="braceAdjustment" value="0"/> <property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/> <property name="caseIndent" value="2"/>
<property name="throwsIndent" value="4"/> <property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/> <property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/> <property name="arrayInitIndent" value="2"/>
</module> </module>
-->
<!-- TODO: 11/09/15 disabled - order is currently wrong in many places -->
<!--
<module name="ImportOrder"> <module name="ImportOrder">
<property name="separated" value="true"/> <property name="separated" value="true"/>
<property name="ordered" value="true"/> <property name="ordered" value="true"/>
<property name="groups" value="/^javax?\./,scala,*,org.apache.spark"/> <property name="groups" value="/^javax?\./,scala,*,ml.dmlc.xgboost4j"/>
</module> </module>
-->
<module name="MethodParamPad"/> <module name="MethodParamPad"/>
<module name="AnnotationLocation"> <module name="AnnotationLocation">
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/> <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>

View File

@ -19,10 +19,11 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import ml.dmlc.xgboost4j.*;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import ml.dmlc.xgboost4j.*;
/** /**
* an example user define objective and eval * an example user define objective and eval
* NOTE: when you do customized loss function, the default prediction value is margin * NOTE: when you do customized loss function, the default prediction value is margin

View File

@ -1,15 +1,9 @@
package ml.dmlc.xgboost4j.demo; package ml.dmlc.xgboost4j.demo;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import ml.dmlc.xgboost4j.Rabit; import ml.dmlc.xgboost4j.*;
import ml.dmlc.xgboost4j.Booster;
import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError;
/** /**
* Distributed training example, used to quick test distributed training. * Distributed training example, used to quick test distributed training.

View File

@ -15,14 +15,14 @@
*/ */
package ml.dmlc.xgboost4j.demo; package ml.dmlc.xgboost4j.demo;
import java.util.HashMap;
import ml.dmlc.xgboost4j.Booster; import ml.dmlc.xgboost4j.Booster;
import ml.dmlc.xgboost4j.DMatrix; import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.XGBoost; import ml.dmlc.xgboost4j.XGBoost;
import ml.dmlc.xgboost4j.XGBoostError; import ml.dmlc.xgboost4j.XGBoostError;
import ml.dmlc.xgboost4j.demo.util.CustomEval; import ml.dmlc.xgboost4j.demo.util.CustomEval;
import java.util.HashMap;
/** /**
* this is an example of fit generalized linear model in xgboost * this is an example of fit generalized linear model in xgboost
* basically, we are using linear model, instead of tree for our boosters * basically, we are using linear model, instead of tree for our boosters

View File

@ -17,6 +17,7 @@ package ml.dmlc.xgboost4j.demo.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import ml.dmlc.xgboost4j.DMatrix; import ml.dmlc.xgboost4j.DMatrix;
import ml.dmlc.xgboost4j.IEvaluation; import ml.dmlc.xgboost4j.IEvaluation;
import ml.dmlc.xgboost4j.XGBoostError; import ml.dmlc.xgboost4j.XGBoostError;

View File

@ -15,12 +15,12 @@
*/ */
package ml.dmlc.xgboost4j.demo.util; package ml.dmlc.xgboost4j.demo.util;
import org.apache.commons.lang3.ArrayUtils;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
/** /**
* util class for loading data * util class for loading data
* *

View File

@ -15,11 +15,11 @@
*/ */
package ml.dmlc.xgboost4j; package ml.dmlc.xgboost4j;
import java.io.IOException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import java.io.IOException;
/** /**
* DMatrix for xgboost. * DMatrix for xgboost.
* *

View File

@ -15,11 +15,11 @@
*/ */
package ml.dmlc.xgboost4j; package ml.dmlc.xgboost4j;
import java.io.IOException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import java.io.IOException;
/** /**
* Error handle for Xgboost. * Error handle for Xgboost.
*/ */

View File

@ -15,14 +15,13 @@
*/ */
package ml.dmlc.xgboost4j; package ml.dmlc.xgboost4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.*; import java.io.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* Booster for xgboost, similar to the python wrapper xgboost.py * Booster for xgboost, similar to the python wrapper xgboost.py

View File

@ -15,12 +15,12 @@
*/ */
package ml.dmlc.xgboost4j; package ml.dmlc.xgboost4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.*; import java.io.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* class to load native library * class to load native library
* *

View File

@ -1,9 +1,10 @@
package ml.dmlc.xgboost4j; package ml.dmlc.xgboost4j;
import java.io.IOException;
import java.util.Map;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import java.util.Map;
import java.io.IOException;
/** /**
* Rabit global class for synchronization. * Rabit global class for synchronization.

View File

@ -15,11 +15,10 @@
*/ */
package ml.dmlc.xgboost4j; package ml.dmlc.xgboost4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.*; import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* trainer for xgboost * trainer for xgboost

View File

@ -19,7 +19,7 @@ package ml.dmlc.xgboost4j.scala
import scala.collection.JavaConverters._ import scala.collection.JavaConverters._
import scala.collection.mutable import scala.collection.mutable
import ml.dmlc.xgboost4j.{Booster => JBooster, IEvaluation, IObjective} import ml.dmlc.xgboost4j.{Booster => JBooster}
private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) extends Booster { private[scala] class ScalaBoosterImpl private[xgboost4j](booster: JBooster) extends Booster {

View File

@ -16,7 +16,8 @@
package ml.dmlc.xgboost4j.scala package ml.dmlc.xgboost4j.scala
import _root_.scala.collection.JavaConverters._ import scala.collection.JavaConverters._
import ml.dmlc.xgboost4j.{XGBoost => JXGBoost} import ml.dmlc.xgboost4j.{XGBoost => JXGBoost}
object XGBoost { object XGBoost {

View File

@ -15,13 +15,14 @@
*/ */
package ml.dmlc.xgboost4j; package ml.dmlc.xgboost4j;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.junit.Test; import org.junit.Test;
import java.util.*;
/** /**
* test cases for Booster * test cases for Booster
* *

View File

@ -15,12 +15,12 @@
*/ */
package ml.dmlc.xgboost4j; package ml.dmlc.xgboost4j;
import junit.framework.TestCase;
import org.junit.Test;
import java.util.Arrays; import java.util.Arrays;
import java.util.Random; import java.util.Random;
import junit.framework.TestCase;
import org.junit.Test;
/** /**
* test cases for DMatrix * test cases for DMatrix
* *

2
rabit

@ -1 +1 @@
Subproject commit be50e7b63224b9fb7ff94ce34df9f8752ef83043 Subproject commit 1392e9f3da59bd5602ddebee944dd8fb5c6507b0