Skip to content

Commit

Permalink
Speed improvements on calculation station data symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Herzog committed Dec 15, 2023
1 parent 216b82d commit 5ee9720
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@ protected double calcStationClient(final RunElementData data, final int clientTy
*/
private int lastStationClientTypeClientIndex=-1;

/**
* Stations-ID beim letzten Aufruf von {@link #calc(double[])}
* @see #calc(double[])
* @see #lastStationData
*/
private double lastStationID=-1;

/**
* Stationsobjekt beim letzten Aufruf von {@link #calc(double[])}
* @see #calc(double[])
* @see #lastStationID
*/
private RunElementData lastStationData;

@Override
protected double calc(double[] parameters) throws MathCalcError {
if (getSimData()==null) throw error();
Expand All @@ -138,6 +152,9 @@ protected double calc(double[] parameters) throws MathCalcError {
if (parameters.length==0 && hasAllData()) return calcAll();

if (parameters.length==1) {
/* Station (wiederverwenden) */
if (parameters[0]==lastStationID) return calc(lastStationData);

/* Kundentyp */
if (hasSingleClientData()) {
final RunElement element=getRunElementForID(parameters[0]);
Expand All @@ -153,6 +170,8 @@ protected double calc(double[] parameters) throws MathCalcError {
/* Station */
final RunElementData stationData=getRunElementDataForID(parameters[0]);
if (stationData==null) return 0.0;
lastStationData=stationData;
lastStationID=parameters[0];
return calc(stationData);
}

Expand Down

0 comments on commit 5ee9720

Please sign in to comment.