private void detectCollision( ReferenceContainer col1, ReferenceContainer col2, String errMsg ) {
Iterator itr = col1.iterator();
while( itr.hasNext() ) {
ReferenceExp r1 = (ReferenceExp)itr.next();
ReferenceExp r2 = col2._get( r1.name );
// if the grammar references elementRule by hedgeRef,
// (or hedgeRule by ref), HedgeRules object and ElementRules object
// are created under the same name.
// And it is inappropriate to report this situation as "label collision".
// Therefore, we have to check both have definitions before reporting an error.