content: /**
   * Copyright 2020 Alexander Herzog
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package simulator.simparser.symbols;
  
  import simulator.coreelements.RunElementData;
  import simulator.simparser.coresymbols.CalcSymbolStationData;
  import statistics.StatisticsDataPerformanceIndicator;
  
  /**
   * Im Falle von einem Parameter:<br>
   * (a) Liefert die maximale Transferzeit der Kunden, deren Name an Quelle bzw. Namenszuweisung id (1. Parameter) auftritt (in Sekunden).<br>
   * (b) Liefert die maximale Transferzeit der Kunden an Station id (1. Parameter) (in Sekunden).<br>
   * Im Falle von keinem Parameter:<br>
   * Liefert die maximale Transferzeit ber alle Kunden (in Sekunden).
   * @author Alexander Herzog
   */
  public class CalcSymbolStationDataTransfer_max extends CalcSymbolStationData {
  	/**
  	 * Namen fr das Symbol
  	 * @see #getNames()
  	 */
  	private static final String[] names=new String[]{
  			"Transferzeit_max","Transferzeit_Maximum",
  			"TransferTime_max","TransferTime_Maximum"
  	};
  
  	/**
  	 * Konstruktor der Klasse
  	 */
  	public CalcSymbolStationDataTransfer_max() {
  		/*
  		 * Wird nur bentigt, um einen JavaDoc-Kommentar fr diesen (impliziten) Konstruktor
  		 * setzen zu knnen, damit der JavaDoc-Compiler keine Warnung mehr ausgibt.
  		 */
  	}
  
  	@Override
  	public String[] getNames() {
  		return names;
  	}
  
  	@Override
  	protected double calc(final RunElementData data) {
  		if (data.statisticTransfer==null) return 0;
  		return data.statisticTransfer.getMax();
  	}
  
  	@Override
  	protected boolean hasAllData() {
  		return true;
  	}
  
  	@Override
  	protected boolean hasSingleClientData() {
  		return true;
  	}
  
  	@Override
  	protected double calcAll() {
  		return getSimData().statistics.clientsAllTransferTimes.getMax();
  	}
  
  	@Override
  	protected double calcSingleClient(final String name) {
  		final StatisticsDataPerformanceIndicator indicator=getClientDataIndicator(name,getSimData().statistics.clientsTransferTimes);
  		return (indicator==null)?0.0:indicator.getMax();
  	}
  
  	@Override
  	protected boolean hasStationAndClientData() {
  		return true;
  	}
  
  	@Override
  	protected double calcStationClient(final RunElementData data, final int clientTypeIndex) {
  		if (data.statisticTransferByClientType==null || data.statisticTransferByClientType[clientTypeIndex]==null) return 0.0;
  		return data.statisticTransferByClientType[clientTypeIndex].getMax();
  	}
  }
  