diff --git a/barcode4j/src/main/java/org/krysalis/barcode4j/configuration/Configuration.java b/barcode4j/src/main/java/org/krysalis/barcode4j/configuration/Configuration.java index b6baa97..9527667 100644 --- a/barcode4j/src/main/java/org/krysalis/barcode4j/configuration/Configuration.java +++ b/barcode4j/src/main/java/org/krysalis/barcode4j/configuration/Configuration.java @@ -13,7 +13,7 @@ * This is a "read only" interface preventing applications from modifying their * own configurations. Once it is created, the information never changes. *
- ** The data model is a subset of XML's; a single-rooted hierarchical tree where each * node can contain multiple attributes, and leaf nodes can also @@ -22,7 +22,7 @@ * class, or directly by a SAX parser using a SAXConfigurationHandler or * NamespacedSAXConfigurationHandler event handler. *
- *
* Since version 4.1, each Configuration
node has a namespace
* associated with it, in the form of a string, accessible through {@link
@@ -30,7 +30,7 @@
* return blank (""). See DefaultConfigurationBuilder for details on how
* XML namespaces are mapped to Configuration
namespaces.
*
* As an example, consider two Configuration
s (with and without
* namespaces) built from this XML:
@@ -55,11 +55,9 @@
* an attribute named "xmlns:doc", and a child called "doc:desc".
*
- * Assuming the Configuration
object is named conf
,
- * here is how the data could be retrieved:
+ * Assuming the Configuration
object is named conf
, here is how the data could be retrieved:
*
- *
Code | No namespaces | With namespaces |
---|---|---|
* conf.{@link #getName getName}() | my-system | |
* conf.{@link #getChild(String) getChild}("desc").{@link #getNamespace getNamespace}()
* | http://myco.com/documentation" |
* Type-safe utility methods are provided for retrieving attribute and element
* values as String
, int
, long
,
* float
and boolean
.
*
* Currently, the configuration tree can only be traversed one node at a time,
* eg., through {@link #getChild(String) getChild("foo")} or {@link #getChildren()}. In
diff --git a/barcode4j/src/main/java/org/krysalis/barcode4j/impl/code128/CheckDigit.java b/barcode4j/src/main/java/org/krysalis/barcode4j/impl/code128/CheckDigit.java
index 18f32bc..a2035f8 100644
--- a/barcode4j/src/main/java/org/krysalis/barcode4j/impl/code128/CheckDigit.java
+++ b/barcode4j/src/main/java/org/krysalis/barcode4j/impl/code128/CheckDigit.java
@@ -1,12 +1,12 @@
/*
* Copyright 2005 Jeremias Maerki and Dietmar Bürkle.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,33 +15,37 @@
*/
package org.krysalis.barcode4j.impl.code128;
+import org.jetbrains.annotations.NotNull;
-public class CheckDigit {
+/**
+ * @since 2.0
+ */
+class CheckDigit {
public final static byte CDNone = 0;
public final static byte CD31 = 1;
public final static byte CD11 = 2;
- public static char calcCheckdigit(String msg, int start, int end, byte type) {
+ /*
+ * @param msg the full barcode message
+ * @param start
+ * @param end
+ * @param type one of either {@link CheckDigit#CD31} or {@link CheckDigit#CD11}
+ * @return The check digit value as a char
+ */
+ // todo: consider removing this class. It's only used by EAN128LogicImpl and could be a private method. There's no need for it to be publicly available
+ static char calcCheckdigit(@NotNull final String msg, int start, int end, byte type) {
switch (type) {
- case CD31 : return calcCheckdigit(3, 1, msg, start, end);
- case CD11 : return calcCheckdigit(1, 1, msg, start, end);
+ case CD31 : return calcCheckdigit(3, 1, msg, start, end);
+ case CD11 : return calcCheckdigit(1, 1, msg, start, end);
default : return '0';
}
}
- public static char calcCheckdigit31(String msg, int start, int end) {
- return calcCheckdigit(3, 1, msg, start, end);
- }
-
- public static char calcCheckdigit11(String msg, int start, int end) {
- return calcCheckdigit(1, 1, msg, start, end);
- }
-
- public static char calcCheckdigit(int oddMult, int evenMult, String msg, int start, int end) {
+ private static char calcCheckdigit(int oddMult, int evenMult, String msg, int start, int end) {
int oddSum = 0;
int evenSum = 0;
- boolean even = false;
+ boolean even = false;
for (int i = end - 1; i >= start; i--) {
if (even) {
evenSum += Character.digit(msg.charAt(i), 10);
diff --git a/pom.xml b/pom.xml
index 231f55a..d163e09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -648,6 +648,7 @@