diff --git a/.gitignore b/.gitignore index 13c4bbbe76eea9afc71901c7f3401d51af57e06f..517d009ffffa9402a5f262c51639742831ed1f6f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /src/gen-res /*.png uml.md +/public/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b7273249631a010ab56bd44d79f76949fb44168..c2ddedf9b67d3a23496fc24b0225c8a4f42ed449 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,6 @@ build: stage: build script: - ./gradlew --console=plain --no-daemon assemble - # - cp -a src/gen java_files/ artifacts: paths: - "src/gen" @@ -33,7 +32,6 @@ ragdoc_build: dependencies: - build script: - # - JAVA_FILES=$(find java_files/ -name '*.java') - JAVA_FILES=$(find src/ -name '*.java') - /ragdoc-builder/start-builder.sh -excludeGenerated -d data/ $JAVA_FILES artifacts: @@ -50,24 +48,24 @@ ragdoc_view: script: - DATA_DIR=$(pwd -P)/data - mkdir -p pages/_static/ragdoc - - OUTPUT_DIR=$(pwd -P)/pages/_static/ragdoc + - OUTPUT_DIR=$(pwd -P)/pages/docs/ragdoc - cd /ragdoc-view - ( cd src/ && rm -rf data && ln -s $DATA_DIR ) - /ragdoc-view/build-view.sh --output-path=$OUTPUT_DIR - ls -lah $OUTPUT_DIR artifacts: paths: - - "pages/_static/ragdoc" + - "pages/docs/ragdoc" pages: - image: python:3.7-alpine + image: python:3.10.0-bullseye stage: publish dependencies: - ragdoc_view before_script: - - pip install -U sphinx sphinx-rtd-theme recommonmark sphinxemoji sphinx-markdown-tables + - pip install -r pages/requirements.txt script: - - sphinx-build -b html pages/ public + - cd pages && mkdocs build artifacts: paths: - public diff --git a/build.gradle b/build.gradle index 89c113e43e0ec627f43e59f96000e088442cadcf..893de14e6cb3c258bbc13fb626c00fcb440af418 100644 --- a/build.gradle +++ b/build.gradle @@ -157,3 +157,6 @@ generateAst.dependsOn relastToJastAdd relastToJastAdd.dependsOn ragConnect // --- Misc --- +run { + standardInput = System.in +} diff --git a/pages/.gitignore b/pages/.gitignore deleted file mode 100644 index 41878fd586c3dd68f05ef1402c78f6bfc3eaa918..0000000000000000000000000000000000000000 --- a/pages/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/ragdoc-builder -/ragdoc-view -/_static/ -/public/ -/data/ diff --git a/pages/Makefile b/pages/Makefile deleted file mode 100644 index 7878ee5305af7d6c04860113aa9ef008991d07af..0000000000000000000000000000000000000000 --- a/pages/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# 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) diff --git a/pages/conf.py b/pages/conf.py deleted file mode 100644 index 586b1692fa3f67a2efb151789f8bed119fb9a501..0000000000000000000000000000000000000000 --- a/pages/conf.py +++ /dev/null @@ -1,52 +0,0 @@ -# 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'] diff --git a/pages/custom_theme/footer.html b/pages/custom_theme/footer.html new file mode 100644 index 0000000000000000000000000000000000000000..2d6c164695b3a1ed19711d3497caf142a8416ebb --- /dev/null +++ b/pages/custom_theme/footer.html @@ -0,0 +1,11 @@ +{% 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 %} diff --git a/pages/docs/automatic-incremental.md b/pages/docs/automatic-incremental.md new file mode 100644 index 0000000000000000000000000000000000000000..c277138b88100e685111f0f2475ff0efaaa90612 --- /dev/null +++ b/pages/docs/automatic-incremental.md @@ -0,0 +1,12 @@ +# 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. diff --git a/pages/docs/dependency-definition.md b/pages/docs/dependency-definition.md new file mode 100644 index 0000000000000000000000000000000000000000..5eb94b613f4b5599f777ba7a39c495d5bf4f925a --- /dev/null +++ b/pages/docs/dependency-definition.md @@ -0,0 +1,32 @@ +# 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. diff --git a/pages/docs/index.md b/pages/docs/index.md new file mode 100644 index 0000000000000000000000000000000000000000..d99c1a3918ba86f23027faebb165a4bad0e3005c --- /dev/null +++ b/pages/docs/index.md @@ -0,0 +1,9 @@ +# 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. diff --git a/pages/docs/simple-tree.md b/pages/docs/simple-tree.md new file mode 100644 index 0000000000000000000000000000000000000000..eb59beabc5486ff6e8ee48a8651e7d06390b8c7a --- /dev/null +++ b/pages/docs/simple-tree.md @@ -0,0 +1,19 @@ +# 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"`. diff --git a/pages/index.rst b/pages/index.rst deleted file mode 100644 index 7dd28b316480b13dd90b4e7f999ebeb45772aaa5..0000000000000000000000000000000000000000 --- a/pages/index.rst +++ /dev/null @@ -1,25 +0,0 @@ -.. 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` diff --git a/pages/make.bat b/pages/make.bat deleted file mode 100644 index c6abfba46443f5335943b13912c8d7b6d62ae644..0000000000000000000000000000000000000000 --- a/pages/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@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 diff --git a/pages/mkdocs.yml b/pages/mkdocs.yml new file mode 100644 index 0000000000000000000000000000000000000000..dfc306f3a2143bdfe71d1567d7ef9a1edee70dda --- /dev/null +++ b/pages/mkdocs.yml @@ -0,0 +1,28 @@ +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 diff --git a/pages/requirements.txt b/pages/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5ae2cc06eb26afe413c3bb61d067fb9f4d1db58 --- /dev/null +++ b/pages/requirements.txt @@ -0,0 +1,5 @@ +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 diff --git a/src/main/jastadd/MinimalModel.relast b/src/main/jastadd/MinimalModel.relast index b7288d4820b477f8bcc3d34e04dd07bdf8d2aca1..91de7769914e4d33a44a9582d128de2be35bbdf6 100644 --- a/src/main/jastadd/MinimalModel.relast +++ b/src/main/jastadd/MinimalModel.relast @@ -7,10 +7,10 @@ D ::= <ID:String> ; Nameable ::= <ID:int> ; SenderRoot : Nameable ::= <Input:int> /Alfa/ Bravo* Charlie* Delta* SenderSubTree ; -SenderSubTree : Nameable ::= Hotel* ; +SenderSubTree : Nameable ::= ; ReceiverRoot : Nameable ::= Alfa Bravo* Charlie* Delta* ReceiverSubTree ; -ReceiverSubTree : Nameable ::= Hotel* ; +ReceiverSubTree : Nameable ::= ; Alfa : Nameable ::= Echo* Foxtrot* Golf* ; @@ -20,7 +20,6 @@ Delta : Nameable ; Echo : Nameable ; Foxtrot : Nameable ; Golf : Nameable ; -Hotel : Nameable ; rel Alfa.MyBravo? -> Bravo ; rel Alfa.MultiBravo* -> Bravo ; @@ -32,9 +31,6 @@ rel Alfa.MyEcho -> Echo ; rel Alfa.MultiEcho* -> Echo ; rel Foxtrot.MyAlfa? -> Alfa ; rel Alfa.MidiGolf <-> Golf.MidiAlfa? ; -rel Alfa.MyHotel? -> Hotel ; -rel Alfa.MultiHotel* -> Hotel ; rel Alfa.Myself -> Alfa ; rel Echo.MyFoxtrot? -> Foxtrot ; -rel Foxtrot.MyHotel? -> Hotel ; diff --git a/src/main/java/de/tudresden/inf/st/mrc/MinimalMain.java b/src/main/java/de/tudresden/inf/st/mrc/MinimalMain.java index cba699bad393333be0d50adec3ffcb7850f81548..bc3e14b03e0364537620156a9711d081a07095e6 100644 --- a/src/main/java/de/tudresden/inf/st/mrc/MinimalMain.java +++ b/src/main/java/de/tudresden/inf/st/mrc/MinimalMain.java @@ -5,12 +5,11 @@ import de.tudresden.inf.st.mrc.ast.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.file.Paths; import java.time.Instant; -import java.util.ArrayList; import java.util.List; +import java.util.Scanner; import java.util.function.Function; import java.util.stream.Collectors; @@ -64,19 +63,59 @@ public class MinimalMain { logger.fatal("MQTT broker on localhost not available. Exiting!"); return; } - publisher.publish("---", ("Start at " + Instant.now()).getBytes()); -// mainIncremental(); -// mainSimpleTree(); - mainRelationalTree(); + System.out.println("Choose scenario:"); + 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(); + break; + default: + System.err.println("Invalid input, please restart."); + } } - private static void mainIncremental() throws Exception { - // byte[] -> bool: input[0] == (byte) 1; - // bool -> byte[]: java.nio.ByteBuffer.allocate(1).put((byte) 1).array(); + private static void mainSimpleTree() throws IOException { + System.out.println("== Starting 'Simple Tree Demo' =="); + + 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; @@ -85,7 +124,10 @@ public class MinimalMain { B b1 = normalA.getB(0); 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 // normalA.addDependencyA(normalA); // // b1.OutputOnB -> a.Input @@ -100,6 +142,7 @@ public class MinimalMain { A aWithNoDependency = addNewA(false); // enableTracing(aWithNoDependency); + root.addA(aWithNoDependency); aWithNoDependency.connectInput(TOPIC_URI_FOR_INPUT); aWithNoDependency.connectOutputOnA("mqtt://localhost/aNoDep/out", true); @@ -152,11 +195,6 @@ public class MinimalMain { describedWait(1, "Publish 101"); 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"); } @@ -183,60 +221,10 @@ public class MinimalMain { 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 { + 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"; Root root1ForSender = new Root(); @@ -278,7 +266,7 @@ public class MinimalMain { SenderRoot result = new SenderRoot(); SenderSubTree subTree = new SenderSubTree(); result.setSenderSubTree(subTree); - templateCreation(result::addBravo, result::addCharlie, result::addDelta, subTree::addHotel); + templateCreation(result::addBravo, result::addCharlie, result::addDelta); return result; } @@ -286,42 +274,34 @@ public class MinimalMain { ReceiverRoot result = new ReceiverRoot(); ReceiverSubTree subTree = new ReceiverSubTree(); result.setReceiverSubTree(subTree); - templateCreation(result::addBravo, result::addCharlie, result::addDelta, subTree::addHotel); + templateCreation(result::addBravo, result::addCharlie, result::addDelta); 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++) { addBravo.accept(new Bravo(i)); addCharlie.accept(new Charlie(i)); addDelta.accept(new Delta(i)); - addHotel.accept(new Hotel(i)); } } interface AddBravo { void accept(Bravo b); } interface AddCharlie { void accept(Charlie b); } interface AddDelta { void accept(Delta b); } - interface AddHotel { void accept(Hotel b); } private static void printAlfa(boolean isSender, SenderRoot senderRoot, ReceiverRoot receiverRoot) { final String name; final String tick; final Alfa alfa; - final Iterable<Delta> deltaList; - final Iterable<Hotel> hotelList; if (isSender) { name = "sender"; tick = " >-"; alfa = senderRoot.getAlfa(); - deltaList = senderRoot.getDeltaList(); - hotelList = senderRoot.getSenderSubTree().getHotelList(); } else { name = "receiver"; tick = " <-"; alfa = receiverRoot.getAlfa(); - deltaList = receiverRoot.getDeltaList(); - hotelList = receiverRoot.getReceiverSubTree().getHotelList(); } // also dump AST StringBuilder sb = new StringBuilder(); @@ -331,10 +311,6 @@ public class MinimalMain { logger.info("Checking Alfa\n" + "{}: {} in {}\n" + tick + " Myself: {}\n" + -// tick + " MyBravo: {}\n" + -// tick + " MultiBravoList: {}\n" + -// tick + " MidiDelta: {} (MidiDelta.getMidiAlfa(): {})\n" + -// tick + " DeltaList: {}\n" + tick + " MyEcho: {}\n" + tick + " EchoList.MyFoxtrot: {}\n" + tick + " MultiEchoList: {}\n" + @@ -342,36 +318,19 @@ public class MinimalMain { tick + " FoxtrotList.MyHotel: {}\n" + tick + " MidiGolf: {} (MidiGolf.getMidiAlfa(): {})\n" + tick + " GolfList (id -> alfa.id): {}\n" + -// tick + " MyHotel: {}\n" + -// tick + " MultiHotelList: {}\n" + -// tick + " HotelList: {}" + - "{}", // just to make swapping of params easier (all have a comma at the end) + "{}", // just to make swapping of params easier name, alfa, alfa.getParent(), nameAndHash(alfa.getMyself()), -// nameAndHash(alfa.getMyBravo()), -// printNameableList(alfa.getMultiBravoList()), -// nameAndHash(alfa.getMidiDelta()), alfa.getMidiDelta().getMidiAlfa(), -// printOptionalList(deltaList, Delta::hasMidiAlfa, Delta::getMidiAlfa), nameAndHash(alfa.getMyEcho()), printOptionalList(alfa.getEchoList(), Echo::hasMyFoxtrot, Echo::getMyFoxtrot), printNameableList(alfa.getMultiEchoList()), printOptionalList(alfa.getFoxtrotList(), Foxtrot::hasMyAlfa, Foxtrot::getMyAlfa), - printOptionalList(alfa.getFoxtrotList(), Foxtrot::hasMyHotel, Foxtrot::getMyHotel), nameAndHash(alfa.getMidiGolf()), nameAndHash(alfa.getMidiGolf().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) { return nameableList.stream().map(MinimalMain::nameAndHash).collect(Collectors.joining(",", "[", "]")); }