/** * Test if a type is contained. * @param type The type. * @return True, if type is part of type model. */ public boolean contains(OAVObjectType type) { boolean ret = types.values().contains(type); for(int i=0; !ret && tmodels!=null && i<tmodels.length; i++) ret = tmodels[i].contains(type); return ret; }
/** * Test if a type is contained. * @param type The type. * @return True, if type is part of type model. */ public boolean contains(OAVObjectType type) { boolean ret = types.values().contains(type); for(int i=0; !ret && tmodels!=null && i<tmodels.length; i++) ret = tmodels[i].contains(type); return ret; }
/** * Test if a type is defined in one of the models. * @param type The type. * @return True, if is defined. */ protected boolean checkTypeDefined(OAVObjectType type) { if(type==null) throw new IllegalArgumentException("Type must not null."); if(type instanceof OAVJavaType) throw new IllegalArgumentException("Type must not be Java type: "+type); if(tmodel==null) throw new RuntimeException("Type model undefined for state: "+this); if(!tmodel.contains(type)) throw new RuntimeException("Type undefined: "+type); return true; }
/** * Test if a type is defined in one of the models. * @param type The type. * @return True, if is defined. */ protected boolean checkTypeDefined(OAVObjectType type) { if(type==null) throw new IllegalArgumentException("Type must not null."); if(type instanceof OAVJavaType) throw new IllegalArgumentException("Type must not be Java type: "+type); if(tmodel==null) throw new RuntimeException("Type model undefined for state: "+this); if(!tmodel.contains(type)) throw new RuntimeException("Type undefined: "+type); return true; }
/** * Test if a type is defined in one of the models. * @param type The type. * @return True, if is defined. */ protected boolean checkTypeDefined(OAVObjectType type) { if(type==null) throw new IllegalArgumentException("Type must not null."); if(type instanceof OAVJavaType) throw new IllegalArgumentException("Type must not be Java type: "+type); if(tmodel==null) throw new RuntimeException("Type model undefined for state: "+this); if(!tmodel.contains(type)) throw new RuntimeException("Type undefined: "+type); return true; }
/** * Test if a type is defined in one of the models. * @param type The type. * @return True, if is defined. */ protected boolean checkTypeDefined(OAVObjectType type) { if(type==null) throw new IllegalArgumentException("Type must not null."); if(type instanceof OAVJavaType) throw new IllegalArgumentException("Type must not be Java type: "+type); if(tmodel==null) throw new RuntimeException("Type model undefined for state: "+this); if(!tmodel.contains(type)) throw new RuntimeException("Type undefined: "+type); return true; }
/** * Create a type. * Creates a type that can be used to create objects. * @param name The type name. * @param supertype The supertype. * @return The type. */ public OAVObjectType createType(String name, OAVObjectType supertype) { OAVObjectType type = new OAVObjectType(name, supertype, this); if(contains(type)) throw new RuntimeException("Type already exists: "+name); types.put(name, type); return type; }
/** * Create a type. * Creates a type that can be used to create objects. * @param name The type name. * @param supertype The supertype. * @return The type. */ public OAVObjectType createType(String name, OAVObjectType supertype) { OAVObjectType type = new OAVObjectType(name, supertype, this); if(contains(type)) throw new RuntimeException("Type already exists: "+name); types.put(name, type); return type; }
/** * Create a Java type. * @param clazz The java class. * @param kind The kind of type as defined in OAVJavaType. * @return The new type. */ public OAVJavaType createJavaType(Class clazz, String kind) { OAVJavaType type = new OAVJavaType(clazz, kind, this); if(contains(type)) throw new RuntimeException("Type already exists: "+clazz); types.put(SReflect.getClassName(clazz), type); return type; }
/** * Create a Java type. * @param clazz The java class. * @param kind The kind of type as defined in OAVJavaType. * @return The new type. */ public OAVJavaType createJavaType(Class clazz, String kind) { OAVJavaType type = new OAVJavaType(clazz, kind, this); if(contains(type)) throw new RuntimeException("Type already exists: "+clazz); types.put(SReflect.getClassName(clazz), type); return type; }
if(tmodel.contains(type)) throw new RuntimeException("Type already contained: "+type);
if(tmodel.contains(type)) throw new RuntimeException("Type already contained: "+type);
/** * Create a new attribute type. * @param name The name. * @param type The type. * @param mult The multiplicity. * @param def The default value. */ public OAVAttributeType createAttributeType(String name, OAVObjectType type, String mult, Object def, OAVAttributeType idxattr) { if(!tmodel.contains(type)) throw new RuntimeException("Unknown object type: "+type); OAVAttributeType attr = new OAVAttributeType(this, name, type, mult, def, idxattr); addAttributeType(attr); return attr; }
/** * Create a new attribute type. * @param name The name. * @param type The type. * @param mult The multiplicity. * @param def The default value. */ public OAVAttributeType createAttributeType(String name, OAVObjectType type, String mult, Object def) { if(!tmodel.contains(type)) throw new RuntimeException("Unknown object type: "+type); OAVAttributeType attr = new OAVAttributeType(this, name, type, mult, def, null); addAttributeType(attr); return attr; }
/** * Create a new attribute type. * @param name The name. * @param type The type. * @param mult The multiplicity. * @param def The default value. */ public OAVAttributeType createAttributeType(String name, OAVObjectType type, String mult, Object def, OAVAttributeType idxattr) { if(!tmodel.contains(type)) throw new RuntimeException("Unknown object type: "+type); OAVAttributeType attr = new OAVAttributeType(this, name, type, mult, def, idxattr); addAttributeType(attr); return attr; }
/** * Create a new attribute type. * @param name The name. * @param type The type. * @param mult The multiplicity. * @param def The default value. */ public OAVAttributeType createAttributeType(String name, OAVObjectType type, String mult, Object def) { if(!tmodel.contains(type)) throw new RuntimeException("Unknown object type: "+type); OAVAttributeType attr = new OAVAttributeType(this, name, type, mult, def, null); addAttributeType(attr); return attr; }
check = type instanceof OAVJavaType || types.contains(type) || mtype!=null && types.contains(mtype) || mtype==null && !OAVBDIMetaModel.bdimm_type_model.contains(type); check = types.contains(type) || mtype!=null && types.contains(mtype) || mtype==null && !OAVBDIMetaModel.bdimm_type_model.contains(type);
/** * Create a java type if it does not already exist. * Required because some (user) Java types are created * on the fly when loading agent models * (e.g. Map in TranslationC1). */ protected static OAVJavaType createJavaType(Class clazz, String kind) { OAVJavaType ret; if(bdi_rt_model.contains(new OAVJavaType(clazz, kind, bdi_rt_model))) { ret = bdi_rt_model.getJavaType(clazz); } else { ret = bdi_rt_model.createJavaType(clazz, kind); } return ret; } }