}
@Check
public void checkIDUniqueOnAllLocations(final TargetPlatform targetPlatform) {
final ListMultimap<String, Location> locationsByURI = this.indexBuilder.getLocationIndex(targetPlatform);
final Resource resource = targetPlatform.eResource();
final LinkedHashMultimap<String, String> locationIDsByURI = LinkedHashMultimap.<String, String>create();
Set<String> _keySet = locationsByURI.keySet();
final Procedure1<String> _function = new Procedure1<String>() {
public void apply(final String it) {
List<Location> _get = locationsByURI.get(it);
final Function1<Location, String> _function = new Function1<Location, String>() {
public String apply(final Location it) {
return it.getID();
}
};
List<String> _map = ListExtensions.<Location, String>map(_get, _function);
Set<String> _set = IterableExtensions.<String>toSet(_map);
locationIDsByURI.putAll(it, _set);
}
};
IterableExtensions.<String>forEach(_keySet, _function);
Map<String, Collection<String>> _asMap = locationIDsByURI.asMap();
final Function2<String, Collection<String>, Boolean> _function_1 = new Function2<String, Collection<String>, Boolean>() {
public Boolean apply(final String key, final Collection<String> value) {
int _size = value.size();
return Boolean.valueOf((_size <= 1));
}
};
Map<String, Collection<String>> _filter = MapExtensions.<String, Collection<String>>filter(_asMap, _function_1);
final Set<String> locationsURIWithoutConflictingID = _filter.keySet();
final Function1<String, List<Location>> _function_2 = new Function1<String, List<Location>>() {
public List<Location> apply(final String it) {
return locationsByURI.get(it);
}
};
Iterable<List<Location>> _map = IterableExtensions.<String, List<Location>>map(locationsURIWithoutConflictingID, _function_2);
final Iterable<Location> locationsWithoutConflictingID = Iterables.<Location>concat(_map);
final Function1<Location, Boolean> _function_3 = new Function1<Location, Boolean>() {
public Boolean apply(final Location it) {
String _iD = it.getID();
return Boolean.valueOf((!Objects.equal(_iD, null)));
}
};
Iterable<Location> _filter_1 = IterableExtensions.<Location>filter(locationsWithoutConflictingID, _function_3);
final Function<Location, String> _function_4 = new Function<Location, String>() {
public String apply(final Location it) {
return it.getID();
}
};
final ImmutableListMultimap<String, Location> locationsWithoutConflictingIDByID = Multimaps.<String, Location>index(_filter_1, _function_4);
ImmutableMap<String, Collection<Location>> _asMap_1 = locationsWithoutConflictingIDByID.asMap();
final Function2<String, Collection<Location>, Boolean> _function_5 = new Function2<String, Collection<Location>, Boolean>() {
public Boolean apply(final String key, final Collection<Location> value) {
final Function1<Location, String> _function = new Function1<Location, String>() {
public String apply(final Location it) {
return it.getUri();
}
};
Iterable<String> _map = IterableExtensions.<Location, String>map(value, _function);
Set<String> _set = IterableExtensions.<String>toSet(_map);
int _size = _set.size();
return Boolean.valueOf((_size > 1));
}
};
Map<String, Collection<Location>> _filter_2 = MapExtensions.<String, Collection<Location>>filter(_asMap_1, _function_5);
Collection<Collection<Location>> _values = _filter_2.values();
final Iterable<Location> locationsWithDuplicateID = Iterables.<Location>concat(_values);
final Procedure1<Location> _function_6 = new Procedure1<Location>() {
public void apply(final Location location) {
Resource _eResource = location.eResource();
boolean _equals = Objects.equal(_eResource, resource);
if (_equals) {
TargetPlatformValidator.this.error("ID must be unique for each location", location,
TargetPlatformPackage.Literals.LOCATION__ID,
TargetPlatformValidator.CHECK__LOCATION_ID_UNIQNESS);