Add the method to calculate the association of an input variable in a
fuzzy range.
<p>
@param clazz the class wrapper
357975
private void addFindAssociation(Java.CLASS clazz) {
		Java.METHOD assoc = clazz.addMETHOD("private", "Number", "findAssociation");
		assoc.setComment("Determine the association of a value into a fuzzy range");
		assoc.setReturnComment("the association");
		assoc.addArg("Number", "value", "value to check");
		assoc.addArg("Number", "from", "fuzzy range start");
		assoc.addArg("Number", "to", "fuzzy range end");
		assoc.addArg("Number", "step", "fuzzy range step");
		assoc.addArg("int[]", "frv", "fuzzy range values");
		Java.IF vlimit = assoc.addIF("value.doubleValue() < from.doubleValue()");
		vlimit.addS("value = from");
		vlimit.addELSEIF("value.doubleValue() > to.doubleValue()")
				.addS("value = to");

		assoc.addS("int index = iround((value.doubleValue() - from.doubleValue()) / step.doubleValue())");

		assoc.addIF("index > frv.length").addS("index = frv.length - 1");
		assoc.addIF("index < 0").addS("index = 0");

		assoc.addS("Number mapped = frv[index]");
		assoc.addRETURN("mapped.doubleValue() / 255.0");
	}
420057
public String getAction(final Class<?> clazz, final Method method) {
        final Annotation[] annotations = clazz.getAnnotations();
        return this.getAction(annotations, method);
    }
1088187
public final static void classAvailable(Class<?> clazz) {
        Object target = classAvailableTarget;
        Method method = classAvailableMethod;
        if (target == null || method == null) {
            return;
        }
        try {
            method.invoke(target, clazz);
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
876976
private static void addSuperAndInterfaces(Set<Class<?>> classes, Class<?> clazz) {
        if (clazz != null) {
            classes.add(clazz);
            addSuperAndInterfaces(classes, clazz.getSuperclass());
            for (Class<?> aClass : clazz.getInterfaces()) {
                addSuperAndInterfaces(classes, aClass);
            }
        }
    }
328809
public void setClazzToPuMap(Map<String, List<String>> map)
    {
        if (clazzToPuMap == null)
        {
            this.clazzToPuMap = map;
        }
        else
        {
            clazzToPuMap.putAll(map);
        }
    }
685873
private void callFindAssociation(Java.METHOD method, String result, Variable variable, Member member) {

		String setName = variable.getName() + "$" + member.getName();
		method.addS("Number " + result + " = findAssociation("
				+ variable.getName() + ", "
				+ variable.getFrom() + ", "
				+ variable.getTo() + ", "
				+ variable.getStep() + ", "
				+ setName + ")");
	}
538700
private void check(Class clazz) {

        final Constructor<?>[] constructors = clazz.getDeclaredConstructors();

        if (constructors.length > 1) {
            throw new AssertionError(clazz + " has more than one constructor");
        }

        final Constructor<?> constructor = constructors[0];

        constructor.setAccessible(true);

        if (!Modifier.isPrivate(constructor.getModifiers())) {
            throw new AssertionError("Constructor of " + clazz + " must be private");
        }

        final Class<?>[] parameterTypes = constructor.getParameterTypes();

        if (parameterTypes.length > 0) {
            if (expectedParameters == null) {
                throw new AssertionError(clazz + " has non-default constructor with some parameters");
            } else {
                if (!Arrays.equals(parameterTypes, expectedParameters)) {
                    throw new AssertionError("Expected constructor with parameters " + getReadableClassesOutput(expectedParameters) + " but found constructor with parameters " + getReadableClassesOutput(parameterTypes));
                } else {
                    return;
                }
            }
        }

        try {
            constructor.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException("Can not instantiate instance of " + clazz, e);
        } catch (IllegalAccessException e) {
            // Fixed by setAccessible(true)
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            final Throwable cause = e.getCause();

            // It's okay case if we expect some exception from this constructor
            if (expectedTypeOfException != null || expectedExceptionMessage != null) {
                if (expectedTypeOfException != null && !expectedTypeOfException.equals(cause.getClass())) {
                    throw new IllegalStateException("For " + clazz + " expected exception of type = " + expectedTypeOfException + ", but was exception of type = " + e.getCause().getClass());
                }

                if (expectedExceptionMessage != null && !expectedExceptionMessage.equals(cause.getMessage())) {
                    throw new IllegalStateException("For " + clazz + " expected exception message = '" + expectedExceptionMessage + "', but was = '" + cause.getMessage() + "'", e.getCause());
                }

                // Everything is okay
            } else {
                throw new IllegalStateException("For " + clazz + " no exception was expected", e);
            }
        } catch (IllegalArgumentException e) {
            throw new RuntimeException("Looks like constructor of " + clazz + " is not default", e);
        }
    }
442680
public void setClazz(Class<? extends ElementBase> clazz) {
        this.clazz = clazz;

        try {
            // Force execution of static initializers
            Class.forName(clazz.getName());
        } catch (ClassNotFoundException e) {
            MiscUtil.toUnchecked(e);
        }
    }
780465
public void addRequestHandler(String clazz) {

        Object initClass;
        try {
            initClass = Class.forName(clazz).newInstance();
        } catch (Throwable t) {
            LOG.error(Messages.get().getBundle().key(Messages.LOG_INIT_REQUEST_HANDLER_FAILURE_1, clazz), t);
            return;
        }
        if (initClass instanceof I_CmsRequestHandler) {
            m_requestHandlers.add((I_CmsRequestHandler)initClass);
            if (CmsLog.INIT.isInfoEnabled()) {
                CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_SUCCESS_1, clazz));
            }
        } else {
            if (CmsLog.INIT.isErrorEnabled()) {
                CmsLog.INIT.error(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_INVALID_1, clazz));
            }
        }
    }
1312118
public void addEventManager(String clazz) {

        try {
            m_eventManager = (CmsEventManager)Class.forName(clazz).newInstance();
            if (CmsLog.INIT.isInfoEnabled()) {
                CmsLog.INIT.info(
                    Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_SUCCESS_1, m_eventManager));
            }
        } catch (Throwable t) {
            LOG.error(Messages.get().getBundle().key(Messages.INIT_EVENTMANAGER_CLASS_INVALID_1, clazz), t);
            return;
        }
    }
936937
public <T extends AbstractJaxb> void addCssClass(String clazz) {
        List<String> classList = this.getCssClass();
        if (!this.hasCssClass(clazz)) {
            classList.add(clazz);
        }
    }
1259590
public void putClass(String key, Class<?> clazz) {
		checkNotNull(key);
		checkNotNull(clazz);
		final String error = InstantiationUtil.checkForInstantiationError(clazz);
		if (error != null) {
			throw new ValidationException("Class '" + clazz.getName() + "' is not supported: " + error);
		}
		put(key, clazz.getName());
	}
158038
public static boolean isPrimitiveWrapperArray(Class<?> clazz) {
		Assert.notNull(clazz, "Class must not be null");
		return (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));
	}
960037
public static void bind(Class clazz, Class<? extends Extension> implementation) {
        bind.put(clazz, implementation);
    }
750663
protected <T> void bindDynamicProvider(Class<T> clazz) {
    DynamicAnnotations.bindDynamicProvider(binder(), clazz, getBindingAnnotation());
  }
1191603
public static void setFieldValue(final Object object, final Class<?> clazz, final String fieldName,
            final Object value) throws NoSuchFieldException {
        final Field field = clazz.getDeclaredField(fieldName);

        try {
            setField(field, object, value);
        } catch (final Exception e) {
            LOG.error(e.getMessage(), e);
        }
    }
419548
public static void initializeClass(Class clazz) {
		try {
			Class.forName(clazz.getName(), true, Thread.currentThread().getContextClassLoader());
		}
		catch (ClassNotFoundException e) {
			throw new RuntimeException(e);
		}
	}