Please review any and all PUBLIC repositories, groups and associate files. These allow anyone on the Internet to access without authentication. Repository and group owners are responsible for their content and permission settings. Go to your project(s), click on Settings > General and expand the "Visibility, project features, permissions" to change this setting.

Commit 4b64bddb authored by tobia's avatar tobia

Initial move to NPS Gitlab

parent d4ca39c6
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Brennenstuhl" default="default" basedir=".">
<description>Builds, tests, and runs the project Brennenstuhl.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Brennenstuhl-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
This source diff could not be displayed because it is too large. You can view the blob instead.
build.xml.data.CRC32=2cdd87f6
build.xml.script.CRC32=9d412d19
build.xml.stylesheet.CRC32=f85dc8f2@1.93.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=2cdd87f6
nbproject/build-impl.xml.script.CRC32=08c29b05
nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.93.0.48
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Brennenstuhl.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/Brennenstuhl
excludes=
file.reference.commons-io-2.6.jar=C:\\NetBeans\\TobisThesisWork\\lib\\commons-io-2.6.jar
file.reference.dis-enums-1.3.jar=C:\\NetBeans\\TobisThesisWork\\lib\\dis-enums-1.3.jar
file.reference.guava-28.0-jre.jar=C:\\NetBeans\\TobisThesisWork\\lib\\guava-28.0-jre.jar
file.reference.Jama-1.0.3.jar=C:\\NetBeans\\TobisThesisWork\\lib\\Jama-1.0.3.jar
file.reference.open-dis7-entities-all.jar=C:\\NetBeans\\TobisThesisWork\\lib\\open-dis7-entities-all.jar
file.reference.open-dis7-java.jar=C:\\NetBeans\\TobisThesisWork\\lib\\open-dis7-java.jar
file.reference.open-dis7-javadoc.jar=C:\\NetBeans\\TobisThesisWork\\lib\\open-dis7-javadoc.jar
file.reference.open-dis7-source.jar=C:\\NetBeans\\TobisThesisWork\\lib\\open-dis7-source.jar
file.reference.open-dis7.jar=C:\\NetBeans\\TobisThesisWork\\lib\\open-dis7.jar
file.reference.open-dis_4.16.jar=C:\\NetBeans\\TobisThesisWork\\lib\\open-dis_4.16.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.Jama-1.0.3.jar}:\
${file.reference.commons-io-2.6.jar}:\
${file.reference.dis-enums-1.3.jar}:\
${file.reference.guava-28.0-jre.jar}:\
${file.reference.open-dis7-entities-all.jar}:\
${file.reference.open-dis7-java.jar}:\
${file.reference.open-dis7-javadoc.jar}:\
${file.reference.open-dis7-source.jar}:\
${file.reference.open-dis7.jar}:\
${file.reference.open-dis_4.16.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=14
javac.target=14
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
# The jlink additional root modules to resolve
jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=Brennenstuhl
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=true
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>Brennenstuhl</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package DISTools;
import static java.lang.Math.pow;
import static java.lang.Math.sqrt;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;
/**
*
* @author tobia
*/
public class Compressor {
private LinkedHashMap<Double, Coordinates> localMap;
public Compressor(LinkedHashMap<Double, Coordinates> localHashMap) {
//copy the given HashMap to a localMap
this.localMap = new LinkedHashMap<>();
Set<Double> keys = localHashMap.keySet();
for (Double k : keys) {
localMap.put(k, localHashMap.get(k));
}
System.out.println("DISTools.Regression.<init>()");
}
public TreeMap<Double, Coordinates> doCompression() {
System.out.println("DISTools.Regression.doRegression()");
//Check whether points could be deleted to compress the stream
//https://www.crashkurs-statistik.de/einfache-lineare-regression/
TreeMap<Double, Coordinates> streamMap = new TreeMap<>();
Set<Double> keys = localMap.keySet();
//Copy LinkedHashMap into TreeMap to be able to pull the first element.
streamMap.putAll(localMap);
TreeMap<Double, Coordinates> returnMap = new TreeMap<>();
//TreeMap of slidingWindows will store all of the points that are currently processed
//use .pullFirstEntry() to get rid of the points at the beginning.
TreeMap<Double, Coordinates> slidingWindow = new TreeMap<>();
boolean addToWindow = true;
while (streamMap.size() > 0) {
slidingWindow.put(streamMap.firstEntry().getKey(), streamMap.get(streamMap.firstEntry().getKey()));
streamMap.pollFirstEntry();
//Calculate the mean and SD
Set<Double> slidingWindowKeys = slidingWindow.keySet();
if (slidingWindow.size() >= 3) {
List<Double> tList = new ArrayList<>();
List<Double> xList = new ArrayList<>();
List<Double> yList = new ArrayList<>();
List<Double> zList = new ArrayList<>();
Double[] k = new Double[slidingWindowKeys.size()];
slidingWindowKeys.toArray(k);
for (int i = 0; i < slidingWindow.size(); i++) {
//Fix Loop to fill Arrays
tList.add(i, k[i]);
xList.add(i, slidingWindow.get(k[i]).getX());
yList.add(i, slidingWindow.get(k[i]).getY());
zList.add(i, slidingWindow.get(k[i]).getZ());
}
//calculate triangle according to the homepage
for (int i = 0; i < slidingWindow.size(); i++) {
//Calculate Area of Triangle
//http://www.ambrsoft.com/TrigoCalc/Line3D/LineColinear.htm
double a = sqrt(pow(xList.get(1) - xList.get(0), 2) + pow(yList.get(1) - yList.get(0), 2) + pow(zList.get(1) - zList.get(0), 2));
double b = sqrt(pow(xList.get(i) - xList.get(0), 2) + pow(yList.get(i) - yList.get(0), 2) + pow(zList.get(i) - zList.get(0), 2));
double c = sqrt(pow(xList.get(i) - xList.get(1), 2) + pow(yList.get(i) - yList.get(1), 2) + pow(zList.get(i) - zList.get(1), 2));
double s = (a + b + c) / 2;
double areaA = sqrt(s * (s - a) * (s - b) * (s - c));
if ((areaA >= 0.1) || (tList.get(i) - tList.get(0) >= 4.0)) {
System.out.println("Threshold met. Break");
//grab the first and the last point from the regression test and push it to the returnMap
Coordinates firstPoint = new Coordinates();
firstPoint.setX(xList.get(0));
firstPoint.setY(yList.get(0));
firstPoint.setZ(zList.get(0));
Coordinates lastPoint = new Coordinates(xList.get(i), yList.get(i), zList.get(i));
returnMap.put(tList.get(0), firstPoint);
returnMap.put(tList.get(i), lastPoint);
slidingWindow.clear();
tList.clear();
xList.clear();
yList.clear();
zList.clear();
break;
}
if ((areaA <= 0.1) && (tList.get(i) - tList.get(0) <= 4.0) && streamMap.size() == 0) {
System.out.println("StreamMap empty. All points left will be added. Break");
//grab the first and the last point from the regression test and push it to the returnMap
for (int j = 0; j < slidingWindow.size(); j++) {
Coordinates leftPoints = new Coordinates(xList.get(j), yList.get(j), zList.get(j));
returnMap.put(tList.get(j), leftPoints);
}
break;
}
System.out.println("Area of Triangle: " + areaA);
}
}
};
return returnMap;
}
;
private void calcValues() {
}
;
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package DISTools;
/**
*
* @author tobia
*/
public class Coordinates {
private double x;
private double y;
private double z;
public Coordinates(double x, double y, double z) {
this.setX(x);
this.setY(y);
this.setZ(z);
}
public Coordinates() {
this.setX(0.0);
this.setY(0.0);
this.setZ(0.0);
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public double getZ() {
return z;
}
public void setZ(double z) {
this.z = z;
}
}
package DISTools;
import java.io.*;
import java.net.*;
import java.util.*;
import edu.nps.moves.dis7.*;
import edu.nps.moves.dis7.util.*;
/**
* Receives PDUs from the network in IEEE DIS format.
* Adapted from OpenDIS library example package edu.nps.moves.examples
*
* @author DMcG
* @version $Id:$
*/
public class EspduReceiver
{
/** Max size of a PDU in binary format that we can receive. This is actually
* somewhat outdated--PDUs can be larger--but this is a reasonable starting point.
*/
public static final int MAX_PDU_SIZE = 8192;
/** Default multicast group address we send on. */
public String DEFAULT_MULTICAST_ADDRESS;
/** Default multicast port used, matches Wireshark DIS capture default */
public int DEFAULT_MULTICAST_PORT;
public String receive(String localBroadCastAddress, int localPort)
{
System.out.println("DisExamplesOpenDis7.EspduReceiver started...");
String returnString;
returnString = new String("Test Return Receiver \n");
this.DEFAULT_MULTICAST_ADDRESS = localBroadCastAddress;
this.DEFAULT_MULTICAST_PORT = localPort;
MulticastSocket socket;
DatagramPacket packet;
InetAddress address;
PduFactory pduFactory = new PduFactory();
try {
// Specify the socket to receive data
socket = new MulticastSocket(DEFAULT_MULTICAST_PORT);
// socket.setBroadcast(true);
address = InetAddress.getByName(DEFAULT_MULTICAST_ADDRESS);
socket.joinGroup(address);
byte buffer[] = new byte[MAX_PDU_SIZE];
packet = new DatagramPacket(buffer, buffer.length);
socket.receive(packet);
List<Pdu> pduBundle = pduFactory.getPdusFromBundle(packet.getData(),packet.getLength());
if (pduBundle.size() > 1)
System.out.println("Bundle size is " + pduBundle.size());
returnString += "Bundle size is "+ pduBundle.size();
Iterator iterator = pduBundle.iterator();
while (iterator.hasNext())
{
Pdu aPdu = (Pdu)iterator.next();
String receiptMessage = "received PDU type " + aPdu.getPduType().getValue() + "=" + aPdu.getPduType().name() + " " + aPdu.getClass().getName();
if (aPdu instanceof EntityStatePdu)
{
System.out.println("===============");
returnString += "===============\n";
System.out.println(receiptMessage);
returnString += receiptMessage + "\n";
EntityID entityID = ((EntityStatePdu)aPdu).getEntityID();
Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation();
System.out.println(" entityID triplet: [" + entityID.getSiteID()+ ", " + entityID.getApplicationID()+ ", " + entityID.getEntityID()+ "] ");
returnString += " entityID triplet: [" + entityID.getSiteID()+ ", " + entityID.getApplicationID()+ ", " + entityID.getEntityID()+ "] ";
System.out.println(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]\n");
returnString += " Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]\n";
}
else if (aPdu instanceof FirePdu)
{
System.out.println(receiptMessage);
returnString += receiptMessage + "\n";
Vector3Double position = ((FirePdu)aPdu).getLocationInWorldCoordinates();
System.out.println(" FirePdu locationInWorldCoordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]");
returnString += " FirePdu locationInWorldCoordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]\n";
}
else
{
System.out.println(receiptMessage);
returnString += receiptMessage + "\n";
}
} // end iterator loop through PDU bundle
} // end try block
catch (IOException e)
{
System.out.println("Problem with DisExamplesOpenDis7.EspduReceiver, see exception trace:");
returnString += "Problem with DisExamplesOpenDis7.EspduReceiver, see exception trace:\n";
System.out.println(e);
returnString += e + "\n";
}
System.out.println("DisExamplesOpenDis7.EspduReceiver complete.");
return returnString;
} // end main
} // end class
This diff is collapsed.
/**
* Copyright (c) 2008-2019, MOVES Institute, Naval Postgraduate School. All rights reserved.
* This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html
*/
package DISTools;
import java.io.IOException;
import java.util.Scanner;
/**
* PduSaver.java created on Aug 21, 2019
* MOVES Institute Naval Postgraduate School, Monterey, CA, USA www.nps.edu
*
* @author Mike Bailey, jmbailey@nps.edu
* @version $Id$
*/
public class PduListenerSaver
{
private final static String DEFAULT_OUTPUTDIR = "pduLog";
private final static String MCAST_ADDR = "239.1.2.3";
private final static int DIS_PORT = 3000;
private enum mystate
{
RUNNING,
PAUSED;
}
public static void main(String[] args)
{
String outDir = DEFAULT_OUTPUTDIR;
String mcast = MCAST_ADDR;
int port = DIS_PORT;
System.out.println("DisExamplesOpenDis7.PduListenerSaver started...");
switch (args.length) {
case 0:
break;
case 1:
outDir = args[0];
break;
case 3:
outDir = args[0];
mcast = args[1];
port = Integer.parseInt(args[2]);
break;
default:
System.err.println("Usage: PduListener() or PduListener(\"outputdir\") or PduListener(\"outputdir\",\"multicast address\", ipPort");
System.exit(1);
}
System.out.println("Beginning pdu save to directory " + outDir);
try {
//RecorderTobi stores an unencoded PduLog
RecorderTobi recorder = new RecorderTobi(outDir, mcast, port);
//Recorder stores a BASE64 encoded PduLod
//Recorder recorder = new Recorder(outDir, mcast, port);
recorder.startResume();
mystate state = mystate.RUNNING;
System.out.println("* recorder.startResume(),