]> gitweb.hamatoma.de Git - jpinet/commitdiff
javadoc improvements, installer
authorhama <hama@siduction.net>
Sat, 30 Jul 2016 22:55:56 +0000 (00:55 +0200)
committerhama <hama@siduction.net>
Sat, 30 Jul 2016 22:55:56 +0000 (00:55 +0200)
22 files changed:
.gitignore
INSTALL [new file with mode: 0644]
install_jpinet.sh [new file with mode: 0644]
mk_doc.sh [new file with mode: 0755]
pack.sh [new file with mode: 0644]
pom.xml
resources/jpinet.sh [new file with mode: 0755]
src/main/java/de/republib/expr/DataType.java
src/main/java/de/republib/expr/OpCode.java
src/main/java/de/republib/expr/ParserException.java
src/main/java/de/republib/expr/TokenType.java
src/main/java/de/republib/expr/Variant.java
src/main/java/de/republib/expr/package-info.java [new file with mode: 0644]
src/main/java/de/republib/gui/package-info.java [new file with mode: 0644]
src/main/java/de/republib/net/package-info.java [new file with mode: 0644]
src/main/java/de/republib/pinet/gui/GPIOSettings.java
src/main/java/de/republib/pinet/gui/package-info.java [new file with mode: 0644]
src/main/java/de/republib/pinet/package-info.java [new file with mode: 0644]
src/main/java/de/republib/util/Announcer.java
src/main/java/de/republib/util/BytePairData.java
src/main/java/de/republib/util/PairData.java
src/main/java/de/republib/util/package-info.java [new file with mode: 0644]

index 0d3132966664fe78b799faffb135b3a65fd8cbf9..cce9e443ebc95b20f3ee42cd1b83306d9cefe3dc 100644 (file)
@@ -6,3 +6,4 @@ test-output
 .classpath
 .idea
 .settings
+./jpinet.sh
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
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 (file)
index 0000000..841f93b
--- /dev/null
@@ -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 (executable)
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 (file)
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 d11fb483ce9e72307b58040d68e459b9c4584e8a..7e2ff0afeae6175f70222761d4d718849c1d05ce 100644 (file)
--- a/pom.xml
+++ b/pom.xml
 
        <name>Controlling a Raspberry Pi</name>
        <url>https://sourcefourge.net</url>
-
+       <scm>
+               <connection>scm:git:git@git.hamatoma.de:repo/jpinet</connection>
+               <developerConnection>scm:svn:https://somerepository.com/svn_repo/trunk</developerConnection>
+               <url>http://somerepository.com/view.cvs</url>
+       </scm>
        <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
                <logback.version>1.1.7</logback.version>
-               <slf4j.version>1.7.21</slf4j.version>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-    </properties>
+               <slf4j.version>1.5.6</slf4j.version>
+               <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+       </properties>
 
        <dependencies>
                <dependency>
                                        <threadCount>4</threadCount>
                                </configuration>
                        </plugin>
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <artifactId>cobertura-maven-plugin</artifactId>
+                               <version>2.7</version>
+                               <configuration>
+                                       <instrumentation>
+                                               <ignores>
+                                                       <ignore>com.example.boringcode.*</ignore>
+                                               </ignores>
+                                               <excludes>
+                                                       <exclude>com/example/dullcode/**/*.class</exclude>
+                                                       <exclude>com/example/**/*Test.class</exclude>
+                                               </excludes>
+                                       </instrumentation>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>clean</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
                        <!-- Allows the example to be run via 'mvn compile exec:java' -->
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>exec-maven-plugin</artifactId>
                                <version>1.4.0</version>
                                <configuration>
-                                       <mainClass>de.republlb.MainApp</mainClass>
+                                       <mainClass>de.republib.pinet.Client</mainClass>
                                        <includePluginDependencies>false</includePluginDependencies>
                                </configuration>
                        </plugin>
                                        <descriptorRefs>
                                                <descriptorRef>jar-with-dependencies</descriptorRef>
                                        </descriptorRefs>
+                                       <archive>
+                                               <manifest>
+                                                       <mainClass>de.republib.pinet.Client</mainClass>
+                                               </manifest>
+                                       </archive>
+                               </configuration>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-jar-plugin</artifactId>
+                               <configuration>
+                                       <archive>
+                                               <manifest>
+                                                       <addClasspath>true</addClasspath>
+                                                       <mainClass>de.republib.pinet.Client</mainClass>
+                                               </manifest>
+                                       </archive>
                                </configuration>
                        </plugin>
                        <plugin>
                                        </execution>
                                </executions>
                        </plugin>
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-release-plugin</artifactId>
+                               <version>2.5.3</version>
+                               <configuration>
+                                       <tagNameFormat>v@{project.version}</tagNameFormat>
+                               </configuration>
+                       </plugin>
                </plugins>
        </build>
        <reporting>
                                <artifactId>maven-project-info-reports-plugin</artifactId>
                                <version>2.8</version>
                        </plugin>
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <artifactId>cobertura-maven-plugin</artifactId>
+                               <version>2.7</version>
+                       </plugin>
                </plugins>
        </reporting>
 </project>
diff --git a/resources/jpinet.sh b/resources/jpinet.sh
new file mode 100755 (executable)
index 0000000..922a9af
--- /dev/null
@@ -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
+
+       
+       
+       
index 8ad69049bf7687de551d850714e02ed4e5f1e7a1..c25bd50cb3979d61b281cecc59aff3c0d91ee6cc 100644 (file)
@@ -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 <i>Variable</i>
+        */
+       VARIABLE,
 }
index 65db894b2c028a090f59b7eeacda3c0d49a3abcb..9d8364fab29077b72427a53cb44264eb16e36e89 100644 (file)
@@ -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), //
index bde06d52b65fa6a52dedd46708438f0541af7f32..c81c5b04ba8f76e4d784396c33c84e226d7e7dbd 100644 (file)
@@ -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
  *
  */
index 8a87ce6957901ad0fdaef4fd46ee58e4ab833159..0f98cd9ff1332ea99cdf0597e6909448201d239f 100644 (file)
@@ -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
 }
index 8ad89333c6d1e8c86d9da3b9dd18ab4629566a02..45c236b3f73fb19827edf74a0434646a28bf3d2c 100644 (file)
@@ -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 (file)
index 0000000..000aaad
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Provides classes for a scanner and/or a parser.
+ *
+ * <p>
+ * Scanner:<br>
+ * A tool to divide a text (source code) into tokens (syntactical element).
+ * </p>
+ *
+ * <p>
+ * Parser:<br>
+ * A tool to analyse a programming language.
+ * </p>
+ *
+ * @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 (file)
index 0000000..2ec94fb
--- /dev/null
@@ -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 (file)
index 0000000..004b2ec
--- /dev/null
@@ -0,0 +1,7 @@
+/**
+ * Utilities for IP communication, specially TCP.
+ *
+ * @author hm
+ *
+ */
+package de.republib.net;
\ No newline at end of file
index 5540bfbceb06a6f193d760762d36a10d4fb2bb7a..81b599233929edbd77ee1dd73d77b8dabe3c3827 100644 (file)
@@ -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 (file)
index 0000000..104ee66
--- /dev/null
@@ -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 (file)
index 0000000..86438d3
--- /dev/null
@@ -0,0 +1,7 @@
+/**
+ * Utilities only usable in the project pinet.
+ *
+ * @author hm
+ *
+ */
+package de.republib.pinet;
\ No newline at end of file
index 89933145171d9c03454ff4fcfa895376539428e2..11f955be12583dff48431a462b0d521ae4528753 100644 (file)
@@ -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);
 }
index 700ebfe8f13e28370833627badac8be21ef49bfb..fb78b5754b53aaa83eee6a55987e016ede2f8146 100644 (file)
@@ -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 <b>data width</b> can be defined between 1 and 8
+ * bytes per value.
+ *
  * @author hm
  *
  */
index c8bfa46dbd1947a75ca7fc59db6781886776c87c..e140a86572b256d4fb5eda90f2ca7e67377cbfc0 100644 (file)
@@ -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 (file)
index 0000000..0deeb7b
--- /dev/null
@@ -0,0 +1,7 @@
+/**
+ * Generally usable utility classes.
+ *
+ * @author hm
+ *
+ */
+package de.republib.util;
\ No newline at end of file