/** * Test if a key is contained in the map attribute. * @param object The identifier of the object. * @param attribute The attribute identifier. * @param key The key. * @return True if key is available. */ public boolean containsKey(Object object, OAVAttributeType attribute, Object key) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MAPS); assert object instanceof OAVExternalObjectId; Map theobject = getObject(object); Map map = (Map)theobject.get(attribute); return map==null? false: map.containsKey(key); }
/** * Test if a key is contained in the map attribute. * @param object The identifier of the object. * @param attribute The attribute identifier. * @param key The key. * @return True if key is available. */ public boolean containsKey(Object object, OAVAttributeType attribute, Object key) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MAPS); assert object instanceof OAVExternalObjectId; Map theobject = getObject(object); Map map = (Map)theobject.get(attribute); return map==null? false: map.containsKey(key); }
/** * Get the keys of an attribute of an object. * @param object The identifier of the object. * @param attribute The attribute identifier. * @return The keys for which values are stored. */ public Collection getAttributeKeys(Object object, OAVAttributeType attribute) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MAPS); assert nocheck || checkValidStateObject(object); assert object instanceof OAVExternalObjectId; Map theobject = getObject(object); Object ret = theobject.get(attribute); if(ret==null && !theobject.containsKey(attribute)) ret = attribute.getDefaultValue(); return ret!=null ? ((Map)ret).keySet(): Collections.emptySet(); }
/** * Get the keys of an attribute of an object. * @param object The identifier of the object. * @param attribute The attribute identifier. * @return The keys for which values are stored. */ public Collection getAttributeKeys(Object object, OAVAttributeType attribute) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MAPS); assert nocheck || checkValidStateObject(object); assert object instanceof OAVExternalObjectId; Map theobject = getObject(object); Object ret = theobject.get(attribute); if(ret==null && !theobject.containsKey(attribute)) ret = attribute.getDefaultValue(); return ret!=null ? ((Map)ret).keySet(): Collections.emptySet(); }
/** * Get an attribute value of an object. * @param object The identifier of the object. * @param attribute The attribute identifier. * @return The value (basic, object id or java object). */ public Object getAttributeValue(Object object, OAVAttributeType attribute) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.NONE); assert nocheck || checkValidStateObject(object); assert object instanceof OAVExternalObjectId: object; Map theobject = getObject(object); Object ret = theobject.get(attribute); if(ret==null && !theobject.containsKey(attribute)) ret = attribute.getDefaultValue(); if(ret instanceof Collection) throw new IllegalArgumentException("Attribute "+attribute+" is not single valued."); return ret; }
/** * Get an attribute value of an object. Method only applicable for * map attribute type. * @param object The identifier of the object. * @param attribute The attribute identifier. * @param key The key. * @return The value (basic, object id or java object). */ public Object getAttributeValue(Object object, OAVAttributeType attribute, Object key) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MAPS); assert nocheck || checkValidStateObject(object); assert object instanceof OAVExternalObjectId; Map theobject = getObject(object); Map map = (Map)theobject.get(attribute); // todo: enable check again by adding containsKey(key) method to state // if(map==null || !map.containsKey(key)) // throw new RuntimeException("Key not available in map: "+key+" "+map); Object ret = map==null? null: map.get(key); assert ret==null || ret instanceof OAVExternalObjectId; return ret; }
/** * Get the values of an attribute of an object. * @param object The identifier of the object. * @param attribute The attribute identifier. * @return The values (basic, object ids or java objects). */ public Collection getAttributeValues(Object object, OAVAttributeType attribute) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MULT); assert nocheck || checkValidStateObject(object); assert object instanceof OAVExternalObjectId; Map theobject = getObject(object); Object ret = theobject.get(attribute); if(ret==null && !theobject.containsKey(attribute)) ret = attribute.getDefaultValue(); return (ret instanceof Map)? ((Map)ret).values(): (Collection)ret; }
/** * Get the values of an attribute of an object. * @param object The identifier of the object. * @param attribute The attribute identifier. * @return The values (basic, object ids or java objects). */ public Collection getAttributeValues(Object object, OAVAttributeType attribute) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MULT); assert nocheck || checkValidStateObject(object); assert object instanceof OAVExternalObjectId; Map theobject = getObject(object); Object ret = theobject.get(attribute); if(ret==null && !theobject.containsKey(attribute)) ret = attribute.getDefaultValue(); return (ret instanceof Map)? ((Map)ret).values(): (Collection)ret; }
/** * Get an attribute value of an object. * @param object The identifier of the object. * @param attribute The attribute identifier. * @return The value (basic, object id or java object). */ public Object getAttributeValue(Object object, OAVAttributeType attribute) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.NONE); assert nocheck || checkValidStateObject(object); assert object instanceof OAVExternalObjectId: object; Map theobject = getObject(object); Object ret = theobject.get(attribute); if(ret==null && !theobject.containsKey(attribute)) ret = attribute.getDefaultValue(); if(ret instanceof Collection) throw new IllegalArgumentException("Attribute "+attribute+" is not single valued."); return ret; }
/** * Get an attribute value of an object. Method only applicable for * map attribute type. * @param object The identifier of the object. * @param attribute The attribute identifier. * @param key The key. * @return The value (basic, object id or java object). */ public Object getAttributeValue(Object object, OAVAttributeType attribute, Object key) { assert nocheck || checkTypeHasAttribute(object, attribute); assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MAPS); assert nocheck || checkValidStateObject(object); assert object instanceof OAVExternalObjectId; Map theobject = getObject(object); Map map = (Map)theobject.get(attribute); // todo: enable check again by adding containsKey(key) method to state // if(map==null || !map.containsKey(key)) // throw new RuntimeException("Key not available in map: "+key+" "+map); Object ret = map==null? null: map.get(key); assert ret==null || ret instanceof OAVExternalObjectId; return ret; }
assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MULT); assert nocheck || checkValueCompatibility(object, attribute, value); assert nocheck || checkValidStateObject(object);
assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MULT); assert nocheck || checkValueCompatibility(object, attribute, value); assert nocheck || checkValidStateObject(object);
assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MULT); assert nocheck || checkValidStateObject(object);
assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.MULTIPLICITIES_MULT); assert nocheck || checkValidStateObject(object);
assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.NONE); assert nocheck || checkValueCompatibility(object, attribute, value); assert nocheck || checkValidStateObject(object): object+" "+attribute+" "+value;
assert nocheck || checkMultiplicity(object, attribute, OAVAttributeType.NONE); assert nocheck || checkValueCompatibility(object, attribute, value); assert nocheck || checkValidStateObject(object): object+" "+attribute+" "+value;