Returns a ghosted distributed array class that derives from BaseClass
    @param BaseClass base class, e.g. DistArray or MaskedDistArray
    @return ghosted dist array class
10990
def ghostedDistArrayFactory(BaseClass):
    

    class GhostedDistArrayAny(BaseClass):
        """
        Ghosted distributed array. Each process owns data and exposes the
        halo region to other processes. These are accessed with tuples
        such (1, 0) for north, (-1, 0) for south, etc.
        """

        def __init__(self, shape, dtype):
            """
            Constructor
            @param shape shape of the array
            @param dtype numpy data type
            @param numGhosts the width of the halo
            """
            # call the parent Ctor
            BaseClass.__init__(self, shape, dtype)

        def setNumberOfGhosts(self, numGhosts):
            """
            Set the width of the ghost halo
            @param numGhosts halo thickness
            """
            # expose each window to other PE domains
            ndim = len(self.shape)
            for dim in range(ndim):
                for drect in (-1, 1):
                    # the window id uniquely specifies the
                    # location of the window. we use 0's to indicate
                    # a slab extending over the entire length for a
                    # given direction, a 1 represents a layer of
                    # thickness numGhosts on the high index side,
                    # -1 on the low index side.
                    winId = tuple([0 for i in range(dim)] +
                                  [drect] +
                                  [0 for i in range(dim+1, ndim)])

                    slce = slice(0, numGhosts)
                    if drect == 1:
                        slce = slice(self.shape[dim] -
                                     numGhosts, self.shape[dim])

                    slab = self.getSlab(dim, slce)

                    # expose MPI window
                    self.expose(slab, winId)

        def getSlab(self, dim, slce):
            """
            Get slab. A slab is a multi-dimensional slice extending in
            all directions except along dim where slce applies
            @param dim dimension (0=first index, 1=2nd index...)
            @param slce python slice object along dimension dim
            @return slab
            """
            shape = self.shape
            ndim = len(shape)

            slab = [slice(0, shape[i]) for i in range(dim)] + \
                   [slce] + [slice(0, shape[i]) for i in range(dim+1, ndim)]
            return slab

        def getEllipsis(self, winID):
            """
            Get the ellipsis for a given halo side

            @param winID a tuple of zeros and one +1 or -1.  To access
               the "north" side for instance, set side=(1, 0),
               (-1, 0) to access the south side, (0, 1) the east
               side, etc. This does not involve any communication.

            @return None if halo was not exposed (bad winID)
            """
            if winID in self.windows:
                return self.windows[winID]['slice']
            else:
                return None

    return GhostedDistArrayAny
1023670
public synchronized Class getProxyClass()
    {
        if ((proxyClass == null) && (proxyClassName != null))
        {
            if (isDynamicProxy())
            {
                /**
                 * AClute: Return the same class back if it is dynamic. This signifies
                 * that this class become the base to a generated sub-class, regadless
                 * of which Proxy implementation is used
                 */
                return getClassOfObject();
            }
            else
            {
                try
                {
                    proxyClass = ClassHelper.getClass(proxyClassName);
                }
                catch (ClassNotFoundException e)
                {
                    throw new MetadataException(e);
                }
            }
        }
        return proxyClass;
    }
784592
public Class getRoot(Class clazz, HashMap derivesFrom) {
        while (derivesFrom.containsKey(clazz)) clazz = (Class) derivesFrom.get(clazz);
        return clazz;
    }
703924
public static Class<?> wrapArrayType(Class<?> type) {
        Class<?> clazz = primToWrapArrayClasses.get(type);
	    return null != clazz ? clazz : type;
	}
1007185
public static Class[] convertToTypeArray(Object[] args) {
        if (args == null)
            return null;
        int s = args.length;
        Class[] ans = new Class[s];
        for (int i = 0; i < s; i++) {
            Object o = args[i];
            ans[i] = getClassWithNullAndWrapper(o);
        }
        return ans;
    }
465636
public static Class<?>[] toPrimitiveType(Class<?>[] types) {
		if (types == null) {
			throw new IllegalArgumentException("types cannot be null");
		}

		Class<?>[] convertedTypes = new Class<?>[types.length];
		for (int i = 0; i < types.length; i++) {
			final Class<?> originalType = types[i];
			Class<?> primitiveType = primitiveWrapper.get(originalType);
			if (primitiveType == null) {
				convertedTypes[i] = originalType;
			} else {
				convertedTypes[i] = primitiveType;
			}
		}
		return convertedTypes;
	}
17578
public <T> T [] toArray(Class<T> componentClass) {
    final int size = size();
    final T[] array = (T[]) java.lang.reflect.Array.newInstance(componentClass, size);
    int i = 0;
    for (KTypeCursor<KType> c : this) {
      array[i++] = (T) c.value;
    }
    return array;
  }
910445
public static Class getArrayClass(Class c) {
     if (c.getComponentType().isArray())
        return getArrayClass(c.getComponentType());
     else
        return c.getComponentType();
  }
1103259
private static Type[] getGenericInterfaces(Class<?> cls, Class<?> expectedClass,
                                               Class<?> commonBaseCls) {
        if (Object.class == cls) {
            return emptyType;
        }
        Type[] cachedTypes = getTypes(cls, expectedClass, commonBaseCls);
        if (cachedTypes != null)
            return cachedTypes;
        if (expectedClass != null) {
            Type genericSuperType = cls.getGenericSuperclass();
            if (genericSuperType instanceof ParameterizedType) {
                Class<?> actualType = InjectionUtils.getActualType(genericSuperType);
                if (actualType != null && actualType.isAssignableFrom(expectedClass)) {
                    Type[] tempTypes = new Type[] { genericSuperType };
                    putTypes(cls, expectedClass, commonBaseCls, tempTypes);
                    return tempTypes;
                } else if (commonBaseCls != null && commonBaseCls != Object.class 
                           && commonBaseCls.isAssignableFrom(expectedClass)
                           && commonBaseCls.isAssignableFrom(actualType)
                           || expectedClass.isAssignableFrom(actualType)) {
                    putTypes(cls, expectedClass, commonBaseCls, emptyType);
                    return emptyType;
                }
            }
        }
        Type[] types = cls.getGenericInterfaces();
        if (types.length > 0) {
            putTypes(cls, expectedClass, commonBaseCls, types);
            return types;
        }
        Type[] superGenericTypes = getGenericInterfaces(cls.getSuperclass(), expectedClass, commonBaseCls);
        putTypes(cls, expectedClass, commonBaseCls, superGenericTypes);
        return superGenericTypes;
    }
481990
public static boolean isAbstractClass (@Nullable final Class <?> aClass)
  {
    // Special case for arrays (see documentation of Class.getModifiers: only
    // final and interface are set, the rest is indeterministic)
    return aClass != null && !aClass.isArray () && Modifier.isAbstract (aClass.getModifiers ());
  }
1130105
public static Class<?> getPrimitiveClass(final Class<?> clazz) {

    if (clazz == null) {
      return null;
    }
    int index = ArrayUtils.indexOf(WRAPPER_CLASSES, clazz);
    if (index != ArrayUtils.INDEX_OF_NOT_FOUND) {
      return PRIMITIVE_CLASSES[index];
    }
    return clazz;
  }
517717
public static TypeDef forClass(final Class<?> typeClass) {
        
        Utils.validateNotNull(typeClass, "Class cannot be null");
        Utils.validateIsTrue(!typeClass.isArray(), "Cannot obtain TypeDef from array class");
        
        final TypeDefRegistry typeDefRegistry = TypeDefRegistry.getInstance();
        return typeDefRegistry.forClass(typeClass);
        
    }
408067
def default_class
        if collection.respond_to?(:proxy_reflection)
          collection.proxy_reflection.klass
        elsif !collection.empty?
          collection.first.class
        end
      end
36258
public static <T> List<Class<?>> getTypeArguments(Class<T> baseClass, Class<? extends T> childClass) {
		
		Map<Type, Type> resolvedTypes = new HashMap<Type, Type>();
		Type type = getNecessaryResolvedTypes(baseClass, childClass, resolvedTypes);

		// finally, for each actual type argument provided to baseClass,
		// determine (if possible)
		// the raw class for that type argument.
		Type[] actualTypeArguments;
		if (type instanceof Class) {
			actualTypeArguments = ((Class<?>) type).getTypeParameters();
		} else {
			actualTypeArguments = ((ParameterizedType) type)
					.getActualTypeArguments();
		}
		List<Class<?>> typeArgumentsAsClasses = new ArrayList<Class<?>>();
		// resolve types by chasing down type variables.
		for (Type baseType : actualTypeArguments) {
			while (resolvedTypes.containsKey(baseType)) {
				baseType = resolvedTypes.get(baseType);
			}
			typeArgumentsAsClasses.add(getClass(baseType));
		}
		return typeArgumentsAsClasses;
	}
1069165
public static function newInstance($baseclass, $args = array(), &$module = null)
    {
        $modules = ModuleManager::getInstance()->getModules();
        foreach ($modules as $module) {
            if (in_array($baseclass, $module->getModels())) {
                $classes = array('\\' . $module->modelNamespace . '\\' . $baseclass, $baseclass);
                foreach ($classes as $class) {
                    if (class_exists($class)) {

                        return new $class($args);
                    }
                }
            }
        }
        $class = '\\GLFramework\\Model\\' . $baseclass;
        if (class_exists($class)) {
            return new $class($args);
        }
        return false;
    }
1329201
@Override
    protected Class<? extends T> enhanceClass(Class<T> baseClass) {
        //noinspection unchecked
        return second.enhanceClass((Class<T>) first.enhanceClass(baseClass));
    }
878939
@SuppressWarnings("unchecked")
    public static <T> T[] newArrayInstance(Class<T> baseClass, int length) {
        return (T[]) Array.newInstance(baseClass, length);
    }