@@ -0,0 +1,2044 @@
+/*%0A * JaamSim Discrete Event Simulation%0A * Copyright (C) 2013 Ausenco Engineering Canada Inc.%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A */%0Apackage com.jaamsim.BasicObjects;%0A%0Aimport com.sandwell.JavaSimulation.EntityInput;%0Aimport com.sandwell.JavaSimulation.InputErrorException;%0Aimport com.sandwell.JavaSimulation.IntegerInput;%0Aimport com.sandwell.JavaSimulation.Keyword;%0Aimport com.sandwell.JavaSimulation3D.DisplayEntity;%0A%0Apublic class Release extends LinkedComponent %7B%0A%0A%09@Keyword(description = %22The Resource to be released.%22,%0A%09         example = %22Release-1 Resource %7B Resource-1 %7D%22)%0A%09private final EntityInput%3CResource%3E resource;%0A%0A%09@Keyword(description = %22The number of resource units to release.%22,%0A%09         example = %22Release-1 NumberOfUnits %7B 2 %7D%22)%0A%09private final IntegerInput numberOfUnits;%0A%0A%09%7B%0A%09%09resource = new EntityInput%3CResource%3E(Resource.class, %22Resource%22, %22Key Inputs%22, null);%0A%09%09this.addInput( resource, true);%0A%0A%09%09numberOfUnits = new IntegerInput(%22NumberOfUnits%22, %22Key Inputs%22, 1);%0A%09%09this.addInput( numberOfUnits, true);%0A%09%7D%0A%0A%09@Override%0A%09public void validate() %7B%0A%09%09super.validate();%0A%0A%09%09// Confirm that the resource has been specified%0A%09%09if( resource.getValue() == null ) %7B%0A%09%09%09throw new InputErrorException( %22The keyword Resource must be set.%22 );%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Add a DisplayEntity from upstream%0A%09 * @param ent = entity to be added%0A%09 */%0A%09@Override%0A%09public void addDisplayEntity( DisplayEntity ent ) %7B%0A%09%09super.addDisplayEntity(ent);%0A%0A%09%09Resource res = resource.getValue();%0A%09%09int n = numberOfUnits.getValue();%0A%0A%09%09res.release(n);%0A%0A%0A%0A%09%09this.sendToNextComponent( ent );%0A%09%7D%0A%0A%7D%0A

Add the Release object