/** * Create a new extractor. */ public MultifieldExtractor(int tupleindex, OAVAttributeType attr, int subindex) { assert attr!=null && !OAVAttributeType.NONE.equals(attr.getMultiplicity()); this.tupleindex = tupleindex; this.attr = attr; this.subindex = subindex; }
/** * Create a new extractor. */ public MultifieldExtractor(int tupleindex, OAVAttributeType attr, int subindex) { assert attr!=null && !OAVAttributeType.NONE.equals(attr.getMultiplicity()); this.tupleindex = tupleindex; this.attr = attr; this.subindex = subindex; }
/** * Ensure that multiplicity is ok. * @param object The object. * @param attribute The attribute. * @param multiplicity The multiplicity. * @throws RuntimeException if value is not allowed. */ protected boolean checkMultiplicity(Object object, OAVAttributeType attribute, Set allowedmults) { if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); if(!allowedmults.contains(attribute.getMultiplicity())) throw new RuntimeException("Multiplicity violation: "+object+" "+attribute +" "+allowedmults+" "+attribute.getMultiplicity()); return true; }
/** * Ensure that multiplicity is ok. * @param object The object. * @param attribute The attribute. * @param multiplicity The multiplicity. * @throws RuntimeException if value is not allowed. */ protected boolean checkMultiplicity(Object object, OAVAttributeType attribute, Set allowedmults) { if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); if(!allowedmults.contains(attribute.getMultiplicity())) throw new RuntimeException("Multiplicity violation: "+object+" "+attribute +" "+allowedmults+" "+attribute.getMultiplicity()); return true; }
/** * Ensure that multiplicity is ok. * @param object The object. * @param attribute The attribute. * @param multiplicity The multiplicity. * @throws RuntimeException if value is not allowed. */ protected boolean checkMultiplicity(Object object, OAVAttributeType attribute, String allowedmult) { if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); if(!allowedmult.equals(attribute.getMultiplicity())) throw new RuntimeException("Multiplicity violation: "+object+" "+attribute +" "+allowedmult+" "+attribute.getMultiplicity()); return true; }
/** * Ensure that multiplicity is ok. * @param object The object. * @param attribute The attribute. * @param multiplicity The multiplicity. * @throws RuntimeException if value is not allowed. */ protected boolean checkMultiplicity(Object object, OAVAttributeType attribute, String allowedmult) { if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); if(!allowedmult.equals(attribute.getMultiplicity())) throw new RuntimeException("Multiplicity violation: "+object+" "+attribute +" "+allowedmult+" "+attribute.getMultiplicity()); return true; }
/** * Ensure that multiplicity is ok. * @param id The object (oid). * @param attribute The attribute. * @param multiplicity The multiplicity. * @throws RuntimeException if value is not allowed. */ protected boolean checkMultiplicity(Object id, OAVAttributeType attribute, Set allowedmults) { // #ifndef MIDP assert nocheck || generator.isId(id); // #endif if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); if(!allowedmults.contains(attribute.getMultiplicity())) throw new RuntimeException("Multiplicity violation: "+id+" "+attribute +" "+allowedmults+" "+attribute.getMultiplicity()); return true; }
/** * Ensure that multiplicity is ok. * @param id The object (oid). * @param attribute The attribute. * @param multiplicity The multiplicity. * @throws RuntimeException if value is not allowed. */ protected boolean checkMultiplicity(Object id, OAVAttributeType attribute, String allowedmult) { // #ifndef MIDP assert nocheck || generator.isId(id); // #endif if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); if(!allowedmult.equals(attribute.getMultiplicity())) throw new RuntimeException("Multiplicity violation: "+id+" "+attribute +" "+allowedmult+" "+attribute.getMultiplicity()); return true; }
/** * Ensure that multiplicity is ok. * @param id The object (oid). * @param attribute The attribute. * @param multiplicity The multiplicity. * @throws RuntimeException if value is not allowed. */ protected boolean checkMultiplicity(Object id, OAVAttributeType attribute, Set allowedmults) { // #ifndef MIDP assert nocheck || generator.isId(id); // #endif if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); if(!allowedmults.contains(attribute.getMultiplicity())) throw new RuntimeException("Multiplicity violation: "+id+" "+attribute +" "+allowedmults+" "+attribute.getMultiplicity()); return true; }
/** * Ensure that multiplicity is ok. * @param id The object (oid). * @param attribute The attribute. * @param multiplicity The multiplicity. * @throws RuntimeException if value is not allowed. */ protected boolean checkMultiplicity(Object id, OAVAttributeType attribute, String allowedmult) { // #ifndef MIDP assert nocheck || generator.isId(id); // #endif if(attribute==null) throw new IllegalArgumentException("Attribute must not null."); if(!allowedmult.equals(attribute.getMultiplicity())) throw new RuntimeException("Multiplicity violation: "+id+" "+attribute +" "+allowedmult+" "+attribute.getMultiplicity()); return true; }
/** * Set/add an attribute value. */ protected void setAttributeValue(IOAVState state, Object object, OAVAttributeType attrtype, Object elem) { if(attrtype.getMultiplicity().equals(OAVAttributeType.NONE)) { state.setAttributeValue(object, attrtype, elem); } else { state.addAttributeValue(object, attrtype, elem); } }
/** * Set/add an attribute value. */ protected void setAttributeValue(IOAVState state, Object object, OAVAttributeType attrtype, Object elem) { if(attrtype.getMultiplicity().equals(OAVAttributeType.NONE)) { state.setAttributeValue(object, attrtype, elem); } else { state.addAttributeValue(object, attrtype, elem); } }
/** * Compute the hascode. * @return The hashcode. */ public int hashCode() { int ret; if(!attribute.getMultiplicity().equals(OAVAttributeType.NONE)) { ret = super.hashCode(); } else { final int prime = 31; ret = prime * id.hashCode(); ret = prime * ret + type.hashCode(); ret = prime * ret + attribute.hashCode(); } return ret; }
/** * Compute the hascode. * @return The hashcode. */ public int hashCode() { int ret; if(!attribute.getMultiplicity().equals(OAVAttributeType.NONE)) { ret = super.hashCode(); } else { final int prime = 31; ret = prime * id.hashCode(); ret = prime * ret + type.hashCode(); ret = prime * ret + attribute.hashCode(); } return ret; }
/** * Get a value from an object. */ protected Object getValue(Object object, Object attr, IContext context, Object info) { Object ret; try { OAVAttributeType attribute = (OAVAttributeType)attr; IOAVState state = (IOAVState)context; if(((OAVAttributeType)attr).getMultiplicity().equals(OAVAttributeType.NONE)) { ret = state.getAttributeValue(object, attribute); } else { ret = state.getAttributeValues(object, attribute); } } catch(Error e) { e.printStackTrace(); throw new RuntimeException(e); } return ret; }
/** * Get a value from an object. */ protected Object getValue(Object object, Object attr, IContext context, Object info) { Object ret; try { OAVAttributeType attribute = (OAVAttributeType)attr; IOAVState state = (IOAVState)context; if(((OAVAttributeType)attr).getMultiplicity().equals(OAVAttributeType.NONE)) { ret = state.getAttributeValue(object, attribute); } else { ret = state.getAttributeValues(object, attribute); } } catch(Error e) { e.printStackTrace(); throw new RuntimeException(e); } return ret; }
if(!ret && attribute.getMultiplicity().equals(OAVAttributeType.NONE) && obj instanceof OAVObjectModifiedEvent)
if(!ret && attribute.getMultiplicity().equals(OAVAttributeType.NONE) && obj instanceof OAVObjectModifiedEvent)
/** * Get the value of an attribute from an object or tuple. * @param left The left input tuple. * @param right The right input object. * @param prefix The prefix input object (last value from previous extractor in a chain). * @param state The working memory. */ public Object getValue(Tuple left, Object right, Object prefix, IOAVState state) { Object ret; if(attr==OAVAttributeType.OBJECTTYPE) { ret = state.getType(prefix); } else if(attr!=null) { ret = OAVAttributeType.NONE.equals(attr.getMultiplicity())? state.getAttributeValue(prefix, attr): key!=null? state.getAttributeValue(prefix, attr, key): state.getAttributeValues(prefix, attr); } else { ret = prefix; } return ret; }
OAVAttributeType.NONE.equals(attr.getMultiplicity())? state.getAttributeValue(right, attr): key!=null? state.getAttributeValue(right, attr, key):