/** * Create a new execution control. */ public SimulationService() { this.mode = MODE_NORMAL; this.startoninit = true; this.listeners = SCollection.createArrayList(); }
/** * Create a new players panel. */ public PlayersPanel() { players = SCollection.createArrayList(); }
/** * Create a new execution control. */ public SimulationService() { this.mode = MODE_NORMAL; this.startoninit = true; this.listeners = SCollection.createArrayList(); }
/** * Transform an array to a vector. * * @param a The array. * @return The vector for the array. */ public static <T> List<T> arrayToList(Object a) { ArrayList<T> ret = null; if(a!=null) { int l = Array.getLength(a); ret = SCollection.createArrayList(); for(int i = 0; i < l; i++) { ret.add((T)Array.get(a, i)); } } return ret; }
/** * Clone an index map. */ public Object clone() throws CloneNotSupportedException { IndexMap<K, V> ret = (IndexMap<K, V>) super.clone(); ArrayList<K> listcopy = SCollection.createArrayList(); listcopy.addAll(list); Map<K, V> mapcopy = SCollection.createHashMap(); mapcopy.putAll(map); ret.list = listcopy; ret.map = mapcopy; return ret; // return new IndexMap<K, V>(listcopy, mapcopy); }
/** * Create a new exponential price calculator. * @param startprice the start price * @param limitprice the minimal price for a successful auction * @param base The base for the exponential function. * @param variation The variation in percentage (0->1) for the increment. * The increment will be used to adapt the increment by multiplying * it with (+/-) a random value that has maximal the variation * percentage influence, e.g. setting 0.1 will cause the increment * being maximally +/-10% changed. * @param minstepwidth The minimum step width (a positive value that describes * the minimum price change in each round). */ public ExponentialPriceCalculator(double startprice, double limitprice, double base, double variation, double minstepwidth) { this.startprice = startprice; this.prices = SCollection.createArrayList(); this.prices.add(Double.valueOf(startprice)); this.limitprice = limitprice; this.base = base; this.variation = variation; this.minstepwidth = minstepwidth; if(minstepwidth<0) throw new IllegalArgumentException("Step width need to be > 0."); this.round = 1; this.increasing = limitprice > startprice; }
/** * Create a new linear price calculator. * @param startprice the start price * @param limitprice the minimal price for a successful auction * @param stepwidth The normal increment/decrement value. * @param variation The variation in percentage (0->1) for the increment. * The increment will be used to adapt the increment by multiplying * it with (+/-) a random value that has maximal the variation * percentage influence, e.g. setting 0.1 will cause the increment * being maximally +/-10% changed. */ public LinearPriceCalculator(double startprice, double limitprice, double stepwidth, double variation, double minstepwidth) { this.startprice = startprice; this.prices = SCollection.createArrayList(); this.prices.add(Double.valueOf(startprice)); this.limitprice = limitprice; this.stepwidth = stepwidth; this.variation = variation; this.minstepwidth = minstepwidth; if(stepwidth<0) throw new IllegalArgumentException("Step width need to be > 0."); this.round = 1; this.increasing = limitprice > startprice; }
/** * Create a new linear price calculator. * @param startprice the start price * @param limitprice the minimal price for a successful auction * @param stepwidth The normal increment/decrement value. * @param variation The variation in percentage (0->1) for the increment. * The increment will be used to adapt the increment by multiplying * it with (+/-) a random value that has maximal the variation * percentage influence, e.g. setting 0.1 will cause the increment * being maximally +/-10% changed. */ public LinearPriceCalculator(double startprice, double limitprice, double stepwidth, double variation, double minstepwidth) { this.startprice = startprice; this.prices = SCollection.createArrayList(); this.prices.add(Double.valueOf(startprice)); this.limitprice = limitprice; this.stepwidth = stepwidth; this.variation = variation; this.minstepwidth = minstepwidth; if(stepwidth<0) throw new IllegalArgumentException("Step width need to be > 0."); this.round = 1; this.increasing = limitprice > startprice; }
/** * Create a new exponential price calculator. * @param startprice the start price * @param limitprice the minimal price for a successful auction * @param base The base for the exponential function. * @param variation The variation in percentage (0->1) for the increment. * The increment will be used to adapt the increment by multiplying * it with (+/-) a random value that has maximal the variation * percentage influence, e.g. setting 0.1 will cause the increment * being maximally +/-10% changed. * @param minstepwidth The minimum step width (a positive value that describes * the minimum price change in each round). */ public ExponentialPriceCalculator(double startprice, double limitprice, double base, double variation, double minstepwidth) { this.startprice = startprice; this.prices = SCollection.createArrayList(); this.prices.add(Double.valueOf(startprice)); this.limitprice = limitprice; this.base = base; this.variation = variation; this.minstepwidth = minstepwidth; if(minstepwidth<0) throw new IllegalArgumentException("Step width need to be > 0."); this.round = 1; this.increasing = limitprice > startprice; }
/** * Get all contained capabilities. * @param state The state. * @param rcapa The start capability. * @return All contained subcapabilities. */ public static List getAllSubcapabilities(IOAVState state, Object rcapa) { // Fetch all capabilities. List capas = SCollection.createArrayList(); capas.add(rcapa); for(int i=0; i<capas.size(); i++) { Collection subcaps = state.getAttributeValues(capas.get(i), OAVBDIRuntimeModel.capability_has_subcapabilities); if(subcaps!=null) { for(Iterator it=subcaps.iterator(); it.hasNext(); ) { capas.add(state.getAttributeValue(it.next(), OAVBDIRuntimeModel.capabilityreference_has_capability)); } } } return capas; }
/** * Create a new execution control. */ public SimulationService(IInternalAccess access, Map properties) { super(access.getServiceContainer().getId(), ISimulationService.class, properties); this.access = access; this.mode = MODE_NORMAL; this.startoninit = true; this.listeners = SCollection.createArrayList(); }
/** * Get all popup actions (also from supertypes). * @return The popup actions. */ public Action[] getPopupActions() { Action[] all = (Action[])actions.toArray(new Action[actions.size()]); if(supertype!=null) { all = (Action[])SUtil.joinArrays(supertype.getPopupActions(), all); } List ret = SCollection.createArrayList(); for(int i=0; i<all.length; i++) { if(all[i].isEnabled()) { //System.out.println("Enabled: "+all[i]); ret.add(all[i]); } } return (Action[])ret.toArray(new Action[ret.size()]); }
/** * Create the arguments panel. */ protected void createArguments() { argelems = SCollection.createArrayList(); arguments.removeAll(); arguments.setBorder(null); if(model!=null) { IArgument[] args = model.getArguments(); for(int i=0; i<args.length; i++) { argelems.add(args[i]); createArgumentGui(args[i], i); } loadargs = null; if(args.length>0) arguments.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), " Arguments ")); } }
/** * Create the arguments panel. */ protected void createArguments() { argelems = SCollection.createArrayList(); arguments.removeAll(); arguments.setBorder(null); if(model!=null) { IArgument[] args = model.getArguments(); for(int i=0; i<args.length; i++) { argelems.add(args[i]); createArgumentGui(args[i], i); } loadargs = null; if(args.length>0) arguments.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), " Arguments ")); } }
public static void main(String[] args) throws InterruptedException { for(int i=1; i<5000; i++) { createArrayList(); createHashMap(); createHashSet(); createHashtable(); createIndexMap(); createVector(); Thread.sleep(10); } System.out.println("finished"); Thread.sleep(10000); System.exit(0); } }
errors = SCollection.createArrayList(); Tuple[] elements = getElements(); for(int i=0; i<elements.length; i++)
public void customResultAvailable(IResourceIdentifier rid) { java.util.List nodes = SCollection.createArrayList(); nodes.add(node); while(nodes.size()>0) { IFileNode n = (IFileNode)nodes.remove(0); if(n.isDirectory()) { for(int i=0; i<n.getChildCount(); i++) { nodes.add(n.getChild(i)); } } else { String model = n.getFilePath(); // tcpanel.getTestList().removeEntry(model); tcpanel.removeTest(model, rid); } } } });
errors = SCollection.createArrayList(); Tuple[] elements = getElements(); for(int i=0; i<elements.length; i++)
public void customResultAvailable(IResourceIdentifier rid) { java.util.List nodes = SCollection.createArrayList(); nodes.add(node); while(nodes.size()>0) { IFileNode n = (IFileNode)nodes.remove(0); if(n.isDirectory()) { for(int i=0; i<n.getChildCount(); i++) { nodes.add(n.getChild(i)); } } else { String model = n.getFilePath(); // tcpanel.getTestList().removeEntry(model); tcpanel.removeTest(model, rid); } } } });
this.agents = SCollection.createArrayList();