*
* @param obj referenced object (<code>null</code> if none, ignored if a schema type)
*/
private void countUse(Object obj) {
if (obj != null) {
AnnotatedBase comp = (AnnotatedBase)obj;
if (comp.getParent() != null) {
s_logger.debug(" incrementing usage count for " + SchemaUtils.describeComponent(comp));
if (m_usageMap.incrementCount(comp) == 1 && m_newReferences != null) {
if (comp.getParent() instanceof SchemaElement) {
s_logger.debug(" (first use for component, added to new references list)");
m_newReferences.add(obj);
} else if (((AnnotatedBase)obj).getParent() != null) {
throw new IllegalStateException("Internal error: non-global in usage counts");
}