/** * Add a mapping from object type to data view * @param objecttype The object type. * @param view Settings for view creation. */ public void addDataViewMapping(String objecttype, Map view) { synchronized(monitor) { dataviewmappings.add(objecttype, view); } }
/** * Add an component listener. * The listener is registered for component changes. * @param comp The component to be listened on (or null for listening on all components). * @param listener The listener to be added. */ public IFuture<Void> addComponentListener(IComponentIdentifier comp, ICMSComponentListener listener) { listeners.add(comp, listener); return IFuture.DONE; }
/** * Internal put method, which doesn't affect the reverse collection. */ protected Object _add(Object key, Object value) { return super.add(key, value); }
/** * Add a percept processor. * @param componenttype The component type. * @param proc The percept processor. */ public void addPerceptProcessor(String componenttype, Set percepttypes, IPerceptProcessor proc) { synchronized(monitor) { perceptprocessors.add(componenttype, new Object[]{percepttypes, proc}); } }
/** * Add all elements of another map. * @param t The other map. */ public void addAll(Map<? extends K, ? extends V> t) { Iterator<? extends K> it = t.keySet().iterator(); while(it.hasNext()) { K key = it.next(); add(key, t.get(key)); } }
/** * Adds an avatar mapping. * @param componenttype The component type. * @param objecttype The object type to represent the component. */ public void addAvatarMappings(AvatarMapping mapping) { synchronized(monitor) { this.avatarmappings.add(mapping.getComponentType(), mapping); } }
/** * Add a new obstacle to the world. * @param obstacle The new obstacle. */ public void addObstacle(Obstacle obstacle) { this.obstacles.add(obstacle); this.world.add(obstacle.getLocation(), obstacle); }
/** * Add a property. * @param key The key. * @param value The value. */ public void addProperty(String key, Object value) { // System.out.println("addP: "+key+" "+value); if(properties==null) properties = new MultiCollection<String, Object>(); properties.add(key, value); }
/** * Add a new prey food to the world. * @param nfood The new food. */ public void addFood(Food nfood) { this.food.add(nfood); this.world.add(nfood.getLocation(), nfood); }
/** * An occurrence appeared. * @param type The occurrence type used as prefix for the event (e.g. use 'step' for 'step_occurred' events). * @param value The occurrence value (must be transferable). */ public void occurrenceAppeared(String type, Object value) { occurred.add(type, value); startTimer(); }
/** * Add a property. * @param key The key. * @param value The value. */ public void addProperty(String key, Object value) { if(properties==null) properties = new MultiCollection<String, Object>(); properties.add(key, value); }
/** * Add an injection field. * @param name The name. * @param field The field. */ public void addArgumentInjection(String name, FieldInfo field, String convert) { if(argumentinjections==null) argumentinjections = new MultiCollection<String, Tuple2<FieldInfo, String>>(); argumentinjections.add(name, new Tuple2<FieldInfo, String>(field, convert!=null && convert.length()==0? null: convert)); }
/** * Add an injection field. * @param name The name. * @param method The method. */ public void addServiceInjection(String name, MethodInfo method, boolean query) { if(serviceinjections==null) serviceinjections = new MultiCollection<String, ServiceInjectionInfo>(); serviceinjections.add(name, new ServiceInjectionInfo(method, query)); }
public void resultAvailable(IClockService cs) { infos.add(name, new InformationEntry(name, info, cs.getTime())); } });
/** * Add an injection field. * @param name The name. * @param field The field. */ public void addServiceInjection(String name, FieldInfo field, boolean lazy) { if(serviceinjections==null) serviceinjections = new MultiCollection<String, ServiceInjectionInfo>(); serviceinjections.add(name, new ServiceInjectionInfo(field, lazy)); }
/** * Add an injection method. * @param name The name. * @param method The method. */ public void addServiceInjection(String name, MethodInfo method) { if(serviceinjections==null) serviceinjections = new MultiCollection<String, ServiceInjectionInfo>(); serviceinjections.add(name, new ServiceInjectionInfo(method, false)); }
/** * Add a result listener to a task. * The result will be the task id. * If the task is already finished, the listener will be notified. */ public void addTaskListener(Object taskid, IResultListener listener) { synchronized(monitor) { if(tasks.containsKey(taskid)) { if(tasklisteners==null) tasklisteners = new MultiCollection<Object, IResultListener<?>>(); tasklisteners.add(taskid, listener); } else { listener.resultAvailable(taskid); } } }
/** * An element was added. * @param type The element type used as prefix for the event (e.g. use 'goal' for 'goal_added' events). * @param value The element value (must be transferable). */ public void elementAdded(String type, Object value) { if(!removed.containsKey(type) || !removed.getCollection(type).remove(value)) { if(changed.containsKey(type)) changed.getCollection(type).remove(value); added.add(type, value); } startTimer(); }
/** * An element was removed. * @param type The element type used as prefix for the event (e.g. use 'goal' for 'goal_removed' events). * @param value The element value (must be transferable). */ public void elementRemoved(String type, Object value) { if(!added.containsKey(type) || !added.getCollection(type).remove(value)) { if(changed.containsKey(type)) changed.getCollection(type).remove(value); removed.add(type, value); } startTimer(); }
public void report(String msg, String type, Object info, ILocation location) throws XMLStreamException { // System.out.println("XML error: "+msg+", "+type+", "+info+", "+location); // Thread.dumpStack(); IContext context = (IContext)(info instanceof IContext ? info : AReader.READ_CONTEXT.get()); Tuple stack = new Tuple(info instanceof StackElement[] ? (StackElement[])info : ((AReadContext)context).getStack()); Map user = (Map)context.getUserContext(); MultiCollection<Tuple, String> report = (MultiCollection<Tuple, String>)user.get(CONTEXT_ENTRIES); String pos; if(stack.getEntities().length>0) { StackElement se = (StackElement)stack.get(stack.getEntities().length-1); pos = " (line "+se.getLocation().getLineNumber()+", column "+se.getLocation().getColumnNumber()+")"; } else { pos = " (line 0, column 0)"; } report.add(stack, msg+pos); } });