/*
 * JaamSim Discrete Event Simulation
 * Copyright (C) 2018-2019 JaamSim Software Inc.
 *
 * 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 com.jaamsim.SubModels;

import com.jaamsim.Graphics.DisplayEntity;
import com.jaamsim.ProcessFlow.Linkable;

public class SubModelEnd extends DisplayEntity implements Linkable {

	public SubModelEnd() {}

	@Override
	public void addEntity(DisplayEntity ent) {
		// TODO Auto-generated method stub
	}

}

@@ -687,179 +687,1280 @@
 ort 
-com.jaamsim.Graphics.DisplayEntity;%0Aimport com.jaamsim.ProcessFlow.Linkable;%0A%0Apublic class SubModelEnd extends DisplayEntity implements Linkable %7B%0A%0A%09public SubModelEnd() %7B
+java.util.ArrayList;%0A%0Aimport com.jaamsim.EntityProviders.EntityProvInput;%0Aimport com.jaamsim.Graphics.DisplayEntity;%0Aimport com.jaamsim.Graphics.LinkDisplayable;%0Aimport com.jaamsim.Graphics.OverlayEntity;%0Aimport com.jaamsim.Graphics.TextBasics;%0Aimport com.jaamsim.ProcessFlow.Linkable;%0Aimport com.jaamsim.basicsim.Entity;%0Aimport com.jaamsim.input.Keyword;%0Aimport com.jaamsim.math.Vec3d;%0A%0Apublic class SubModelEnd extends DisplayEntity implements Linkable, LinkDisplayable %7B%0A%0A%09@Keyword(description = %22The next object, external to the sub-model, to which the processed %22%0A%09                     + %22entity is passed. %22%0A%09                     + %22If left blank, the entity is returned to the parent sub-model which %22%0A%09                     + %22directs it to the object specified by its NextComponent input.%22,%0A%09         exampleList = %7B%22Statistics1%22%7D)%0A%09protected final EntityProvInput%3CDisplayEntity%3E nextComponent;%0A%0A%09private CompoundEntity submodel;%0A%0A%09%7B%0A%09%09nextComponent = new EntityProvInput%3C%3E(DisplayEntity.class, %22NextComponent%22, KEY_INPUTS, null);%0A%09%09nextComponent.addInvalidClass(OverlayEntity.class);%0A%09%09nextComponent.addInvalidClass(TextBasics.class);%0A%09%09this.addInput(nextComponent);%0A%09%7D%0A%0A%09public SubModelEnd() %7B%7D%0A%0A%09public void setSubModel(CompoundEntity sub) %7B%0A%09%09submodel = sub;%0A%09
 %7D%0A%0A%09
@@ -2017,44 +2017,931 @@
 ) %7B%0A
+%0A
 %09%09// 
-TODO Auto-generated method stub
+If NextComponent is not specified, return the entity to the sub-model object%0A%09%09if (nextComponent.isDefault()) %7B%0A%09%09%09submodel.addReturnedEntity(ent);%0A%09%09%09return;%0A%09%09%7D%0A%0A%09%09// If NextComponent is specified, send the entity to that object%0A%09%09DisplayEntity nextComp = nextComponent.getValue().getNextEntity(getSimTime());%0A%09%09if (!(nextComp instanceof Linkable)) %7B%0A%09%09%09error(%22Object '%25s' returned by NextComponent does not accept an entity.%22, nextComp);%0A%09%09%7D%0A%09%09((Linkable)nextComp).addEntity(ent);%0A%09%7D%0A%0A%09// LinkDisplayable%0A%09@Override%0A%09public ArrayList%3CEntity%3E getDestinationEntities() %7B%0A%09%09return new ArrayList%3C%3E();%09%7D%0A%0A%09@Override%0A%09public ArrayList%3CEntity%3E getSourceEntities() %7B%0A%09%09return new ArrayList%3C%3E();%0A%09%7D%0A%0A%09@Override%0A%09public Vec3d getSourcePoint() %7B%0A%09%09return getGlobalPosition();%0A%09%7D%0A%09@Override%0A%09public Vec3d getSinkPoint() %7B%0A%09%09return getGlobalPosition();%0A%09%7D%0A%0A%09@Override%0A%09public double getRadius() %7B%0A%09%09return getSize().mag2()/2.0;
 %0A%09%7D%0A

add code for 'SubModelEnd' to SubModels