Skip to content

Releases: averbraeck/djutils

djutils v2.1.4

16 Jan 02:16
Compare
Choose a tag to compare

Updates for djutils-stats project:

Handling initialize() a bit different in the EventBased statistics.

  • Make EventProducer to be null explicitly before end of constructor
  • Don't call initialize() again from constructor since there cannot be any listeners yet...
  • Reverse if(..) in initialize() method

Change newline character in reportHeader() methods

  • Use %n in String.format rather than \n for newline in reportHeader()
  • Adapt unit tests to deal with different newline character options using \R in line.split() to check for all newline characters.

Introduce a TallyStatistic class with the min() and max() methods

  • Many packages expect min() and max(), e.g., for BoxAndWhisker charts in dsol
  • Tally implements TallyStatistic
  • WeightedTally implements TallyStatistic

Make TimestampWeightedTally extend WeightedTally

  • Avoids embedding and code duplication
  • Added special structure to handle the timestamp type by casting to (T)
  • Added special method to avoid double value to be sent to WeightedTally but instead used the Number-based method

Initialization of statistics fields removed

  • This is done also in initialize(), and was therefore done twice
  • Since initialize() in a derived class is called BEFORE the initialization of its fields, field values would be reset, which is wrong...

TimeStampedWeightedTally reports the interval in the report() functions

  • Line length adapted
  • Extra field included in header and line

Unit tests expanded

  • Test coverage now ~ 100%
  • All tests use Try.testFail(..) instead of the long try - assert - fail - catch - do nothing structure
  • Explicitly testing Calendar-based events of the EventBasedTimestampWeightedTally class
  • Remote errors emulated and tested

Classes added to test for Remote error testing

  • RmiErrorEventListener
  • RmiErrorEventProducer

EventBased statistics use this.eventProducer to EXPLICITLY call the embedded event producer

  • Otherwise overridden methods will not be called

EventBasedWeightedTally does not check notify() preconditions

  • The metadata already takes care of this

EventBasedTimestampWeightedTally follows changes in TimestampedWeightedTally and EventBased statistics classes

  • Added special structure to handle the timestamp type by casting to (T)
  • Added special method to avoid double value to be sent to WeightedTally but instead used the Number-based method
  • EventBasedTimestampWeightedTally uses this.eventProducer to call the embedded event producer, otherwise overridden methods will not be called

djutils v2.1.3

15 Jan 16:36
Compare
Choose a tag to compare

Changes in djutils-stats project:

Resolved Issue #2.

The following changes were made to the Counter:

  • Got rid of the CounterInterface
  • Embedded EventProducer in EventBasedCounter
  • Made EventBasedCounter extend Counter
  • Created extra constructor in EventBasedCounter to include an EventProducer
  • Handled the RemoteException of the EventProducer
  • Updated toString() method of Counter
  • Adapted the unit tests to deal with new toString()
  • Counter throws NullPointerException when description is null
  • EventBasedCounter throws NullPointerException when eventProducer is null
  • protected fireEvents() method of EventBasedCounter now throws RemoteException
  • EventBasedCounter implementation needs special handling of initialize() to ensure that the eventProducer has been set

The following changes were made to the Tally:

  • Got rid of the BasicTallyInterface
  • Got rid of the TallyInterface
  • Embedded EventProducer in EventBasedTally
  • Made EventBasedTally extend Tally
  • Created 2 extra constructors in EventBasedTally to include an EventProducer
  • Handled the RemoteException of the EventProducer
  • Updated toString() method of EventBasedTally
  • Adapted the unit tests to deal with RemoteException
  • Tally throws NullPointerException when description or storageAccumulator is null
  • EventBasedTally throws NullPointerException when eventProducer is null
  • protected fireEvents() method of EventBasedTally now throws RemoteException
  • getXXX() methods in Tally no longer final
  • EventBasedTally implementation needs special handling of initialize() to ensure that the eventProducer has been set

The following changes were made to the (EventBased) WeightedTally:

  • Got rid of BasicTallyInterface
  • Got rid of WeightedTallyInterface
  • Embedded EventProducer in EventBasedWeightedTally
  • Made EventBasedWeightedTally extend WeightedTally
  • Created an extra constructor in EventBasedWeightedTally to include an EventProducer
  • Handled the RemoteException of the EventProducer
  • Updated toString() method of EventBasedWeightedTally
  • Adapted the unit tests to deal with RemoteException
  • WeightedTally throws NullPointerException when description is null
  • EventBasedWeightedTally throws NullPointerException when eventProducer is null
  • protected fireEvents() method of EventBasedWeightedTally now throws RemoteException
  • getXXX() methods in WeightedTally no longer final
  • EventBasedWeightedTally implementation needs special handling of initialize() to ensure that the eventProducer has been set

The following changes were made to the TimestampWeightedTally:

  • Got rid of BasicTallyInterface
  • Got rid of TimestampTallyInterface
  • Embedded EventProducer in EventBasedTimestampWeightedTally
  • Made EventBasedTimestampWeightedTally extend TimestampWeightedTally
  • Created an extra constructor in EventBasedWeightedTally to include an EventProducer
  • Handled the RemoteException of the EventProducer
  • Updated toString() method of EventBasedTimestampWeightedTally
  • Adapted the unit tests to deal with RemoteException
  • TimestampWeightedTally throws NullPointerException when description is null
  • EventBasedTimestampWeightedTally throws NullPointerException when eventProducer is null
  • protected fireEvents() method of EventBasedTimestampWeightedTally now throws RemoteException
  • getXXX() methods in TimestampWeightedTally no longer final
  • EventBasedTimestampWeightedTally implementation needs special handling of initialize() to ensure that the eventProducer has been set

Resolved Issue #3.

Analogous to the Python implementation, all statistics should be able to report the most important values in a monospaced textual table.
Three methods have been added for each statistics class:

  • reportHeader()
  • reportLine()
  • reportFooter()

djutils v2.1.2

04 Jan 00:22
Compare
Choose a tag to compare

Further enhanced the remote event producing and event listening capabilities of djutils to help the RmiEventProducer and RmiEventListener to work without issues.

djutils project, event package

  • New hashCode() and equals() implementation for Event and EventType
  • The EventListener and EventProducer interfaces are now Remote. Note that since Java 8u241, a not so well documented change has been made in Remote classes for RMI. See https://bugs.openjdk.org/browse/JDK-8237213: Only those methods specified in a "remote interface", an interface that DIRECTLY extends java.rmi.Remote are available remotely. This means that when the Remote interface is added in a sub-interface, methods are NOT available remotely. Repeating the method declaration in the interface that extends Remote will correctly indicate the method is a remote method. The base interface does not need to extend Remote if the method is re-declared in the Remote interface.
  • The EventProducer interface also implements all fireEvent() methods. This is to make it easier for classes implementing the EventProducer interface to immediately have all the publisher's behavior available. All methods throw RemoteException; the LocalEventProducer (which only needs to implement 1 real method now) wraps all methods with a try-catch, as no RemoteExceptions are to be expected from a LocalEventProducer. If such an Exception would happen, it wraps it in a RuntimeException.
  • The LocalEventProducer now extends the 'rich' EventProducer interface. All method implementations are embedded in the interface (addListener, removeListener, fireEvent, fireTimedEvent, etc.). The LocalEventProducer wraps these methods because it is not expected to throw a RemoteException.
  • The RmiEventProducer now extends the 'rich' EventProducer interface. All method implementations are embedded in the interface (addListener, removeListener, fireEvent, fireTimedEvent, etc.). Since all methods throw RemoteException, and the EventProducer interface extends Remote, the RmiEventProducer only has to implement a single method for the Event producing behavior.

djutils v2.1.1

02 Jan 16:52
Compare
Choose a tag to compare

Changes in djutils project, event package:

  • EventProducer implements RemoteException for all methods. This enables the usage of the EventProducer and EventListener as remote objects, where a remote EventListener can call addListener() on a remote EventProducer, and the EventProducer can call notify() on a remote EventListener.
  • The LocalEventProducer wraps all methods with RemoteException. Since it is a local (non-remote) class, no RemoteExceptions will be thrown. Therefore, the class wraps all methods and throws the RemoteException embedded in a RuntimeException.
  • The Event-producing collections now extend LocalEventProducer. This to avoid having to wrap all methods to avoid throwing RemoteExceptions for all methods. Of course, a more generic version that also acts as a remote event producing collection could be built as well.
  • The RmiObject can throw a RemoteException on the getRegistry() method.
  • The RmiEventProducer throws RemoteException on all methods.

These changes should make remote publish/subscribe through the event package more robust.

djutils v2.1.0

02 Jan 01:46
Compare
Choose a tag to compare

djutils project

  • Heavily simplified the event package; removed unnecessary abstract classes and interfaces; removed the sourceId from the Event and from the EventProducer (if needed, put it in the content payload of the event); renamed methods and classes.
  • Removed the AbstractEvent and the AbstractEventType.
  • Removed the EventInterface, and implemented code of EventInterface and AbstractEvent into Event.
  • Removed the EventTypeInterface, and implemented code of EventTypeInterface and AbstractEventType in EventType.
  • Removed the TimedEventInterface, and implemented TimedEvent as an Event with a timestamp.
  • Removed the TimedEventTypeInterface and the TimedEventType. Use EventType for all events. Events can be sent with or without a timestamp; the type of the event does not determine the use case.
  • As a result of the above, TimedEvent uses an EventType rather than TimedEventType, and EventType no longer contains the getValidEventClass() method
  • EventListenerInterface was renamed to EventListener.
  • Removed the IdProvider class, since sourceIds have been removed from this version.
  • Event can no longer have a null eventType.
  • TimedEvent checks on timestamp != null on construction.
  • Renamed EventProducer to LocalEventProducer, as opposed to RemoteEventProducer (which will be renamed to RmiEventProducer`).
  • Renamed EventProducerInterface to EventProducer. The interface exposes the essential methods for other objects: addListener and removeListener.
  • LocalEventProducer (the old 'EventProducer` class) is no longer abstract. It can be embedded in an event producing object as-is.
  • Moved several methods of LocalEventProducer as default methods to the EventProducer interface.
  • Removed all int / byte / float / double ... versions of fireEvent from the EventProducer Since primitive types are serializable, the method signature with Serializable was sufficient.
  • Removed return value of fireEvent.
  • Got rid of RemoteException in signatures of EventProducer; only the notify() method of the EventListener is a stub in case of remote events.
  • The EventProducing collections are updated with the new structure of EventProducer.
  • Removed the tagging interfaces for remote pub/sub.
  • Re-implemented Remote event producer / listener based on above changes.
  • Renamed RMIObject to RmiObject.
  • Renamed RMIUtils to RmiRegistry.
  • Renamed package org.djutils.event.remote to org.djutils.event.rmi.
  • Renamed RemoteEventListener to RmiEventListener (other remote implementations are possible as well).
  • Renamed RemoteEventProducer to RmiEventProducer (other remote implementations are possible as well).
  • RmiObject is no longer abstract to allow it to be embedded.
  • RmiEventProducer embeds RmiObject rather than LocalEventProducer.
  • Removal of sourceId from Event, TimedEvent, and EventProducer. If the source is important, make it part of the CONTENT of the event, instead of forcing it on the creation of each and every event... In hundreds of uses cases of the usage of the event, the sourceId has not been used in a single instance.
  • More clear name for package org.djutils.event.uti" -> org.djutils.event.collection.
  • Rename org.djutils.event.ref package to org.djutils.event.reference for clarity.
  • Unit tests adapted for changes in the event package.
  • All RMI-based unit tests use different port numbers to avoid problems with still open ports during the tests.
  • Renamed EventUtilTest to EventCollectionTest.

Note: These changes breaks backward compatibility!

djutils-draw project:

  • Added getPointList method to Drawable.
  • Added toPath2D method to PolyLine2d and Polygon2d.
  • Expanded test coverage to test getPointList and toPath2D methods.
  • More consistent handling of Cannot happen cases.
  • Improved surface computation code in Polygon2d.
  • All coordinates are translated to the median of the bounding box to improve precision in Polygon2d.
  • Added contains test for rectangular argument (Bounds2d) and test code for Polygon2d.
  • Changed definitions of disjoint and intersects for Bounds, Point and Polygon. As of this change, touching is a case of intersecting.
  • Removed (apparently) unreachable code from Polygon2d.
  • Added reverse method to LineSegment classes (with unit tests).
  • Added toPlot method to LineSegment2d

djutils-stats project:

  • Replaced event-based statistics with new Event and EventProducer implementation.
  • Removed the getSourceId() method for the event-based statistics.
  • Adapted the unit tests for the above changes.

Other changes

  • Adding UML diagrams with PlantUML, since ObjectAid has unfortunately been discontinued as an Eclipse plugin. PlantULM nicely works as standalone software, or as a plugin to most development environments, including Eclipse.

djutils v2.0.1

29 Aug 17:36
Compare
Choose a tag to compare

djutils version 2.0.1

  • documentation updated with correct links and Maven Central repo
  • ingest(...) method in djutils-stats renamed to register(...)
  • 'current' folder renamed to 'latest' folder in docs
  • DITTlab URL corrected; site.xml for djutils-parent reduced
  • configuring maven-changes-plugin correctly
  • site.vm in pom file left out -- default to standard site.vm
  • added tag -> false in maven-site-plugin
  • newest version of all dependencies; changed imports where necessary
  • remove module djutils-generato -- this module was only used to create one static table
  • site information in /src/site for all modules added
  • update gson to v2.9.0 b/c of vulnerability sonatype-2021-1694 aka CVE-2022-25647

djutils v2.0.0

27 Aug 19:53
Compare
Choose a tag to compare

djutils version 2.0.0

  • code moved from svn to git
  • code deployed via github actions
  • deployment on Maven Central prepared
  • documentation fully integrated in /dcos folder
  • all plugins in pom files updated to latest version
  • documentation in the readthedocs theme
  • documentation published on readthedocs
  • project fully structured as a modular project