private boolean isPresent ( JMFSchema schema ) throws JMFSchemaIdException { long id = schema . getID ( ) ; JMFSchema reg = ( JMFSchema ) schemaTable . get ( id ) ; if ( reg != null ) { // We are assuming that collisions on key don't happen if ( ! schema . equals ( reg ) ) { // The schema id is a 64bit SHA-1 derived hashcode, so we really don't expect // to get random collisions. throw new JMFSchemaIdException ( "Schema id clash: id=" + id ) ; } Object newAssoc = schema . getJMFType ( ) . getAssociation ( ) ; Object oldAssoc = reg . getJMFType ( ) . getAssociation ( ) ; if ( newAssoc != oldAssoc && newAssoc != null ) { if ( oldAssoc != null ) associations . remove ( oldAssoc ) ; reg . getJMFType ( ) . updateAssociations ( schema . getJMFType ( ) ) ; associations . put ( newAssoc , reg ) ; } return true ; } else return false ; }
to the same schema .