Skip to content

Commit

Permalink
Merge pull request #36 from eincs/reformat-codes-and-javadoc
Browse files Browse the repository at this point in the history
Reformat codes and javadoc
  • Loading branch information
0mok committed Feb 12, 2015
2 parents 1d92971 + 19ea6f0 commit 7fc6b07
Show file tree
Hide file tree
Showing 34 changed files with 197 additions and 308 deletions.
134 changes: 67 additions & 67 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,118 +17,118 @@
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="NewlineAtEndOfFile" />
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="NewlineAtEndOfFile"/>
<!-- Unmaintainable Javadoc tags -->
<module name="RegexpSingleline">
<property name="format" value="(@(author|version)|\(non-Javadoc\))" />
<property name="ignoreCase" value="true" />
<property name="message" value="unmaintainable Javadoc tags: @author, @version, or (non-Javadoc)" />
<property name="format" value="(@(author|version)|\(non-Javadoc\))"/>
<property name="ignoreCase" value="true"/>
<property name="message" value="unmaintainable Javadoc tags: @author, @version, or (non-Javadoc)"/>
</module>
<module name="FileTabCharacter" />
<module name="FileTabCharacter"/>
<!-- Force UNIX line separator -->
<module name="io.netty.build.checkstyle.NewlineCheck" />
<module name="io.netty.build.checkstyle.NewlineCheck"/>
<!-- Trailing whitespace -->
<module name="RegexpSingleline">
<property name="format" value="\s+$" />
<property name="message" value="trailing whitespace" />
<property name="format" value="\s+$"/>
<property name="message" value="trailing whitespace"/>
</module>
<!-- Prohibit consecutive empty lines (except the lines after package/import) -->
<module name="RegexpMultiline">
<property name="format" value="\n *(?!package )(?!import )[^\n]+\n{3,}" />
<property name="message" value="two or more consecutive empty lines" />
<property name="format" value="\n *(?!package )(?!import )[^\n]+\n{3,}"/>
<property name="message" value="two or more consecutive empty lines"/>
</module>
<!-- Prohibit an empty after { or before } -->
<module name="RegexpMultiline">
<property name="format" value="\n\n\s+\}[^\n]{0,10}\n" />
<property name="message" value="an empty line before '}'" />
<property name="format" value="\n\n\s+\}[^\n]{0,10}\n"/>
<property name="message" value="an empty line before '}'"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="\n\s+[^\n]{1,10}\{\n\n" />
<property name="message" value="an empty line after a short line that ends with '{'" />
<property name="format" value="\n\s+[^\n]{1,10}\{\n\n"/>
<property name="message" value="an empty line after a short line that ends with '{'"/>
</module>
<module name="TreeWalker">
<!-- configure annotations -->
<module name="MissingOverride" />
<module name="PackageAnnotation" />
<module name="MissingOverride"/>
<module name="PackageAnnotation"/>
<!-- configure block checks -->
<module name="LeftCurly" />
<module name="RightCurly" />
<module name="NeedBraces" />
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="NeedBraces"/>
<module name="EmptyBlock">
<property name="option" value="text" />
<property name="option" value="text"/>
</module>
<!-- configure class design -->
<module name="FinalClass" />
<module name="HideUtilityClassConstructor" />
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<!-- confiture coding -->
<module name="CovariantEquals" />
<module name="EmptyStatement" />
<module name="EqualsHashCode" />
<module name="SimplifyBooleanExpression" />
<module name="SimplifyBooleanReturn" />
<module name="NoFinalizer" />
<module name="SuperFinalize" />
<module name="PackageDeclaration" />
<module name="DefaultComesLast" />
<module name="UnnecessaryParentheses" />
<module name="CovariantEquals"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="NoFinalizer"/>
<module name="SuperFinalize"/>
<module name="PackageDeclaration"/>
<module name="DefaultComesLast"/>
<module name="UnnecessaryParentheses"/>
<!-- configure imports -->
<module name="AvoidStarImport" />
<module name="RedundantImport" />
<module name="AvoidStarImport"/>
<module name="RedundantImport"/>
<!-- configure javadoc -->
<module name="JavadocStyle">
<property name="checkFirstSentence" value="false" />
<property name="checkFirstSentence" value="false"/>
</module>
<!-- configure miscellaneous -->
<module name="UpperEll" />
<module name="ArrayTypeStyle" />
<module name="OuterTypeFilename" />
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
<module name="OuterTypeFilename"/>
<!-- configure modifiers -->
<module name="ModifierOrder" />
<module name="RedundantModifier" />
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- configure naming conventions -->
<module name="ConstantName" />
<module name="LocalVariableName" />
<module name="MemberName" />
<module name="MethodName" />
<module name="PackageName" />
<module name="ParameterName" />
<module name="ConstantName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName">
<property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$" />
<property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
</module>
<module name="TypeName" />
<module name="TypeName"/>
<!-- configure size violations -->
<module name="LineLength">
<property name="max" value="160" />
<property name="max" value="160"/>
</module>
<!-- configure whitespaces -->
<module name="GenericWhitespace" />
<module name="EmptyForInitializerPad" />
<module name="EmptyForIteratorPad" />
<module name="MethodParamPad" />
<module name="ParenPad" />
<module name="TypecastParenPad" />
<module name="GenericWhitespace"/>
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LE, LITERAL_CATCH,
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD,
MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN" />
MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
</module>
<module name="WhitespaceAfter">
<property name="tokens" value="COMMA, SEMI, TYPECAST" />
<property name="tokens" value="COMMA, SEMI, TYPECAST"/>
</module>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS" />
<property name="allowLineBreaks" value="true" />
<property name="severity" value="error" />
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
<property name="allowLineBreaks" value="true"/>
<property name="severity" value="error"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC" />
<property name="allowLineBreaks" value="true" />
<property name="severity" value="error" />
<property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
<property name="allowLineBreaks" value="true"/>
<property name="severity" value="error"/>
</module>
</module>
</module>
</module>
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
limitations under the License.
-->
<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/xsd/maven-4.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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
Expand Down Expand Up @@ -318,7 +319,7 @@
</goals>
</pluginExecutionFilter>
<action>
<ignore />
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
Expand All @@ -331,7 +332,7 @@
</goals>
</pluginExecutionFilter>
<action>
<ignore />
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
Expand Down Expand Up @@ -449,7 +450,7 @@
<profile>
<id>java8</id>
<activation>
<jdk>1.8</jdk>
<jdk>1.8</jdk>
</activation>
<build>
<plugins>
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/kr/co/vcnc/haeinsa/ForwardingHaeinsaTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
public class ForwardingHaeinsaTable extends ForwardingObject implements HaeinsaTableIfaceInternal {
private final HaeinsaTableIfaceInternal delegate;

/**
* Constructor
* @param haeinsaTable HaeinsaTable
*/
public ForwardingHaeinsaTable(HaeinsaTableIface haeinsaTable) {
Preconditions.checkArgument(haeinsaTable instanceof HaeinsaTableIfaceInternal);
this.delegate = (HaeinsaTableIfaceInternal) haeinsaTable;
Expand Down
22 changes: 5 additions & 17 deletions src/main/java/kr/co/vcnc/haeinsa/HaeinsaColumnTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.apache.hadoop.hbase.util.Bytes;

import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

/**
Expand All @@ -32,8 +33,7 @@
*/
public class HaeinsaColumnTracker {
// { family -> qualifier }
private final Map<byte[], NavigableSet<byte[]>> familyMap =
new TreeMap<byte[], NavigableSet<byte[]>>(Bytes.BYTES_COMPARATOR);
private final Map<byte[], NavigableSet<byte[]>> familyMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);

private final byte[] minColumn;
private final boolean minColumnInclusive;
Expand All @@ -44,19 +44,11 @@ public class HaeinsaColumnTracker {
* Constructor of HaeinsaColumnTracker.
* <p>
* If this ColumnTracker track {@link HaeinsaScan}, minColumn, maxColumn
* should be null and minColumnInclusive, maxColumnInclusive should be
* false.
*
* @param familyMap
*
* @param minColumn
* @param minColumnInclusive
* @param maxColumn
* @param maxColumnInclusive
* should be null and minColumnInclusive, maxColumnInclusive should be false.
*/
public HaeinsaColumnTracker(Map<byte[], NavigableSet<byte[]>> familyMap,
byte[] minColumn, boolean minColumnInclusive,
byte[] maxColumn, boolean maxColumnInclusive) {
byte[] minColumn, boolean minColumnInclusive,
byte[] maxColumn, boolean maxColumnInclusive) {
this.minColumn = minColumn;
this.maxColumn = maxColumn;
this.minColumnInclusive = minColumnInclusive;
Expand All @@ -76,9 +68,6 @@ public HaeinsaColumnTracker(Map<byte[], NavigableSet<byte[]>> familyMap,
* Return true if qualifier of kv is placed between minColumn and maxColumn.
* <p>
* Using lexicographical ordering to compare byte[]
*
* @param kv
* @return
*/
public boolean isColumnInclusive(HaeinsaKeyValue kv) {
int cmpMin = 1;
Expand Down Expand Up @@ -121,7 +110,6 @@ public boolean isColumnInclusive(HaeinsaKeyValue kv) {
* </ol>
*
* @param kv HaeinsaKeyValue which will be checked.
* @return
*/
public boolean isMatched(HaeinsaKeyValue kv) {
// If familyMap is empty, then Haeinsa transaction assumes
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/kr/co/vcnc/haeinsa/HaeinsaConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
* Static Class of Constants for Haeinsa
*/
public final class HaeinsaConstants {
private HaeinsaConstants() {
}
private HaeinsaConstants() {}

/**
* Haeinsa protocol version of this release.
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/kr/co/vcnc/haeinsa/HaeinsaDelete.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import com.google.common.collect.Sets;

/**
* Implementation of {@link HaeinsaMuation} which only contains HaeinsaKeyValue
* Implementation of {@link HaeinsaMutation} which only contains HaeinsaKeyValue
* with {@link Type#DeleteFamily} and {@link Type#DeleteColumn} identifier.
* HaeinsaPut can be analogous to {@link Delete} class in HBase.
* <p>
Expand Down Expand Up @@ -121,9 +121,10 @@ public TMutation toTMutation() {
newTRemove.addToRemoveFamilies(ByteBuffer.wrap(kv.getFamily()));
break;
}
default:
default: {
break;
}
}
}
newTMutation.setRemove(newTRemove);
return newTMutation;
Expand Down
16 changes: 6 additions & 10 deletions src/main/java/kr/co/vcnc/haeinsa/HaeinsaDeleteTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ public class HaeinsaDeleteTracker {
private final NavigableMap<byte[], NavigableMap<byte[], Long>> cells = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);

/**
* Update family map or column map if kv is not exist in map or sequenceId
* is lower.
* Update family map or column map if kv is not exist in map or sequenceId is lower.
*
* @param kv - HaeinsaKeyValue to track
* @param sequenceID - sequence ID, lower is newer.
* @param kv HaeinsaKeyValue to track
* @param sequenceID sequence ID, lower is newer.
*/
public void add(HaeinsaKeyValue kv, long sequenceID) {
switch (kv.getType()) {
Expand All @@ -60,17 +59,14 @@ public void add(HaeinsaKeyValue kv, long sequenceID) {
}
break;
}
default:
default: {
break;
}
}
}

/**
*
* @param kv
* @param sequenceID
* @return Return true if kv is deleted after sequenceID (lower sequenceID),
* return false otherwise.
* @return Return true if kv is deleted after sequenceID (lower sequenceID), return false otherwise.
*/
public boolean isDeleted(HaeinsaKeyValue kv, long sequenceID) {
// check family
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/kr/co/vcnc/haeinsa/HaeinsaGet.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.util.Bytes;

import com.google.common.collect.Maps;

/**
* HaeinsaGet can be analogous to {@link Get} class in HBase.
* <p>
* HaeinsaGet only contains data of single row.
*/
public class HaeinsaGet extends HaeinsaQuery {
private byte[] row;
private Map<byte[], NavigableSet<byte[]>> familyMap =
new TreeMap<byte[], NavigableSet<byte[]>>(Bytes.BYTES_COMPARATOR);
private Map<byte[], NavigableSet<byte[]>> familyMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);

/**
* Create a Get operation for the specified row.
Expand Down
Loading

0 comments on commit 7fc6b07

Please sign in to comment.