protected Key keyForComponent(Component component) { final String cacheKey = Component.class.getSimpleName() + ":" + System.identityHashCode(component); Key interactionKey = null; if (!keyCache.containsKey(cacheKey)) { if (component.getInteraction() == null) { throw new IllegalArgumentException("Cannot generate a key for a component without interaction: " + component); } interactionKey = keyForInteraction(component.getInteraction()); } if (keyCache.containsKey(cacheKey)) { return keyCache.get(cacheKey); } if (interactionKey != null) { Key compKey = new Key(interactionKey.getUniqueString() + ":" + component.getShortLabel() + "[" + component.hashCode() + "]"); keyCache.put(cacheKey, compKey); return compKey; } throw new IllegalStateException("This component should already have already a key, generated when the interaction key is generated: " + component); }
protected Key keyForComponent(Component component) { final String cacheKey = Component.class.getSimpleName() + ":" + System.identityHashCode(component); Key interactionKey = null; if (!keyCache.containsKey(cacheKey)) { if (component.getInteraction() == null) { throw new IllegalArgumentException("Cannot generate a key for a component without interaction: " + component); } interactionKey = keyForInteraction(component.getInteraction()); } if (keyCache.containsKey(cacheKey)) { return keyCache.get(cacheKey); } if (interactionKey != null) { Key compKey = new Key(interactionKey.getUniqueString() + ":" + component.getShortLabel() + "[" + component.hashCode() + "]"); keyCache.put(cacheKey, compKey); return compKey; } throw new IllegalStateException("This component should already have already a key, generated when the interaction key is generated: " + component); }
protected Key keyForInteraction(Interaction interaction) { final Key key = new Key(new CrcCalculator().crc64(interaction)); // pre-calculate the keys for the components here and put them in a map int n = 0; for (Component component : interaction.getComponents()) { Key compKey = new Key(key.getUniqueString() + ":" + component.getShortLabel() + "[" + n + "]"); keyCache.put(Component.class.getSimpleName() + ":" + System.identityHashCode(component), compKey); n++; } return key; }
protected Key keyForInteraction(Interaction interaction) { final Key key = new Key(new CrcCalculator().crc64(interaction)); // pre-calculate the keys for the components here and put them in a map int n = 0; for (Component component : interaction.getComponents()) { Key compKey = new Key(key.getUniqueString() + ":" + component.getShortLabel() + "[" + n + "]"); keyCache.put(Component.class.getSimpleName() + ":" + System.identityHashCode(component), compKey); n++; } return key; }
public Key keyForAlias(Alias alias) { return new Key(keyFor(alias.getParent()).getUniqueString() + "::" + alias.getName()); }
public Key keyForXref(Xref xref) { return new Key(keyFor(xref.getParent()).getUniqueString() + "::" + xref.getPrimaryId()); }
public Key keyForAnnotation(Annotation annotation, AnnotatedObject parent) { return new Key(keyFor(parent).getUniqueString() + "::" + annotation.getCvTopic() + "_" + annotation.getAnnotationText()); }
public Key keyForAlias(Alias alias) { return new Key(keyFor(alias.getParent()).getUniqueString() + "::" + alias.getName()); }
public Key keyForXref(Xref xref) { return new Key(keyFor(xref.getParent()).getUniqueString() + "::" + xref.getPrimaryId()); }
public Key keyForAnnotation(Annotation annotation, AnnotatedObject parent) { return new Key(keyFor(parent).getUniqueString() + "::" + annotation.getCvTopic() + "_" + annotation.getAnnotationText()); }
protected Key keyForFeature(Feature feature) { if (feature.getComponent() == null) { throw new IllegalArgumentException("Cannot create a feature key for feature without component: " + feature); } Key componentKey = keyFor(feature.getComponent()); return new Key(new FeatureKeyCalculator().calculateFeatureKey(feature) + "___" + componentKey.getUniqueString()); // return new Key( keyForAnnotatedObject( feature ).getUniqueString() + "___" + componentKey.getUniqueString() ); }
protected Key keyForFeature(Feature feature) { if (feature.getComponent() == null) { throw new IllegalArgumentException("Cannot create a feature key for feature without component: " + feature); } Key componentKey = keyFor(feature.getComponent()); return new Key(new FeatureKeyCalculator().calculateFeatureKey(feature) + "___" + componentKey.getUniqueString()); // return new Key( keyForAnnotatedObject( feature ).getUniqueString() + "___" + componentKey.getUniqueString() ); }