@Test public void testUnknownMatchesUnknown() { assertTrue(ResourceProfile.UNKNOWN.isMatching(ResourceProfile.UNKNOWN)); }
public boolean isMatching(ResourceProfile required) { if (required == UNKNOWN) { return true; } if (cpuCores >= required.getCpuCores() && heapMemoryInMB >= required.getHeapMemoryInMB() && directMemoryInMB >= required.getDirectMemoryInMB() && nativeMemoryInMB >= required.getNativeMemoryInMB() && networkMemoryInMB >= required.getNetworkMemoryInMB() && managedMemoryInMB >= required.getManagedMemoryInMB()) { for (Map.Entry<String, Resource> resource : required.extendedResources.entrySet()) { if (!extendedResources.containsKey(resource.getKey()) || !extendedResources.get(resource.getKey()).getResourceAggregateType().equals(resource.getValue().getResourceAggregateType()) || extendedResources.get(resource.getKey()).getValue() < resource.getValue().getValue()) { return false; } } return true; } return false; }
ResourceProfile implements Serializable, Comparable<ResourceProfile> { public boolean isMatching(ResourceProfile required) { if (required == UNKNOWN) { return true; } if (cpuCores >= required.getCpuCores() && heapMemoryInMB >= required.getHeapMemoryInMB() && directMemoryInMB >= required.getDirectMemoryInMB() && nativeMemoryInMB >= required.getNativeMemoryInMB() && networkMemoryInMB >= required.getNetworkMemoryInMB() && managedMemoryInMB >= required.getManagedMemoryInMB()) { for (Map.Entry<String, Resource> resource : required.extendedResources.entrySet()) { if (!extendedResources.containsKey(resource.getKey()) || !extendedResources.get(resource.getKey()).getResourceAggregateType().equals(resource.getValue().getResourceAggregateType()) || extendedResources.get(resource.getKey()).getValue() < resource.getValue().getValue()) { return false; } } return true; } return false; } }
ResourceProfile implements Serializable, Comparable<ResourceProfile> { public boolean isMatching(ResourceProfile required) { if (required == UNKNOWN) { return true; } if (cpuCores >= required.getCpuCores() && heapMemoryInMB >= required.getHeapMemoryInMB() && directMemoryInMB >= required.getDirectMemoryInMB() && nativeMemoryInMB >= required.getNativeMemoryInMB() && networkMemoryInMB >= required.getNetworkMemoryInMB() && managedMemoryInMB >= required.getManagedMemoryInMB()) { for (Map.Entry<String, Resource> resource : required.extendedResources.entrySet()) { if (!extendedResources.containsKey(resource.getKey()) || !extendedResources.get(resource.getKey()).getResourceAggregateType().equals(resource.getValue().getResourceAggregateType()) || extendedResources.get(resource.getKey()).getValue() < resource.getValue().getValue()) { return false; } } return true; } return false; } ResourceProfile(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int networkMemoryInMB,
			int managedMemoryInMB,
			Map<String, Resource> extendedResources);  ResourceProfile(double cpuCores, int heapMemoryInMB); private  ResourceProfile();  ResourceProfile(ResourceProfile other); }
ResourceProfile implements Serializable, Comparable<ResourceProfile> { public boolean isMatching(ResourceProfile required) { if (required == UNKNOWN) { return true; } if (cpuCores >= required.getCpuCores() && heapMemoryInMB >= required.getHeapMemoryInMB() && directMemoryInMB >= required.getDirectMemoryInMB() && nativeMemoryInMB >= required.getNativeMemoryInMB() && networkMemoryInMB >= required.getNetworkMemoryInMB() && managedMemoryInMB >= required.getManagedMemoryInMB()) { for (Map.Entry<String, Resource> resource : required.extendedResources.entrySet()) { if (!extendedResources.containsKey(resource.getKey()) || !extendedResources.get(resource.getKey()).getResourceAggregateType().equals(resource.getValue().getResourceAggregateType()) || extendedResources.get(resource.getKey()).getValue() < resource.getValue().getValue()) { return false; } } return true; } return false; } ResourceProfile(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int networkMemoryInMB,
			int managedMemoryInMB,
			Map<String, Resource> extendedResources);  ResourceProfile(double cpuCores, int heapMemoryInMB); private  ResourceProfile();  ResourceProfile(ResourceProfile other); double getCpuCores(); int getHeapMemoryInMB(); int getDirectMemoryInMB(); int getNativeMemoryInMB(); int getNetworkMemoryInMB(); int getManagedMemoryInMB(); int getMemoryInMB(); int getOperatorsMemoryInMB(); Map<String, Resource> getExtendedResources(); boolean isMatching(ResourceProfile required); @Override int compareTo(@Nonnull ResourceProfile other); @Override int hashCode(); @Override boolean equals(Object obj); @Nonnull ResourceProfile merge(@Nonnull ResourceProfile other); ResourceProfile subtract(ResourceProfile other); @Override String toString(); static ResourceProfile fromResourceSpec(ResourceSpec resourceSpec, int networkMemory); }
ResourceProfile implements Serializable, Comparable<ResourceProfile> { public boolean isMatching(ResourceProfile required) { if (required == UNKNOWN) { return true; } if (cpuCores >= required.getCpuCores() && heapMemoryInMB >= required.getHeapMemoryInMB() && directMemoryInMB >= required.getDirectMemoryInMB() && nativeMemoryInMB >= required.getNativeMemoryInMB() && networkMemoryInMB >= required.getNetworkMemoryInMB() && managedMemoryInMB >= required.getManagedMemoryInMB()) { for (Map.Entry<String, Resource> resource : required.extendedResources.entrySet()) { if (!extendedResources.containsKey(resource.getKey()) || !extendedResources.get(resource.getKey()).getResourceAggregateType().equals(resource.getValue().getResourceAggregateType()) || extendedResources.get(resource.getKey()).getValue() < resource.getValue().getValue()) { return false; } } return true; } return false; } ResourceProfile(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int networkMemoryInMB,
			int managedMemoryInMB,
			Map<String, Resource> extendedResources);  ResourceProfile(double cpuCores, int heapMemoryInMB); private  ResourceProfile();  ResourceProfile(ResourceProfile other); double getCpuCores(); int getHeapMemoryInMB(); int getDirectMemoryInMB(); int getNativeMemoryInMB(); int getNetworkMemoryInMB(); int getManagedMemoryInMB(); int getMemoryInMB(); int getOperatorsMemoryInMB(); Map<String, Resource> getExtendedResources(); boolean isMatching(ResourceProfile required); @Override int compareTo(@Nonnull ResourceProfile other); @Override int hashCode(); @Override boolean equals(Object obj); @Nonnull ResourceProfile merge(@Nonnull ResourceProfile other); ResourceProfile subtract(ResourceProfile other); @Override String toString(); static ResourceProfile fromResourceSpec(ResourceSpec resourceSpec, int networkMemory); static final ResourceProfile UNKNOWN; static final ResourceProfile ANY; static final ResourceProfile ZERO; }