Releases: averbraeck/djutils
djutils v2.1.4
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 inreportHeader()
- 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()
andmax()
, e.g., forBoxAndWhisker
charts in dsol Tally
implementsTallyStatistic
WeightedTally
implementsTallyStatistic
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 theEventBasedTimestampWeightedTally
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
usesthis.eventProducer
to call the embedded event producer, otherwise overridden methods will not be called
djutils v2.1.3
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
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()
andequals()
implementation forEvent
andEventType
- The
EventListener
andEventProducer
interfaces are nowRemote
. 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 extendsjava.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 extendsRemote
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 theRemote
interface. - The
EventProducer
interface also implements allfireEvent()
methods. This is to make it easier for classes implementing theEventProducer
interface to immediately have all the publisher's behavior available. All methods throwRemoteException
; theLocalEventProducer
(which only needs to implement 1 real method now) wraps all methods with a try-catch, as noRemoteException
s are to be expected from aLocalEventProducer
. If such an Exception would happen, it wraps it in aRuntimeException
. - The
LocalEventProducer
now extends the 'rich'EventProducer
interface. All method implementations are embedded in the interface (addListener
,removeListener
,fireEvent
,fireTimedEvent
, etc.). TheLocalEventProducer
wraps these methods because it is not expected to throw aRemoteException
. - The
RmiEventProducer
now extends the 'rich'EventProducer
interface. All method implementations are embedded in the interface (addListener
,removeListener
,fireEvent
,fireTimedEvent
, etc.). Since all methods throwRemoteException
, and theEventProducer
interface extendsRemote
, theRmiEventProducer
only has to implement a single method for the Event producing behavior.
djutils v2.1.1
Changes in djutils project, event package:
EventProducer
implementsRemoteException
for all methods. This enables the usage of theEventProducer
andEventListener
as remote objects, where a remoteEventListener
can calladdListener()
on a remoteEventProducer
, and theEventProducer
can callnotify()
on a remoteEventListener
.- The
LocalEventProducer
wraps all methods withRemoteException
. Since it is a local (non-remote) class, noRemoteException
s will be thrown. Therefore, the class wraps all methods and throws theRemoteException
embedded in aRuntimeException
. - The Event-producing collections now extend
LocalEventProducer
. This to avoid having to wrap all methods to avoid throwingRemoteExceptions
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 aRemoteException
on thegetRegistry()
method. - The
RmiEventProducer
throwsRemoteException
on all methods.
These changes should make remote publish/subscribe through the event package more robust.
djutils v2.1.0
djutils project
- Heavily simplified the
event
package; removed unnecessary abstract classes and interfaces; removed thesourceId
from theEvent
and from theEventProducer
(if needed, put it in thecontent
payload of the event); renamed methods and classes. - Removed the
AbstractEvent
and theAbstractEventType
. - Removed the
EventInterface
, and implemented code ofEventInterface
andAbstractEvent
intoEvent
. - Removed the
EventTypeInterface
, and implemented code ofEventTypeInterface
andAbstractEventType
inEventType
. - Removed the
TimedEventInterface
, and implementedTimedEvent
as anEvent
with a timestamp. - Removed the
TimedEventTypeInterface
and theTimedEventType
. UseEventType
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 anEventType
rather thanTimedEventType
, andEventType
no longer contains thegetValidEventClass()
method EventListenerInterface
was renamed toEventListener
.- Removed the
IdProvider
class, since sourceIds have been removed from this version. Event
can no longer have a nulleventType
.TimedEvent
checks ontimestamp != null
on construction.- Renamed
EventProducer
toLocalEventProducer
, as opposed toRemoteEventProducer
(which will be renamed to RmiEventProducer`). - Renamed
EventProducerInterface
toEventProducer
. The interface exposes the essential methods for other objects:addListener
andremoveListener
. 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
asdefault
methods to theEventProducer
interface. - Removed all int / byte / float / double ... versions of
fireEvent
from theEventProducer
Since primitive types are serializable, the method signature withSerializable
was sufficient. - Removed return value of
fireEvent
. - Got rid of
RemoteException
in signatures ofEventProducer
; only thenotify()
method of theEventListener
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
toRmiObject
. - Renamed
RMIUtils
toRmiRegistry
. - Renamed package
org.djutils.event.remote
toorg.djutils.event.rmi
. - Renamed
RemoteEventListener
toRmiEventListener
(other remote implementations are possible as well). - Renamed
RemoteEventProducer
toRmiEventProducer
(other remote implementations are possible as well). RmiObject
is no longer abstract to allow it to be embedded.RmiEventProducer
embedsRmiObject
rather thanLocalEventProducer
.- Removal of
sourceId
fromEvent
,TimedEvent
, andEventProducer
. 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 toorg.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
toEventCollectionTest
.
Note: These changes breaks backward compatibility!
djutils-draw project:
- Added
getPointList
method toDrawable
. - Added
toPath2D
method toPolyLine2d
andPolygon2d
. - Expanded test coverage to test
getPointList
andtoPath2D
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 forPolygon2d
. - Changed definitions of disjoint and intersects for
Bounds
,Point
andPolygon
. 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 toLineSegment2d
djutils-stats project:
- Replaced event-based statistics with new
Event
andEventProducer
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
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
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