/** * Get a property. * @param key The key. * @return The value. */ public List<Object> getPropertyList(String key) { return properties!=null? (List)properties.get(key): null; }
/** * Create a string representation of this filter. * * @return A string representing this filter. */ public String toString() { StringBuffer sb = new StringBuffer(); sb.append(SReflect.getInnerClassName(this.getClass())); sb.append("(values=["); if(values != null) { Object[] vkeys = values.getKeys(); for(int i = 0; i < vkeys.length; i++) { sb.append(vkeys[i] + " = " + values.get(vkeys[i])); if(i < vkeys.length - 1) { sb.append(", "); } } } sb.append("])"); return sb.toString(); }
/** * Get all locally stored information about a person. * @param name The person's name. * @return Future that contains the information. */ public Collection<InformationEntry> getInformation(String name) { Collection<InformationEntry> ret = infos.get(name); return ret!=null ? ret : Collections.EMPTY_LIST; }
/** * Get a property. * @param key The key. * @return The value. */ public List getPropertyList(String key) { return properties!=null? (List)properties.get(key): null; }
/** * Get children. */ public Object getChildren(Object key) { return children==null? null: children.get(key); }
/** * Get the values associated to a key as collection. * @param key The key. * @return The collection of associated values. */ public Collection<V> getCollection(Object key) { Collection<V> ret = get(key); if(ret==null) { ret = Collections.EMPTY_LIST; } return ret; }
/** * Get the argument injection fields. * @return The fields. */ public Tuple2<FieldInfo, String>[] getArgumentInjections(String name) { Collection col = argumentinjections==null? null: (Collection)argumentinjections.get(name); return col==null? new Tuple2[0]: (Tuple2<FieldInfo, String>[])col.toArray(new Tuple2[col.size()]); }
/** * Get the service injection fields. * @return The field or method infos. */ public ServiceInjectionInfo[] getServiceInjections(String name) { Collection<ServiceInjectionInfo> col = serviceinjections==null? null: serviceinjections.get(name); return col==null? new ServiceInjectionInfo[0]: (ServiceInjectionInfo[])col.toArray(new ServiceInjectionInfo[col.size()]); }
/** * Get a property from a (multi)map. * @param map The map. * @param name The name. * @return The property. */ public Object getProperty(String name) { Object ret = null; if(properties!=null) { Object tmp = properties.get(name); ret = (tmp instanceof List)? ((List)tmp).get(0): tmp; } return ret; }
/** * Get all world objects of a position. * @param pos The position. * @return All objects at the position. */ protected WorldObject[] getWorldObjects(Position pos) { Collection col = (Collection)pos_objects.get(pos); return col==null? new WorldObject[0]: (WorldObject[])col.toArray(new WorldObject[col.size()]); }
/** * Get the values as array. * @param type The component type of the array. * @return The array of values. */ public Object[] getObjects(Class<?> type) { Object ret = Array.newInstance(type, 0); for(Iterator<K> i=map.keySet().iterator(); i.hasNext(); ) { ret = SUtil.joinArrays(ret, get(i.next()).toArray()); } return (Object[])ret; }
/** * remove a percept processor. * @param componenttype The component type. * @param proc The percept processor. */ public void removePerceptProcessor(String componenttype, IPerceptProcessor proc) { synchronized(monitor) { List procs = (List)perceptprocessors.get(componenttype); for(int i=0; i<procs.size(); i++) { Object[] tmp = (Object[])procs.get(i); if(proc.equals(tmp[1])) { perceptprocessors.removeObject(componenttype, tmp); break; } } } }
/** * Refresh the result values. */ protected void refreshResults() { // Assert that all argument components are there. if(model==null || results==null || reselems==null) return; // Find results of specific instance. Map mres = null; int sel = selectavail.getSelectedIndex(); // System.out.println("Selected index: "+sel+selectavail.getSelectedItem().hashCode()); if(sel>0) { List rs = (List)resultsets.get(model.getFullName()); Object[] r = rs!=null && (sel-1)<rs.size() ? (Object[])rs.get(sel-1) : null; mres = r!=null ? (Map)r[1] : null; } for(int i=0; reselems!=null && i<reselems.size(); i++) { IArgument arg = ((IArgument)reselems.get(i)); // Object value = mres!=null? mres.get(arg.getName()): arg.getDefaultValue((String)config.getSelectedItem()); Object value = mres!=null? mres.get(arg.getName()): ""; JTextField valt = (JTextField)results.getComponent(i*4+3); valt.setText(""+value); } }
/** * Refresh the result values. */ protected void refreshResults() { // Assert that all argument components are there. if(model==null || results==null || reselems==null) return; // Find results of specific instance. Map mres = null; int sel = selectavail.getSelectedIndex(); // System.out.println("Selected index: "+sel+selectavail.getSelectedItem().hashCode()); if(sel>0) { List rs = (List)resultsets.get(model.getFullName()); Object[] r = rs!=null && (sel-1)<rs.size() ? (Object[])rs.get(sel-1) : null; mres = r!=null ? (Map)r[1] : null; } for(int i=0; reselems!=null && i<reselems.size(); i++) { IArgument arg = ((IArgument)reselems.get(i)); // Object value = mres!=null? mres.get(arg.getName()): arg.getDefaultValue((String)config.getSelectedItem()); Object value = mres!=null? mres.get(arg.getName()): ""; JTextField valt = (JTextField)results.getComponent(i*4+3); valt.setText(""+value); } }
public IFuture<Void> execute(IInternalAccess ia) { // Merge new output with last output, if not yet sent. boolean merged = false; ArrayList list = (ArrayList)occurred.get(event.getType()); if(list!=null && !list.isEmpty()) { String val = (String)list.get(list.size()-1); if(val.length()<LIMIT) { val += "\n"+event.getValue(); list.set(list.size()-1, val); merged = true; } } if(!merged) occurrenceAppeared(event.getType(), event.getValue()); return IFuture.DONE; } });
public IFuture<Void> execute(IInternalAccess ia) { // Merge new output with last output, if not yet sent. boolean merged = false; ArrayList list = (ArrayList)occurred.get(event.getType()); if(list!=null && !list.isEmpty()) { String val = (String)list.get(list.size()-1); if(val.length()<LIMIT) { val += "\n"+event.getValue(); list.set(list.size()-1, val); merged = true; } } if(!merged) occurrenceAppeared(event.getType(), event.getValue()); return IFuture.DONE; } });
Object[] vals = ((Collection)values.get(vkey)).toArray();
/** * Get the action types for a percept. * @param pt The percept type. */ protected Set<String> getActionTypes(PerceptType pt) { if(actiontypes==null) { actiontypes = new MultiCollection<String, String>(new HashMap(), HashSet.class); Object[] percepttypes = getPerceptTypes(); for(int i=0; i<percepttypes.length; i++) { String[] per = (String[])percepttypes[i]; for(int j=1; j<per.length; j++) { actiontypes.add(per[0], per[j]); } } } Set<String> ret = (Set<String>)actiontypes.get(pt.getName()); return ret==null? Collections.EMPTY_SET: ret; }
/** * Test if a position is free. * @return True, if a position is free. */ protected boolean isFree(Position pos) { boolean free = true; if(pos_objects.get(pos)!=null) { WorldObject[] wos = getWorldObjects(pos); for(int i=0; i<wos.length && free; i++) { if(wos[i].getPosition().equals(pos)) free = false; } } return free; }
if (newkey != Traverser.IGNORE_RESULT) Collection<Object> vals = map.get(key); for(Object val : vals)