@@ -0,0 +1,1946 @@
+/*%0A * JaamSim Discrete Event Simulation%0A * Copyright (C) 2015 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.input;%0A%0Aimport java.util.ArrayList;%0A%0Aimport com.jaamsim.Graphics.DisplayEntity;%0A%0Apublic class KeywordInput extends Input%3CString%3E %7B%0A%09private DisplayEntity targetEntity;%0A%09private Input%3C?%3E targetInput;%0A%0A%09public KeywordInput(String key, String cat, String def) %7B%0A%09%09super(key, cat, def);%0A%09%09targetEntity = null;%0A%09%09targetInput = null;%0A%09%7D%0A%0A%09@Override%0A%09public void copyFrom(Input%3C?%3E in) %7B%0A%09%09super.copyFrom(in);%0A%09%09KeywordInput inp = (KeywordInput) in;%0A%09%09targetEntity = inp.targetEntity;%0A%09%09targetInput = inp.targetInput;%0A%09%7D%0A%0A%09@Override%0A%09public void parse(KeywordIndex kw) throws InputErrorException %7B%0A%09%09Input.assertCount(kw, 2);%0A%09%09try %7B%0A%09%09%09DisplayEntity ent = Input.parseEntity(kw.getArg(0), DisplayEntity.class);%0A%0A%09%09%09String key = kw.getArg(1);%0A%09%09%09Input%3C?%3E in = ent.getInput(key);%0A%09%09%09if (in == null)%0A%09%09%09%09throw new InputErrorException(%22'%25s' is not a valid keyword for entity '%25s'%22, key, ent);%0A%0A%09%09%09value = key;%0A%09%09%09targetEntity = ent;%0A%09%09%09targetInput = in;%0A%09%09%7D%0A%09%09catch (InputErrorException e) %7B%0A%09%09%09throw new InputErrorException(e.getMessage());%0A%09%09%7D%0A%09%7D%0A%0A%09public Input%3C?%3E getTargetInput() %7B%0A%09%09return targetInput;%0A%09%7D%0A%0A%09public DisplayEntity getTargetEntity() %7B%0A%09%09return targetEntity;%0A%09%7D%0A%0A%09@Override%0A%09public void getValueTokens(ArrayList%3CString%3E toks) %7B%0A%09%09if (value == null) return;%0A%09%09toks.add(targetEntity.getName());%0A%09%09toks.add(value);%0A%09%7D%0A%0A%7D%0A

add input object to specify an Entity and Keyword