@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SModelReference that = (SModelReference) o; if (!myModelId.equals(that.myModelId)) return false; if (myModelId.isGloballyUnique() && that.myModelId.isGloballyUnique()) return true; return getModuleReference().equals(that.getModuleReference()); }
public SModelReference( @Nullable SModuleReference module, @NotNull SModelId modelId, @NotNull String modelName) { myModelId = modelId; myModelName = modelName; if (module == null) { if (!modelId.isGloballyUnique()) { throw new IllegalArgumentException( String.format( "Only globally unique model id could be used without module specification: %s", modelId)); } } myModuleReference = module; }
@Override public int hashCode() { int result = myModelId.hashCode(); result = 31 * result + (myModelId.isGloballyUnique() ? 0 : getModuleReference().hashCode()); return result; }