Skip to content
Snippets Groups Projects
Commit 44b89700 authored by René Schöne's avatar René Schöne
Browse files

pages + demos

- add switch to launch the three demos
- switch to mkdocs for pages
- add documentation for all three demos
parent 18597fcb
No related branches found
No related tags found
No related merge requests found
Pipeline #14215 passed
...@@ -10,3 +10,4 @@ ...@@ -10,3 +10,4 @@
/src/gen-res /src/gen-res
/*.png /*.png
uml.md uml.md
/public/
...@@ -20,7 +20,6 @@ build: ...@@ -20,7 +20,6 @@ build:
stage: build stage: build
script: script:
- ./gradlew --console=plain --no-daemon assemble - ./gradlew --console=plain --no-daemon assemble
# - cp -a src/gen java_files/
artifacts: artifacts:
paths: paths:
- "src/gen" - "src/gen"
...@@ -33,7 +32,6 @@ ragdoc_build: ...@@ -33,7 +32,6 @@ ragdoc_build:
dependencies: dependencies:
- build - build
script: script:
# - JAVA_FILES=$(find java_files/ -name '*.java')
- JAVA_FILES=$(find src/ -name '*.java') - JAVA_FILES=$(find src/ -name '*.java')
- /ragdoc-builder/start-builder.sh -excludeGenerated -d data/ $JAVA_FILES - /ragdoc-builder/start-builder.sh -excludeGenerated -d data/ $JAVA_FILES
artifacts: artifacts:
...@@ -50,24 +48,24 @@ ragdoc_view: ...@@ -50,24 +48,24 @@ ragdoc_view:
script: script:
- DATA_DIR=$(pwd -P)/data - DATA_DIR=$(pwd -P)/data
- mkdir -p pages/_static/ragdoc - mkdir -p pages/_static/ragdoc
- OUTPUT_DIR=$(pwd -P)/pages/_static/ragdoc - OUTPUT_DIR=$(pwd -P)/pages/docs/ragdoc
- cd /ragdoc-view - cd /ragdoc-view
- ( cd src/ && rm -rf data && ln -s $DATA_DIR ) - ( cd src/ && rm -rf data && ln -s $DATA_DIR )
- /ragdoc-view/build-view.sh --output-path=$OUTPUT_DIR - /ragdoc-view/build-view.sh --output-path=$OUTPUT_DIR
- ls -lah $OUTPUT_DIR - ls -lah $OUTPUT_DIR
artifacts: artifacts:
paths: paths:
- "pages/_static/ragdoc" - "pages/docs/ragdoc"
pages: pages:
image: python:3.7-alpine image: python:3.10.0-bullseye
stage: publish stage: publish
dependencies: dependencies:
- ragdoc_view - ragdoc_view
before_script: before_script:
- pip install -U sphinx sphinx-rtd-theme recommonmark sphinxemoji sphinx-markdown-tables - pip install -r pages/requirements.txt
script: script:
- sphinx-build -b html pages/ public - cd pages && mkdocs build
artifacts: artifacts:
paths: paths:
- public - public
...@@ -157,3 +157,6 @@ generateAst.dependsOn relastToJastAdd ...@@ -157,3 +157,6 @@ generateAst.dependsOn relastToJastAdd
relastToJastAdd.dependsOn ragConnect relastToJastAdd.dependsOn ragConnect
// --- Misc --- // --- Misc ---
run {
standardInput = System.in
}
/ragdoc-builder
/ragdoc-view
/_static/
/public/
/data/
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = public
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'Minimal RagConnect Example'
copyright = '2021, René Schöne, Sebastian Ebert'
author = 'René Schöne, Sebastian Ebert'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
{% block footer %}
<p>{% if config.copyright %}
<small>{{ config.copyright }}<br></small>
{% endif %}
<hr>
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
{% if page and page.meta and page.meta.git_revision_date_localized %}
<small><br><i>Last updated {{ page.meta.git_revision_date_localized }}</i></small>
{% endif %}
</p>
{% endblock %}
# Automatic Incremental Demo
This demonstration shows receiving and send of a complete subtree (of a type named `Alfa`).
The subtree has various children and relations within the subtree.
There are two separate trees ("sender" and "receiver").
The sender has a token "Input" which the subtree that is sent depends on.
That means, whenever this token is changed, a new subtree is calculated and sent out.
When running, three visualizations will be generated, one for the initial state (`00-initial-*.png`), one after setting the Input to "1" (`01-after-1-*.png`), and a last setting Input to "2" (`02-after-2-*.png`).
They show sender and receiver, respectively.
Furthermore, the console output also show sender and receiver.
# Dependency Definition Demo
This demo requires some setup in order to showcase its use case - the dependency definitions.
As all demos are based on the same code base, those changes have to be done manually.
First disable incremental evaluation by commenting out parameters for incremental evaluation (lines 76 and 143 in `build.gradle`):
```
'--incremental=param,debug',
"--incremental=param,debug",
```
Then comment in the dependency definitions in the connect specification (lines 15-17 in `src/main/jastadd/MinimalModel.connect`) to look like:
```
A.OutputOnA canDependOn A.Input as dependencyA ;
B.OutputOnB canDependOn A.Input as dependencyB ;
C.OutputOnC canDependOn A.Input as dependencyC ;
```
And finally comment in the usage of dependency definitions in the main class (lines 133-138 in `src/main/java/de/tudresden/inf/st/mrc/MinimalMain.java`) to look like:
```
// a.OutputOnA -> a.Input
normalA.addDependencyA(normalA);
// b1.OutputOnB -> a.Input
b1.addDependencyB(normalA);
// b2.OutputOnB -> a.Input
b2.addDependencyB(normalA);
```
The demonstration will show, how dependency definitions can be used in case incremental evaluation is not used.
# RagConnect Minimal Example
This repository is used to show three examples using [RagConnect](https://jastadd.pages.st.inf.tu-dresden.de/ragconnect/).
All examples can be run without prior knowledge of RagConnect or Attribute Grammars, but you are encouraged to change inputs (grammar, attributes, connect specifications), recompile and observe the resulting changes.
All three demos require a running MQTT broker on your machine (the application will abort if no connection is possible).
We recommend [mosquitto](https://mosquitto.org/) as it is easy to set up.
To visualize the complete grammar, the gradle task `grammar2uml` can be used, which produces the file `uml.png` containing the visualization.
# Simple Tree Demo
This demonstration is an interactive demo.
It requires you to publish messages by hand. This can be achieved by using e.g. [mqtt-spy](https://kamilfb.github.io/mqtt-spy/) or the command line tools from mosquitto (`mosquitto_pub`).
The demo creates a tiny AST of the form:
```
Root
|- A
|- Input:String
|- B
|- (computed) OutputOnB:String
```
The "Input" token is connected to MQTT topic `input`, i.e., whenever a new message is received on that topic, the content of the message is written into that token.
Everytime the Input token is updated, the computed property "OutputOnB" is recalculated.
Then its content is to be sent to topic `output`, but only after applying a (simple) transformation appending `"postfix"`.
.. Minimal RagConnect Example documentation master file, created by
sphinx-quickstart on Wed Jan 27 17:59:48 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Minimal RagConnect Example's documentation!
======================================================
.. toctree::
:maxdepth: 2
:caption: Contents:
.. .. raw:: html
.. :file: _static/ragdoc.html
some text
documentation at `ragdoc <_static/ragdoc/index.html>`_
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=public
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd
site_name: RagConnect Minimal Example
repo_url: https://git-st.inf.tu-dresden.de/jastadd/ragconnect-minimal
site_dir: ../public
nav:
- "Home": index.md
- "1. Simple Tree": simple-tree.md
- "2. Dependency Definition Demo": dependency-definition.md
- "3. Automatic Incremental Demo": automatic-incremental.md
- "API documentation": ragdoc/index.html
theme:
name: readthedocs
custom_dir: custom_theme/
markdown_extensions:
- toc:
permalink:
- admonition
plugins:
- search
- git-revision-date-localized:
type: datetime
timezone: Europe/Berlin
locale: en
fallback_to_build_date: True
- macros
mkdocs==1.2.2
mkdocs-git-revision-date-localized-plugin==0.10.3
mkdocs-macros-plugin==0.6.3
Jinja2==2.11.2
MarkupSafe==1.1.1
...@@ -7,10 +7,10 @@ D ::= <ID:String> ; ...@@ -7,10 +7,10 @@ D ::= <ID:String> ;
Nameable ::= <ID:int> ; Nameable ::= <ID:int> ;
SenderRoot : Nameable ::= <Input:int> /Alfa/ Bravo* Charlie* Delta* SenderSubTree ; SenderRoot : Nameable ::= <Input:int> /Alfa/ Bravo* Charlie* Delta* SenderSubTree ;
SenderSubTree : Nameable ::= Hotel* ; SenderSubTree : Nameable ::= ;
ReceiverRoot : Nameable ::= Alfa Bravo* Charlie* Delta* ReceiverSubTree ; ReceiverRoot : Nameable ::= Alfa Bravo* Charlie* Delta* ReceiverSubTree ;
ReceiverSubTree : Nameable ::= Hotel* ; ReceiverSubTree : Nameable ::= ;
Alfa : Nameable ::= Echo* Foxtrot* Golf* ; Alfa : Nameable ::= Echo* Foxtrot* Golf* ;
...@@ -20,7 +20,6 @@ Delta : Nameable ; ...@@ -20,7 +20,6 @@ Delta : Nameable ;
Echo : Nameable ; Echo : Nameable ;
Foxtrot : Nameable ; Foxtrot : Nameable ;
Golf : Nameable ; Golf : Nameable ;
Hotel : Nameable ;
rel Alfa.MyBravo? -> Bravo ; rel Alfa.MyBravo? -> Bravo ;
rel Alfa.MultiBravo* -> Bravo ; rel Alfa.MultiBravo* -> Bravo ;
...@@ -32,9 +31,6 @@ rel Alfa.MyEcho -> Echo ; ...@@ -32,9 +31,6 @@ rel Alfa.MyEcho -> Echo ;
rel Alfa.MultiEcho* -> Echo ; rel Alfa.MultiEcho* -> Echo ;
rel Foxtrot.MyAlfa? -> Alfa ; rel Foxtrot.MyAlfa? -> Alfa ;
rel Alfa.MidiGolf <-> Golf.MidiAlfa? ; rel Alfa.MidiGolf <-> Golf.MidiAlfa? ;
rel Alfa.MyHotel? -> Hotel ;
rel Alfa.MultiHotel* -> Hotel ;
rel Alfa.Myself -> Alfa ; rel Alfa.Myself -> Alfa ;
rel Echo.MyFoxtrot? -> Foxtrot ; rel Echo.MyFoxtrot? -> Foxtrot ;
rel Foxtrot.MyHotel? -> Hotel ;
...@@ -5,12 +5,11 @@ import de.tudresden.inf.st.mrc.ast.*; ...@@ -5,12 +5,11 @@ import de.tudresden.inf.st.mrc.ast.*;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Scanner;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -64,19 +63,59 @@ public class MinimalMain { ...@@ -64,19 +63,59 @@ public class MinimalMain {
logger.fatal("MQTT broker on localhost not available. Exiting!"); logger.fatal("MQTT broker on localhost not available. Exiting!");
return; return;
} }
publisher.publish("---", ("Start at " + Instant.now()).getBytes()); publisher.publish("---", ("Start at " + Instant.now()).getBytes());
// mainIncremental(); System.out.println("Choose scenario:");
// mainSimpleTree(); System.out.println("1: Simple Tree Demo (Manually send MQTT message and observe output)");
System.out.println("2: Dependency Definition Demo (requires setup, primitive types)");
System.out.println("3: Automatic Incremental Demo (subtrees, with visualization of steps)");
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
switch (input) {
case "1":
mainSimpleTree();
break;
case "2":
mainIncremental();
break;
case "3":
mainRelationalTree(); mainRelationalTree();
break;
default:
System.err.println("Invalid input, please restart.");
}
} }
private static void mainIncremental() throws Exception { private static void mainSimpleTree() throws IOException {
// byte[] -> bool: input[0] == (byte) 1; System.out.println("== Starting 'Simple Tree Demo' ==");
// bool -> byte[]: java.nio.ByteBuffer.allocate(1).put((byte) 1).array();
String inTopic = "mqtt://localhost/input";
String outTopic = "mqtt://localhost/output";
Root root = new Root();
root.ragconnectSetupMqttWaitUntilReady(2, SECONDS);
A treeA = new A();
root.addA(treeA);
treeA.setInput("initial");
B treeB = new B();
treeA.addB(treeB);
treeA.connectInput(inTopic);
treeB.connectOutputOnB(outTopic, true);
System.out.println("Send inputs to MQTT topic '" + inTopic + "' and observe output on '" + outTopic + "'");
System.out.println("Exit with [Enter]");
Scanner scanner = new Scanner(System.in);
scanner.nextLine();
}
private static void mainIncremental() throws Exception {
System.out.println("== Starting 'Dependency Definition Demo (requires setup, primitive types)' ==");
boolean success; boolean success;
...@@ -85,7 +124,10 @@ public class MinimalMain { ...@@ -85,7 +124,10 @@ public class MinimalMain {
B b1 = normalA.getB(0); B b1 = normalA.getB(0);
B b2 = normalA.getB(1); B b2 = normalA.getB(1);
// dependency definitions not needed for incremental evaluation Root root = new Root();
root.addA(normalA);
// dependency definitions
// // a.OutputOnA -> a.Input // // a.OutputOnA -> a.Input
// normalA.addDependencyA(normalA); // normalA.addDependencyA(normalA);
// // b1.OutputOnB -> a.Input // // b1.OutputOnB -> a.Input
...@@ -100,6 +142,7 @@ public class MinimalMain { ...@@ -100,6 +142,7 @@ public class MinimalMain {
A aWithNoDependency = addNewA(false); A aWithNoDependency = addNewA(false);
// enableTracing(aWithNoDependency); // enableTracing(aWithNoDependency);
root.addA(aWithNoDependency);
aWithNoDependency.connectInput(TOPIC_URI_FOR_INPUT); aWithNoDependency.connectInput(TOPIC_URI_FOR_INPUT);
aWithNoDependency.connectOutputOnA("mqtt://localhost/aNoDep/out", true); aWithNoDependency.connectOutputOnA("mqtt://localhost/aNoDep/out", true);
...@@ -152,11 +195,6 @@ public class MinimalMain { ...@@ -152,11 +195,6 @@ public class MinimalMain {
describedWait(1, "Publish 101"); describedWait(1, "Publish 101");
publisher.publish(TOPIC_FOR_INPUT, "101".getBytes()); publisher.publish(TOPIC_FOR_INPUT, "101".getBytes());
// while (true) {}
// System.out.println("[Enter] to exit");
// Scanner scanner = new Scanner(System.in);
// scanner.nextLine();
// SECONDS.sleep(15);
describedWait(0, "End"); describedWait(0, "End");
} }
...@@ -183,60 +221,10 @@ public class MinimalMain { ...@@ -183,60 +221,10 @@ public class MinimalMain {
return result; return result;
} }
private static void testTree() throws IOException, SerializationException, DeserializationException {
A root = new A();
root.setInput("123");
java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream();
{
com.fasterxml.jackson.core.JsonFactory factory = new com.fasterxml.jackson.core.JsonFactory();
com.fasterxml.jackson.core.JsonGenerator generator = factory.createGenerator(outputStream, com.fasterxml.jackson.core.JsonEncoding.UTF8);
root.serialize(generator);
generator.flush();
}
String content = outputStream.toString();
System.out.println(content);
com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
com.fasterxml.jackson.core.JsonFactory factory = new com.fasterxml.jackson.core.JsonFactory();
com.fasterxml.jackson.core.JsonParser parser = factory.createParser(content);
A result = A.deserialize((com.fasterxml.jackson.databind.JsonNode)mapper.readTree(parser));
parser.close();
logger.info("result.getInput() = " + result.getInput());
logger.info("result.getD().getID() = " + result.getD().getID());
}
private static void mainSimpleTree() throws IOException, InterruptedException {
String uriString = "mqtt://localhost/normalA/d/out";
Root root = new Root();
root.ragconnectSetupMqttWaitUntilReady(2, SECONDS);
A sender = new A();
root.addA(sender);
sender.setInput("123");
A receiver = new A();
root.addA(receiver);
receiver.connectReading(uriString);
sender.connectOutputOnA("mqtt://localhost/normalA/out", true);
sender.connectD(uriString, true);
describedWait(1, "initial value");
logger.info("receiver.getReading().getID() = " + receiver.getReading().getID());
sender.getD().setID("abc");
describedWait(1, "after setID (does not work)");
logger.info("receiver.getReading().getID() = " + receiver.getReading().getID());
sender.setInput("def");
describedWait(1, "after setInput");
logger.info("receiver.getReading().getID() = " + receiver.getReading().getID());
}
private static void mainRelationalTree() throws IOException, InterruptedException { private static void mainRelationalTree() throws IOException, InterruptedException {
System.out.println("== Starting 'Automatic Incremental Demo (subtrees, with visualization of steps)' ==");
System.out.println("Find the generated images in the root of this repository");
final String mqttUriString = "mqtt://localhost/alfa"; final String mqttUriString = "mqtt://localhost/alfa";
Root root1ForSender = new Root(); Root root1ForSender = new Root();
...@@ -278,7 +266,7 @@ public class MinimalMain { ...@@ -278,7 +266,7 @@ public class MinimalMain {
SenderRoot result = new SenderRoot(); SenderRoot result = new SenderRoot();
SenderSubTree subTree = new SenderSubTree(); SenderSubTree subTree = new SenderSubTree();
result.setSenderSubTree(subTree); result.setSenderSubTree(subTree);
templateCreation(result::addBravo, result::addCharlie, result::addDelta, subTree::addHotel); templateCreation(result::addBravo, result::addCharlie, result::addDelta);
return result; return result;
} }
...@@ -286,42 +274,34 @@ public class MinimalMain { ...@@ -286,42 +274,34 @@ public class MinimalMain {
ReceiverRoot result = new ReceiverRoot(); ReceiverRoot result = new ReceiverRoot();
ReceiverSubTree subTree = new ReceiverSubTree(); ReceiverSubTree subTree = new ReceiverSubTree();
result.setReceiverSubTree(subTree); result.setReceiverSubTree(subTree);
templateCreation(result::addBravo, result::addCharlie, result::addDelta, subTree::addHotel); templateCreation(result::addBravo, result::addCharlie, result::addDelta);
return result; return result;
} }
private static void templateCreation(AddBravo addBravo, AddCharlie addCharlie, AddDelta addDelta, AddHotel addHotel) { private static void templateCreation(AddBravo addBravo, AddCharlie addCharlie, AddDelta addDelta) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
addBravo.accept(new Bravo(i)); addBravo.accept(new Bravo(i));
addCharlie.accept(new Charlie(i)); addCharlie.accept(new Charlie(i));
addDelta.accept(new Delta(i)); addDelta.accept(new Delta(i));
addHotel.accept(new Hotel(i));
} }
} }
interface AddBravo { void accept(Bravo b); } interface AddBravo { void accept(Bravo b); }
interface AddCharlie { void accept(Charlie b); } interface AddCharlie { void accept(Charlie b); }
interface AddDelta { void accept(Delta b); } interface AddDelta { void accept(Delta b); }
interface AddHotel { void accept(Hotel b); }
private static void printAlfa(boolean isSender, SenderRoot senderRoot, ReceiverRoot receiverRoot) { private static void printAlfa(boolean isSender, SenderRoot senderRoot, ReceiverRoot receiverRoot) {
final String name; final String name;
final String tick; final String tick;
final Alfa alfa; final Alfa alfa;
final Iterable<Delta> deltaList;
final Iterable<Hotel> hotelList;
if (isSender) { if (isSender) {
name = "sender"; name = "sender";
tick = " >-"; tick = " >-";
alfa = senderRoot.getAlfa(); alfa = senderRoot.getAlfa();
deltaList = senderRoot.getDeltaList();
hotelList = senderRoot.getSenderSubTree().getHotelList();
} else { } else {
name = "receiver"; name = "receiver";
tick = " <-"; tick = " <-";
alfa = receiverRoot.getAlfa(); alfa = receiverRoot.getAlfa();
deltaList = receiverRoot.getDeltaList();
hotelList = receiverRoot.getReceiverSubTree().getHotelList();
} }
// also dump AST // also dump AST
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -331,10 +311,6 @@ public class MinimalMain { ...@@ -331,10 +311,6 @@ public class MinimalMain {
logger.info("Checking Alfa\n" + logger.info("Checking Alfa\n" +
"{}: {} in {}\n" + "{}: {} in {}\n" +
tick + " Myself: {}\n" + tick + " Myself: {}\n" +
// tick + " MyBravo: {}\n" +
// tick + " MultiBravoList: {}\n" +
// tick + " MidiDelta: {} (MidiDelta.getMidiAlfa(): {})\n" +
// tick + " DeltaList: {}\n" +
tick + " MyEcho: {}\n" + tick + " MyEcho: {}\n" +
tick + " EchoList.MyFoxtrot: {}\n" + tick + " EchoList.MyFoxtrot: {}\n" +
tick + " MultiEchoList: {}\n" + tick + " MultiEchoList: {}\n" +
...@@ -342,36 +318,19 @@ public class MinimalMain { ...@@ -342,36 +318,19 @@ public class MinimalMain {
tick + " FoxtrotList.MyHotel: {}\n" + tick + " FoxtrotList.MyHotel: {}\n" +
tick + " MidiGolf: {} (MidiGolf.getMidiAlfa(): {})\n" + tick + " MidiGolf: {} (MidiGolf.getMidiAlfa(): {})\n" +
tick + " GolfList (id -> alfa.id): {}\n" + tick + " GolfList (id -> alfa.id): {}\n" +
// tick + " MyHotel: {}\n" + "{}", // just to make swapping of params easier
// tick + " MultiHotelList: {}\n" +
// tick + " HotelList: {}" +
"{}", // just to make swapping of params easier (all have a comma at the end)
name, alfa, alfa.getParent(), name, alfa, alfa.getParent(),
nameAndHash(alfa.getMyself()), nameAndHash(alfa.getMyself()),
// nameAndHash(alfa.getMyBravo()),
// printNameableList(alfa.getMultiBravoList()),
// nameAndHash(alfa.getMidiDelta()), alfa.getMidiDelta().getMidiAlfa(),
// printOptionalList(deltaList, Delta::hasMidiAlfa, Delta::getMidiAlfa),
nameAndHash(alfa.getMyEcho()), nameAndHash(alfa.getMyEcho()),
printOptionalList(alfa.getEchoList(), Echo::hasMyFoxtrot, Echo::getMyFoxtrot), printOptionalList(alfa.getEchoList(), Echo::hasMyFoxtrot, Echo::getMyFoxtrot),
printNameableList(alfa.getMultiEchoList()), printNameableList(alfa.getMultiEchoList()),
printOptionalList(alfa.getFoxtrotList(), Foxtrot::hasMyAlfa, Foxtrot::getMyAlfa), printOptionalList(alfa.getFoxtrotList(), Foxtrot::hasMyAlfa, Foxtrot::getMyAlfa),
printOptionalList(alfa.getFoxtrotList(), Foxtrot::hasMyHotel, Foxtrot::getMyHotel),
nameAndHash(alfa.getMidiGolf()), nameAndHash(alfa.getMidiGolf().getMidiAlfa()), nameAndHash(alfa.getMidiGolf()), nameAndHash(alfa.getMidiGolf().getMidiAlfa()),
printOptionalList(alfa.getGolfList(), Golf::hasMidiAlfa, Golf::getMidiAlfa), printOptionalList(alfa.getGolfList(), Golf::hasMidiAlfa, Golf::getMidiAlfa),
// nameAndHash(alfa.getMyHotel()),
// printNameableList(alfa.getMultiHotelList()),
// printNameableList(toList(hotelList)),
"" ""
); );
} }
private static List<? extends Nameable> toList(Iterable<Hotel> hotelList) {
List<Hotel> result = new ArrayList<>();
hotelList.forEach(result::add);
return result;
}
private static String printNameableList(List<? extends Nameable> nameableList) { private static String printNameableList(List<? extends Nameable> nameableList) {
return nameableList.stream().map(MinimalMain::nameAndHash).collect(Collectors.joining(",", "[", "]")); return nameableList.stream().map(MinimalMain::nameAndHash).collect(Collectors.joining(",", "[", "]"));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment