/***************************************************************************
                            KRandomSequence.cpp -  description
                             -------------------
    begin                : Tue Jan 29 14:56:40 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Tue Jan 29 14:56:40 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <krandomsequence.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/KRandomSequence.h>

class KRandomSequenceJBridge : public KRandomSequence
{
public:
	KRandomSequenceJBridge(long lngSeed) : KRandomSequence(lngSeed) {}
	~KRandomSequenceJBridge() {QtSupport::qtKeyDeleted(this);}
	KRandomSequenceJBridge(const KRandomSequence& a) : KRandomSequence(a) {}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_newKRandomSequence__J(JNIEnv *env, jobject obj, jlong lngSeed)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KRandomSequenceJBridge((long) lngSeed));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_newKRandomSequence__(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KRandomSequenceJBridge(0));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (KRandomSequence*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KRandomSequence_finalize(env, obj);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KRandomSequence_isDisposed(JNIEnv *env, jobject obj)
{
	return (QtSupport::getQt(env, obj) == 0);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_newKRandomSequence__Lorg_kde_koala_KRandomSequence_2(JNIEnv *env, jobject obj, jobject a)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KRandomSequenceJBridge((KRandomSequence&) *(KRandomSequence *) QtSupport::getQt(env, a)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_setSeed__J(JNIEnv *env, jobject obj, jlong lngSeed)
{
	((KRandomSequence*) QtSupport::getQt(env, obj))->setSeed((long) lngSeed);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_setSeed__(JNIEnv *env, jobject obj)
{
	((KRandomSequence*) QtSupport::getQt(env, obj))->setSeed(1);
	return;
}

JNIEXPORT jdouble JNICALL
Java_org_kde_koala_KRandomSequence_getDouble(JNIEnv *env, jobject obj)
{
	return (jdouble) ((KRandomSequence*) QtSupport::getQt(env, obj))->getDouble();
}

JNIEXPORT jlong JNICALL
Java_org_kde_koala_KRandomSequence_getLong(JNIEnv *env, jobject obj, jlong max)
{
	return (jlong) ((KRandomSequence*) QtSupport::getQt(env, obj))->getLong((unsigned long) max);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KRandomSequence_getBool(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KRandomSequence*) QtSupport::getQt(env, obj))->getBool();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_randomize(JNIEnv *env, jobject obj, jobject list)
{
	((KRandomSequence*) QtSupport::getQt(env, obj))->randomize((QGList*) QtSupport::getQt(env, list));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KRandomSequence_modulate(JNIEnv *env, jobject obj, jint i)
{
	((KRandomSequence*) QtSupport::getQt(env, obj))->modulate((int) i);
	return;
}

