@@ -0,0 +1,2515 @@
+/*%0A * JaamSim Discrete Event Simulation%0A * Copyright (C) 2018 JaamSim Software Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.jaamsim.resourceObjects;%0A%0Aimport java.util.ArrayList;%0A%0Aimport com.jaamsim.Graphics.DisplayEntity;%0A%0Apublic interface ResourceProvider %7B%0A%0A%09/**%0A%09 * Tests whether the specified number of resource units are available to be assigned to the%0A%09 * specified entity.%0A%09 * @param n - number of resource units to seize%0A%09 * @param ent - entity that would seize the units%0A%09 * @return true if the units can be seized%0A%09 */%0A%09public boolean canSeize(int n, DisplayEntity ent);%0A%0A%09/**%0A%09 * Assigns the specified number of resource units to the specified entity.%0A%09 * @param n - number of resource units to assign%0A%09 * @param ent - entity seizing the units%0A%09 */%0A%09public void seize(int n, DisplayEntity ent);%0A%0A%09/**%0A%09 * Unassigns the specified number of resource units from the specified entity.%0A%09 * If the number of units assigned to the entity is less than the specified number to release,%0A%09 * then as many units are released as possible.%0A%09 * @param n - number of resource units to release%0A%09 * @param ent - entity releasing the units%0A%09 */%0A%09public void release(int n, DisplayEntity ent);%0A%0A%09/**%0A%09 * Returns a list of objects that can seize this resource for use by an entity.%0A%09 * @return users that can seize this resource%0A%09 */%0A%09public ArrayList%3CResourceUser%3E getUserList();%0A%0A%09/**%0A%09 * Returns whether the resource units are assigned to users strictly strictly on the basis of%0A%09 * priority and waiting time. If true and this entity is unable to seize the resource because%0A%09 * of other restrictions, then other entities with lower priority or shorter waiting time will%0A%09 * NOT be allowed to seize the resource. If false, the entities will be tested in the same%0A%09 * order of priority and waiting time, but the first entity that is able to seize the resource%0A%09 * will be allowed to do so.%0A%09 * @return true if resources are assigned in strict order%0A%09 */%0A%09public boolean isStrictOrder();%0A%0A%7D%0A

add ResourceProvider interface