From: hama Date: Sat, 30 Jul 2016 22:55:56 +0000 (+0200) Subject: javadoc improvements, installer X-Git-Tag: v0.1~2 X-Git-Url: https://gitweb.hamatoma.de/?a=commitdiff_plain;h=fd49eeea8d95f3d63130c544f9158ae0273a9ffc;p=jpinet javadoc improvements, installer --- diff --git a/.gitignore b/.gitignore index 0d31329..cce9e44 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ test-output .classpath .idea .settings +./jpinet.sh diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..858ce96 --- /dev/null +++ b/INSTALL @@ -0,0 +1,5 @@ +Installation of jpinet: + +unzip jpinet*.zip +./install_jpinet.sh + diff --git a/install_jpinet.sh b/install_jpinet.sh new file mode 100644 index 0000000..841f93b --- /dev/null +++ b/install_jpinet.sh @@ -0,0 +1,5 @@ +#! /bin/bash + +cp -v resources/pinet-*-jar-with-dependencies.jar \ + resources/jpinet.sh \ + /usr/local/bin diff --git a/mk_doc.sh b/mk_doc.sh new file mode 100755 index 0000000..604af84 --- /dev/null +++ b/mk_doc.sh @@ -0,0 +1,39 @@ +#! /bin/bash + +FN=/tmp/jdoc.list +FN2=/tmp/jdoc2.list +PATTERN_SRC_JAR=pinet-*-sources.jar +PATTERN_FULL_JAR=pinet-*-jar-with-dependencies.jar +DIR_DOC=target/doc + +echo "mvn clean install..." +mvn clean install -Dmaven.test.skip=true | tail -n 10 +echo "mvn assembly:single..." +mvn assembly:single | tail -n 10 + +function buildPath(){ + BASE=$1 + find -name "*.java" >$FN + while read line ; do + dir=$(dirname $line) + echo $dir >>$FN2 + done <$FN + sort -u <$FN2 >$FN + while read line ; do + dir=$(echo $line | awk '{ print $1; };') + list="$list;$dir" + done < $FN + echo ${list:1} +} + +rm -Rf $FN $FN2 $DIR_DOC +mkdir -p $DIR_DOC +CLASSES=$(buildPath target) +find src/main/java -name "*.java" >$FN +FULL_JAR=$(ls target/$PATTERN_FULL_JAR) +set -x +javadoc -cp $FULL_JAR -d target/doc @$FN +set +x +cd target +zip -9r ../$PATTERN_SRC_JAR doc +cd .. diff --git a/pack.sh b/pack.sh new file mode 100644 index 0000000..39c1c23 --- /dev/null +++ b/pack.sh @@ -0,0 +1,5 @@ +#! /bin/bash + +cp target/pinet-*-jar-with-dependencies.jar resources +zip jpinet.zip resources/* install_jpinet.sh +rm -f resources/pinet-*-jar-with-dependencies.jar diff --git a/pom.xml b/pom.xml index d11fb48..7e2ff0a 100644 --- a/pom.xml +++ b/pom.xml @@ -11,14 +11,18 @@ Controlling a Raspberry Pi https://sourcefourge.net - + + scm:git:git@git.hamatoma.de:repo/jpinet + scm:svn:https://somerepository.com/svn_repo/trunk + http://somerepository.com/view.cvs + UTF-8 UTF-8 1.1.7 - 1.7.21 - UTF-8 - + 1.5.6 + UTF-8 + @@ -88,13 +92,36 @@ 4 + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + + + + com.example.boringcode.* + + + com/example/dullcode/**/*.class + com/example/**/*Test.class + + + + + + + clean + + + + org.codehaus.mojo exec-maven-plugin 1.4.0 - de.republlb.MainApp + de.republib.pinet.Client false @@ -112,6 +139,24 @@ jar-with-dependencies + + + de.republib.pinet.Client + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + de.republib.pinet.Client + + @@ -126,6 +171,15 @@ + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + v@{project.version} + + @@ -140,6 +194,11 @@ maven-project-info-reports-plugin 2.8 + + org.codehaus.mojo + cobertura-maven-plugin + 2.7 + diff --git a/resources/jpinet.sh b/resources/jpinet.sh new file mode 100755 index 0000000..922a9af --- /dev/null +++ b/resources/jpinet.sh @@ -0,0 +1,22 @@ +#! /bin/bash +set -x +found= +for dir in . /usr/bin /usr/local/bin target ; do + full=$(echo $dir/pinet*-with-dependencies.jar) + part=${full#$dir/pinet} + part=${part:0:1} + if [ $part != '*' ] ; then + found=$(ls -1 $dir/pinet*-with-dependencies.jar | tail -n 1) + break + fi +done +if [ -z "$found" ] ; then + echo "+++ missing pinet*-with-dependencies.jar" +else + echo "starting $full..." + java -jar $full de.republib.pinet.Client +fi + + + + diff --git a/src/main/java/de/republib/expr/DataType.java b/src/main/java/de/republib/expr/DataType.java index 8ad6904..c25bd50 100644 --- a/src/main/java/de/republib/expr/DataType.java +++ b/src/main/java/de/republib/expr/DataType.java @@ -10,5 +10,32 @@ package de.republib.expr; * */ public enum DataType { - UNDEF, BOOLEAN, LONG, DOUBLE, STRING, OBJECT, VARIABLE + /** + * undefined type + */ + UNDEF, + /** + * true or false + */ + BOOLEAN, + /** + * 64 bit integer number + */ + LONG, + /** + * 64 bit floating point number + */ + DOUBLE, + /** + * a sequence of characters + */ + STRING, + /** + * an object not defined closer + */ + OBJECT, + /** + * an instance of the class Variable + */ + VARIABLE, } diff --git a/src/main/java/de/republib/expr/OpCode.java b/src/main/java/de/republib/expr/OpCode.java index 65db894..9d8364f 100644 --- a/src/main/java/de/republib/expr/OpCode.java +++ b/src/main/java/de/republib/expr/OpCode.java @@ -1,5 +1,11 @@ package de.republib.expr; +/** + * Enumerates operation codes used from a parser. + * + * @author hm + * + */ public enum OpCode { UNDEF(0), ASSIGNMENT(1, false, true), // PLUS(10, true), MINUS(10, true), // diff --git a/src/main/java/de/republib/expr/ParserException.java b/src/main/java/de/republib/expr/ParserException.java index bde06d5..c81c5b0 100644 --- a/src/main/java/de/republib/expr/ParserException.java +++ b/src/main/java/de/republib/expr/ParserException.java @@ -6,6 +6,8 @@ package de.republib.expr; /** * Handles scanner and parser errors like "unknown token". * + * The error message contains the position of the error. + * * @author hm * */ diff --git a/src/main/java/de/republib/expr/TokenType.java b/src/main/java/de/republib/expr/TokenType.java index 8a87ce6..0f98cd9 100644 --- a/src/main/java/de/republib/expr/TokenType.java +++ b/src/main/java/de/republib/expr/TokenType.java @@ -4,9 +4,39 @@ package de.republib.expr; /** + * Enumerates the several types of tokens recognized from a scanner. + * * @author hm * */ public enum TokenType { - UNDEF, INTEGER, OP, ID, STRING, SPACE, END_OF_STRING, UNKNOWN + UNDEF, + /** + * integer number. + */ + INTEGER, + /** + * operator (unary or binary). + */ + OP, + /** + * identificator (variable...). + */ + ID, + /** + * Character sequences. + */ + STRING, + /** + * a whitespace like blank, tabulator, newline... + */ + SPACE, + /** + * end of input has been reached. + */ + END_OF_STRING, + /** + * unknown token: error occurred. + */ + UNKNOWN } diff --git a/src/main/java/de/republib/expr/Variant.java b/src/main/java/de/republib/expr/Variant.java index 8ad8933..45c236b 100644 --- a/src/main/java/de/republib/expr/Variant.java +++ b/src/main/java/de/republib/expr/Variant.java @@ -775,6 +775,7 @@ public class Variant implements Cloneable { * @param op * unary operator to check * @throws VariantException + * informs about a wrong data type */ protected void wrongDataType(Variant operand, OpCode op) throws VariantException { throw new VariantException(String.format(I18N.tr("unexpected unary operation %s (not matching %s)"), op.name(), @@ -791,6 +792,7 @@ public class Variant implements Cloneable { * @param op2 * second operand * @throws VariantException + * informs about a wrong data type */ protected void wrongDataType(Variant op1, OpCode op, Variant op2) throws VariantException { throw new VariantException(String.format(I18N.tr("wrong operators (%s - %s) for operator %s"), diff --git a/src/main/java/de/republib/expr/package-info.java b/src/main/java/de/republib/expr/package-info.java new file mode 100644 index 0000000..000aaad --- /dev/null +++ b/src/main/java/de/republib/expr/package-info.java @@ -0,0 +1,17 @@ +/** + * Provides classes for a scanner and/or a parser. + * + *

+ * Scanner:
+ * A tool to divide a text (source code) into tokens (syntactical element). + *

+ * + *

+ * Parser:
+ * A tool to analyse a programming language. + *

+ * + * @author hm + * + */ +package de.republib.expr; \ No newline at end of file diff --git a/src/main/java/de/republib/gui/package-info.java b/src/main/java/de/republib/gui/package-info.java new file mode 100644 index 0000000..2ec94fb --- /dev/null +++ b/src/main/java/de/republib/gui/package-info.java @@ -0,0 +1,7 @@ +/** + * Utilities for Graphical User Interface. + * + * @author hm + * + */ +package de.republib.gui; \ No newline at end of file diff --git a/src/main/java/de/republib/net/package-info.java b/src/main/java/de/republib/net/package-info.java new file mode 100644 index 0000000..004b2ec --- /dev/null +++ b/src/main/java/de/republib/net/package-info.java @@ -0,0 +1,7 @@ +/** + * Utilities for IP communication, specially TCP. + * + * @author hm + * + */ +package de.republib.net; \ No newline at end of file diff --git a/src/main/java/de/republib/pinet/gui/GPIOSettings.java b/src/main/java/de/republib/pinet/gui/GPIOSettings.java index 5540bfb..81b5992 100644 --- a/src/main/java/de/republib/pinet/gui/GPIOSettings.java +++ b/src/main/java/de/republib/pinet/gui/GPIOSettings.java @@ -429,11 +429,11 @@ class OutputBlinkPanel extends JPanel implements ActionListener { final int high = this.comboHigh.getIntValue(); final int low = this.ComboLow.getIntValue(); if (this.center.reconnect()) { - this.center.say(Announcer.LOG, + this.center.say(Announcer.INFO, String.format(I18N.tr("blinking started on pin %d"), current.getPinNumber().getNumber())); final DynBytes answer = client.blink(current.getPinNumber(), count, high, low); if (answer.startsWith("OK")) { - this.center.say(Announcer.LOG, String.format(I18N.tr("pin %d blinks %d times"), + this.center.say(Announcer.INFO, String.format(I18N.tr("pin %d blinks %d times"), current.getPinNumber().getNumber(), count)); } } @@ -517,12 +517,12 @@ class OutputPwmPanel extends JPanel implements ActionListener { final int functionSteps = this.comboFunctionSteps.getIntValue(); final int count = this.comboCount.getIntValue(); if (this.center.reconnect()) { - this.center.say(Announcer.LOG, + this.center.say(Announcer.INFO, String.format(I18N.tr("PWM output: period: %d start: %f Mode: %s"), period, startValue, mode)); final DynBytes answer = client.pwmOutput(current.getPinNumber(), period, startValue, function, functionSteps, count); if (answer.startsWith("OK")) { - this.center.say(Announcer.LOG, String.format(I18N.tr("pin %d puts pwm %d times"), + this.center.say(Announcer.INFO, String.format(I18N.tr("pin %d puts pwm %d times"), current.getPinNumber().getNumber(), count)); } } diff --git a/src/main/java/de/republib/pinet/gui/package-info.java b/src/main/java/de/republib/pinet/gui/package-info.java new file mode 100644 index 0000000..104ee66 --- /dev/null +++ b/src/main/java/de/republib/pinet/gui/package-info.java @@ -0,0 +1,10 @@ +/** + * + */ +/** + * Utilities for Graphical User Interface only usable in the project pinet. + * + * @author hm + * + */ +package de.republib.pinet.gui; \ No newline at end of file diff --git a/src/main/java/de/republib/pinet/package-info.java b/src/main/java/de/republib/pinet/package-info.java new file mode 100644 index 0000000..86438d3 --- /dev/null +++ b/src/main/java/de/republib/pinet/package-info.java @@ -0,0 +1,7 @@ +/** + * Utilities only usable in the project pinet. + * + * @author hm + * + */ +package de.republib.pinet; \ No newline at end of file diff --git a/src/main/java/de/republib/util/Announcer.java b/src/main/java/de/republib/util/Announcer.java index 8993314..11f955b 100644 --- a/src/main/java/de/republib/util/Announcer.java +++ b/src/main/java/de/republib/util/Announcer.java @@ -4,14 +4,43 @@ package de.republib.util; /** + * Handles the output to a medium. + * * @author hm * */ public interface Announcer { + /** + * Indicate an error. + * + * The program's flow is influenced usually. The user must be informed. + */ final int ERROR = 1; + /** + * Indicates a warning. + * + * The program's flow is not influenced usually. The user should be + * informed. + */ final int WARNING = 2; - final int LOG = 3; + /** + * Indicates an info. + * + * The user should be informed. + */ + final int INFO = 3; + /** + * Indicates an additional info used for debugging purpose. + */ final int DEBUG = 4; + /** + * Puts a message depending of the given level. + * + * @param level + * the type of the message: ERROR ... DEBUG + * @param message + * the message to display + */ void say(int level, String message); } diff --git a/src/main/java/de/republib/util/BytePairData.java b/src/main/java/de/republib/util/BytePairData.java index 700ebfe..fb78b57 100644 --- a/src/main/java/de/republib/util/BytePairData.java +++ b/src/main/java/de/republib/util/BytePairData.java @@ -7,6 +7,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** + * A data container usable for curves. + * + * Data are specified by a x range (minimum and maximum) and an array of y + * values. + * + * The number of x steps is given by the number of elements in the y array. + * + * The y data are integer. The data width can be defined between 1 and 8 + * bytes per value. + * * @author hm * */ diff --git a/src/main/java/de/republib/util/PairData.java b/src/main/java/de/republib/util/PairData.java index c8bfa46..e140a86 100644 --- a/src/main/java/de/republib/util/PairData.java +++ b/src/main/java/de/republib/util/PairData.java @@ -4,6 +4,10 @@ package de.republib.util; /** + * Utilities for curve data: a set of (x, y) pairs. + * + * This class contains only static methods. + * * @author hm * */ diff --git a/src/main/java/de/republib/util/package-info.java b/src/main/java/de/republib/util/package-info.java new file mode 100644 index 0000000..0deeb7b --- /dev/null +++ b/src/main/java/de/republib/util/package-info.java @@ -0,0 +1,7 @@ +/** + * Generally usable utility classes. + * + * @author hm + * + */ +package de.republib.util; \ No newline at end of file