Find allocation for a resource type.
@param type The resource type.
@return The allocation.
425983
public int getAllocatedCpuForType(ResourceType type) {
    int total = 0;

    for (ClusterNode node: nameToNode.values()) {
      synchronized (node) {
        if (node.deleted) {
          continue;
        }
        total += node.getAllocatedCpuForType(type);
      }
    }
    return total;
  }
1256388
public static void cost(String type, long costInMilli) {
        info(new JSONObject() {{
            put("type", type);
            put("cost", costInMilli);
        }});
    }
339299
public String getTreeSite(String type) {

        String result = m_treeSite.get(type);
        return result;
    }
958011
public <T extends Mapping> T findMapping(MappingType type, Predicate<T> predicate)
    {
        T mapping = getMapping(type);
        if (mapping != null)
        {

            // check predicate: can invalidate the local mapping
            if (predicate != null)
            {
                mapping = (predicate.appliesTo(mapping)) ? mapping : null;
            }

            // complement the mapping (i.e. resource address at a higher level)
            if(mapping!=null && parent!=null)
            {
                Mapping parentMapping = parent.findMapping(type, predicate);
                if(parentMapping!=null)
                {
                    mapping.complementFrom(parentMapping);
                }
            }

        }

        if (mapping == null && parent != null)
        {
            mapping = (T) parent.findMapping(type, predicate);
        }

        return mapping;
    }
907447
private static File _getClassSource (final Class <?> type)
  {
    if (type != null)
    {
      final String classResource = type.getName ().replace ('.', '/') + ".class";
      return _getResourceSource (classResource, type.getClassLoader ());
    }
    return null;
  }
146174
private static List<Resource> getResources(Datatype datatype) {
    	List<Resource> toReturn = new ArrayList<Resource>();
    	
    	Resources resources = datatype.getResources();
		if (resources != null) {
			for (Resource resource : resources.getResource()) {
				if(useObsoleteResources // ok to collect (- do not care about obsolete)
					|| resource.isObsolete() == null // undefined - here means non-obsolete (ok)
						|| !resource.isObsolete().booleanValue()) {
					toReturn.add(resource);
				}
			}
		}
		
		return toReturn;
    }
1007987
public synchronized int getPoolGroupMaximum(String poolGroupName,
                                              ResourceType type) {
    Integer max = (typePoolGroupNameToMax == null) ? null :
        typePoolGroupNameToMax.get(type, poolGroupName);
    return max == null ? Integer.MAX_VALUE : max;
  }
607670
public <T extends Mapping> T getMapping(MappingType type)
    {
        return (T) mappings.get(type);
    }
775739
public static <T> Position.Writable<T> writable(final Type type) {
        return writable(type, noop());
    }
487059
public String getMappingForResourceType(String resourceType) {

        String[] resourceTypeParams = getResourceTypes().get(resourceType);
        if (resourceTypeParams == null) {
            return null;
        } else {
            return resourceTypeParams[1];
        }
    }
941450
public synchronized static Set<MeasureUnit> getAvailable(String type) {
        populateCache();
        Map<String, MeasureUnit> units = cache.get(type);
        // Train users not to modify returned set from the start giving us more
        // flexibility for implementation.
        return units == null ? Collections.<MeasureUnit>emptySet()
                : Collections.unmodifiableSet(new HashSet<MeasureUnit>(units.values()));
    }
735576
public static DAType getPreferredInt(DAType type) {
        if (type.isInMemory())
            return type.isStoring() ? RAM_INT_STORE : RAM_INT;
        return type;
    }
1328852
public static Class<?> getTypeByDescriptor(TypeDescriptor type) {
		if (type == null)
			throw new NullPointerException("Type descriptor cannot be null");

		return getType(type.getName(), type.getLibrary());
	}
707727
public <T extends Mapping> T findMapping(MappingType type)
    {
        return (T) this.findMapping(type, DEFAULT_PREDICATE);
    }
1237467
public DataPoint type(Type type) {
        if (this.type != type) {
            this.type = type;
            switch (type) {
            case AVERAGE:
            case SUM:
                this.value = 0;
                break;
            case MAXIMUM:
                this.value = Long.MIN_VALUE;
                break;
            case MINIMUM:
                this.value = Long.MAX_VALUE;
                break;
            default:
                this.value = 0;
                break;
            }
            this.numPoints = 0;
        }
        return this;
    }
350295
public JClassType getType( String type ) throws UnableToCompleteException {
        try {
            return typeOracle.getType( type );
        } catch ( NotFoundException e ) {
            logger.log( TreeLogger.ERROR, "TypeOracle could not find " + type );
            throw new UnableToCompleteException();
        }
    }
307066
public V get(ResourceType type, PoolInfo poolInfo) {
    Map<PoolInfo, V> poolInfoMap = typePoolInfoMap.get(type);
    if (poolInfoMap == null) {
      return null;
    }
    return poolInfoMap.get(poolInfo);
  }