(function(Clazz
,Clazz_newLongArray
,Clazz_doubleToByte
,Clazz_doubleToInt
,Clazz_doubleToLong
,Clazz_declarePackage
,Clazz_instanceOf
,Clazz_load
,Clazz_instantialize
,Clazz_decorateAsClass
,Clazz_floatToInt
,Clazz_floatToLong
,Clazz_makeConstructor
,Clazz_defineEnumConstant
,Clazz_exceptionOf
,Clazz_newIntArray
,Clazz_defineStatics
,Clazz_newFloatArray
,Clazz_declareType
,Clazz_prepareFields
,Clazz_superConstructor
,Clazz_newByteArray
,Clazz_declareInterface
,Clazz_p0p
,Clazz_pu$h
,Clazz_newShortArray
,Clazz_innerTypeInstance
,Clazz_isClassDefined
,Clazz_prepareCallback
,Clazz_newArray
,Clazz_castNullAs
,Clazz_floatToShort
,Clazz_superCall
,Clazz_decorateAsType
,Clazz_newBooleanArray
,Clazz_newCharArray
,Clazz_implementOf
,Clazz_newDoubleArray
,Clazz_overrideConstructor
,Clazz_clone
,Clazz_doubleToShort
,Clazz_getInheritedLevel
,Clazz_getParamsType
,Clazz_isAF
,Clazz_isAI
,Clazz_isAS
,Clazz_isASS
,Clazz_isAP
,Clazz_isAFloat
,Clazz_isAII
,Clazz_isAFF
,Clazz_isAFFF
,Clazz_tryToSearchAndExecute
,Clazz_getStackTrace
,Clazz_inheritArgs
,Clazz_alert
,Clazz_defineMethod
,Clazz_overrideMethod
,Clazz_declareAnonymous
//,Clazz_checkPrivateMethod
,Clazz_cloneFinals
){
var $t$;
//var c$;
Jmol.___JmolDate="$Date: 2015-01-20 12:29:14 -0600 (Tue, 20 Jan 2015) $"
Jmol.___fullJmolProperties="src/org/jmol/viewer/Jmol.properties"
Jmol.___JmolVersion="14.2.11_2015.01.20"
// JSmolJavaExt.js

// This library will be wrapped by an additional anonymous function using ANT in 
// build_03_tojs.xml. This task will also modify variable names. References 
// to Clazz._ will not be changed, but other Clazz_xxx will be changed to 
// (local scope) Clazz_xxx, allowing them to be further compressed using
// Google Closure Compiler in that same ANT task.

// BH 1/16/2015 10:09:38 AM Chrome failure jqGrig due to new String("x").toString() not being a simple string
// BH 8/14/2014 6:49:22 PM Character class efficiencies
// BH 7/24/2014 9:02:18 AM most browsers do not support String.codePointAt()
// BH 7/11/2014 4:17:22 PM fix for Boolean.valueOf("false") not being false 
// BH 5/27/2014 6:29:59 AM ensure floats and doubles have decimal point in toString
// BH 4/1/2014 12:23:41 PM Encoding moved to Clazz._Encoding; 
// BH 4/1/2014 7:51:46 AM removing java.lang.B00lean
// BH 3/7/2014 9:17:10 AM removing Array.toString; moving that code here from j2sJmol.js
// BH 1/30/2014 9:04:25 AM adding Throwable.getStackTrace() as a STRING
// BH 12/4/2013 9:20:44 PM fix for reassigning Date.prototype.toString()
// BH 12/3/2013 11:43:10 AM bizarre Safari bug in reassigning Boolean (OK, I admit, we shouldn't have done that...) 
// BH 12/1/2013 6:50:16 AM evit Number.prototype.toString assignment removed!
// BH 11/30/2013 1:46:31 PM fixing Byte, Short, Long, Integer, Float, Double to reflect proper bounds and error conditions
// BH 11/29/2013 8:58:49 PM removing Boolean.toString(boolean)
// BH 11/4/2013 7:34:26 AM changing "var nativeClazz" to "var nativeClass" to avoid ANT replacement of "nativeClazz_" to "nativeClazz_"
// BH 10/19/2013 1:29:27 PM fixed String.$replace()
// BH 10/18/2013 6:09:23 PM fixed (Double|Float).valueOf(NaN).valueOf(), which should return NaN, not throw an error
// BH 10/12/2013 11:18:44 AM fixed bug in Double(String) and Float(String) that was returning typeof "string"
// BH 10/10/2013 2:40:20 PM  added Math.log10   
// BH 7/23/2013 7:24:01 AM fixing Number.shortValue() and Number.byteValue() for negative values
// BH 6/16/2013 1:31:30 PM adding /| in String.replace -- thank you David Koes
// BH 3/13/2013 12:49:23 PM setting Boolean.valueOf() "@" 
// BH 3/2/2013 10:46:45 PM removed Double.valueOf(String)
// BH 11/6/2012 8:26:33 PM added instanceof Int32Array in String.instantialize
// BH 10/13/2012 11:38:07 PM corrected Integer.parseInt to allow only +-0123456789; created Integer.parseIntRadix
// BH 11/1/2012 added Short
// BH 9/10/2012 6:27:21 AM added java.net.URL... classes
// BH 1/7/2013 7:40:06 AM added Clazz_dateToString

;(function(Clazz) {

// moved here from package.js
// these classes will be created as objects prior to any others
// and are then available immediately

	Clazz._Loader.registerPackages("java", [ "io", "lang", "lang.reflect", "util" ]);

  var sJU = "java.util";

  //var sJU = "JU";  
	//Clazz._Loader.registerPackages (sJU, ["regex", "zip"]);
	//var javautil = JU;

  var javautil = java.util;

	Clazz._Loader.ignore([
		"net.sf.j2s.ajax.HttpRequest",
		sJU + ".MapEntry.Type",
		"java.net.UnknownServiceException",
		"java.lang.Runtime",
		"java.security.AccessController",
		"java.security.PrivilegedExceptionAction",
		"java.io.File",
		"java.io.FileInputStream",
		"java.io.FileWriter",
		"java.io.OutputStreamWriter",
		sJU + ".Calendar", // bypassed in ModelCollection
		"java.text.SimpleDateFormat", // not used
		"java.text.DateFormat", // not used
		sJU + ".concurrent.Executors"
	])

Math.log10||(Math.log10=function(a){return Math.log(a)/2.302585092994046});

if(Clazz._supportsNativeObject){
	// Number and Array are special -- do not override prototype.toString -- "length - 2" here
	for(var i=0;i<Clazz._extendedObjectMethods.length - 2;i++){
		var p=Clazz._extendedObjectMethods[i];
		Array.prototype[p] = Clazz._O.prototype[p];
		Number.prototype[p] = Clazz._O.prototype[p];
	}
}

java.lang.Number=Number;
Number.__CLASS_NAME__="Number";
Clazz_implementOf(Number,java.io.Serializable);
Number.equals=Clazz._innerFunctions.equals;
Number.getName=Clazz._innerFunctions.getName;


Clazz_defineMethod(Number,"shortValue",
function(){
var x = Math.round(this)&0xffff;
return (this < 0 && x > 0 ? x - 0x10000 : x);
});

Clazz_defineMethod(Number,"byteValue",
function(){
var x = Math.round(this)&0xff;
return (this < 0 && x > 0 ? x - 0x100 : x);
});

Clazz_defineMethod(Number,"intValue",
function(){
return Math.round(this)&0xffffffff;
});

Clazz_defineMethod(Number,"longValue",
function(){
return Math.round(this);
});

Clazz_defineMethod(Number,"floatValue",
function(){
return this.valueOf();
});
Clazz_defineMethod(Number,"doubleValue",
function(){
return parseFloat(this.valueOf());
});

Clazz_overrideMethod(Number,"hashCode",
function(){
return this.valueOf();
});

java.lang.Integer=Integer=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Integer,"Integer",Number,Comparable,null,true);
Integer.prototype.valueOf=function(){return 0;};
Integer.toString=Integer.prototype.toString=function(){
if(arguments.length!=0){
return""+arguments[0];
} else if(this===Integer){
return"class java.lang.Integer";
}
return""+this.valueOf();
};

/*

Clazz_makeConstructor(Integer,
function(){
this.valueOf=function(){
return 0;
};
});
*/


Clazz_overrideConstructor(Integer, function(v){
 v == null && (v = 0);
 if (typeof v != "number")
	v = Integer.parseIntRadix(v, 10);
 this.valueOf=function(){return v;};
}); //BH
/*
Clazz_makeConstructor(Integer,
function(s){
var value=Integer.parseInt(s,10);
this.valueOf=function(){
return value;
};
},"String");
*/
Integer.MIN_VALUE=Integer.prototype.MIN_VALUE=-0x80000000;
Integer.MAX_VALUE=Integer.prototype.MAX_VALUE=0x7fffffff;
Integer.TYPE=Integer.prototype.TYPE=Integer;


Clazz_defineMethod(Integer,"bitCount",
function(i) {
	i = i - ((i >>> 1) & 0x55555555);
	i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
	i = (i + (i >>> 4)) & 0x0f0f0f0f;
	i = i + (i >>> 8);
	i = i + (i >>> 16);
	return i & 0x3f;
},"Number");
Integer.bitCount=Integer.prototype.bitCount;

Clazz_defineMethod(Integer,"numberOfLeadingZeros",
function(i) {
 if (i == 0) return 32;
 var n = 1;
 if (i >>> 16 == 0) { n += 16; i <<= 16; }
 if (i >>> 24 == 0) { n +=  8; i <<=  8; }
 if (i >>> 28 == 0) { n +=  4; i <<=  4; }
 if (i >>> 30 == 0) { n +=  2; i <<=  2; }
 n -= i >>> 31;
 return n;
},"Number");
Integer.numberOfLeadingZeros=Integer.prototype.numberOfLeadingZeros;

Clazz_defineMethod(Integer,"numberOfTrailingZeros",
function(i) {
	if (i == 0) return 32;
	var n = 31;
	var y = i <<16; if (y != 0) { n = n -16; i = y; }
	y = i << 8; if (y != 0) { n = n - 8; i = y; }
	y = i << 4; if (y != 0) { n = n - 4; i = y; }
	y = i << 2; if (y != 0) { n = n - 2; i = y; }
	return n - ((i << 1) >>> 31);
},"Number");
Integer.numberOfTrailingZeros=Integer.prototype.numberOfTrailingZeros;

Clazz_defineMethod(Integer,"parseIntRadix",
function(s,radix){
if(s==null){
throw new NumberFormatException("null");
}if(radix<2){
throw new NumberFormatException("radix "+radix+" less than Character.MIN_RADIX");
}if(radix>36){
throw new NumberFormatException("radix "+radix+" greater than Character.MAX_RADIX");
}
if (radix == 10) {
	for (var i = s.length; --i >= 0;) {
		var c = s.charCodeAt(i);
		if (c >= 48 && c <= 57) continue;
		if (i > 0 || c != 43 && c != 45)
			throw new NumberFormatException("Not a Number : "+s);

	}
}
var i=parseInt(s,radix);
if(isNaN(i)){
throw new NumberFormatException("Not a Number : "+s);
}
return i;
},"String, Number");
Integer.parseIntRadix=Integer.prototype.parseIntRadix;

Clazz_defineMethod(Integer,"parseInt",
function(s){
return Integer.parseIntRadix(s,10);
},"String");
Integer.parseInt=Integer.prototype.parseInt;

/*
Clazz_defineMethod(Integer,"$valueOf",
function(s){
return new Integer(Integer.parseIntRadix(s,10));
},"String");
*/

Clazz_overrideMethod(Integer,"$valueOf",
function(s){
return new Integer(s);
});

/*
Clazz_defineMethod(Integer,"$valueOf",
function(s,r){
return new Integer(Integer.parseIntRadix(s,r));
},"String, Number");
*/

Integer.$valueOf=Integer.prototype.$valueOf;


Clazz_overrideMethod(Integer,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Integer)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");
Integer.toHexString=Integer.prototype.toHexString=function(d){
if(d.valueOf)d=d.valueOf();
if (d < 0) {
var b = d & 0xFFFFFF;
var c = ((d>>24)&0xFF);
return c._numberToString(16) + (b = b._numberToString(16)).substring(b.length - 6);
}
return d._numberToString(16);};
Integer.toOctalString=Integer.prototype.toOctalString=function(d){if(d.valueOf)d=d.valueOf();return d._numberToString(8);};
Integer.toBinaryString=Integer.prototype.toBinaryString=function(d){if(d.valueOf)d=d.valueOf();return d._numberToString(2);};

Integer.decodeRaw=Clazz_defineMethod(Integer,"decodeRaw", function(n){
if (n.indexOf(".") >= 0)n = "";
var i = (n.startsWith("-") ? 1 : 0);
n = n.replace(/\#/, "0x").toLowerCase();
var radix=(n.startsWith("0x", i) ? 16 : n.startsWith("0", i) ? 8 : 10);
// The general problem with parseInt is that is not strict -- ParseInt("10whatever") == 10.
// Number is strict, but Number("055") does not work, though ParseInt("055", 8) does.
n = Number(n);
return (radix == 8 ? parseInt(n, 8) : n);
},"~S");

Integer.decode=Clazz_defineMethod(Integer,"decode", function(n){
	n = Integer.decodeRaw(n);
	if (isNaN(n) || n < Integer.MIN_VALUE|| n > Integer.MAX_VALUE)
	throw new NumberFormatException("Invalid Integer");
	return new Integer(n);
},"~S");

Clazz_overrideMethod(Integer,"hashCode",
function(){
return this.valueOf();
});

// Note that Long is problematic in JavaScript 

java.lang.Long=Long=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Long,"Long",Number,Comparable,null,true);
Long.prototype.valueOf=function(){return 0;};
Long.toString=Long.prototype.toString=function(){
if(arguments.length!=0){
return""+arguments[0];
}else if(this===Long){
return"class java.lang.Long";
}
return""+this.valueOf();
};

Clazz_overrideConstructor(Long, function(v){
 v == null && (v = 0);
 v = (typeof v == "number" ? Math.round(v) : Integer.parseIntRadix(v, 10));
this.valueOf=function(){return v;};
});

//Long.MIN_VALUE=Long.prototype.MIN_VALUE=-0x8000000000000000;
//Long.MAX_VALUE=Long.prototype.MAX_VALUE=0x7fffffffffffffff;
Long.TYPE=Long.prototype.TYPE=Long;

Clazz_defineMethod(Long,"parseLong",
function(s,radix){
 return Integer.parseInteger(s, radix || 10);
});

Long.parseLong=Long.prototype.parseLong;

Clazz_overrideMethod(Long,"$valueOf",
function(s){
return new Long(s);
});
/*
Clazz_defineMethod(Long,"$valueOf",
function(s){
return new Long(s);
},"Number");

Clazz_defineMethod(Long,"$valueOf",
function(s,r){
return new Long(Long.parseLong(s,r));
},"String, Number");
*/
Long.$valueOf=Long.prototype.$valueOf;
Clazz_overrideMethod(Long,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Long)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");
Long.toHexString=Long.prototype.toHexString=function(i){
return i.toString(16);
};
Long.toOctalString=Long.prototype.toOctalString=function(i){
return i.toString(8);
};
Long.toBinaryString=Long.prototype.toBinaryString=function(i){
return i.toString(2);
};


Long.decode=Clazz_defineMethod(Long,"decode",
function(n){
	n = Integer.decodeRaw(n);
	if (isNaN(n))
		throw new NumberFormatException("Invalid Long");
	return new Long(n);
},"~S");

java.lang.Short = Short = function () {
Clazz_instantialize (this, arguments);
};
Clazz_decorateAsType (Short, "Short", Number, Comparable, null, true);
Short.prototype.valueOf = function () { return 0; };
Short.toString = Short.prototype.toString = function () {
	if (arguments.length != 0) {
		return "" + arguments[0];
	} else if (this === Short) {
		return "class java.lang.Short"; // Short.class.toString
	}
	return "" + this.valueOf ();
};

Clazz_overrideConstructor(Short,
function (v) {
 v == null && (v = 0);
 if (typeof v != "number")
	v = Integer.parseIntRadix(v, 10);
 v = v.shortValue();
 this.valueOf = function () {return v;};
});


Short.MIN_VALUE = Short.prototype.MIN_VALUE = -32768;
Short.MAX_VALUE = Short.prototype.MAX_VALUE = 32767;
Short.TYPE = Short.prototype.TYPE = Short;

Clazz_defineMethod(Short, "parseShortRadix",
function (s, radix) {
return Integer.parseIntRadix(s, radix).shortValue();
}, "String, Number");
Short.parseShortRadix = Short.prototype.parseShortRadix;

Clazz_defineMethod(Short, "parseShort",
function (s) {
return Short.parseShortRadix (s, 10);
}, "String");

Short.parseShort = Short.prototype.parseShort;

/*
Clazz_defineMethod(Short, "$valueOf",
function (s) {
return new Short(Short.parseShort (s, 10));
}, "String");
	*/

Clazz_overrideMethod(Short, "$valueOf",
function (s) {
return new Short(s);
});

/*
Clazz_defineMethod(Short, "$valueOf",
function (s, r) {
return new Short(Short.parseShort (s, r));
}, "String, Number");
	*/

Short.$valueOf = Short.prototype.$valueOf;
Clazz_overrideMethod(Short, "equals",
function (s) {
if(s == null || !Clazz_instanceOf(s, Short) ){
	return false;
}
return s.valueOf()  == this.valueOf();
}, "Object");
Short.toHexString = Short.prototype.toHexString = function (i) {
	return i.toString (16);
};
Short.toOctalString = Short.prototype.toOctalString = function (i) {
	return i.toString (8);
};
Short.toBinaryString = Short.prototype.toBinaryString = function (i) {
	return i.toString (2);
};
Short.decode = Clazz_defineMethod(Short, "decode",
function(n){
	n = Integer.decodeRaw(n);
	if (isNaN(n) || n < -32768|| n > 32767)
		throw new NumberFormatException("Invalid Short");
	return new Short(n);
}, "~S");

java.lang.Byte=Byte=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Byte,"Byte",Number,Comparable,null,true);
Byte.prototype.valueOf=function(){return 0;};
Byte.toString=Byte.prototype.toString=function(){
if(arguments.length!=0){
return""+arguments[0];
}else if(this===Byte){
return"class java.lang.Byte";
}
return""+this.valueOf();
};
Clazz_makeConstructor(Byte,
function(v){
 if (typeof v != "number")
	 v = Integer.parseIntRadix(v, 10);
 v = v.byteValue();
this.valueOf=function(){
return v;
};
});

Byte.serialVersionUID=Byte.prototype.serialVersionUID=-7183698231559129828;
Byte.MIN_VALUE=Byte.prototype.MIN_VALUE=-128;
Byte.MAX_VALUE=Byte.prototype.MAX_VALUE=127;
Byte.SIZE=Byte.prototype.SIZE=8;
Byte.TYPE=Byte.prototype.TYPE=Byte;

Clazz_defineMethod(Byte,"parseByteRadix",
function(s,radix){
 return Integer.parseIntRadix(s, radix).byteValue();
},"String, Number");
Byte.parseByteRadix=Byte.prototype.parseByteRadix;

Clazz_defineMethod(Byte,"parseByte",
function(s){
return Byte.parseByte(s,10);
},"String");

Byte.parseByte=Byte.prototype.parseByte;

Clazz_overrideMethod(Byte, "$valueOf",
function (s) {
return new Byte(s);
});

Byte.$valueOf=Byte.prototype.$valueOf;
Clazz_overrideMethod(Byte,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Byte)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");
Byte.toHexString=Byte.prototype.toHexString=function(i){
return i.toString(16);
};
Byte.toOctalString=Byte.prototype.toOctalString=function(i){
return i.toString(8);
};
Byte.toBinaryString=Byte.prototype.toBinaryString=function(i){
return i.toString(2);
};
Byte.decode=Clazz_defineMethod(Byte,"decode",
function(n){
	n = Integer.decodeRaw(n);
	if (isNaN(n) || n < -128|| n > 127)
		throw new NumberFormatException("Invalid Byte");
return new Byte(n);
},"~S");

Clazz._floatToString = function(f) {
 var s = ""+f
 if (s.indexOf(".") < 0 && s.indexOf("e") < 0)
 	 s += ".0";
 return s;
}

java.lang.Float=Float=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Float,"Float",Number,Comparable,null,true);
Float.prototype.valueOf=function(){return 0;};
Float.toString=Float.prototype.toString=function(){
if(arguments.length!=0){
return Clazz._floatToString(arguments[0]);
}else if(this===Float){
return"class java.lang.Float";
}
return Clazz._floatToString(this.valueOf());
};

Clazz_overrideConstructor(Float, function(v){
 v == null && (v = 0);
 if (typeof v != "number") 
	v = Number(v);
 this.valueOf=function(){return v;}
});

Float.serialVersionUID=Float.prototype.serialVersionUID=-2671257302660747028;
Float.MIN_VALUE=Float.prototype.MIN_VALUE=3.4028235e+38;
Float.MAX_VALUE=Float.prototype.MAX_VALUE=1.4e-45;
Float.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
Float.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
Float.NaN=Number.NaN;
Float.TYPE=Float.prototype.TYPE=Float;

Clazz_defineMethod(Float,"parseFloat",
function(s){
if(s==null){
throw new NumberFormatException("null");
}
if (typeof s == "number")return s;  // important -- typeof NaN is "number" and is OK here
var floatVal=Number(s);
if(isNaN(floatVal)){
throw new NumberFormatException("Not a Number : "+s);
}
return floatVal;
},"String");
Float.parseFloat=Float.prototype.parseFloat;

Clazz_overrideMethod(Float,"$valueOf",
function(s){
return new Float(s);
});

Float.$valueOf=Float.prototype.$valueOf;

Clazz_defineMethod(Float,"isNaN",
function(num){
return isNaN(num);
},"Number");
Float.isNaN=Float.prototype.isNaN;
Clazz_defineMethod(Float,"isInfinite",
function(num){
return!isFinite(num);
},"Number");
Float.isInfinite=Float.prototype.isInfinite;

Clazz_overrideMethod(Float,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Float)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");

java.lang.Double=Double=function(){
Clazz_instantialize(this,arguments);
};
Clazz_decorateAsType(Double,"Double",Number,Comparable,null,true);
Double.prototype.valueOf=function(){return 0;};
Double.toString=Double.prototype.toString=function(){
if(arguments.length!=0){
return Clazz._floatToString(arguments[0]);
}else if(this===Double){
return"class java.lang.Double";
}
return Clazz._floatToString(this.valueOf());
};

Clazz_overrideConstructor(Double, function(v){
 v == null && (v = 0);
 if (typeof v != "number") 
	v = Double.parseDouble(v);
 this.valueOf=function(){return v;};
}); // BH

Double.serialVersionUID=Double.prototype.serialVersionUID=-9172774392245257468;
Double.MIN_VALUE=Double.prototype.MIN_VALUE=4.9e-324;
Double.MAX_VALUE=Double.prototype.MAX_VALUE=1.7976931348623157e+308;
Double.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY;
Double.POSITIVE_INFINITY=Number.POSITIVE_INFINITY;
Double.NaN=Number.NaN;
Double.TYPE=Double.prototype.TYPE=Double;

Clazz_defineMethod(Double,"isNaN",
function(num){
return isNaN(num);
},"Number");
Double.isNaN=Double.prototype.isNaN;
Clazz_defineMethod(Double,"isInfinite",
function(num){
return!isFinite(num);
},"Number");
Double.isInfinite=Double.prototype.isInfinite;

Clazz_defineMethod(Double,"parseDouble",
function(s){
if(s==null){
throw new NumberFormatException("null");
}
if (typeof s == "number")return s;  // important -- typeof NaN is "number" and is OK here
var doubleVal=Number(s);
if(isNaN(doubleVal)){
throw new NumberFormatException("Not a Number : "+s);
}
return doubleVal;
},"String");
Double.parseDouble=Double.prototype.parseDouble;

/*
Clazz_defineMethod(Double,"$valueOf",
function(s){
return new Double(this.parseDouble(s));
},"String");
*/

Clazz_defineMethod(Double,"$valueOf",
function(v){
return new Double(v);
},"Number");

Double.$valueOf=Double.prototype.$valueOf;

Clazz_overrideMethod(Double,"equals",
function(s){
if(s==null||!Clazz_instanceOf(s,Double)){
return false;
}
return s.valueOf()==this.valueOf();
},"Object");


//java.lang.B00lean = Boolean; ?? BH why this?
Boolean = java.lang.Boolean = Boolean || function () {Clazz_instantialize (this, arguments);};
if (Clazz._supportsNativeObject) {
	for (var i = 0; i < Clazz._extendedObjectMethods.length; i++) {
		var p = Clazz._extendedObjectMethods[i];
		Boolean.prototype[p] = Clazz._O.prototype[p];
	}
}
Boolean.__CLASS_NAME__="Boolean";
Clazz_implementOf(Boolean,[java.io.Serializable,java.lang.Comparable]);
Boolean.equals=Clazz._innerFunctions.equals;
Boolean.getName=Clazz._innerFunctions.getName;
Boolean.serialVersionUID=Boolean.prototype.serialVersionUID=-3665804199014368530;

//Clazz_makeConstructor(Boolean,
//function(value){
//this.valueOf=function(){
//return value;
//};
//},"~B");

Clazz_overrideConstructor(Boolean,
function(s){
	var b = ((typeof s == "string" ? Boolean.toBoolean(s) : s) ? true : false);
	this.valueOf=function(){return b;};
},"~O");

Boolean.parseBoolean=Clazz_defineMethod(Boolean,"parseBoolean",
function(s){
return Boolean.toBoolean(s);
},"~S");
Clazz_defineMethod(Boolean,"booleanValue",
function(){
return this.valueOf();
});
Boolean.$valueOf=Clazz_overrideMethod(Boolean,"$valueOf",
function(b){
return((typeof b == "string"? "true".equalsIgnoreCase(b) : b)?Boolean.TRUE:Boolean.FALSE);
});

/*
Boolean.toString=Clazz_defineMethod(Boolean,"toString",
function(b){
return b?"true":"false";
},"~B");
*/

Clazz_overrideMethod(Boolean,"toString",
function(){
return this.valueOf()?"true":"false";
});
Clazz_overrideMethod(Boolean,"hashCode",
function(){
return this.valueOf()?1231:1237;
});
Clazz_overrideMethod(Boolean,"equals",
function(obj){
if(Clazz_instanceOf(obj,Boolean)){
return this.booleanValue()==obj.booleanValue();
}return false;
},"~O");
Boolean.getBoolean=Clazz_defineMethod(Boolean,"getBoolean",
function(name){
var result=false;
try{
result=Boolean.toBoolean(System.getProperty(name));
}catch(e){
if(Clazz_instanceOf(e,IllegalArgumentException)){
}else if(Clazz_instanceOf(e,NullPointerException)){
}else{
throw e;
}
}
return result;
},"~S");
Clazz_overrideMethod(Boolean,"compareTo",
function(b){
return(b.value==this.value?0:(this.value?1:-1));
},"Boolean");
Boolean.toBoolean=Clazz_defineMethod(Boolean,"toBoolean",
($fz=function(name){
return((name!=null)&&name.equalsIgnoreCase("true"));
},$fz.isPrivate=true,$fz),"~S");
Boolean.TRUE=Boolean.prototype.TRUE=new Boolean(true);
Boolean.FALSE=Boolean.prototype.FALSE=new Boolean(false);
Boolean.TYPE=Boolean.prototype.TYPE=Boolean;


Clazz._Encoding=new Object();

(function(Encoding) {

Encoding.UTF8="utf-8";
Encoding.UTF16="utf-16";
Encoding.ASCII="ascii";


Encoding.guessEncoding=function(str){
if(str.charCodeAt(0)==0xEF&&str.charCodeAt(1)==0xBB&&str.charCodeAt(2)==0xBF){
return Encoding.UTF8;
}else if(str.charCodeAt(0)==0xFF&&str.charCodeAt(1)==0xFE){
return Encoding.UTF16;
}else{
return Encoding.ASCII;
}
};

Encoding.readUTF8=function(str){
var encoding=this.guessEncoding(str);
var startIdx=0;
if(encoding==Encoding.UTF8){
startIdx=3;
}else if(encoding==Encoding.UTF16){
startIdx=2;
}
var arrs=new Array();
for(var i=startIdx;i<str.length;i++){
var charCode=str.charCodeAt(i);
if(charCode<0x80){
arrs[arrs.length]=str.charAt(i);
}else if(charCode>0xc0&&charCode<0xe0){
var c1=charCode&0x1f;
i++;
var c2=str.charCodeAt(i)&0x3f;
var c=(c1<<6)+c2;
arrs[arrs.length]=String.fromCharCode(c);
}else if(charCode>=0xe0){
var c1=charCode&0x0f;
i++;
var c2=str.charCodeAt(i)&0x3f;
i++;
var c3=str.charCodeAt(i)&0x3f;
var c=(c1<<12)+(c2<<6)+c3;
arrs[arrs.length]=String.fromCharCode(c);
}
}
return arrs.join('');
};

Encoding.convert2UTF8=function(str){
var encoding=this.guessEncoding(str);
var startIdx=0;
if(encoding==Encoding.UTF8){
return str;
}else if(encoding==Encoding.UTF16){
startIdx=2;
}

var offset=0;
var arrs=new Array(offset+str.length-startIdx);

for(var i=startIdx;i<str.length;i++){
var charCode=str.charCodeAt(i);
if(charCode<0x80){
arrs[offset+i-startIdx]=str.charAt(i);
}else if(charCode<=0x07ff){
var c1=0xc0+((charCode&0x07c0)>>6);
var c2=0x80+(charCode&0x003f);
arrs[offset+i-startIdx]=String.fromCharCode(c1)+String.fromCharCode(c2);
}else{
var c1=0xe0+((charCode&0xf000)>>12);
var c2=0x80+((charCode&0x0fc0)>>6);
var c3=0x80+(charCode&0x003f);
arrs[offset+i-startIdx]=String.fromCharCode(c1)+String.fromCharCode(c2)+String.fromCharCode(c3);
}
}
return arrs.join('');
};
Encoding.base64Chars=new Array(
'A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X',
'Y','Z','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v',
'w','x','y','z','0','1','2','3',
'4','5','6','7','8','9','+','/'
);
Encoding.encodeBase64=function(str){
if(str==null||str.length==0)return str;
var b64=Encoding.base64Chars;
var length=str.length;
var index=0;
var buf=[];
var c0,c1,c2;
while(index<length){
c0=str.charCodeAt(index++);
buf[buf.length]=b64[c0>>2];
if(index<length){
c1=str.charCodeAt(index++);
buf[buf.length]=b64[((c0<<4)&0x30)|(c1>>4)];
if(index<length){
c2=str.charCodeAt(index++);
buf[buf.length]=b64[((c1<<2)&0x3c)|(c2>>6)];
buf[buf.length]=b64[c2&0x3F];
}else{
buf[buf.length]=b64[((c1<<2)&0x3c)];
buf[buf.length]='=';
}
}else{
buf[buf.length]=b64[(c0<<4)&0x30];
buf[buf.length]='=';
buf[buf.length]='=';
}
}
return buf.join('');
};
Encoding.decodeBase64=function(str){
if(str==null||str.length==0)return str;
var b64=Encoding.base64Chars;
var xb64=Encoding.xBase64Chars;
if(Encoding.xBase64Chars==null){
xb64=new Object();
for(var i=0;i<b64.length;i++){
xb64[b64[i]]=i;
}
Encoding.xBase64Chars=xb64;
}
var length=str.length;
var index=0;
var buf=[];
var c0,c1,c2,c3;
var c=0;
while(index<length&&c++<60000){
c0=xb64[str.charAt(index++)];
c1=xb64[str.charAt(index++)];
c2=xb64[str.charAt(index++)];
c3=xb64[str.charAt(index++)];
buf[buf.length]=String.fromCharCode(((c0<<2)&0xff)|c1>>4);
if(c2!=null){
buf[buf.length]=String.fromCharCode(((c1<<4)&0xff)|c2>>2);
if(c3!=null){
buf[buf.length]=String.fromCharCode(((c2<<6)&0xff)|c3);
}
}
}
return buf.join('');
};

if(String.prototype.$replace==null){
java.lang.String=String;
if(Clazz._supportsNativeObject){
for(var i=0;i<Clazz._extendedObjectMethods.length;i++){
var p=Clazz._extendedObjectMethods[i];
if("to$tring"==p||"toString"==p||"equals"==p||"hashCode"==p){
continue;
}
String.prototype[p]=Clazz._O.prototype[p];
}
}

Clazz_implementOf(String,[java.io.Serializable,CharSequence,Comparable]);

String.getName=Clazz._innerFunctions.getName;

String.serialVersionUID=String.prototype.serialVersionUID=-6849794470754667710;


;(function(sp) {

sp.$replace=function(c1,c2){
	if (c1 == c2 || this.indexOf (c1) < 0) return "" + this;
	if (c1.length == 1) {
		if ("\\$.*+|?^{}()[]".indexOf(c1) >= 0) 	c1 = "\\" + c1;
	} else {    
		c1=c1.replace(/([\\\$\.\*\+\|\?\^\{\}\(\)\[\]])/g,function($0,$1){return"\\"+$1;});
	}
	return this.replace(new RegExp(c1,"gm"),c2);
};
sp.$generateExpFunction=function(str){
var arr=[];
var orders=[];
var idx=0;
arr[0]="";
var i=0;
for(;i<str.length;i++){
var ch=str.charAt(i);
if(i!=str.length-1&&ch=='\\'){
i++;
var c=str.charAt(i);
if(c=='\\'){
arr[idx]+='\\';
}
arr[idx]+=c;
}else if(i!=str.length-1&&ch=='$'){
i++;
orders[idx]=parseInt(str.charAt(i));
idx++;
arr[idx]="";
}else if(ch=='\r'){
arr[idx]+="\\r";
}else if(ch=='\n'){
arr[idx]+="\\n";
}else if(ch=='\t'){
arr[idx]+="\\t";
}else if(ch=='\"'){
arr[idx]+="\\\"";
}else{
arr[idx]+=ch;
}
}
var funStr="f = function (";
var max=Math.max.apply({},orders);
for(i=0;i<=max;i++){
funStr+="$"+i;
if(i!=max){
funStr+=", ";
}
}
funStr+=") { return ";
for(i=0;i<arr.length-1;i++){
funStr+="\""+arr[i]+"\" + $"+orders[i]+" + ";
}
funStr+="\""+arr[i]+"\"; }";
var f=null;
eval(funStr)
return f;
};

sp.replaceAll=function(exp,str){
var regExp=new RegExp(exp,"gm");
return this.replace(regExp,this.$generateExpFunction(str));
};
sp.replaceFirst=function(exp,str){
var regExp=new RegExp(exp,"m");
return this.replace(regExp,this.$generateExpFunction(str));
};
sp.matches=function(exp){
if(exp!=null){
exp="^("+exp+")$";
}
var regExp=new RegExp(exp,"gm");
var m=this.match(regExp);
return m!=null&&m.length!=0;
};
sp.regionMatches=function(ignoreCase,toffset,
other,ooffset,len){

if(typeof ignoreCase=="number"
||(ignoreCase!=true&&ignoreCase!=false)){
len=ooffset;
ooffset=other;
other=toffset;
toffset=ignoreCase;
ignoreCase=false;
}
var to=toffset;
var po=ooffset;

if((ooffset<0)||(toffset<0)||(toffset>this.length-len)||
(ooffset>other.length-len)){
return false;
}
var s1=this.substring(toffset,toffset+len);
var s2=other.substring(ooffset,ooffset+len);
if(ignoreCase){
s1=s1.toLowerCase();
s2=s2.toLowerCase();
}
return s1==s2;
};



sp.$plit=function(regex,limit){
if (!limit && regex == " ")
	return this.split(regex);

if(limit!=null&&limit>0){
if(limit==1){
return this;
}
var regExp=new RegExp("("+regex+")","gm");
var count=1;
var s=this.replace(regExp,function($0,$1){
count++;
if(count==limit){
return"@@_@@";
}else if(count>limit){
return $0;
}else{
return $0;
}
});
regExp=new RegExp(regex,"gm");
var arr=this.split(regExp);
if(arr.length>limit){
arr[limit-1]=s.substring(s.indexOf("@@_@@")+5);
arr.length=limit;
}
return arr;
}else{
var regExp=new RegExp(regex,"gm");
return this.split(regExp);
}
};
/*
sp.trim=function(){
var len=this.length;
var st=0;

while((st<len)&&(this.charAt(st)<=' ')){
st++;
}
while((st<len)&&(this.charAt(len-1)<=' ')){
len--;
}
return((st>0)||(len<len))?this.substring(st,len):this;
};


*/

if (!sp.trim)
sp.trim=function(){
return this.replace(/^\s+/g,'').replace(/\s+$/g,'');
};

if (!sp.startsWith || !sp.endsWith) {
var sn=function(s, prefix,toffset){
var to=toffset;
var po=0;
var pc=prefix.length;

if((toffset<0)||(toffset>s.length-pc)){
return false;
}
while(--pc>=0){
if(s.charAt(to++)!=prefix.charAt(po++)){
return false;
}
}
return true;
};

sp.startsWith=function(prefix){
if(arguments.length==1){
return sn(this,arguments[0],0);
}else if(arguments.length==2){
return sn(this,arguments[0],arguments[1]);
}else{
return false;
}
};

sp.endsWith=function(suffix){
return sn(this, suffix,this.length-suffix.length);
};

}

sp.equals=function(anObject){
return this.valueOf()==anObject;
};

sp.equalsIgnoreCase=function(anotherString){
return(anotherString==null)?false:(this==anotherString
||this.toLowerCase()==anotherString.toLowerCase());
};


sp.hash=0;

sp.hashCode=function(){
var h=this.hash;
if(h==0){
var off=0;
var len=this.length;
for(var i=0;i<len;i++){
h=31*h+this.charCodeAt(off++);
h&=0xffffffff;
}
this.hash=h;
}
return h;
};

sp.getBytes=function(){
if(arguments.length==4){
return this.getChars(arguments[0],arguments[1],arguments[2],arguments[3]);
}
var s=this;
if(arguments.length==1){
var cs=arguments[0].toString().toLowerCase();
var charset=[
"utf-8","UTF8","us-ascii","iso-8859-1","8859_1","gb2312","gb18030","gbk"
];
var existed=false;
for(var i=0;i<charset.length;i++){
if(charset[i]==cs){
existed=true;
break;
}
}
if(!existed){
throw new java.io.UnsupportedEncodingException();
}
if(cs=="utf-8"||cs=="utf8"){
s=Encoding.convert2UTF8(this);
}
}
var arrs=new Array(s.length);
var c=0,ii=0;
for(var i=0;i<s.length;i++){
c=s.charCodeAt(i);
if(c>255){
arrs[ii]=0x1a;
arrs[ii+1]=c&0xff;
arrs[ii+2]=(c&0xff00)>>8;
ii+=2;
}else{
arrs[ii]=c;
}
ii++;
}
return arrs;
};

/*
sp.compareTo=function(anotherString){
if(anotherString==null){
throw new java.lang.NullPointerException();
}
var len1=this.length;
var len2=anotherString.length;
var n=Math.min(len1,len2);
var k=0;
while(k<n){
var c1=this.charCodeAt(k);
var c2=anotherString.charCodeAt(k);
if(c1!=c2){
return c1-c2;
}
k++;
}
return len1-len2;
};

*/

sp.contains = function(a) {return this.indexOf(a) >= 0}  // bh added
sp.compareTo = function(a){return this > a ? 1 : this < a ? -1 : 0} // bh added



sp.toCharArray=function(){
var result=new Array(this.length);
for(var i=0;i<this.length;i++){
result[i]=this.charAt(i);
}
return result;
};
String.value0f=String.valueOf;
String.valueOf=function(o){
if(o=="undefined"){
return String.value0f();
}
if(o instanceof Array){
if(arguments.length==1){
return o.join('');
}else{
var off=arguments[1];
var len=arguments[2];
var oo=new Array(len);
for(var i=0;i<len;i++){
oo[i]=o[off+i];
}
return oo.join('');
}
}
return""+o;
};

sp.subSequence=function(beginIndex,endIndex){
return this.substring(beginIndex,endIndex);
};

sp.compareToIgnoreCase=function(str){
if(str==null){
throw new NullPointerException();
}
var s1=this.toUpperCase();
var s2=str.toUpperCase();
if(s1==s2){
return 0;
}else{
var s1=this.toLowerCase();
var s2=str.toLowerCase();
if(s1==s2){
return 0;
}else if(s1>s2){
return 1;
}else{
return-1;
}
}
};

sp.contentEquals=function(sb){
if(this.length!=sb.length()){
return false;
}
var v=sb.getValue();
var i=0;
var j=0;
var n=this.length;
while(n--!=0){
if(this.charCodeAt(i++)!=v[j++]){
return false;
}
}
return true;
};

sp.getChars=function(srcBegin,srcEnd,dst,dstBegin){
if(srcBegin<0){
throw new StringIndexOutOfBoundsException(srcBegin);
}
if(srcEnd>this.length){
throw new StringIndexOutOfBoundsException(srcEnd);
}
if(srcBegin>srcEnd){
throw new StringIndexOutOfBoundsException(srcEnd-srcBegin);
}
if(dst==null){
throw new NullPointerException();
}
for(var i=0;i<srcEnd-srcBegin;i++){
dst[dstBegin+i]=this.charAt(srcBegin+i);
}
};
sp.$concat=sp.concat;
sp.concat=function(s){
if(s==null){
throw new NullPointerException();
}
return this.$concat(s);
};

sp.$lastIndexOf=sp.lastIndexOf;
sp.lastIndexOf=function(s,last){
if(last!=null&&last+this.length<=0){
return-1;
}
if(last!=null){
return this.$lastIndexOf(s,last);
}else{
return this.$lastIndexOf(s);
}
};

sp.intern=function(){
return this.valueOf();
};
String.copyValueOf=sp.copyValueOf=function(){
if(arguments.length==1){
return String.instantialize(arguments[0]);
}else{
return String.instantialize(arguments[0],arguments[1],arguments[2]);
}
};

sp.codePointAt || (sp.codePointAt = sp.charCodeAt); // Firefox only


})(String.prototype);

/*

String.indexOf=function(source,sourceOffset,sourceCount,
target,targetOffset,targetCount,fromIndex){
if(fromIndex>=sourceCount){
return(targetCount==0?sourceCount:-1);
}
if(fromIndex<0){
fromIndex=0;
}
if(targetCount==0){
return fromIndex;
}

var first=target[targetOffset];
var i=sourceOffset+fromIndex;
var max=sourceOffset+(sourceCount-targetCount);

startSearchForFirstChar:
while(true){

while(i<=max&&source[i]!=first){
i++;
}
if(i>max){
return-1;
}


var j=i+1;
var end=j+targetCount-1;
var k=targetOffset+1;
while(j<end){
if(source[j++]!=target[k++]){
i++;

continue startSearchForFirstChar;
}
}
return i-sourceOffset;
}
};



String.instantialize=function(){
if(arguments.length==0){
return new String();
}else if(arguments.length==1){
var x=arguments[0];
if(typeof x=="string"||x instanceof String){
return new String(x);
}else if(x instanceof Array){
if(x.length>0&&typeof x[0]=="number"){
var arr=new Array(x.length);
for(var i=0;i<x.length;i++){
arr[i]=String.fromCharCode(x[i]&0xff);
}
return Encoding.readUTF8(arr.join(''));
}
return x.join('');
}else if(x.__CLASS_NAME__=="StringBuffer"
||x.__CLASS_NAME__=="java.lang.StringBuffer"){
var value=x.shareValue();
var length=x.length();
var valueCopy=new Array(length);
for(var i=0;i<length;i++){
valueCopy[i]=value[i];
}
return valueCopy.join('')

}else{
return""+x;
}
}else if(arguments.length==2){
var x=arguments[0];
var hibyte=arguments[1];
if(typeof hibyte=="string"){
return String.instantialize(x,0,x.length,hibyte);
}else{
return String.instantialize(x,hibyte,0,x.length);
}
}else if(arguments.length==3){
var bytes=arguments[0];
var offset=arguments[1];
var length=arguments[2];
if(arguments[2]instanceof Array){
bytes=arguments[2];
offset=arguments[0];
length=arguments[1];
}
var arr=new Array(length);
if(offset<0||length+offset>bytes.length){
throw new IndexOutOfBoundsException();
}
if(length>0){
var isChar=(bytes[offset].length!=null);
if(isChar){
for(var i=0;i<length;i++){
arr[i]=bytes[offset+i];
}
}else{
for(var i=0;i<length;i++){
arr[i]=String.fromCharCode(bytes[offset+i]);
}
}
}
return arr.join('');
}else if(arguments.length==4){
var bytes=arguments[0];
var y=arguments[3];
if(typeof y=="string"||y instanceof String){
var offset=arguments[1];
var length=arguments[2];
var arr=new Array(length);
for(var i=0;i<length;i++){
arr[i]=bytes[offset+i];
if(typeof arr[i]=="number"){
arr[i]=String.fromCharCode(arr[i]&0xff);
}
}
var cs=y.toLowerCase();
if(cs=="utf-8"||cs=="utf8"){
return Encoding.readUTF8(arr.join(''));
}else{
return arr.join('');
}
}else{
var count=arguments[3];
var offset=arguments[2];
var hibyte=arguments[1];
var value=new Array(count);
if(hibyte==0){
for(var i=count;i-->0;){
value[i]=String.fromCharCode(bytes[i+offset]&0xff);
}
}else{
hibyte<<=8;
for(var i=count;i-->0;){
value[i]=String.fromCharCode(hibyte|(bytes[i+offset]&0xff));
}
}
return value.join('');
}
}else{
var s="";
for(var i=0;i<arguments.length;i++){
s+=arguments[i];
}
return s;
}
};


*/


String.instantialize=function(){
switch (arguments.length) {
case 0:
	return new String();
case 1:
	var x=arguments[0];
	if(typeof x=="string"||x instanceof String){
		return new String(x);
	}
	if(x instanceof Array || x instanceof Int32Array){
		if(x.length == 0)
			return "";
		if(typeof x[0]!="number")
			return x.join('');
		var arr=new Array(x.length);
		for(var i=0;i<x.length;i++)
			arr[i]=String.fromCharCode(x[i]&0xff);
		return Encoding.readUTF8(arr.join(''));
	}
	if(x.__CLASS_NAME__=="StringBuffer"||x.__CLASS_NAME__=="java.lang.StringBuffer"){
		var value=x.shareValue();
		var length=x.length();
		var valueCopy=new Array(length);
		for(var i=0;i<length;i++){
			valueCopy[i]=value[i];
		}
		return valueCopy.join('')
	}
	return""+x;
case 2:	
	var x=arguments[0];
	var hibyte=arguments[1];
	if(typeof hibyte=="string"){
		return String.instantialize(x,0,x.length,hibyte);
	}
	return String.instantialize(x,hibyte,0,x.length);
case 3:
	var bytes=arguments[0];
	var offset=arguments[1];
	var length=arguments[2];
	if(arguments[2]instanceof Array){
		bytes=arguments[2];
		offset=arguments[0];
		length=arguments[1];
	}
	var arr=new Array(length);
	if(offset<0||length+offset>bytes.length){
		throw new IndexOutOfBoundsException();
	}
	if(length>0){
		var isChar=(bytes[offset].length!=null);
		if(isChar){
			for(var i=0;i<length;i++){
				arr[i]=bytes[offset+i];
			}
		}else{
			for(var i=0;i<length;i++){
				arr[i]=String.fromCharCode(bytes[offset+i]);
			}
		}
	}
	return arr.join('');
case 4:
	var bytes=arguments[0];
	var y=arguments[3];
	if(typeof y=="string"||y instanceof String){
		var offset=arguments[1];
		var length=arguments[2];
		var arr=new Array(length);
		for(var i=0;i<length;i++){
			arr[i]=bytes[offset+i];
			if(typeof arr[i]=="number"){
				arr[i]=String.fromCharCode(arr[i]&0xff);
			}
		}
		var cs=y.toLowerCase();
		if(cs=="utf-8"||cs=="utf8"){
			return Encoding.readUTF8(arr.join(''));
		}
		return arr.join('');
	}
	var count=arguments[3];
	var offset=arguments[2];
	var hibyte=arguments[1];
	var value=new Array(count);
	if(hibyte==0){
		for(var i=count;i-->0;){
			value[i]=String.fromCharCode(bytes[i+offset]&0xff);
		}
	}else{
		hibyte<<=8;
		for(var i=count;i-->0;){
			value[i]=String.fromCharCode(hibyte|(bytes[i+offset]&0xff));
		}
	}
	return value.join('');
default:
	var s="";
	for(var i=0;i<arguments.length;i++){
		s+=arguments[i];
	}
	return s;
}
};

if(navigator.userAgent.toLowerCase().indexOf("chrome")!=-1){
	String.prototype.toString=function(){return this.valueOf();};
}

}

})(Clazz._Encoding);



c$=Clazz_decorateAsClass(function(){
this.value=0;
Clazz_instantialize(this,arguments);
},java.lang,"Character",null,[java.io.Serializable,Comparable]);
Clazz_makeConstructor(c$,
function(value){
this.value=value;
},"~N");
Clazz_defineMethod(c$,"charValue",
function(){
return this.value;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return(this.value).charCodeAt(0);
});
Clazz_overrideMethod(c$,"equals",
function(obj){
if(Clazz_instanceOf(obj,Character)){
return(this.value).charCodeAt(0)==((obj).charValue()).charCodeAt(0);
}return false;
},"~O");
Clazz_overrideMethod(c$,"compareTo",
function(c){
return(this.value).charCodeAt(0)-(c.value).charCodeAt(0);
},"Character");
c$.toLowerCase=Clazz_defineMethod(c$,"toLowerCase",
function(c){
return(""+c).toLowerCase().charAt(0);
},"~N");
c$.toUpperCase=Clazz_defineMethod(c$,"toUpperCase",
function(c){
return(""+c).toUpperCase().charAt(0);
},"~N");
c$.isDigit=Clazz_defineMethod(c$,"isDigit",
function(c){
c = c.charCodeAt(0);
return (48 <= c && c <= 57);
},"~N");
c$.isUpperCase=Clazz_defineMethod(c$,"isUpperCase",
function(c){
c = c.charCodeAt(0);
return (65 <= c && c <= 90);
},"~N");
c$.isLowerCase=Clazz_defineMethod(c$,"isLowerCase",
function(c){
c = c.charCodeAt(0);
return (97 <= c && c <= 122);
},"~N");
c$.isWhitespace=Clazz_defineMethod(c$,"isWhitespace",
function(c){
c = (c).charCodeAt(0);
return (c >= 0x1c && c <= 0x20 || c >= 0x9 && c <= 0xd || c == 0x1680
	|| c >= 0x2000 && c != 0x2007 && (c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x3000));
},"~N");
c$.isLetter=Clazz_defineMethod(c$,"isLetter",
function(c){
c = c.charCodeAt(0);
return (65 <= c && c <= 90 || 97 <= c && c <= 122);
},"~N");
c$.isLetterOrDigit=Clazz_defineMethod(c$,"isLetterOrDigit",
function(c){
c = c.charCodeAt(0);
return (65 <= c && c <= 90 || 97 <= c && c <= 122 || 48 <= c && c <= 57);
},"~N");
c$.isSpaceChar=Clazz_defineMethod(c$,"isSpaceChar",
function(c){
 var i = c.charCodeAt(0);
if(i==0x20||i==0xa0||i==0x1680)return true;
if(i<0x2000)return false;
returni<=0x200b||i==0x2028||i==0x2029||i==0x202f||i==0x3000;
},"~N");
c$.digit=Clazz_defineMethod(c$,"digit",
function(c,radix){
var i = c.charCodeAt(0);
if(radix >= 2 && radix <= 36){
	if(i < 128){
		var result = -1;
		if(48 <= i && i <= 57){
		result = i - 48;
		}else if(97 <= i && i <= 122){
		result = i - 87;
		}else if(65 <= i && i <= 90){
		result=i-(55);
		}
		return (result < radix ? result : -1);
	}
}
return -1;
},"~N,~N");
Clazz_overrideMethod(c$,"toString",
function(){
var buf=[this.value];
return String.valueOf(buf);
});
c$.toString=Clazz_overrideMethod(c$,"toString",
function(c){
{
if(this===Character){
return"class java.lang.Character";
}
}return String.valueOf(c);
},"~N");
Clazz_defineStatics(c$,
"MIN_VALUE",'\u0000',
"MAX_VALUE",'\uffff',
"MIN_RADIX",2,
"MAX_RADIX",36,
"TYPE",null);

java.lang.Character.TYPE=java.lang.Character.prototype.TYPE=java.lang.Character;
Array.getComponentType=function(){
return Object;
};c$=Clazz_declareType(java.lang.reflect,"Array");
c$.newInstance=Clazz_defineMethod(c$,"newInstance",
function(componentType,size){
return Clazz_newArray(length);
},"Class,~N");

javautil.Date=Date;
Date.TYPE="javautil.Date";
Date.__CLASS_NAME__="Date";
Clazz_implementOf(Date,[java.io.Serializable,java.lang.Comparable]);

Clazz_defineMethod(javautil.Date,"clone",
function(){
return new Date(this.getTime());
});

Clazz_defineMethod(javautil.Date,"before",
function(when){
return this.getTime()<when.getTime();
},"javautil.Date");
Clazz_defineMethod(javautil.Date,"after",
function(when){
return this.getTime()>when.getTime();
},"javautil.Date");
Clazz_defineMethod(javautil.Date,"equals",
function(obj){
return Clazz_instanceOf(obj,javautil.Date)&&this.getTime()==(obj).getTime();
},"Object");
Clazz_defineMethod(javautil.Date,"compareTo",
function(anotherDate){
var thisTime=this.getTime();
var anotherTime=anotherDate.getTime();
return(thisTime<anotherTime?-1:(thisTime==anotherTime?0:1));
},"javautil.Date");
Clazz_defineMethod(javautil.Date,"compareTo",
function(o){
return this.compareTo(o);
},"Object");
Clazz_overrideMethod(javautil.Date,"hashCode",
function(){
var ht=this.getTime();
return parseInt(ht)^parseInt((ht>>32));
});

c$=Clazz_decorateAsClass(function(){
this.source=null;
Clazz_instantialize(this,arguments);
},javautil,"EventObject",null,java.io.Serializable);
Clazz_makeConstructor(c$,
function(source){
if(source!=null)this.source=source;
else throw new IllegalArgumentException();
},"~O");
Clazz_defineMethod(c$,"getSource",
function(){
return this.source;
});
Clazz_overrideMethod(c$,"toString",
function(){
return this.getClass().getName()+"[source="+String.valueOf(this.source)+']';
});
Clazz_declareInterface(javautil,"EventListener");

c$=Clazz_decorateAsClass(function(){
this.listener=null;
Clazz_instantialize(this,arguments);
},javautil,"EventListenerProxy",null,javautil.EventListener);
Clazz_makeConstructor(c$,
function(listener){
this.listener=listener;
},"javautil.EventListener");
Clazz_defineMethod(c$,"getListener",
function(){
return this.listener;
});
Clazz_declareInterface(javautil,"Iterator");

Clazz_declareInterface(javautil,"ListIterator",javautil.Iterator);
Clazz_declareInterface(javautil,"Enumeration");
Clazz_declareInterface(javautil,"Collection",Iterable);

Clazz_declareInterface(javautil,"Set",javautil.Collection);
Clazz_declareInterface(javautil,"Map");
Clazz_declareInterface(javautil.Map,"Entry");

Clazz_declareInterface(javautil,"List",javautil.Collection);

Clazz_declareInterface(javautil,"Queue",javautil.Collection);
Clazz_declareInterface(javautil,"RandomAccess");
c$=Clazz_decorateAsClass(function(){
this.detailMessage=null;
this.cause=null;
this.stackTrace=null;
Clazz_instantialize(this,arguments);
},java.lang,"Throwable",null,java.io.Serializable);
Clazz_prepareFields(c$,function(){
this.cause=this;
//alert("e0 "+ arguments.callee.caller.caller.caller.caller.caller)
});
Clazz_makeConstructor(c$,
function(){
this.fillInStackTrace();
});
Clazz_makeConstructor(c$,
function(message){
this.fillInStackTrace();
this.detailMessage=message;
},"~S");
Clazz_makeConstructor(c$,
function(message,cause){
this.fillInStackTrace();
this.detailMessage=message;
this.cause=cause;
},"~S,Throwable");
Clazz_makeConstructor(c$,
function(cause){
this.fillInStackTrace();
this.detailMessage=(cause==null?null:cause.toString());
this.cause=cause;
},"Throwable");
Clazz_defineMethod(c$,"getMessage",
function(){
return (this.message || this.detailMessage || this.toString());
});
Clazz_defineMethod(c$,"getLocalizedMessage",
function(){
return this.getMessage();
});
Clazz_defineMethod(c$,"getCause",
function(){
return(this.cause===this?null:this.cause);
});
Clazz_defineMethod(c$,"initCause",
function(cause){
if(this.cause!==this)throw new IllegalStateException("Can't overwrite cause");
if(cause===this)throw new IllegalArgumentException("Self-causation not permitted");
this.cause=cause;
return this;
},"Throwable");
Clazz_overrideMethod(c$,"toString",
function(){
var s=this.getClass().getName();
var message=this.message || this.detailMessage;
return(message ? s+": "+message : s);
});
Clazz_defineMethod(c$,"printStackTrace",
function(){
System.err.println(this.getStackTrace ? this.getStackTrace() : this.message + " " + Clazz_getStackTrace());
});

Clazz_defineMethod(c$,"getStackTrace",
function(){
var s = "" + this + "\n";
for(var i=0;i<this.stackTrace.length;i++){
 var t=this.stackTrace[i];
	var x=t.methodName.indexOf("(");
	var n=t.methodName.substring(0,x).replace(/\s+/g,"");
	if(n!="construct"||t.nativeClazz==null
		 ||Clazz_getInheritedLevel(t.nativeClazz,Throwable)<0){
				s += t + "\n";
	}
}
return s;
});


Clazz_defineMethod(c$,"printStackTrace",
function(s){
this.printStackTrace();
},"java.io.PrintStream");
Clazz_defineMethod(c$,"printStackTrace",
function(s){
this.printStackTrace();
},"java.io.PrintWriter");
Clazz_defineMethod(c$,"fillInStackTrace",
function(){
this.stackTrace=new Array();
var caller=arguments.callee.caller;
var superCaller=null;
var callerList=new Array();
var index=Clazz._callingStackTraces.length-1;
var noLooping=true;
while(index>-1||caller!=null){
var clazzName=null;
var nativeClass=null;
if(!noLooping||caller==Clazz_tryToSearchAndExecute||caller==Clazz_superCall||caller==null){
if(index<0){
break;
}
noLooping=true;
superCaller=Clazz._callingStackTraces[index].caller;
nativeClass=Clazz._callingStackTraces[index].owner;
index--;
}else{
superCaller=caller;
if(superCaller.claxxOwner!=null){
nativeClass=superCaller.claxxOwner;
}else if(superCaller.exClazz!=null){
nativeClass=superCaller.exClazz;
}
}
var st=new StackTraceElement(
((nativeClass!=null&&nativeClass.__CLASS_NAME__.length!=0)?
nativeClass.__CLASS_NAME__:"anonymous"),
((superCaller.exName==null)?"anonymous":superCaller.exName)
+" ("+Clazz_getParamsType(superCaller.arguments)+")",
null,-1);
st.nativeClazz=nativeClass;
this.stackTrace[this.stackTrace.length]=st;
for(var i=0;i<callerList.length;i++){
if(callerList[i]==superCaller){

var st=new StackTraceElement("lost","missing",null,-3);
st.nativeClazz=null;
this.stackTrace[this.stackTrace.length]=st;
noLooping=false;

}
}
if(superCaller!=null){
callerList[callerList.length]=superCaller;
}
caller=superCaller.arguments.callee.caller;
}
Clazz._initializingException=false;
return this;
});
Clazz_defineMethod(c$,"setStackTrace",
function(stackTrace){
var defensiveCopy=stackTrace.clone();
for(var i=0;i<defensiveCopy.length;i++)if(defensiveCopy[i]==null)throw new NullPointerException("stackTrace["+i+"]");

this.stackTrace=defensiveCopy;
},"~A");

c$=Clazz_decorateAsClass(function(){
this.declaringClass=null;
this.methodName=null;
this.fileName=null;
this.lineNumber=0;
Clazz_instantialize(this,arguments);
},java.lang,"StackTraceElement",null,java.io.Serializable);
Clazz_makeConstructor(c$,
function(cls,method,file,line){
if(cls==null||method==null){
throw new NullPointerException();
}this.declaringClass=cls;
this.methodName=method;
this.fileName=file;
this.lineNumber=line;
},"~S,~S,~S,~N");
Clazz_overrideMethod(c$,"equals",
function(obj){
if(!(Clazz_instanceOf(obj,StackTraceElement))){
return false;
}var castObj=obj;
if((this.methodName==null)||(castObj.methodName==null)){
return false;
}if(!this.getMethodName().equals(castObj.getMethodName())){
return false;
}if(!this.getClassName().equals(castObj.getClassName())){
return false;
}var localFileName=this.getFileName();
if(localFileName==null){
if(castObj.getFileName()!=null){
return false;
}}else{
if(!localFileName.equals(castObj.getFileName())){
return false;
}}if(this.getLineNumber()!=castObj.getLineNumber()){
return false;
}return true;
},"~O");
Clazz_defineMethod(c$,"getClassName",
function(){
return(this.declaringClass==null)?"<unknown class>":this.declaringClass;
});
Clazz_defineMethod(c$,"getFileName",
function(){
return this.fileName;
});
Clazz_defineMethod(c$,"getLineNumber",
function(){
return this.lineNumber;
});
Clazz_defineMethod(c$,"getMethodName",
function(){
return(this.methodName==null)?"<unknown method>":this.methodName;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
if(this.methodName==null){
return 0;
}return this.methodName.hashCode()^this.declaringClass.hashCode();
});
Clazz_defineMethod(c$,"isNativeMethod",
function(){
return this.lineNumber==-2;
});
Clazz_overrideMethod(c$,"toString",
function(){
var buf=new StringBuilder(80);
buf.append(this.getClassName());
buf.append('.');
buf.append(this.getMethodName());
if(this.isNativeMethod()){
buf.append("(Native Method)");
}else{
var fName=this.getFileName();
if(fName==null){
buf.append("(Unknown Source)");
}else{
var lineNum=this.getLineNumber();
buf.append('(');
buf.append(fName);
if(lineNum>=0){
buf.append(':');
buf.append(lineNum);
}buf.append(')');
}}return buf.toString();
});
TypeError.prototype.getMessage || (TypeError.prototype.getMessage = function(){ return (this.message || this.toString()) + (this.getStackTrace ? this.getStackTrace() : Clazz_getStackTrace())});
c$=Clazz_declareType(java.lang,"Error",Throwable);

c$=Clazz_declareType(java.lang,"LinkageError",Error);

c$=Clazz_declareType(java.lang,"IncompatibleClassChangeError",LinkageError);

c$=Clazz_declareType(java.lang,"AbstractMethodError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"AssertionError",Error);
Clazz_makeConstructor(c$,
function(detailMessage){
Clazz_superConstructor(this,AssertionError,[String.valueOf(detailMessage),(Clazz_instanceOf(detailMessage,Throwable)?detailMessage:null)]);
},"~O");
Clazz_makeConstructor(c$,
function(detailMessage){
this.construct("" + detailMessage);
},"~B");
Clazz_makeConstructor(c$,
function(detailMessage){
this.construct("" + detailMessage);
},"~N");

c$=Clazz_declareType(java.lang,"ClassCircularityError",LinkageError);

c$=Clazz_declareType(java.lang,"ClassFormatError",LinkageError);

c$=Clazz_decorateAsClass(function(){
this.exception=null;
Clazz_instantialize(this,arguments);
},java.lang,"ExceptionInInitializerError",LinkageError);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,ExceptionInInitializerError);
this.initCause(null);
});
Clazz_makeConstructor(c$,
function(detailMessage){
Clazz_superConstructor(this,ExceptionInInitializerError,[detailMessage]);
this.initCause(null);
},"~S");
Clazz_makeConstructor(c$,
function(exception){
Clazz_superConstructor(this,ExceptionInInitializerError);
this.exception=exception;
this.initCause(exception);
},"Throwable");
Clazz_defineMethod(c$,"getException",
function(){
return this.exception;
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.exception;
});

c$=Clazz_declareType(java.lang,"IllegalAccessError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"InstantiationError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"VirtualMachineError",Error);

c$=Clazz_declareType(java.lang,"InternalError",VirtualMachineError);

c$=Clazz_declareType(java.lang,"NoClassDefFoundError",LinkageError);

c$=Clazz_declareType(java.lang,"NoSuchFieldError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"NoSuchMethodError",IncompatibleClassChangeError);

c$=Clazz_declareType(java.lang,"OutOfMemoryError",VirtualMachineError);

c$=Clazz_declareType(java.lang,"StackOverflowError",VirtualMachineError);

c$=Clazz_declareType(java.lang,"UnknownError",VirtualMachineError);

c$=Clazz_declareType(java.lang,"UnsatisfiedLinkError",LinkageError);

c$=Clazz_declareType(java.lang,"UnsupportedClassVersionError",ClassFormatError);

c$=Clazz_declareType(java.lang,"VerifyError",LinkageError);

c$=Clazz_declareType(java.lang,"ThreadDeath",Error);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,ThreadDeath,[]);
});

c$=Clazz_declareType(java.lang,"Exception",Throwable);

c$=Clazz_declareType(java.lang,"RuntimeException",Exception);

c$=Clazz_declareType(java.lang,"ArithmeticException",RuntimeException);

c$=Clazz_declareType(java.lang,"IndexOutOfBoundsException",RuntimeException);

c$=Clazz_declareType(java.lang,"ArrayIndexOutOfBoundsException",IndexOutOfBoundsException);
Clazz_makeConstructor(c$,
function(index){
Clazz_superConstructor(this,ArrayIndexOutOfBoundsException,["Array index out of range: "+index]);
},"~N");

c$=Clazz_declareType(java.lang,"ArrayStoreException",RuntimeException);

c$=Clazz_declareType(java.lang,"ClassCastException",RuntimeException);

c$=Clazz_decorateAsClass(function(){
this.ex=null;
Clazz_instantialize(this,arguments);
},java.lang,"ClassNotFoundException",Exception);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,ClassNotFoundException,[Clazz_castNullAs("Throwable")]);
});
Clazz_makeConstructor(c$,
function(detailMessage){
Clazz_superConstructor(this,ClassNotFoundException,[detailMessage,null]);
},"~S");
Clazz_makeConstructor(c$,
function(detailMessage,exception){
Clazz_superConstructor(this,ClassNotFoundException,[detailMessage]);
this.ex=exception;
},"~S,Throwable");
Clazz_defineMethod(c$,"getException",
function(){
return this.ex;
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.ex;
});

c$=Clazz_declareType(java.lang,"CloneNotSupportedException",Exception);

c$=Clazz_declareType(java.lang,"IllegalAccessException",Exception);

c$=Clazz_declareType(java.lang,"IllegalArgumentException",RuntimeException);
Clazz_makeConstructor(c$,
function(cause){
Clazz_superConstructor(this,IllegalArgumentException,[(cause==null?null:cause.toString()),cause]);
},"Throwable");

c$=Clazz_declareType(java.lang,"IllegalMonitorStateException",RuntimeException);

c$=Clazz_declareType(java.lang,"IllegalStateException",RuntimeException);
Clazz_makeConstructor(c$,
function(cause){
Clazz_superConstructor(this,IllegalStateException,[(cause==null?null:cause.toString()),cause]);
},"Throwable");

c$=Clazz_declareType(java.lang,"IllegalThreadStateException",IllegalArgumentException);

c$=Clazz_declareType(java.lang,"InstantiationException",Exception);

c$=Clazz_declareType(java.lang,"InterruptedException",Exception);

c$=Clazz_declareType(java.lang,"NegativeArraySizeException",RuntimeException);

c$=Clazz_declareType(java.lang,"NoSuchFieldException",Exception);

c$=Clazz_declareType(java.lang,"NoSuchMethodException",Exception);

c$=Clazz_declareType(java.lang,"NullPointerException",RuntimeException);

c$=Clazz_declareType(java.lang,"NumberFormatException",IllegalArgumentException);

c$=Clazz_declareType(java.lang,"SecurityException",RuntimeException);
Clazz_makeConstructor(c$,
function(cause){
Clazz_superConstructor(this,SecurityException,[(cause==null?null:cause.toString()),cause]);
},"Throwable");

c$=Clazz_declareType(java.lang,"StringIndexOutOfBoundsException",IndexOutOfBoundsException);
Clazz_makeConstructor(c$,
function(index){
Clazz_superConstructor(this,StringIndexOutOfBoundsException,["String index out of range: "+index]);
},"~N");

c$=Clazz_declareType(java.lang,"UnsupportedOperationException",RuntimeException);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,UnsupportedOperationException,[]);
});
Clazz_makeConstructor(c$,
function(cause){
Clazz_superConstructor(this,UnsupportedOperationException,[(cause==null?null:cause.toString()),cause]);
},"Throwable");

c$=Clazz_decorateAsClass(function(){
this.target=null;
Clazz_instantialize(this,arguments);
},java.lang.reflect,"InvocationTargetException",Exception);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,java.lang.reflect.InvocationTargetException,[Clazz_castNullAs("Throwable")]);
});
Clazz_makeConstructor(c$,
function(exception){
Clazz_superConstructor(this,java.lang.reflect.InvocationTargetException,[null,exception]);
this.target=exception;
},"Throwable");
Clazz_makeConstructor(c$,
function(exception,detailMessage){
Clazz_superConstructor(this,java.lang.reflect.InvocationTargetException,[detailMessage,exception]);
this.target=exception;
},"Throwable,~S");
Clazz_defineMethod(c$,"getTargetException",
function(){
return this.target;
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.target;
});

c$=Clazz_decorateAsClass(function(){
this.undeclaredThrowable=null;
Clazz_instantialize(this,arguments);
},java.lang.reflect,"UndeclaredThrowableException",RuntimeException);
Clazz_makeConstructor(c$,
function(exception){
Clazz_superConstructor(this,java.lang.reflect.UndeclaredThrowableException);
this.undeclaredThrowable=exception;
this.initCause(exception);
},"Throwable");
Clazz_makeConstructor(c$,
function(exception,detailMessage){
Clazz_superConstructor(this,java.lang.reflect.UndeclaredThrowableException,[detailMessage]);
this.undeclaredThrowable=exception;
this.initCause(exception);
},"Throwable,~S");
Clazz_defineMethod(c$,"getUndeclaredThrowable",
function(){
return this.undeclaredThrowable;
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.undeclaredThrowable;
});

c$=Clazz_declareType(java.io,"IOException",Exception);


c$=Clazz_declareType(java.io,"CharConversionException",java.io.IOException);

c$=Clazz_declareType(java.io,"EOFException",java.io.IOException);

c$=Clazz_declareType(java.io,"FileNotFoundException",java.io.IOException);

c$=Clazz_decorateAsClass(function(){
this.bytesTransferred=0;
Clazz_instantialize(this,arguments);
},java.io,"InterruptedIOException",java.io.IOException);

c$=Clazz_declareType(java.io,"ObjectStreamException",java.io.IOException);

c$=Clazz_decorateAsClass(function(){
this.classname=null;
Clazz_instantialize(this,arguments);
},java.io,"InvalidClassException",java.io.ObjectStreamException);
Clazz_makeConstructor(c$,
function(className,detailMessage){
Clazz_superConstructor(this,java.io.InvalidClassException,[detailMessage]);
this.classname=className;
},"~S,~S");
Clazz_defineMethod(c$,"getMessage",
function(){
var msg=Clazz_superCall(this,java.io.InvalidClassException,"getMessage",[]);
if(this.classname!=null){
msg=this.classname+';' + ' '+msg;
}return msg;
});

c$=Clazz_declareType(java.io,"InvalidObjectException",java.io.ObjectStreamException);

c$=Clazz_declareType(java.io,"NotActiveException",java.io.ObjectStreamException);

c$=Clazz_declareType(java.io,"NotSerializableException",java.io.ObjectStreamException);

c$=Clazz_decorateAsClass(function(){
this.eof=false;
this.length=0;
Clazz_instantialize(this,arguments);
},java.io,"OptionalDataException",java.io.ObjectStreamException);

c$=Clazz_declareType(java.io,"StreamCorruptedException",java.io.ObjectStreamException);

c$=Clazz_declareType(java.io,"SyncFailedException",java.io.IOException);

c$=Clazz_declareType(java.io,"UnsupportedEncodingException",java.io.IOException);

c$=Clazz_declareType(java.io,"UTFDataFormatException",java.io.IOException);

c$=Clazz_decorateAsClass(function(){
this.detail=null;
Clazz_instantialize(this,arguments);
},java.io,"WriteAbortedException",java.io.ObjectStreamException);
Clazz_makeConstructor(c$,
function(detailMessage,rootCause){
Clazz_superConstructor(this,java.io.WriteAbortedException,[detailMessage]);
this.detail=rootCause;
this.initCause(rootCause);
},"~S,Exception");
Clazz_defineMethod(c$,"getMessage",
function(){
var msg=Clazz_superCall(this,java.io.WriteAbortedException,"getMessage",[]);
return (this.detail ? msg + "; "+this.detail.toString() : msg);
});
Clazz_overrideMethod(c$,"getCause",
function(){
return this.detail;
});

c$=Clazz_declareType(javautil,"ConcurrentModificationException",RuntimeException);
Clazz_makeConstructor(c$,
function(){
Clazz_superConstructor(this,javautil.ConcurrentModificationException,[]);
});

c$=Clazz_declareType(javautil,"EmptyStackException",RuntimeException);

c$=Clazz_decorateAsClass(function(){
this.className=null;
this.key=null;
Clazz_instantialize(this,arguments);
},javautil,"MissingResourceException",RuntimeException);
Clazz_makeConstructor(c$,
function(detailMessage,className,resourceName){
Clazz_superConstructor(this,javautil.MissingResourceException,[detailMessage]);
this.className=className;
this.key=resourceName;
},"~S,~S,~S");
Clazz_defineMethod(c$,"getClassName",
function(){
return this.className;
});
Clazz_defineMethod(c$,"getKey",
function(){
return this.key;
});

c$=Clazz_declareType(javautil,"NoSuchElementException",RuntimeException);

c$=Clazz_declareType(javautil,"TooManyListenersException",Exception);

c$=Clazz_declareType(java.lang,"Void");
Clazz_defineStatics(c$,
"TYPE",null);
{
java.lang.Void.TYPE=java.lang.Void;
}Clazz_declareInterface(java.lang.reflect,"GenericDeclaration");
Clazz_declareInterface(java.lang.reflect,"AnnotatedElement");

c$=Clazz_declareType(java.lang.reflect,"AccessibleObject",null,java.lang.reflect.AnnotatedElement);
Clazz_makeConstructor(c$,
function(){
});
Clazz_defineMethod(c$,"isAccessible",
function(){
return false;
});
c$.setAccessible=Clazz_defineMethod(c$,"setAccessible",
function(objects,flag){
return;
},"~A,~B");
Clazz_defineMethod(c$,"setAccessible",
function(flag){
return;
},"~B");
Clazz_overrideMethod(c$,"isAnnotationPresent",
function(annotationType){
return false;
},"Class");
Clazz_overrideMethod(c$,"getDeclaredAnnotations",
function(){
return new Array(0);
});
Clazz_overrideMethod(c$,"getAnnotations",
function(){
return new Array(0);
});
Clazz_overrideMethod(c$,"getAnnotation",
function(annotationType){
return null;
},"Class");
c$.marshallArguments=Clazz_defineMethod(c$,"marshallArguments",
function(parameterTypes,args){
return null;
},"~A,~A");
Clazz_defineMethod(c$,"invokeV",
function(receiver,args){
return;
},"~O,~A");
Clazz_defineMethod(c$,"invokeL",
function(receiver,args){
return null;
},"~O,~A");
Clazz_defineMethod(c$,"invokeI",
function(receiver,args){
return 0;
},"~O,~A");
Clazz_defineMethod(c$,"invokeJ",
function(receiver,args){
return 0;
},"~O,~A");
Clazz_defineMethod(c$,"invokeF",
function(receiver,args){
return 0.0;
},"~O,~A");
Clazz_defineMethod(c$,"invokeD",
function(receiver,args){
return 0.0;
},"~O,~A");
c$.emptyArgs=c$.prototype.emptyArgs=new Array(0);
Clazz_declareInterface(java.lang.reflect,"InvocationHandler");
c$=Clazz_declareInterface(java.lang.reflect,"Member");
Clazz_defineStatics(c$,
"PUBLIC",0,
"DECLARED",1);

c$=Clazz_declareType(java.lang.reflect,"Modifier");
Clazz_makeConstructor(c$,
function(){
});
c$.isAbstract=Clazz_defineMethod(c$,"isAbstract",
function(modifiers){
return((modifiers&1024)!=0);
},"~N");
c$.isFinal=Clazz_defineMethod(c$,"isFinal",
function(modifiers){
return((modifiers&16)!=0);
},"~N");
c$.isInterface=Clazz_defineMethod(c$,"isInterface",
function(modifiers){
return((modifiers&512)!=0);
},"~N");
c$.isNative=Clazz_defineMethod(c$,"isNative",
function(modifiers){
return((modifiers&256)!=0);
},"~N");
c$.isPrivate=Clazz_defineMethod(c$,"isPrivate",
function(modifiers){
return((modifiers&2)!=0);
},"~N");
c$.isProtected=Clazz_defineMethod(c$,"isProtected",
function(modifiers){
return((modifiers&4)!=0);
},"~N");
c$.isPublic=Clazz_defineMethod(c$,"isPublic",
function(modifiers){
return((modifiers&1)!=0);
},"~N");
c$.isStatic=Clazz_defineMethod(c$,"isStatic",
function(modifiers){
return((modifiers&8)!=0);
},"~N");
c$.isStrict=Clazz_defineMethod(c$,"isStrict",
function(modifiers){
return((modifiers&2048)!=0);
},"~N");
c$.isSynchronized=Clazz_defineMethod(c$,"isSynchronized",
function(modifiers){
return((modifiers&32)!=0);
},"~N");
c$.isTransient=Clazz_defineMethod(c$,"isTransient",
function(modifiers){
return((modifiers&128)!=0);
},"~N");
c$.isVolatile=Clazz_defineMethod(c$,"isVolatile",
function(modifiers){
return((modifiers&64)!=0);
},"~N");
c$.toString=Clazz_defineMethod(c$,"toString",
function(modifiers){
var sb=new Array(0);
if(java.lang.reflect.Modifier.isPublic(modifiers))sb[sb.length]="public";
if(java.lang.reflect.Modifier.isProtected(modifiers))sb[sb.length]="protected";
if(java.lang.reflect.Modifier.isPrivate(modifiers))sb[sb.length]="private";
if(java.lang.reflect.Modifier.isAbstract(modifiers))sb[sb.length]="abstract";
if(java.lang.reflect.Modifier.isStatic(modifiers))sb[sb.length]="static";
if(java.lang.reflect.Modifier.isFinal(modifiers))sb[sb.length]="final";
if(java.lang.reflect.Modifier.isTransient(modifiers))sb[sb.length]="transient";
if(java.lang.reflect.Modifier.isVolatile(modifiers))sb[sb.length]="volatile";
if(java.lang.reflect.Modifier.isSynchronized(modifiers))sb[sb.length]="synchronized";
if(java.lang.reflect.Modifier.isNative(modifiers))sb[sb.length]="native";
if(java.lang.reflect.Modifier.isStrict(modifiers))sb[sb.length]="strictfp";
if(java.lang.reflect.Modifier.isInterface(modifiers))sb[sb.length]="interface";
if(sb.length>0){
return sb.join(" ");
}return"";
},"~N");
Clazz_defineStatics(c$,
"PUBLIC",0x1,
"PRIVATE",0x2,
"PROTECTED",0x4,
"STATIC",0x8,
"FINAL",0x10,
"SYNCHRONIZED",0x20,
"VOLATILE",0x40,
"TRANSIENT",0x80,
"NATIVE",0x100,
"INTERFACE",0x200,
"ABSTRACT",0x400,
"STRICT",0x800,
"BRIDGE",0x40,
"VARARGS",0x80,
"SYNTHETIC",0x1000,
"ANNOTATION",0x2000,
"ENUM",0x4000);

c$=Clazz_decorateAsClass(function(){
this.clazz=null;
this.parameterTypes=null;
this.exceptionTypes=null;
this.modifiers=0;
Clazz_instantialize(this,arguments);
},java.lang.reflect,"Constructor",java.lang.reflect.AccessibleObject,[java.lang.reflect.GenericDeclaration,java.lang.reflect.Member]);
Clazz_makeConstructor(c$,
function(declaringClass,parameterTypes,checkedExceptions,modifiers){
Clazz_superConstructor(this,java.lang.reflect.Constructor,[]);
this.clazz=declaringClass;
this.parameterTypes=parameterTypes;
this.exceptionTypes=checkedExceptions;
this.modifiers=modifiers;
},"Class,~A,~A,~N");
Clazz_overrideMethod(c$,"getTypeParameters",
function(){
return null;
});
Clazz_defineMethod(c$,"toGenericString",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericParameterTypes",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericExceptionTypes",
function(){
return null;
});
Clazz_defineMethod(c$,"getParameterAnnotations",
function(){
return null;
});
Clazz_defineMethod(c$,"isVarArgs",
function(){
return false;
});
Clazz_overrideMethod(c$,"isSynthetic",
function(){
return false;
});
Clazz_overrideMethod(c$,"equals",
function(object){
if(object!=null&&Clazz_instanceOf(object,java.lang.reflect.Constructor)){
var other=object;
if(this.getDeclaringClass()===other.getDeclaringClass()){
var params1=this.parameterTypes;
var params2=other.parameterTypes;
if(params1.length==params2.length){
for(var i=0;i<params1.length;i++){
if(params1[i]!==params2[i])return false;
}
return true;
}}}return false;
},"~O");
Clazz_overrideMethod(c$,"getDeclaringClass",
function(){
return this.clazz;
});
Clazz_defineMethod(c$,"getExceptionTypes",
function(){
return this.exceptionTypes;
});
Clazz_overrideMethod(c$,"getModifiers",
function(){
return this.modifiers;
});
Clazz_overrideMethod(c$,"getName",
function(){
return this.getDeclaringClass().getName();
});
Clazz_defineMethod(c$,"getParameterTypes",
function(){
return this.parameterTypes;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return this.getDeclaringClass().getName().hashCode();
});
Clazz_defineMethod(c$,"newInstance",
function(args){
var instance=new this.clazz(Clazz_inheritArgs);
Clazz_instantialize(instance,args);
return instance;
},"~A");
Clazz_overrideMethod(c$,"toString",
function(){
return null;
});

c$=Clazz_declareType(java.lang.reflect,"Field",java.lang.reflect.AccessibleObject,java.lang.reflect.Member);
Clazz_overrideMethod(c$,"isSynthetic",
function(){
return false;
});
Clazz_defineMethod(c$,"toGenericString",
function(){
return null;
});
Clazz_defineMethod(c$,"isEnumConstant",
function(){
return false;
});
Clazz_defineMethod(c$,"getGenericType",
function(){
return null;
});
Clazz_overrideMethod(c$,"equals",
function(object){
return false;
},"~O");
Clazz_overrideMethod(c$,"getDeclaringClass",
function(){
return null;
});
Clazz_overrideMethod(c$,"getName",
function(){
return null;
});
Clazz_defineMethod(c$,"getType",
function(){
return null;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return 0;
});
Clazz_overrideMethod(c$,"toString",
function(){
return null;
});

c$=Clazz_decorateAsClass(function(){
this.clazz=null;
this.name=null;
this.returnType=null;
this.parameterTypes=null;
this.exceptionTypes=null;
this.modifiers=0;
Clazz_instantialize(this,arguments);
},java.lang.reflect,"Method",java.lang.reflect.AccessibleObject,[java.lang.reflect.GenericDeclaration,java.lang.reflect.Member]);
Clazz_makeConstructor(c$,
function(declaringClass,name,parameterTypes,returnType,checkedExceptions,modifiers){
Clazz_superConstructor(this,java.lang.reflect.Method,[]);
this.clazz=declaringClass;
this.name=name;
this.parameterTypes=parameterTypes;
this.returnType=returnType;
this.exceptionTypes=checkedExceptions;
this.modifiers=modifiers;
},"Class,~S,~A,Class,~A,~N");
Clazz_overrideMethod(c$,"getTypeParameters",
function(){
return null;
});
Clazz_defineMethod(c$,"toGenericString",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericParameterTypes",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericExceptionTypes",
function(){
return null;
});
Clazz_defineMethod(c$,"getGenericReturnType",
function(){
return null;
});
Clazz_defineMethod(c$,"getParameterAnnotations",
function(){
return null;
});
Clazz_defineMethod(c$,"isVarArgs",
function(){
return false;
});
Clazz_defineMethod(c$,"isBridge",
function(){
return false;
});
Clazz_overrideMethod(c$,"isSynthetic",
function(){
return false;
});
Clazz_defineMethod(c$,"getDefaultValue",
function(){
return null;
});
Clazz_overrideMethod(c$,"equals",
function(object){
if(object!=null&&Clazz_instanceOf(object,java.lang.reflect.Method)){
var other=object;
if((this.getDeclaringClass()===other.getDeclaringClass())&&(this.getName()===other.getName())){
var params1=this.parameterTypes;
var params2=other.parameterTypes;
if(params1.length==params2.length){
for(var i=0;i<params1.length;i++){
if(params1[i]!==params2[i])return false;
}
return true;
}}}return false;
},"~O");
Clazz_overrideMethod(c$,"getDeclaringClass",
function(){
return this.clazz;
});
Clazz_defineMethod(c$,"getExceptionTypes",
function(){
return this.exceptionTypes;
});
Clazz_overrideMethod(c$,"getModifiers",
function(){
return this.modifiers;
});
Clazz_overrideMethod(c$,"getName",
function(){
return this.name;
});
Clazz_defineMethod(c$,"getParameterTypes",
function(){
return this.parameterTypes;
});
Clazz_defineMethod(c$,"getReturnType",
function(){
return this.returnType;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return this.getDeclaringClass().getName().hashCode()^this.getName().hashCode();
});
Clazz_defineMethod(c$,"invoke",
function(receiver,args){
var m=this.clazz.prototype[this.getName()];
if(m==null){
m=this.clazz[this.getName()];
}
if(m!=null){
m.apply(receiver,args);
}else{

}
},"~O,~A");
Clazz_overrideMethod(c$,"toString",
function(){
return null;
});

})(Clazz);
;(function() {

if (Jmol._debugCode)return;

Clazz_load(null,"java.lang.AbstractStringBuilder",["java.io.InvalidObjectException","java.lang.ArrayIndexOutOfBoundsException","$.IndexOutOfBoundsException","$.NegativeArraySizeException","$.NullPointerException","$.StringIndexOutOfBoundsException"],function(){
c$=Clazz_decorateAsClass(function(){
this.value=null;
this.count=0;
this.shared=false;
Clazz_instantialize(this,arguments);
},java.lang,"AbstractStringBuilder");
Clazz_defineMethod(c$,"getValue",
function(){
return this.value;
});
Clazz_defineMethod(c$,"shareValue",
function(){
this.shared=true;
return this.value;
});
Clazz_defineMethod(c$,"set",
function(val,len){
if(val==null)val=Clazz_newArray(0,'\0');
if(val.length<len)throw new java.io.InvalidObjectException(("K0199"));
this.shared=false;
this.value=val;
this.count=len;
},"~A,~N");
Clazz_makeConstructor(c$,
function(){
this.value=Clazz_newArray(16,'\0');
});
Clazz_makeConstructor(c$,
function(capacity){
if(capacity<0)throw new NegativeArraySizeException();
this.value=Clazz_newArray(capacity,'\0');
},"~N");
Clazz_makeConstructor(c$,
function(string){
this.count=string.length;
this.shared=false;
this.value=Clazz_newArray(this.count+16,'\0');
string.getChars(0,this.count,this.value,0);
},"~S");
Clazz_defineMethod(c$,"enlargeBuffer",
($fz=function(min){
var twice=(this.value.length<<1)+2;
var newData=Clazz_newArray(min>twice?min:twice,'\0');
System.arraycopy(this.value,0,newData,0,this.count);
this.value=newData;
this.shared=false;
},$fz.isPrivate=true,$fz),"~N");
Clazz_defineMethod(c$,"appendNull",
function(){
var newSize=this.count+4;
if(newSize>this.value.length){
this.enlargeBuffer(newSize);
}else if(this.shared){
this.value=this.value.clone();
this.shared=false;
}this.value[this.count++]='n';
this.value[this.count++]='u';
this.value[this.count++]='l';
this.value[this.count++]='l';
});
Clazz_defineMethod(c$,"append0",
function(chars){
var newSize=this.count+chars.length;
if(newSize>this.value.length){
this.enlargeBuffer(newSize);
}else if(this.shared){
this.value=this.value.clone();
this.shared=false;
}System.arraycopy(chars,0,this.value,this.count,chars.length);
this.count=newSize;
},"~A");
Clazz_defineMethod(c$,"append0",
function(chars,start,length){
if(chars==null){
throw new NullPointerException();
}if(start>=0&&0<=length&&length<=chars.length-start){
var newSize=this.count+length;
if(newSize>this.value.length){
this.enlargeBuffer(newSize);
}else if(this.shared){
this.value=this.value.clone();
this.shared=false;
}System.arraycopy(chars,start,this.value,this.count,length);
this.count=newSize;
}else{
throw new ArrayIndexOutOfBoundsException();
}},"~A,~N,~N");
Clazz_defineMethod(c$,"append0",
function(ch){
if(this.count==this.value.length){
this.enlargeBuffer(this.count+1);
}if(this.shared){
this.value=this.value.clone();
this.shared=false;
}this.value[this.count++]=ch;
},"~N");
Clazz_defineMethod(c$,"append0",
function(string){
if(string==null){
this.appendNull();
return;
}var adding=string.length;
var newSize=this.count+adding;
if(newSize>this.value.length){
this.enlargeBuffer(newSize);
}else if(this.shared){
this.value=this.value.clone();
this.shared=false;
}string.getChars(0,adding,this.value,this.count);
this.count=newSize;
},"~S");
Clazz_defineMethod(c$,"append0",
function(s,start,end){
if(s==null)s="null";
if(start<0||end<0||start>end||end>s.length())throw new IndexOutOfBoundsException();
this.append0(s.subSequence(start,end).toString());
},"CharSequence,~N,~N");
Clazz_defineMethod(c$,"capacity",
function(){
return this.value.length;
});
Clazz_defineMethod(c$,"charAt",
function(index){
if(index<0||index>=this.count)throw new StringIndexOutOfBoundsException(index);
return this.value[index];
},"~N");
Clazz_defineMethod(c$,"delete0",
function(start,end){
if(start>=0){
if(end>this.count){
end=this.count;
}if(end==start){
return;
}if(end>start){
var length=this.count-end;
if(length>0){
if(!this.shared){
System.arraycopy(this.value,end,this.value,start,length);
}else{
var newData=Clazz_newArray(this.value.length,'\0');
System.arraycopy(this.value,0,newData,0,start);
System.arraycopy(this.value,end,newData,start,length);
this.value=newData;
this.shared=false;
}}this.count-=end-start;
return;
}}throw new StringIndexOutOfBoundsException();
},"~N,~N");
Clazz_defineMethod(c$,"deleteCharAt0",
function(location){
if(0>location||location>=this.count)throw new StringIndexOutOfBoundsException(location);
var length=this.count-location-1;
if(length>0){
if(!this.shared){
System.arraycopy(this.value,location+1,this.value,location,length);
}else{
var newData=Clazz_newArray(this.value.length,'\0');
System.arraycopy(this.value,0,newData,0,location);
System.arraycopy(this.value,location+1,newData,location,length);
this.value=newData;
this.shared=false;
}}this.count--;
},"~N");
Clazz_defineMethod(c$,"ensureCapacity",
function(min){
if(min>this.value.length){
this.enlargeBuffer(min);
}},"~N");
Clazz_defineMethod(c$,"getChars",
function(start,end,dest,destStart){
if(start>this.count||end>this.count||start>end){
throw new StringIndexOutOfBoundsException();
}System.arraycopy(this.value,start,dest,destStart,end-start);
},"~N,~N,~A,~N");
Clazz_defineMethod(c$,"insert0",
function(index,chars){
if(0>index||index>this.count){
throw new StringIndexOutOfBoundsException(index);
}if(chars.length!=0){
this.move(chars.length,index);
System.arraycopy(chars,0,this.value,index,chars.length);
this.count+=chars.length;
}},"~N,~A");
Clazz_defineMethod(c$,"insert0",
function(index,chars,start,length){
if(0<=index&&index<=this.count){
if(start>=0&&0<=length&&length<=chars.length-start){
if(length!=0){
this.move(length,index);
System.arraycopy(chars,start,this.value,index,length);
this.count+=length;
}return;
}throw new StringIndexOutOfBoundsException("offset "+start+", len "+length+", array.length "+chars.length);
}throw new StringIndexOutOfBoundsException(index);
},"~N,~A,~N,~N");
Clazz_defineMethod(c$,"insert0",
function(index,ch){
if(0>index||index>this.count){
throw new ArrayIndexOutOfBoundsException(index);
}this.move(1,index);
this.value[index]=ch;
this.count++;
},"~N,~N");
Clazz_defineMethod(c$,"insert0",
function(index,string){
if(0<=index&&index<=this.count){
if(string==null)string="null";
var min=string.length;
if(min!=0){
this.move(min,index);
string.getChars(0,min,this.value,index);
this.count+=min;
}}else{
throw new StringIndexOutOfBoundsException(index);
}},"~N,~S");
Clazz_defineMethod(c$,"insert0",
function(index,s,start,end){
if(s==null)s="null";
if(index<0||index>this.count||start<0||end<0||start>end||end>s.length())throw new IndexOutOfBoundsException();
this.insert0(index,s.subSequence(start,end).toString());
},"~N,CharSequence,~N,~N");
Clazz_defineMethod(c$,"length",
function(){
return this.count;
});
Clazz_defineMethod(c$,"move",
($fz=function(size,index){
var newSize;
if(this.value.length-this.count>=size){
if(!this.shared){
System.arraycopy(this.value,index,this.value,index+size,this.count-index);
return;
}newSize=this.value.length;
}else{
var a=this.count+size;
var b=(this.value.length<<1)+2;
newSize=a>b?a:b;
}var newData=Clazz_newArray(newSize,'\0');
System.arraycopy(this.value,0,newData,0,index);
System.arraycopy(this.value,index,newData,index+size,this.count-index);
this.value=newData;
this.shared=false;
},$fz.isPrivate=true,$fz),"~N,~N");
Clazz_defineMethod(c$,"replace0",
function(start,end,string){
if(start>=0){
if(end>this.count)end=this.count;
if(end>start){
var stringLength=string.length;
var diff=end-start-stringLength;
if(diff>0){
if(!this.shared){
System.arraycopy(this.value,end,this.value,start+stringLength,this.count-end);
}else{
var newData=Clazz_newArray(this.value.length,'\0');
System.arraycopy(this.value,0,newData,0,start);
System.arraycopy(this.value,end,newData,start+stringLength,this.count-end);
this.value=newData;
this.shared=false;
}}else if(diff<0){
this.move(-diff,end);
}else if(this.shared){
this.value=this.value.clone();
this.shared=false;
}string.getChars(0,stringLength,this.value,start);
this.count-=diff;
return;
}if(start==end){
if(string==null)throw new NullPointerException();
this.insert0(start,string);
return;
}}throw new StringIndexOutOfBoundsException();
},"~N,~N,~S");
Clazz_defineMethod(c$,"reverse0",
function(){
if(this.count<2){
return;
}if(!this.shared){
for(var i=0,end=this.count,mid=Math.floor(this.count/2);i<mid;i++){
var temp=this.value[--end];
this.value[end]=this.value[i];
this.value[i]=temp;
}
}else{
var newData=Clazz_newArray(this.value.length,'\0');
for(var i=0,end=this.count;i<this.count;i++){
newData[--end]=this.value[i];
}
this.value=newData;
this.shared=false;
}});
Clazz_defineMethod(c$,"setCharAt",
function(index,ch){
if(0>index||index>=this.count){
throw new StringIndexOutOfBoundsException(index);
}if(this.shared){
this.value=this.value.clone();
this.shared=false;
}this.value[index]=ch;
},"~N,~N");
Clazz_defineMethod(c$,"setLength",
function(length){
if(length<0)throw new StringIndexOutOfBoundsException(length);
if(this.count<length){
if(length>this.value.length){
this.enlargeBuffer(length);
}else{
if(this.shared){
var newData=Clazz_newArray(this.value.length,'\0');
System.arraycopy(this.value,0,newData,0,this.count);
this.value=newData;
this.shared=false;
}else{
for(var i=this.count;i<length;i++){
this.value[i]=String.fromCharCode(0);
}
}}}this.count=length;
},"~N");
Clazz_defineMethod(c$,"substring",
function(start){
if(0<=start&&start<=this.count){
if(start==this.count)return"";
this.shared=true;
return String.instantialize(start,this.count-start,this.value);
}throw new StringIndexOutOfBoundsException(start);
},"~N");
Clazz_defineMethod(c$,"substring",
function(start,end){
if(0<=start&&start<=end&&end<=this.count){
if(start==end)return"";
this.shared=true;
return String.instantialize(this.value,start,end-start);
}throw new StringIndexOutOfBoundsException();
},"~N,~N");
Clazz_overrideMethod(c$,"toString",
function(){
if(this.count==0)return"";
if(this.count>=256&&this.count<=(this.value.length>>1))return String.instantialize(this.value,0,this.count);
this.shared=true;
return String.instantialize(0,this.count,this.value);
});
Clazz_defineMethod(c$,"subSequence",
function(start,end){
return this.substring(start,end);
},"~N,~N");
Clazz_defineMethod(c$,"indexOf",
function(string){
return this.indexOf(string,0);
},"~S");
Clazz_defineMethod(c$,"indexOf",
function(subString,start){
if(start<0)start=0;
var subCount=subString.length;
if(subCount>0){
if(subCount+start>this.count)return-1;
var firstChar=subString.charAt(0);
while(true){
var i=start;
var found=false;
for(;i<this.count;i++)if((this.value[i]).charCodeAt(0)==(firstChar).charCodeAt(0)){
found=true;
break;
}
if(!found||subCount+i>this.count)return-1;
var o1=i;
var o2=0;
while(++o2<subCount&&(this.value[++o1]).charCodeAt(0)==(subString.charAt(o2)).charCodeAt(0)){
}
if(o2==subCount)return i;
start=i+1;
}
}return(start<this.count||start==0)?start:this.count;
},"~S,~N");
Clazz_defineMethod(c$,"lastIndexOf",
function(string){
return this.lastIndexOf(string,this.count);
},"~S");
Clazz_defineMethod(c$,"lastIndexOf",
function(subString,start){
var subCount=subString.length;
if(subCount<=this.count&&start>=0){
if(subCount>0){
if(start>this.count-subCount)start=this.count-subCount;
var firstChar=subString.charAt(0);
while(true){
var i=start;
var found=false;
for(;i>=0;--i)if((this.value[i]).charCodeAt(0)==(firstChar).charCodeAt(0)){
found=true;
break;
}
if(!found)return-1;
var o1=i;
var o2=0;
while(++o2<subCount&&(this.value[++o1]).charCodeAt(0)==(subString.charAt(o2)).charCodeAt(0)){
}
if(o2==subCount)return i;
start=i-1;
}
}return start<this.count?start:this.count;
}return-1;
},"~S,~N");
Clazz_defineMethod(c$,"trimToSize",
function(){
if(this.count<this.value.length){
var newValue=Clazz_newArray(this.count,'\0');
System.arraycopy(this.value,0,newValue,0,this.count);
this.value=newValue;
this.shared=false;
}});
Clazz_defineStatics(c$,
"INITIAL_CAPACITY",16);
});
// BH removed inner class 
Clazz_load(null,"java.lang.Enum",["java.lang.CloneNotSupportedException","$.IllegalArgumentException","$.NullPointerException"],function(){
c$=Clazz_decorateAsClass(function(){
this.$name=null;
this.$ordinal=0;
Clazz_instantialize(this,arguments);
},java.lang,"Enum",null,[java.io.Serializable,Comparable]);
Clazz_makeConstructor(c$,
function(name,ordinal){
this.$name=name;
this.$ordinal=ordinal;
},"~S,~N");
Clazz_defineMethod(c$,"name",
function(){
return this.$name;
});
Clazz_defineMethod(c$,"ordinal",
function(){
return this.$ordinal;
});
Clazz_overrideMethod(c$,"toString",
function(){
return this.$name;
});
Clazz_overrideMethod(c$,"equals",
function(other){
return this===other;
},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
return this.$ordinal+(this.$name==null?0:this.$name.hashCode());
});
Clazz_overrideMethod(c$,"clone",
function(){
throw new CloneNotSupportedException(("KA004"));
});
Clazz_overrideMethod(c$,"compareTo",
function(o){
return this.$ordinal-o.$ordinal;
},"~O");
Clazz_defineMethod(c$,"getDeclaringClass",
function(){
var myClass=this.getClass();
var mySuperClass=myClass.getSuperclass();
if(Enum===mySuperClass){
return myClass;
}return mySuperClass;
});
c$.$valueOf=Clazz_defineMethod(c$,"$valueOf",
function(enumType,name){
if((enumType==null)||(name==null)){
throw new NullPointerException(("KA001"));
}var values=Enum.getValues(enumType);
if(values==null){
throw new IllegalArgumentException(("KA005"));
}for(var enumConst,$enumConst=0,$$enumConst=values;$enumConst<$$enumConst.length&&((enumConst=$$enumConst[$enumConst])||true);$enumConst++){
if(enumConst.$name.equals(name)){
return enumConst;
}}
throw new IllegalArgumentException(("KA006"));
},"Class,~S");
c$.getValues=Clazz_defineMethod(c$,"getValues",
function(enumType){
return enumType.values();
},"Class");

//c$.$Enum$1$=function(){
//Clazz_pu$h(self.c$);

//c$=Clazz_declareAnonymous(null,"Enum$1",null,java.security.PrivilegedExceptionAction);
//Clazz_overrideMethod(c$,"run",
//function(){
//var valsMethod=this.f$.enumType.getMethod("values",null);
//valsMethod.setAccessible(true);
//return valsMethod;
//});
//c$=Clazz_p0p();
//};


});
Clazz_load(["java.lang.AbstractStringBuilder","$.Appendable"],"java.lang.StringBuffer",["java.lang.Character","$.Double","$.Float","$.Long"],function(){
c$=Clazz_declareType(java.lang,"StringBuffer",AbstractStringBuilder,[Appendable,java.io.Serializable,CharSequence]);
Clazz_makeConstructor(c$,
function(cs){
if(cs==null){
throw new NullPointerException();
}
Clazz_superConstructor(this,StringBuffer,[cs.toString()]);
},"CharSequence");
Clazz_defineMethod(c$,"append",
function(b){
return this.append(b?"true":"false");
},"~B");
Clazz_defineMethod(c$,"append",
function(ch){
this.append0(ch);
return this;
},"~N");
Clazz_defineMethod(c$,"append",
function(d){
return this.append(Double.toString(d));
},"~N");
Clazz_defineMethod(c$,"append",
function(obj){
if(obj==null){
this.appendNull();
}else{
this.append0(obj.toString());
}return this;
},"~O");
Clazz_defineMethod(c$,"append",
function(string){
this.append0(string);
return this;
},"~S");
Clazz_defineMethod(c$,"append",
function(sb){
if(sb==null){
this.appendNull();
}else{
{
this.append0(sb.getValue(),0,sb.length());
}}return this;
},"StringBuffer");
Clazz_defineMethod(c$,"append",
function(chars){
this.append0(chars);
return this;
},"~A");
Clazz_defineMethod(c$,"append",
function(chars,start,length){
this.append0(chars,start,length);
return this;
},"~A,~N,~N");
Clazz_defineMethod(c$,"append",
function(s){
if(s==null){
this.appendNull();
}else{
this.append0(s.toString());
}return this;
},"CharSequence");
Clazz_defineMethod(c$,"append",
function(s,start,end){
this.append0(s,start,end);
return this;
},"CharSequence,~N,~N");
Clazz_defineMethod(c$,"appendCodePoint",
function(codePoint){
return this.append(Character.toChars(codePoint));
},"~N");
Clazz_defineMethod(c$,"$delete",
function(start,end){
this.delete0(start,end);
return this;
},"~N,~N");
Clazz_defineMethod(c$,"deleteCharAt",
function(location){
this.deleteCharAt0(location);
return this;
},"~N");
Clazz_defineMethod(c$,"insert",
function(index,ch){
this.insert0(index,ch);
return this;
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(index,b){
return this.insert(index,b?"true":"false");
},"~N,~B");
Clazz_defineMethod(c$,"insert",
function(index,i){
return this.insert(index,Integer.toString(i));
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(index,l){
return this.insert(index,Long.toString(l));
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(index,d){
return this.insert(index,Double.toString(d));
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(index,f){
return this.insert(index,Float.toString(f));
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(index,obj){
return this.insert(index,obj==null?"null":obj.toString());
},"~N,~O");
Clazz_defineMethod(c$,"insert",
function(index,string){
this.insert0(index,string);
return this;
},"~N,~S");
Clazz_defineMethod(c$,"insert",
function(index,chars){
this.insert0(index,chars);
return this;
},"~N,~A");
Clazz_defineMethod(c$,"insert",
function(index,chars,start,length){
this.insert0(index,chars,start,length);
return this;
},"~N,~A,~N,~N");
Clazz_defineMethod(c$,"insert",
function(index,s){
this.insert0(index,s==null?"null":s.toString());
return this;
},"~N,CharSequence");
Clazz_defineMethod(c$,"insert",
function(index,s,start,end){
this.insert0(index,s,start,end);
return this;
},"~N,CharSequence,~N,~N");
Clazz_defineMethod(c$,"replace",
function(start,end,string){
this.replace0(start,end,string);
return this;
},"~N,~N,~S");
Clazz_defineMethod(c$,"reverse",
function(){
this.reverse0();
return this;
});
Clazz_overrideMethod(c$,"subSequence",
function(start,end){
return Clazz_superCall(this,StringBuffer,"substring",[start,end]);
},"~N,~N");
});
Clazz_load(["java.lang.AbstractStringBuilder","$.Appendable"],"java.lang.StringBuilder",["java.lang.Double","$.Float","$.Long"],function(){
c$=Clazz_declareType(java.lang,"StringBuilder",AbstractStringBuilder,[Appendable,CharSequence,java.io.Serializable]);
Clazz_makeConstructor(c$,
function(seq){
Clazz_superConstructor(this,StringBuilder,[seq.toString()]);
},"CharSequence");
Clazz_defineMethod(c$,"append",
function(b){
this.append0(b?"true":"false");
return this;
},"~B");
Clazz_defineMethod(c$,"append",
function(c){
this.append0(c);
return this;
},"~N");
Clazz_defineMethod(c$,"append",
function(i){
this.append0(Integer.toString(i));
return this;
},"~N");
Clazz_defineMethod(c$,"append",
function(lng){
this.append0(Long.toString(lng));
return this;
},"~N");
Clazz_defineMethod(c$,"append",
function(f){
this.append0(Float.toString(f));
return this;
},"~N");
Clazz_defineMethod(c$,"append",
function(d){
this.append0(Double.toString(d));
return this;
},"~N");
Clazz_defineMethod(c$,"append",
function(obj){
if(obj==null){
this.appendNull();
}else{
this.append0(obj.toString());
}return this;
},"~O");
Clazz_defineMethod(c$,"append",
function(str){
this.append0(str);
return this;
},"~S");
Clazz_defineMethod(c$,"append",
function(sb){
if(sb==null){
this.appendNull();
}else{
this.append0(sb.getValue(),0,sb.length());
}return this;
},"StringBuffer");
Clazz_defineMethod(c$,"append",
function(ch){
this.append0(ch);
return this;
},"~A");
Clazz_defineMethod(c$,"append",
function(str,offset,len){
this.append0(str,offset,len);
return this;
},"~A,~N,~N");
Clazz_defineMethod(c$,"append",
function(csq){
if(csq==null){
this.appendNull();
}else{
this.append0(csq.toString());
}return this;
},"CharSequence");
Clazz_defineMethod(c$,"append",
function(csq,start,end){
this.append0(csq,start,end);
return this;
},"CharSequence,~N,~N");
Clazz_defineMethod(c$,"$delete",
function(start,end){
this.delete0(start,end);
return this;
},"~N,~N");
Clazz_defineMethod(c$,"deleteCharAt",
function(index){
this.deleteCharAt0(index);
return this;
},"~N");
Clazz_defineMethod(c$,"insert",
function(offset,b){
this.insert0(offset,b?"true":"false");
return this;
},"~N,~B");
Clazz_defineMethod(c$,"insert",
function(offset,c){
this.insert0(offset,c);
return this;
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(offset,i){
this.insert0(offset,Integer.toString(i));
return this;
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(offset,l){
this.insert0(offset,Long.toString(l));
return this;
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(offset,f){
this.insert0(offset,Float.toString(f));
return this;
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(offset,d){
this.insert0(offset,Double.toString(d));
return this;
},"~N,~N");
Clazz_defineMethod(c$,"insert",
function(offset,obj){
this.insert0(offset,obj==null?"null":obj.toString());
return this;
},"~N,~O");
Clazz_defineMethod(c$,"insert",
function(offset,str){
this.insert0(offset,str);
return this;
},"~N,~S");
Clazz_defineMethod(c$,"insert",
function(offset,ch){
this.insert0(offset,ch);
return this;
},"~N,~A");
Clazz_defineMethod(c$,"insert",
function(offset,str,strOffset,strLen){
this.insert0(offset,str,strOffset,strLen);
return this;
},"~N,~A,~N,~N");
Clazz_defineMethod(c$,"insert",
function(offset,s){
this.insert0(offset,s==null?"null":s.toString());
return this;
},"~N,CharSequence");
Clazz_defineMethod(c$,"insert",
function(offset,s,start,end){
this.insert0(offset,s,start,end);
return this;
},"~N,CharSequence,~N,~N");
Clazz_defineMethod(c$,"replace",
function(start,end,str){
this.replace0(start,end,str);
return this;
},"~N,~N,~S");
Clazz_defineMethod(c$,"reverse",
function(){
this.reverse0();
return this;
});
});
Clazz_load(null,"java.lang.Thread",["java.lang.IllegalArgumentException","$.ThreadGroup","java.util.Date"],function(){
c$=Clazz_decorateAsClass(function(){
this.target=null;
this.group=null;
this.name=null;
this.priority=0;
Clazz_instantialize(this,arguments);
},java.lang,"Thread",null,Runnable);
c$.currentThread=Clazz_defineMethod(c$,"currentThread",
function(){
if(Thread.J2S_THREAD==null){
(Thread.J2S_THREAD=new Thread(),Thread.prototype.J2S_THREAD=Thread.J2S_THREAD);
}return Thread.J2S_THREAD;
});
c$.sleep=Clazz_defineMethod(c$,"sleep",
function(millis){
Clazz_alert("Thread.sleep is not implemented in Java2Script!");
},"~N");
Clazz_makeConstructor(c$,
function(){
});
Clazz_makeConstructor(c$,
function(target){
this.init(null,target,"Thread-"+new java.util.Date().getTime()+Math.random(),0);
},"Runnable");
Clazz_makeConstructor(c$,
function(group,target){
this.init(group,target,"Thread-"+new java.util.Date().getTime()+Math.random(),0);
},"ThreadGroup,Runnable");
Clazz_makeConstructor(c$,
function(name){
this.init(null,null,name,0);
},"~S");
Clazz_makeConstructor(c$,
function(group,name){
this.init(group,null,name,0);
},"ThreadGroup,~S");
Clazz_makeConstructor(c$,
function(target,name){
this.init(null,target,name,0);
},"Runnable,~S");
Clazz_makeConstructor(c$,
function(group,target,name){
this.init(group,target,name,0);
},"ThreadGroup,Runnable,~S");
Clazz_makeConstructor(c$,
function(group,target,name,stackSize){
this.init(group,target,name,stackSize);
},"ThreadGroup,Runnable,~S,~N");
Clazz_defineMethod(c$,"init",
($fz=function(g,target,name,stackSize){
if(g==null){
g=new ThreadGroup();
}this.group=g;
this.target=target;
this.name=name;
this.priority=5;
},$fz.isPrivate=true,$fz),"ThreadGroup,Runnable,~S,~N");
Clazz_defineMethod(c$,"start",
function(){
window.setTimeout((function(runnable){
return function(){
runnable.run();
};
})(this),0);
});
Clazz_defineMethod(c$,"run",
function(){
if(this.target!=null){
this.target.run();
}});
Clazz_defineMethod(c$,"setPriority",
function(newPriority){
if(newPriority>10||newPriority<1){
throw new IllegalArgumentException();
}this.priority=newPriority;
},"~N");
Clazz_defineMethod(c$,"getPriority",
function(){
return this.priority;
});


Clazz_defineMethod(c$,"interrupt",
function(){
 //not implemented
});

Clazz_defineMethod(c$,"setName",
function(name){
this.name=name;
},"~S");
Clazz_defineMethod(c$,"getName",
function(){
return String.valueOf(this.name);
});
Clazz_defineMethod(c$,"getThreadGroup",
function(){
return this.group;
});
Clazz_overrideMethod(c$,"toString",
function(){
var group=this.getThreadGroup();
if(group!=null){
return"Thread["+this.getName()+","+this.getPriority()+","+group.getName()+"]";
}else{
return"Thread["+this.getName()+","+this.getPriority()+","+""+"]";
}});
Clazz_defineStatics(c$,
"MIN_PRIORITY",1,
"NORM_PRIORITY",5,
"MAX_PRIORITY",10,
"J2S_THREAD",null);
});
Clazz_load(null,"java.lang.ThreadGroup",["java.lang.NullPointerException","$.Thread"],function(){
c$=Clazz_decorateAsClass(function(){
this.parent=null;
this.name=null;
this.maxPriority=0;
Clazz_instantialize(this,arguments);
},java.lang,"ThreadGroup");
Clazz_makeConstructor(c$,
function(){
this.name="system";
this.maxPriority=10;
});
Clazz_makeConstructor(c$,
function(name){
this.construct(Thread.currentThread().getThreadGroup(),name);
},"~S");
Clazz_makeConstructor(c$,
function(parent,name){
if(parent==null){
throw new NullPointerException();
}this.name=name;
this.parent=parent;
this.maxPriority=10;
},"ThreadGroup,~S");
Clazz_defineMethod(c$,"getName",
function(){
return this.name;
});
Clazz_defineMethod(c$,"getParent",
function(){
return this.parent;
});
Clazz_defineMethod(c$,"getMaxPriority",
function(){
return this.maxPriority;
});
});
Clazz_load (["java.io.FilterInputStream"], "java.io.BufferedInputStream", ["java.io.IOException", "java.lang.IndexOutOfBoundsException"], function () {
c$ = Clazz_decorateAsClass (function () {
this.buf = null;
this.count = 0;
this.pos = 0;
this.markpos = -1;
this.marklimit = 0;
Clazz_instantialize (this, arguments);
}, java.io, "BufferedInputStream", java.io.FilterInputStream);
Clazz_defineMethod (c$, "getInIfOpen", 
 function () {
var input = this.$in;
if (input == null) throw  new java.io.IOException ("Stream closed");
return input;
});
Clazz_defineMethod (c$, "getBufIfOpen", 
 function () {
var buffer = this.buf;
if (buffer == null) throw  new java.io.IOException ("Stream closed");
return buffer;
});
Clazz_overrideMethod (c$, "resetStream", 
function () {
});
Clazz_makeConstructor (c$, 
function ($in) {
Clazz_superConstructor (this, java.io.BufferedInputStream, [$in]);
this.buf =  Clazz_newByteArray (8192, 0);
}, "java.io.InputStream");
Clazz_defineMethod (c$, "fill", 
 function () {
var buffer = this.getBufIfOpen ();
if (this.markpos < 0) this.pos = 0;
 else if (this.pos >= buffer.length) if (this.markpos > 0) {
var sz = this.pos - this.markpos;
System.arraycopy (buffer, this.markpos, buffer, 0, sz);
this.pos = sz;
this.markpos = 0;
} else if (buffer.length >= this.marklimit) {
this.markpos = -1;
this.pos = 0;
} else {
var nsz = this.pos * 2;
if (nsz > this.marklimit) nsz = this.marklimit;
var nbuf =  Clazz_newByteArray (nsz, 0);
System.arraycopy (buffer, 0, nbuf, 0, this.pos);
buffer = this.buf = nbuf;
}this.count = this.pos;
var n = this.getInIfOpen ().read (buffer, this.pos, buffer.length - this.pos);
if (n > 0) this.count = n + this.pos;
});
Clazz_overrideMethod (c$, "readByteAsInt", 
function () {
if (this.pos >= this.count) {
this.fill ();
if (this.pos >= this.count) return -1;
}return this.getBufIfOpen ()[this.pos++] & 0xff;
});
Clazz_defineMethod (c$, "read1", 
 function (b, off, len) {
var avail = this.count - this.pos;
if (avail <= 0) {
if (len >= this.getBufIfOpen ().length && this.markpos < 0) {
return this.getInIfOpen ().read (b, off, len);
}this.fill ();
avail = this.count - this.pos;
if (avail <= 0) return -1;
}var cnt = (avail < len) ? avail : len;
System.arraycopy (this.getBufIfOpen (), this.pos, b, off, cnt);
this.pos += cnt;
return cnt;
}, "~A,~N,~N");
Clazz_overrideMethod (c$, "read", 
function (b, off, len) {
this.getBufIfOpen ();
if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
throw  new IndexOutOfBoundsException ();
} else if (len == 0) {
return 0;
}var n = 0;
for (; ; ) {
var nread = this.read1 (b, off + n, len - n);
if (nread <= 0) return (n == 0) ? nread : n;
n += nread;
if (n >= len) return n;
var input = this.$in;
if (input != null && input.available () <= 0) return n;
}
}, "~A,~N,~N");
Clazz_overrideMethod (c$, "skip", 
function (n) {
this.getBufIfOpen ();
if (n <= 0) {
return 0;
}var avail = this.count - this.pos;
if (avail <= 0) {
if (this.markpos < 0) return this.getInIfOpen ().skip (n);
this.fill ();
avail = this.count - this.pos;
if (avail <= 0) return 0;
}var skipped = (avail < n) ? avail : n;
this.pos += skipped;
return skipped;
}, "~N");
Clazz_overrideMethod (c$, "available", 
function () {
var n = this.count - this.pos;
var avail = this.getInIfOpen ().available ();
return n > (2147483647 - avail) ? 2147483647 : n + avail;
});
Clazz_overrideMethod (c$, "mark", 
function (readlimit) {
this.marklimit = readlimit;
this.markpos = this.pos;
}, "~N");
Clazz_overrideMethod (c$, "reset", 
function () {
this.getBufIfOpen ();
if (this.markpos < 0) throw  new java.io.IOException ("Resetting to invalid mark");
this.pos = this.markpos;
});
Clazz_overrideMethod (c$, "markSupported", 
function () {
return true;
});
Clazz_overrideMethod (c$, "close", 
function () {
var input = this.$in;
this.$in = null;
if (input != null) input.close ();
return;
});
Clazz_defineStatics (c$,
"DEFAULT_BUFFER_SIZE", 8192);
});
Clazz_load (["java.io.Reader"], "java.io.BufferedReader", ["java.io.IOException", "java.lang.IllegalArgumentException", "$.IndexOutOfBoundsException", "JU.SB"], function () {
c$ = Clazz_decorateAsClass (function () {
this.$in = null;
this.cb = null;
this.nChars = 0;
this.nextChar = 0;
this.markedChar = -1;
this.readAheadLimit = 0;
this.skipLF = false;
this.markedSkipLF = false;
Clazz_instantialize (this, arguments);
}, java.io, "BufferedReader", java.io.Reader);
Clazz_defineMethod (c$, "setSize", 
 function (sz) {
if (sz <= 0) throw  new IllegalArgumentException ("Buffer size <= 0");
this.cb =  Clazz_newCharArray (sz, '\0');
this.nextChar = this.nChars = 0;
}, "~N");
Clazz_makeConstructor (c$, 
function ($in) {
Clazz_superConstructor (this, java.io.BufferedReader, [$in]);
this.$in = $in;
this.setSize (8192);
}, "java.io.Reader");
Clazz_defineMethod (c$, "ensureOpen", 
 function () {
if (this.$in == null) throw  new java.io.IOException ("Stream closed");
});
Clazz_defineMethod (c$, "fill", 
 function () {
var dst;
if (this.markedChar <= -1) {
dst = 0;
} else {
var delta = this.nextChar - this.markedChar;
if (delta >= this.readAheadLimit) {
this.markedChar = -2;
this.readAheadLimit = 0;
dst = 0;
} else {
if (this.readAheadLimit <= this.cb.length) {
System.arraycopy (this.cb, this.markedChar, this.cb, 0, delta);
this.markedChar = 0;
dst = delta;
} else {
var ncb =  Clazz_newCharArray (this.readAheadLimit, '\0');
System.arraycopy (this.cb, this.markedChar, ncb, 0, delta);
this.cb = ncb;
this.markedChar = 0;
dst = delta;
}this.nextChar = this.nChars = delta;
}}var n;
do {
n = this.$in.read (this.cb, dst, this.cb.length - dst);
} while (n == 0);
if (n > 0) {
this.nChars = dst + n;
this.nextChar = dst;
}});
Clazz_defineMethod (c$, "read1", 
 function (cbuf, off, len) {
if (this.nextChar >= this.nChars) {
if (len >= this.cb.length && this.markedChar <= -1 && !this.skipLF) {
return this.$in.read (cbuf, off, len);
}this.fill ();
}if (this.nextChar >= this.nChars) return -1;
if (this.skipLF) {
this.skipLF = false;
if (this.cb[this.nextChar] == '\n') {
this.nextChar++;
if (this.nextChar >= this.nChars) this.fill ();
if (this.nextChar >= this.nChars) return -1;
}}var n = Math.min (len, this.nChars - this.nextChar);
System.arraycopy (this.cb, this.nextChar, cbuf, off, n);
this.nextChar += n;
return n;
}, "~A,~N,~N");
Clazz_defineMethod (c$, "read", 
function (cbuf, off, len) {
{
this.ensureOpen ();
if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) {
throw  new IndexOutOfBoundsException ();
} else if (len == 0) {
return 0;
}var n = this.read1 (cbuf, off, len);
if (n <= 0) return n;
while ((n < len) && this.$in.ready ()) {
var n1 = this.read1 (cbuf, off + n, len - n);
if (n1 <= 0) break;
n += n1;
}
return n;
}}, "~A,~N,~N");
Clazz_defineMethod (c$, "readLine1", 
 function (ignoreLF) {
var s = null;
var startChar;
{
this.ensureOpen ();
var omitLF = ignoreLF || this.skipLF;
for (; ; ) {
if (this.nextChar >= this.nChars) this.fill ();
if (this.nextChar >= this.nChars) {
if (s != null && s.length () > 0) return s.toString ();
return null;
}var eol = false;
var c = String.fromCharCode (0);
var i;
if (omitLF && (this.cb[this.nextChar] == '\n')) this.nextChar++;
this.skipLF = false;
omitLF = false;
charLoop : for (i = this.nextChar; i < this.nChars; i++) {
c = this.cb[i];
if ((c == '\n') || (c == '\r')) {
eol = true;
break charLoop;
}}
startChar = this.nextChar;
this.nextChar = i;
if (eol) {
var str;
if (s == null) {
str =  String.instantialize (this.cb, startChar, i - startChar);
} else {
s.appendCB (this.cb, startChar, i - startChar);
str = s.toString ();
}this.nextChar++;
if (c == '\r') {
this.skipLF = true;
}return str;
}if (s == null) s = JU.SB.newN (80);
s.appendCB (this.cb, startChar, i - startChar);
}
}}, "~B");
Clazz_defineMethod (c$, "readLine", 
function () {
return this.readLine1 (false);
});
Clazz_overrideMethod (c$, "skip", 
function (n) {
if (n < 0) {
throw  new IllegalArgumentException ("skip value is negative");
}{
this.ensureOpen ();
var r = n;
while (r > 0) {
if (this.nextChar >= this.nChars) this.fill ();
if (this.nextChar >= this.nChars) break;
if (this.skipLF) {
this.skipLF = false;
if (this.cb[this.nextChar] == '\n') {
this.nextChar++;
}}var d = this.nChars - this.nextChar;
if (r <= d) {
this.nextChar += r;
r = 0;
break;
}r -= d;
this.nextChar = this.nChars;
}
return n - r;
}}, "~N");
Clazz_defineMethod (c$, "ready", 
function () {
{
this.ensureOpen ();
if (this.skipLF) {
if (this.nextChar >= this.nChars && this.$in.ready ()) {
this.fill ();
}if (this.nextChar < this.nChars) {
if (this.cb[this.nextChar] == '\n') this.nextChar++;
this.skipLF = false;
}}return (this.nextChar < this.nChars) || this.$in.ready ();
}});
Clazz_overrideMethod (c$, "markSupported", 
function () {
return true;
});
Clazz_overrideMethod (c$, "mark", 
function (readAheadLimit) {
if (readAheadLimit < 0) {
throw  new IllegalArgumentException ("Read-ahead limit < 0");
}{
this.ensureOpen ();
this.readAheadLimit = readAheadLimit;
this.markedChar = this.nextChar;
this.markedSkipLF = this.skipLF;
}}, "~N");
Clazz_overrideMethod (c$, "reset", 
function () {
{
this.ensureOpen ();
if (this.markedChar < 0) throw  new java.io.IOException ((this.markedChar == -2) ? "Mark invalid" : "Stream not marked");
this.nextChar = this.markedChar;
this.skipLF = this.markedSkipLF;
}});
Clazz_defineMethod (c$, "close", 
function () {
{
if (this.$in == null) return;
this.$in.close ();
this.$in = null;
this.cb = null;
}});
Clazz_defineStatics (c$,
"INVALIDATED", -2,
"UNMARKED", -1,
"DEFAULT_CHAR_BUFFER_SIZE", 8192,
"DEFAULT_EXPECTED_LINE_LENGTH", 80);
});
Clazz_load(["java.io.Writer"],"java.io.BufferedWriter",["java.io.IOException","java.lang.IllegalArgumentException","$.IndexOutOfBoundsException","$.StringIndexOutOfBoundsException"],function(){
c$=Clazz_decorateAsClass(function(){
this.out=null;
this.buf=null;
this.pos=0;
this.lineSeparator="\r\n";
Clazz_instantialize(this,arguments);
},java.io,"BufferedWriter",java.io.Writer);
Clazz_makeConstructor(c$,
function(out){
Clazz_superConstructor(this,java.io.BufferedWriter,[out]);
this.out=out;
this.buf=Clazz_newArray(8192,'\0');
},"java.io.Writer");
Clazz_makeConstructor(c$,
function(out,size){
Clazz_superConstructor(this,java.io.BufferedWriter,[out]);
if(size>0){
this.out=out;
this.buf=Clazz_newArray(size,'\0');
}else{
throw new IllegalArgumentException(("K0058"));
}},"java.io.Writer,~N");
Clazz_defineMethod(c$,"close",
function(){
{
if(this.isOpen()){
this.flush();
this.out.close();
this.buf=null;
this.out=null;
}}});
Clazz_defineMethod(c$,"flush",
function(){
{
if(this.isOpen()){
if(this.pos>0){
this.out.write(this.buf,0,this.pos);
}this.pos=0;
this.out.flush();
}else{
throw new java.io.IOException(("K005d"));
}}});
Clazz_defineMethod(c$,"isOpen",
($fz=function(){
return this.out!=null;
},$fz.isPrivate=true,$fz));
Clazz_defineMethod(c$,"newLine",
function(){
this.write("\r\n",0,"\r\n".length);
});
Clazz_defineMethod(c$,"write",
function(cbuf,offset,count){
{
if(!this.isOpen()){
throw new java.io.IOException(("K005d"));
}if(offset<0||offset>cbuf.length-count||count<0){
throw new IndexOutOfBoundsException();
}if(this.pos==0&&count>=this.buf.length){
this.out.write(cbuf,offset,count);
return;
}var available=this.buf.length-this.pos;
if(count<available){
available=count;
}if(available>0){
System.arraycopy(cbuf,offset,this.buf,this.pos,available);
this.pos+=available;
}if(this.pos==this.buf.length){
this.out.write(this.buf,0,this.buf.length);
this.pos=0;
if(count>available){
offset+=available;
available=count-available;
if(available>=this.buf.length){
this.out.write(cbuf,offset,available);
return;
}System.arraycopy(cbuf,offset,this.buf,this.pos,available);
this.pos+=available;
}}}},"~A,~N,~N");
Clazz_defineMethod(c$,"write",
function(oneChar){
{
if(this.isOpen()){
if(this.pos>=this.buf.length){
this.out.write(this.buf,0,this.buf.length);
this.pos=0;
}this.buf[this.pos++]=String.fromCharCode(oneChar);
}else{
throw new java.io.IOException(("K005d"));
}}},"~N");
Clazz_defineMethod(c$,"write",
function(str,offset,count){
{
if(!this.isOpen()){
throw new java.io.IOException(("K005d"));
}if(count<=0){
return;
}if(offset>str.length-count||offset<0){
throw new StringIndexOutOfBoundsException();
}if(this.pos==0&&count>=this.buf.length){
var chars=Clazz_newArray(count,'\0');
str.getChars(offset,offset+count,chars,0);
this.out.write(chars,0,count);
return;
}var available=this.buf.length-this.pos;
if(count<available){
available=count;
}if(available>0){
str.getChars(offset,offset+available,this.buf,this.pos);
this.pos+=available;
}if(this.pos==this.buf.length){
this.out.write(this.buf,0,this.buf.length);
this.pos=0;
if(count>available){
offset+=available;
available=count-available;
if(available>=this.buf.length){
var chars=Clazz_newArray(count,'\0');
str.getChars(offset,offset+available,chars,0);
this.out.write(chars,0,available);
return;
}str.getChars(offset,offset+available,this.buf,this.pos);
this.pos+=available;
}}}},"~S,~N,~N");
});
Clazz_load (["java.io.InputStream"], "java.io.ByteArrayInputStream", ["java.lang.IndexOutOfBoundsException", "$.NullPointerException"], function () {
c$ = Clazz_decorateAsClass (function () {
this.buf = null;
this.pos = 0;
this.$mark = 0;
this.count = 0;
Clazz_instantialize (this, arguments);
}, java.io, "ByteArrayInputStream", java.io.InputStream);
Clazz_makeConstructor (c$, 
function (buf) {
Clazz_superConstructor (this, java.io.ByteArrayInputStream, []);
this.buf = buf;
this.pos = 0;
this.count = buf.length;
}, "~A");
Clazz_overrideMethod (c$, "readByteAsInt", 
function () {
return (this.pos < this.count) ? (this.buf[this.pos++] & 0xff) : -1;
});
Clazz_overrideMethod (c$, "read", 
function (b, off, len) {
if (b == null) {
throw  new NullPointerException ();
} else if (off < 0 || len < 0 || len > b.length - off) {
throw  new IndexOutOfBoundsException ();
}if (this.pos >= this.count) {
return -1;
}var avail = this.count - this.pos;
if (len > avail) {
len = avail;
}if (len <= 0) {
return 0;
}System.arraycopy (this.buf, this.pos, b, off, len);
this.pos += len;
return len;
}, "~A,~N,~N");
Clazz_overrideMethod (c$, "skip", 
function (n) {
var k = this.count - this.pos;
if (n < k) {
k = n < 0 ? 0 : n;
}this.pos += k;
return k;
}, "~N");
Clazz_overrideMethod (c$, "available", 
function () {
return this.count - this.pos;
});
Clazz_overrideMethod (c$, "markSupported", 
function () {
return true;
});
Clazz_overrideMethod (c$, "mark", 
function (readAheadLimit) {
this.$mark = this.pos;
}, "~N");
Clazz_overrideMethod (c$, "resetStream", 
function () {
});
Clazz_overrideMethod (c$, "reset", 
function () {
this.pos = this.$mark;
});
Clazz_overrideMethod (c$, "close", 
function () {
});
});
Clazz_load (["java.io.OutputStream"], "java.io.ByteArrayOutputStream", ["java.lang.IllegalArgumentException", "$.IndexOutOfBoundsException", "$.OutOfMemoryError"], function () {
c$ = Clazz_decorateAsClass (function () {
this.buf = null;
this.count = 0;
Clazz_instantialize (this, arguments);
}, java.io, "ByteArrayOutputStream", java.io.OutputStream);
Clazz_makeConstructor (c$, 
function () {
this.construct (32);
});
Clazz_makeConstructor (c$, 
function (size) {
Clazz_superConstructor (this, java.io.ByteArrayOutputStream, []);
if (size < 0) {
throw  new IllegalArgumentException ("Negative initial size: " + size);
}this.buf =  Clazz_newByteArray (size, 0);
}, "~N");
Clazz_defineMethod (c$, "ensureCapacity", 
 function (minCapacity) {
if (minCapacity - this.buf.length > 0) this.grow (minCapacity);
}, "~N");
Clazz_defineMethod (c$, "grow", 
 function (minCapacity) {
var oldCapacity = this.buf.length;
var newCapacity = oldCapacity << 1;
if (newCapacity - minCapacity < 0) newCapacity = minCapacity;
if (newCapacity < 0) {
if (minCapacity < 0) throw  new OutOfMemoryError ();
newCapacity = minCapacity;
}this.buf = java.io.ByteArrayOutputStream.arrayCopyByte (this.buf, newCapacity);
}, "~N");
c$.arrayCopyByte = Clazz_defineMethod (c$, "arrayCopyByte", 
 function (array, newLength) {
var t =  Clazz_newByteArray (newLength, 0);
System.arraycopy (array, 0, t, 0, array.length < newLength ? array.length : newLength);
return t;
}, "~A,~N");
Clazz_overrideMethod (c$, "writeByteAsInt", 
function (b) {
this.ensureCapacity (this.count + 1);
this.buf[this.count] = b;
this.count += 1;
}, "~N");
Clazz_defineMethod (c$, "write", 
function (b, off, len) {
if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) - b.length > 0)) {
throw  new IndexOutOfBoundsException ();
}this.ensureCapacity (this.count + len);
System.arraycopy (b, off, this.buf, this.count, len);
this.count += len;
}, "~A,~N,~N");
Clazz_defineMethod (c$, "writeTo", 
function (out) {
out.write (this.buf, 0, this.count);
}, "java.io.OutputStream");
Clazz_defineMethod (c$, "reset", 
function () {
this.count = 0;
});
Clazz_defineMethod (c$, "toByteArray", 
function () {
return (this.count == this.buf.length ? this.buf : java.io.ByteArrayOutputStream.arrayCopyByte (this.buf, this.count));
});
Clazz_defineMethod (c$, "size", 
function () {
return this.count;
});
Clazz_overrideMethod (c$, "toString", 
function () {
return  String.instantialize (this.buf, 0, this.count);
});
Clazz_overrideMethod (c$, "close", 
function () {
});
});
Clazz_load (["java.io.InputStream"], "java.io.FilterInputStream", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.$in = null;
Clazz_instantialize (this, arguments);
}, java.io, "FilterInputStream", java.io.InputStream);
Clazz_makeConstructor (c$, 
function ($in) {
Clazz_superConstructor (this, java.io.FilterInputStream, []);
this.$in = $in;
}, "java.io.InputStream");
Clazz_defineMethod (c$, "readByteAsInt", 
function () {
return this.$in.readByteAsInt ();
});
Clazz_defineMethod (c$, "read", 
function (b, off, len) {
return this.$in.read (b, off, len);
}, "~A,~N,~N");
Clazz_defineMethod (c$, "skip", 
function (n) {
return this.$in.skip (n);
}, "~N");
Clazz_defineMethod (c$, "available", 
function () {
return this.$in.available ();
});
Clazz_defineMethod (c$, "close", 
function () {
this.$in.close ();
});
Clazz_defineMethod (c$, "mark", 
function (readlimit) {
this.$in.mark (readlimit);
}, "~N");
Clazz_defineMethod (c$, "reset", 
function () {
this.$in.reset ();
});
Clazz_defineMethod (c$, "markSupported", 
function () {
return this.$in.markSupported ();
});
});
Clazz_load (null, "java.io.InputStream", ["java.io.IOException", "java.lang.IndexOutOfBoundsException", "$.NullPointerException"], function () {
c$ = Clazz_declareType (java.io, "InputStream");
Clazz_defineMethod (c$, "read", 
function (b, off, len) {
if (b == null) {
throw  new NullPointerException ();
} else if (off < 0 || len < 0 || len > b.length - off) {
throw  new IndexOutOfBoundsException ();
} else if (len == 0) {
return 0;
}var c = this.readByteAsInt ();
if (c == -1) {
return -1;
}b[off] = c;
var i = 1;
try {
for (; i < len; i++) {
c = this.readByteAsInt ();
if (c == -1) {
break;
}b[off + i] = c;
}
} catch (ee) {
if (Clazz_exceptionOf (ee, java.io.IOException)) {
} else {
throw ee;
}
}
return i;
}, "~A,~N,~N");
Clazz_defineMethod (c$, "skip", 
function (n) {
var remaining = n;
var nr;
if (java.io.InputStream.skipBuffer == null) java.io.InputStream.skipBuffer =  Clazz_newByteArray (2048, 0);
var localSkipBuffer = java.io.InputStream.skipBuffer;
if (n <= 0) {
return 0;
}while (remaining > 0) {
nr = this.read (localSkipBuffer, 0, Math.min (2048, remaining));
if (nr < 0) {
break;
}remaining -= nr;
}
return n - remaining;
}, "~N");
Clazz_defineMethod (c$, "available", 
function () {
return 0;
});
Clazz_defineMethod (c$, "close", 
function () {
});
Clazz_defineMethod (c$, "mark", 
function (readlimit) {
}, "~N");
Clazz_defineMethod (c$, "reset", 
function () {
throw  new java.io.IOException ("mark/reset not supported");
});
Clazz_defineMethod (c$, "markSupported", 
function () {
return false;
});
Clazz_defineMethod (c$, "resetStream", 
function () {
});
Clazz_defineStatics (c$,
"SKIP_BUFFER_SIZE", 2048,
"skipBuffer", null);
});
Clazz_load (["java.io.Reader"], "java.io.InputStreamReader", ["java.lang.NullPointerException"], function () {
c$ = Clazz_decorateAsClass (function () {
this.$in = null;
this.isOpen = true;
this.charsetName = null;
this.isUTF8 = false;
this.bytearr = null;
this.pos = 0;
Clazz_instantialize (this, arguments);
}, java.io, "InputStreamReader", java.io.Reader);
Clazz_makeConstructor (c$, 
function ($in, charsetName) {
Clazz_superConstructor (this, java.io.InputStreamReader, [$in]);
this.$in = $in;
this.charsetName = charsetName;
if (!(this.isUTF8 = "UTF-8".equals (charsetName)) && !"ISO-8859-1".equals (charsetName)) throw  new NullPointerException ("charsetName");
}, "java.io.InputStream,~S");
Clazz_defineMethod (c$, "getEncoding", 
function () {
return this.charsetName;
});
Clazz_overrideMethod (c$, "read", 
function (cbuf, offset, length) {
if (this.bytearr == null || this.bytearr.length < length) this.bytearr =  Clazz_newByteArray (length, 0);
var c;
var char2;
var char3;
var byteCount = 0;
var charCount = offset;
var byteLen = this.$in.read (this.bytearr, this.pos, length - this.pos);
var nAvail = this.$in.available ();
if (byteLen < 0) return -1;
var nMax = byteLen;
while (byteCount < nMax) {
c = this.bytearr[byteCount] & 0xff;
if (this.isUTF8) switch (c >> 4) {
case 0xC:
case 0xD:
if (byteCount + 1 >= byteLen) {
if (nAvail >= 1) {
nMax = byteCount;
continue;
}} else if (((char2 = this.bytearr[byteCount + 1]) & 0xC0) == 0x80) {
cbuf[charCount++] = String.fromCharCode (((c & 0x1F) << 6) | (char2 & 0x3F));
byteCount += 2;
continue;
}this.isUTF8 = false;
break;
case 0xE:
if (byteCount + 2 >= byteLen) {
if (nAvail >= 2) {
nMax = byteCount;
continue;
}} else if (((char2 = this.bytearr[byteCount + 1]) & 0xC0) == 0x80 && ((char3 = this.bytearr[byteCount + 2]) & 0xC0) == 0x80) {
cbuf[charCount++] = String.fromCharCode (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | (char3 & 0x3F));
byteCount += 3;
continue;
}this.isUTF8 = false;
break;
}
byteCount++;
cbuf[charCount++] = String.fromCharCode (c);
}
this.pos = byteLen - byteCount;
for (var i = 0; i < this.pos; i++) {
this.bytearr[i] = this.bytearr[byteCount++];
}
return charCount - offset;
}, "~A,~N,~N");
Clazz_overrideMethod (c$, "ready", 
function () {
return this.isOpen;
});
Clazz_overrideMethod (c$, "close", 
function () {
this.$in.close ();
this.isOpen = false;
});
});
Clazz_load (["java.io.Closeable", "$.Flushable"], "java.io.OutputStream", ["java.lang.IndexOutOfBoundsException", "$.NullPointerException"], function () {
c$ = Clazz_declareType (java.io, "OutputStream", null, [java.io.Closeable, java.io.Flushable]);
Clazz_defineMethod (c$, "write", 
function (b, off, len) {
if (b == null) {
throw  new NullPointerException ();
} else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) {
throw  new IndexOutOfBoundsException ();
} else if (len == 0) {
return;
}for (var i = 0; i < len; i++) {
this.writeByteAsInt (b[off + i]);
}
}, "~A,~N,~N");
Clazz_overrideMethod (c$, "flush", 
function () {
});
Clazz_overrideMethod (c$, "close", 
function () {
});
});
Clazz_load (["java.io.Closeable"], "java.io.Reader", ["java.io.IOException", "java.lang.IllegalArgumentException", "$.NullPointerException"], function () {
c$ = Clazz_decorateAsClass (function () {
this.lock = null;
this.skipBuffer = null;
Clazz_instantialize (this, arguments);
}, java.io, "Reader", null, java.io.Closeable);
Clazz_makeConstructor (c$, 
function (lock) {
if (lock == null) {
throw  new NullPointerException ();
}this.lock = lock;
}, "~O");
Clazz_defineMethod (c$, "skip", 
function (n) {
if (n < 0) throw  new IllegalArgumentException ("skip value is negative");
var nn = Math.min (n, 8192);
{
if ((this.skipBuffer == null) || (this.skipBuffer.length < nn)) this.skipBuffer =  Clazz_newCharArray (nn, '\0');
var r = n;
while (r > 0) {
var nc = this.read (this.skipBuffer, 0, Math.min (r, nn));
if (nc == -1) break;
r -= nc;
}
return n - r;
}}, "~N");
Clazz_defineMethod (c$, "ready", 
function () {
return false;
});
Clazz_defineMethod (c$, "markSupported", 
function () {
return false;
});
Clazz_defineMethod (c$, "mark", 
function (readAheadLimit) {
throw  new java.io.IOException ("mark() not supported");
}, "~N");
Clazz_defineMethod (c$, "reset", 
function () {
throw  new java.io.IOException ("reset() not supported");
});
Clazz_defineStatics (c$,
"MAX_SKIP_BUFFE_SIZE", 8192);
});
Clazz_load (["java.io.Reader"], "java.io.StringReader", ["java.io.IOException", "java.lang.IllegalArgumentException", "$.IndexOutOfBoundsException"], function () {
c$ = Clazz_decorateAsClass (function () {
this.str = null;
this.length = 0;
this.next = 0;
this.$mark = 0;
Clazz_instantialize (this, arguments);
}, java.io, "StringReader", java.io.Reader);
Clazz_makeConstructor (c$, 
function (s) {
Clazz_superConstructor (this, java.io.StringReader, [s]);
this.str = s;
this.length = s.length;
}, "~S");
Clazz_defineMethod (c$, "ensureOpen", 
 function () {
if (this.str == null) throw  new java.io.IOException ("Stream closed");
});
Clazz_overrideMethod (c$, "read", 
function (cbuf, off, len) {
{
this.ensureOpen ();
if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) {
throw  new IndexOutOfBoundsException ();
} else if (len == 0) {
return 0;
}if (this.next >= this.length) return -1;
var n = Math.min (this.length - this.next, len);
this.str.getChars (this.next, this.next + n, cbuf, off);
this.next += n;
return n;
}}, "~A,~N,~N");
Clazz_overrideMethod (c$, "skip", 
function (ns) {
{
this.ensureOpen ();
if (this.next >= this.length) return 0;
var n = Math.min (this.length - this.next, ns);
n = Math.max (-this.next, n);
this.next += n;
return n;
}}, "~N");
Clazz_overrideMethod (c$, "ready", 
function () {
{
this.ensureOpen ();
return true;
}});
Clazz_overrideMethod (c$, "markSupported", 
function () {
return true;
});
Clazz_overrideMethod (c$, "mark", 
function (readAheadLimit) {
if (readAheadLimit < 0) {
throw  new IllegalArgumentException ("Read-ahead limit < 0");
}{
this.ensureOpen ();
this.$mark = this.next;
}}, "~N");
Clazz_overrideMethod (c$, "reset", 
function () {
{
this.ensureOpen ();
this.next = this.$mark;
}});
Clazz_overrideMethod (c$, "close", 
function () {
this.str = null;
});
});
Clazz_load(["java.io.Closeable","$.Flushable","java.lang.Appendable"],"java.io.Writer",["java.lang.NullPointerException","$.StringIndexOutOfBoundsException"],function(){
c$=Clazz_decorateAsClass(function(){
this.lock=null;
Clazz_instantialize(this,arguments);
},java.io,"Writer",null,[Appendable,java.io.Closeable,java.io.Flushable]);
Clazz_makeConstructor(c$,
function(){
this.lock=this;
});
Clazz_makeConstructor(c$,
function(lock){
if(lock!=null){
this.lock=lock;
}else{
throw new NullPointerException();
}},"~O");
Clazz_defineMethod(c$,"write",
function(buf){
this.write(buf,0,buf.length);
},"~A");
Clazz_defineMethod(c$,"write",
function(oneChar){
{
var oneCharArray=Clazz_newArray(1,'\0');
oneCharArray[0]=String.fromCharCode(oneChar);
this.write(oneCharArray);
}},"~N");
Clazz_defineMethod(c$,"write",
function(str){
var buf=Clazz_newArray(str.length,'\0');
str.getChars(0,buf.length,buf,0);
{
this.write(buf);
}},"~S");
Clazz_defineMethod(c$,"write",
function(str,offset,count){
if(count>=0){
var buf=Clazz_newArray(count,'\0');
str.getChars(offset,offset+count,buf,0);
{
this.write(buf);
}}else{
throw new StringIndexOutOfBoundsException();
}},"~S,~N,~N");
Clazz_defineMethod(c$,"append",
function(c){
this.write(c.charCodeAt(0));
return this;
},"~N");
Clazz_defineMethod(c$,"append",
function(csq){
if(null==csq){
this.write("null");
}else{
this.write(csq.toString());
}return this;
},"CharSequence");
Clazz_defineMethod(c$,"append",
function(csq,start,end){
if(null==csq){
this.write("null".substring(start,end));
}else{
this.write(csq.subSequence(start,end).toString());
}return this;
},"CharSequence,~N,~N");
Clazz_defineStatics(c$,
"TOKEN_NULL","null");
});
Clazz_declarePackage ("java.net");
Clazz_load (["java.io.IOException"], "java.net.MalformedURLException", null, function () {
c$ = Clazz_declareType (java.net, "MalformedURLException", java.io.IOException);
Clazz_makeConstructor (c$, 
function () {
Clazz_superConstructor (this, java.net.MalformedURLException, []);
});
});
Clazz_declarePackage ("java.net");
Clazz_load (["java.util.Hashtable"], "java.net.URL", ["java.io.IOException", "java.lang.Character", "$.Error", "java.net.MalformedURLException"], function () {
c$ = Clazz_decorateAsClass (function () {
this.protocol = null;
this.host = null;
this.port = -1;
this.file = null;
this.query = null;
this.authority = null;
this.path = null;
this.userInfo = null;
this.ref = null;
this.handler = null;
this.$hashCode = -1;
Clazz_instantialize (this, arguments);
}, java.net, "URL", null, java.io.Serializable);
Clazz_makeConstructor (c$, 
function (context, spec, handler) {
var original = spec;
var i;
var limit;
var c;
var start = 0;
var newProtocol = null;
var aRef = false;
var isRelative = false;
if (handler != null) {
var sm = System.getSecurityManager ();
if (sm != null) {
this.checkSpecifyHandler (sm);
}}try {
limit = spec.length;
while ((limit > 0) && (spec.charAt (limit - 1) <= ' ')) {
limit--;
}
while ((start < limit) && (spec.charAt (start) <= ' ')) {
start++;
}
if (spec.regionMatches (true, start, "url:", 0, 4)) {
start += 4;
}if (start < spec.length && spec.charAt (start) == '#') {
aRef = true;
}for (i = start; !aRef && (i < limit) && ((c = spec.charCodeAt (i)) != 47); i++) {
if (c == 58) {
var s = spec.substring (start, i).toLowerCase ();
if (this.isValidProtocol (s)) {
newProtocol = s;
start = i + 1;
}break;
}}
this.protocol = newProtocol;
if ((context != null) && ((newProtocol == null) || newProtocol.equalsIgnoreCase (context.protocol))) {
if (handler == null) {
handler = context.handler;
}if (context.path != null && context.path.startsWith ("/")) newProtocol = null;
if (newProtocol == null) {
this.protocol = context.protocol;
this.authority = context.authority;
this.userInfo = context.userInfo;
this.host = context.host;
this.port = context.port;
this.file = context.file;
this.path = context.path;
isRelative = true;
}}if (this.protocol == null) {
throw  new java.net.MalformedURLException ("no protocol: " + original);
}if (handler == null && (handler = java.net.URL.getURLStreamHandler (this.protocol)) == null) {
throw  new java.net.MalformedURLException ("unknown protocol: " + this.protocol);
}this.handler = handler;
i = spec.indexOf ('#', start);
if (i >= 0) {
this.ref = spec.substring (i + 1, limit);
limit = i;
}if (isRelative && start == limit) {
this.query = context.query;
if (this.ref == null) {
this.ref = context.ref;
}}handler.parseURL (this, spec, start, limit);
} catch (e$$) {
if (Clazz_exceptionOf (e$$, java.net.MalformedURLException)) {
var e = e$$;
{
throw e;
}
} else if (Clazz_exceptionOf (e$$, Exception)) {
var e = e$$;
{
var exception =  new java.net.MalformedURLException (e.getMessage ());
exception.initCause (e);
throw exception;
}
} else {
throw e$$;
}
}
}, "java.net.URL,~S,java.net.URLStreamHandler");
Clazz_defineMethod (c$, "isValidProtocol", 
 function (protocol) {
var len = protocol.length;
if (len < 1) return false;
var c = protocol.charAt (0);
if (!Character.isLetter (c)) return false;
for (var i = 1; i < len; i++) {
c = protocol.charAt (i);
if (!Character.isLetterOrDigit (c) && c != '.' && c != '+' && c != '-') {
return false;
}}
return true;
}, "~S");
Clazz_defineMethod (c$, "checkSpecifyHandler", 
 function (sm) {
}, "SecurityManager");
Clazz_defineMethod (c$, "set5", 
function (protocol, host, port, file, ref) {
{
this.protocol = protocol;
this.host = host;
this.authority = port == -1 ? host : host + ":" + port;
this.port = port;
this.file = file;
this.ref = ref;
this.$hashCode = -1;
var q = file.lastIndexOf ('?');
if (q != -1) {
this.query = file.substring (q + 1);
this.path = file.substring (0, q);
} else this.path = file;
}}, "~S,~S,~N,~S,~S");
Clazz_defineMethod (c$, "set", 
function (protocol, host, port, authority, userInfo, path, query, ref) {
{
this.protocol = protocol;
this.host = host;
this.port = port;
this.file = query == null ? path : path + "?" + query;
this.userInfo = userInfo;
this.path = path;
this.ref = ref;
this.$hashCode = -1;
this.query = query;
this.authority = authority;
}}, "~S,~S,~N,~S,~S,~S,~S,~S");
Clazz_defineMethod (c$, "getQuery", 
function () {
return this.query;
});
Clazz_defineMethod (c$, "getPath", 
function () {
return this.path;
});
Clazz_defineMethod (c$, "getUserInfo", 
function () {
return this.userInfo;
});
Clazz_defineMethod (c$, "getAuthority", 
function () {
return this.authority;
});
Clazz_defineMethod (c$, "getPort", 
function () {
return this.port;
});
Clazz_defineMethod (c$, "getDefaultPort", 
function () {
return this.handler.getDefaultPort ();
});
Clazz_defineMethod (c$, "getProtocol", 
function () {
return this.protocol;
});
Clazz_defineMethod (c$, "getHost", 
function () {
return this.host;
});
Clazz_defineMethod (c$, "getFile", 
function () {
return this.file;
});
Clazz_defineMethod (c$, "getRef", 
function () {
return this.ref;
});
Clazz_overrideMethod (c$, "equals", 
function (obj) {
if (!(Clazz_instanceOf (obj, java.net.URL))) return false;
var u2 = obj;
return this.handler.equals2 (this, u2);
}, "~O");
Clazz_overrideMethod (c$, "hashCode", 
function () {
if (this.$hashCode != -1) return this.$hashCode;
this.$hashCode = this.handler.hashCode (this);
return this.$hashCode;
});
Clazz_defineMethod (c$, "sameFile", 
function (other) {
return this.handler.sameFile (this, other);
}, "java.net.URL");
Clazz_overrideMethod (c$, "toString", 
function () {
return this.toExternalForm ();
});
Clazz_defineMethod (c$, "toExternalForm", 
function () {
return this.handler.toExternalForm (this);
});
Clazz_defineMethod (c$, "openConnection", 
function () {
return this.handler.openConnection (this);
});
Clazz_defineMethod (c$, "openStream", 
function () {
return this.openConnection ().getInputStream ();
});
Clazz_defineMethod (c$, "getContent", 
function () {
return this.openConnection ().getInputStream ();
});
c$.setURLStreamHandlerFactory = Clazz_defineMethod (c$, "setURLStreamHandlerFactory", 
function (fac) {
{
if (java.net.URL.factory != null) {
throw  new Error ("factory already defined");
}var security = System.getSecurityManager ();
if (security != null) {
security.checkSetFactory ();
}java.net.URL.handlers.clear ();
java.net.URL.factory = fac;
}}, "java.net.URLStreamHandlerFactory");
c$.getURLStreamHandler = Clazz_defineMethod (c$, "getURLStreamHandler", 
function (protocol) {
var handler = java.net.URL.handlers.get (protocol);
if (handler == null) {
if (java.net.URL.factory != null) {
handler = java.net.URL.factory.createURLStreamHandler (protocol);
}}return handler;
}, "~S");
Clazz_defineStatics (c$,
"factory", null);
c$.handlers = c$.prototype.handlers =  new java.util.Hashtable ();
c$.streamHandlerLock = c$.prototype.streamHandlerLock =  new Clazz._O ();
});
Clazz_declarePackage ("java.net");
Clazz_load (null, "java.net.URLConnection", ["java.lang.IllegalStateException", "$.NullPointerException", "java.net.UnknownServiceException", "JU.Lst"], function () {
c$ = Clazz_decorateAsClass (function () {
this.url = null;
this.doInput = true;
this.doOutput = false;
this.connected = false;
this.requests = null;
Clazz_instantialize (this, arguments);
}, java.net, "URLConnection");
Clazz_defineMethod (c$, "setDoInput", 
function (doinput) {
if (this.connected) throw  new IllegalStateException ("Already connected");
this.doInput = doinput;
}, "~B");
Clazz_defineMethod (c$, "getDoInput", 
function () {
return this.doInput;
});
Clazz_defineMethod (c$, "setDoOutput", 
function (dooutput) {
if (this.connected) throw  new IllegalStateException ("Already connected");
this.doOutput = dooutput;
}, "~B");
Clazz_defineMethod (c$, "getDoOutput", 
function () {
return this.doOutput;
});
Clazz_makeConstructor (c$, 
function (url) {
this.url = url;
}, "java.net.URL");
Clazz_defineMethod (c$, "getURL", 
function () {
return this.url;
});
Clazz_defineMethod (c$, "getInputStream", 
function () {
throw  new java.net.UnknownServiceException ("protocol doesn't support input");
});
Clazz_defineMethod (c$, "getOutputStream", 
function () {
throw  new java.net.UnknownServiceException ("protocol doesn't support output");
});
Clazz_defineMethod (c$, "setRequestProperty", 
function (key, value) {
if (this.connected) throw  new IllegalStateException ("Already connected");
if (key == null) throw  new NullPointerException ("key is null");
if (this.requests == null) this.requests =  new JU.Lst ();
for (var i = this.requests.size (); --i >= 0; ) if (this.requests.get (i)[0].equals (key)) {
this.requests.get (i)[1] = value;
return;
}
this.requests.addLast ([key, value]);
}, "~S,~S");
});
Clazz_declarePackage("java.net");
c$=Clazz_declareType(java.net,"URLEncoder");
c$.encode=Clazz_defineMethod(c$,"encode",
function(s){
return encodeURIComponent(arguments[0]);
},"~S");
c$.encode=Clazz_defineMethod(c$,"encode",
function(s,enc){
return encodeURIComponent(arguments[0]);
},"~S,~S");
Clazz_defineStatics(c$,
"digits","0123456789ABCDEF");
Clazz_declarePackage ("java.net");
Clazz_load (null, "java.net.URLStreamHandler", ["java.lang.IllegalArgumentException", "$.SecurityException", "$.UnsupportedOperationException"], function () {
c$ = Clazz_declareType (java.net, "URLStreamHandler");
Clazz_defineMethod (c$, "openConnectionProxy", 
function (u, p) {
throw  new UnsupportedOperationException ("Method not implemented.");
}, "java.net.URL,java.net.Proxy");
Clazz_defineMethod (c$, "parseURL", 
function (u, spec, start, limit) {
var protocol = u.getProtocol ();
var authority = u.getAuthority ();
var userInfo = u.getUserInfo ();
var host = u.getHost ();
var port = u.getPort ();
var path = u.getPath ();
var query = u.getQuery ();
var ref = u.getRef ();
var isRelPath = false;
var queryOnly = false;
if (start < limit) {
var queryStart = spec.indexOf ('?');
queryOnly = queryStart == start;
if ((queryStart != -1) && (queryStart < limit)) {
query = spec.substring (queryStart + 1, limit);
if (limit > queryStart) limit = queryStart;
spec = spec.substring (0, queryStart);
}}var i = 0;
var isUNCName = (start <= limit - 4) && (spec.charAt (start) == '/') && (spec.charAt (start + 1) == '/') && (spec.charAt (start + 2) == '/') && (spec.charAt (start + 3) == '/');
if (!isUNCName && (start <= limit - 2) && (spec.charAt (start) == '/') && (spec.charAt (start + 1) == '/')) {
start += 2;
i = spec.indexOf ('/', start);
if (i < 0) {
i = spec.indexOf ('?', start);
if (i < 0) i = limit;
}host = authority = spec.substring (start, i);
var ind = authority.indexOf ('@');
if (ind != -1) {
userInfo = authority.substring (0, ind);
host = authority.substring (ind + 1);
} else {
userInfo = null;
}if (host != null) {
if (host.length > 0 && (host.charAt (0) == '[')) {
throw  new IllegalArgumentException ("Invalid host: " + host);
}ind = host.indexOf (':');
port = -1;
if (ind >= 0) {
if (host.length > (ind + 1)) {
port = Integer.parseInt (host.substring (ind + 1));
}host = host.substring (0, ind);
}} else {
host = "";
}if (port < -1) throw  new IllegalArgumentException ("Invalid port number :" + port);
start = i;
if (authority.length > 0) path = "";
}if (host == null) {
host = "";
}if (start < limit) {
if (spec.charAt (start) == '/') {
path = spec.substring (start, limit);
} else if (path != null && path.length > 0) {
isRelPath = true;
var ind = path.lastIndexOf ('/');
var seperator = "";
if (ind == -1 && authority != null) seperator = "/";
path = path.substring (0, ind + 1) + seperator + spec.substring (start, limit);
} else {
var seperator = (authority != null) ? "/" : "";
path = seperator + spec.substring (start, limit);
}} else if (queryOnly && path != null) {
var ind = path.lastIndexOf ('/');
if (ind < 0) ind = 0;
path = path.substring (0, ind) + "/";
}if (path == null) path = "";
if (isRelPath) {
while ((i = path.indexOf ("/./")) >= 0) {
path = path.substring (0, i) + path.substring (i + 2);
}
i = 0;
while ((i = path.indexOf ("/../", i)) >= 0) {
if (i > 0 && (limit = path.lastIndexOf ('/', i - 1)) >= 0 && (path.indexOf ("/../", limit) != 0)) {
path = path.substring (0, limit) + path.substring (i + 3);
i = 0;
} else {
i = i + 3;
}}
while (path.endsWith ("/..")) {
i = path.indexOf ("/..");
if ((limit = path.lastIndexOf ('/', i - 1)) >= 0) {
path = path.substring (0, limit + 1);
} else {
break;
}}
if (path.startsWith ("./") && path.length > 2) path = path.substring (2);
if (path.endsWith ("/.")) path = path.substring (0, path.length - 1);
}this.setURL (u, protocol, host, port, authority, userInfo, path, query, ref);
}, "java.net.URL,~S,~N,~N");
Clazz_defineMethod (c$, "getDefaultPort", 
function () {
return -1;
});
Clazz_defineMethod (c$, "equals2", 
function (u1, u2) {
var ref1 = u1.getRef ();
var ref2 = u2.getRef ();
return (ref1 === ref2 || (ref1 != null && ref1.equals (ref2))) && this.sameFile (u1, u2);
}, "java.net.URL,java.net.URL");
Clazz_defineMethod (c$, "hashCode", 
function (u) {
var h = 0;
var protocol = u.getProtocol ();
if (protocol != null) h += protocol.hashCode ();
h += u.toString ().hashCode ();
var file = u.getFile ();
if (file != null) h += file.hashCode ();
if (u.getPort () == -1) h += this.getDefaultPort ();
 else h += u.getPort ();
var ref = u.getRef ();
if (ref != null) h += ref.hashCode ();
return h;
}, "java.net.URL");
Clazz_defineMethod (c$, "sameFile", 
function (u1, u2) {
if (!((u1.getProtocol () === u2.getProtocol ()) || (u1.getProtocol () != null && u1.getProtocol ().equalsIgnoreCase (u2.getProtocol ())))) return false;
if (!(u1.getFile () === u2.getFile () || (u1.getFile () != null && u1.getFile ().equals (u2.getFile ())))) return false;
var port1;
var port2;
port1 = (u1.getPort () != -1) ? u1.getPort () : u1.handler.getDefaultPort ();
port2 = (u2.getPort () != -1) ? u2.getPort () : u2.handler.getDefaultPort ();
if (port1 != port2) return false;
if (!this.hostsEqual (u1, u2)) return false;
return true;
}, "java.net.URL,java.net.URL");
Clazz_defineMethod (c$, "hostsEqual", 
function (u1, u2) {
if (u1.getHost () != null && u2.getHost () != null) return u1.getHost ().equalsIgnoreCase (u2.getHost ());
return u1.getHost () == null && u2.getHost () == null;
}, "java.net.URL,java.net.URL");
Clazz_defineMethod (c$, "toExternalForm", 
function (u) {
return "";
}, "java.net.URL");
Clazz_defineMethod (c$, "setURL", 
function (u, protocol, host, port, authority, userInfo, path, query, ref) {
if (this !== u.handler) {
throw  new SecurityException ("handler for url different from this handler");
}u.set (u.getProtocol (), host, port, authority, userInfo, path, query, ref);
}, "java.net.URL,~S,~S,~N,~S,~S,~S,~S,~S");
Clazz_defineMethod (c$, "setURLDeprecated", 
function (u, protocol, host, port, file, ref) {
var authority = null;
var userInfo = null;
if (host != null && host.length != 0) {
authority = (port == -1) ? host : host + ":" + port;
var at = host.lastIndexOf ('@');
if (at != -1) {
userInfo = host.substring (0, at);
host = host.substring (at + 1);
}}var path = null;
var query = null;
if (file != null) {
var q = file.lastIndexOf ('?');
if (q != -1) {
query = file.substring (q + 1);
path = file.substring (0, q);
} else path = file;
}this.setURL (u, protocol, host, port, authority, userInfo, path, query, ref);
}, "java.net.URL,~S,~S,~N,~S,~S");
});
Clazz_declarePackage ("java.net");
Clazz_declareInterface (java.net, "URLStreamHandlerFactory");
Clazz_declarePackage("java.text");
c$=Clazz_decorateAsClass(function(){
this.pattern=null;
Clazz_instantialize(this,arguments);
},java.text,"MessageFormat");
Clazz_makeConstructor(c$,
function(pattern){
this.pattern=pattern;
},"~S");
Clazz_makeConstructor(c$,
function(pattern,locale){
this.pattern=pattern;
},"~S,java.util.Locale");
c$.format=Clazz_defineMethod(c$,"format",
function(pattern,args){
return pattern.replace(/\{(\d+)\}/g,function($0,$1){
var i=parseInt($1);
if(args==null)return null;
return args[i];
});
},"~S,~A");
Clazz_defineMethod(c$,"format",
function(obj){
return java.text.MessageFormat.format(this.pattern,[obj]);
},"~O");
Clazz_load(["java.util.Collection"],"java.util.AbstractCollection",["java.lang.StringBuilder","$.UnsupportedOperationException","java.lang.reflect.Array"],function(){
c$=Clazz_declareType(java.util,"AbstractCollection",null,java.util.Collection);
Clazz_makeConstructor(c$,
function(){
});
Clazz_overrideMethod(c$,"add",
function(object){
throw new UnsupportedOperationException();
},"~O");
Clazz_overrideMethod(c$,"addAll",
function(collection){
var result=false;
var it=collection.iterator();
while(it.hasNext()){
if(this.add(it.next())){
result=true;
}}
return result;
},"java.util.Collection");
Clazz_overrideMethod(c$,"clear",
function(){
var it=this.iterator();
while(it.hasNext()){
it.next();
it.remove();
}
});
Clazz_overrideMethod(c$,"contains",
function(object){
var it=this.iterator();
if(object!=null){
while(it.hasNext()){
if(object.equals(it.next())){
return true;
}}
}else{
while(it.hasNext()){
if(it.next()==null){
return true;
}}
}return false;
},"~O");
Clazz_overrideMethod(c$,"containsAll",
function(collection){
var it=collection.iterator();
while(it.hasNext()){
if(!this.contains(it.next())){
return false;
}}
return true;
},"java.util.Collection");
Clazz_overrideMethod(c$,"isEmpty",
function(){
return this.size()==0;
});
Clazz_overrideMethod(c$,"remove",
function(object){
var it=this.iterator();
if(object!=null){
while(it.hasNext()){
if(object.equals(it.next())){
it.remove();
return true;
}}
}else{
while(it.hasNext()){
if(it.next()==null){
it.remove();
return true;
}}
}return false;
},"~O");
Clazz_overrideMethod(c$,"removeAll",
function(collection){
var result=false;
var it=this.iterator();
while(it.hasNext()){
if(collection.contains(it.next())){
it.remove();
result=true;
}}
return result;
},"java.util.Collection");
Clazz_overrideMethod(c$,"retainAll",
function(collection){
var result=false;
var it=this.iterator();
while(it.hasNext()){
if(!collection.contains(it.next())){
it.remove();
result=true;
}}
return result;
},"java.util.Collection");
Clazz_defineMethod(c$,"toArray",
function(){
var size=this.size();
var index=0;
var it=this.iterator();
var array=new Array(size);
while(index<size){
array[index++]=it.next();
}
return array;
});
Clazz_defineMethod(c$,"toArray",
function(contents){
var size=this.size();
var index=0;
if(size>contents.length){
var ct=contents.getClass().getComponentType();
contents=java.lang.reflect.Array.newInstance(ct,size);
}for(var entry,$entry=this.iterator();$entry.hasNext()&&((entry=$entry.next())||true);){
contents[index++]=entry;
}
if(index<contents.length){
contents[index]=null;
}return contents;
},"~A");
Clazz_overrideMethod(c$,"toString",
function(){
if(this.isEmpty()){
return"[]";
}var buffer=new StringBuilder(this.size()*16);
buffer.append('[');
var it=this.iterator();
while(it.hasNext()){
var next=it.next();
if(next!==this){
buffer.append(next);
}else{
buffer.append("(this Collection)");
}if(it.hasNext()){
buffer.append(", ");
}}
buffer.append(']');
return buffer.toString();
});
});
// BH 8/25/2014 1:10:59 AM  - removed indirect access/inner class business.

Clazz_load(["java.util.AbstractCollection","$.Iterator","$.List","$.ListIterator","$.RandomAccess","$.NoSuchElementException"],"java.util.AbstractList",["java.lang.IllegalArgumentException","$.IllegalStateException","$.IndexOutOfBoundsException","$.UnsupportedOperationException","java.util.ConcurrentModificationException"],function(){
c$=Clazz_decorateAsClass(function(){
this.modCount=0;



//if(!Clazz_isClassDefined("java.util.AbstractList.SimpleListIterator")){
//java.util.AbstractList.$AbstractList$SimpleListIterator$();
//}
//if(!Clazz_isClassDefined("java.util.AbstractList.FullListIterator")){
//java.util.AbstractList.$AbstractList$FullListIterator$();
//}



Clazz_instantialize(this,arguments);
},java.util,"AbstractList",java.util.AbstractCollection,java.util.List);
Clazz_defineMethod(c$,"add",
function(location,object){
throw new UnsupportedOperationException();
},"~N,~O");
Clazz_defineMethod(c$,"add",
function(object){
this.add(this.size(),object);
return true;
},"~O");
Clazz_defineMethod(c$,"addAll",
function(location,collection){
var it=collection.iterator();
while(it.hasNext()){
this.add(location++,it.next());
}
return!collection.isEmpty();
},"~N,java.util.Collection");
Clazz_overrideMethod(c$,"clear",
function(){
this.removeRange(0,this.size());
});
Clazz_overrideMethod(c$,"equals",
function(object){
if(this===object){
return true;
}if(Clazz_instanceOf(object,java.util.List)){
var list=object;
if(list.size()!=this.size()){
return false;
}var it1=this.iterator();
var it2=list.iterator();
while(it1.hasNext()){
var e1=it1.next();
var e2=it2.next();
if(!(e1==null?e2==null:e1.equals(e2))){
return false;
}}
return true;
}return false;
},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
var result=1;
var it=this.iterator();
while(it.hasNext()){
var object=it.next();
result=(31*result)+(object==null?0:object.hashCode());
}
return result;
});
Clazz_overrideMethod(c$,"indexOf",
function(object){
var it=this.listIterator();
if(object!=null){
while(it.hasNext()){
if(object.equals(it.next())){
return it.previousIndex();
}}
}else{
while(it.hasNext()){
if(it.next()==null){
return it.previousIndex();
}}
}return-1;
},"~O");
Clazz_overrideMethod(c$,"iterator",
function(){
return new java.util.AbstractListSimpleListIterator(this); // Clazz_innerTypeInstance(java.util.AbstractList.SimpleListIterator,this,null);
});
Clazz_overrideMethod(c$,"lastIndexOf",
function(object){
var it=this.listIterator(this.size());
if(object!=null){
while(it.hasPrevious()){
if(object.equals(it.previous())){
return it.nextIndex();
}}
}else{
while(it.hasPrevious()){
if(it.previous()==null){
return it.nextIndex();
}}
}return-1;
},"~O");
//Clazz_defineMethod(c$,"listIterator",
//function(){
//return this.listIterator(0);
//});
Clazz_defineMethod(c$,"listIterator",
function(location){
location || (location = 0);
return new java.util.AbstractListFullListIterator(this, location);//Clazz_innerTypeInstance(java.util.AbstractList.FullListIterator,this,null,location);
},"~N");
Clazz_defineMethod(c$,"remove",
function(location){
throw new UnsupportedOperationException();
},"~N");
Clazz_defineMethod(c$,"removeRange",
function(start,end){
var it=this.listIterator(start);
for(var i=start;i<end;i++){
it.next();
it.remove();
}
},"~N,~N");
Clazz_overrideMethod(c$,"set",
function(location,object){
throw new UnsupportedOperationException();
},"~N,~O");
Clazz_overrideMethod(c$,"subList",
function(start,end){
if(0<=start&&end<=this.size()){
if(start<=end){
if(Clazz_instanceOf(this,java.util.RandomAccess)){
return new java.util.AbstractList.SubAbstractListRandomAccess(this,start,end);
}return new java.util.AbstractList.SubAbstractList(this,start,end);
}throw new IllegalArgumentException();
}throw new IndexOutOfBoundsException();
},"~N,~N");



//c$.$AbstractList$SimpleListIterator$=function(){

Clazz_pu$h(self.c$);

c$=Clazz_decorateAsClass(function(){
//Clazz_prepareCallback(this,arguments);
this.pos=-1;
this.expectedModCount=0;
this.lastPosition=-1;
Clazz_instantialize(this,arguments);
},java.util,"AbstractListSimpleListIterator",null,java.util.Iterator);


Clazz_makeConstructor(c$,
function(a){
this._list = a;
this.expectedModCount=a.modCount;
}, "java.util.AbstractList");

Clazz_overrideMethod(c$,"hasNext",
function(){
return this.pos+1<this._list.size();
});
Clazz_overrideMethod(c$,"next",
function(){
if(this.expectedModCount==this._list.modCount){
try{
var a=this._list.get(this.pos+1);
this.lastPosition=++this.pos;
return a;
}catch(e){
if(Clazz_instanceOf(e,IndexOutOfBoundsException)){
throw new java.util.NoSuchElementException();
}else{
throw e;
}
}
}throw new java.util.ConcurrentModificationException();
});
Clazz_overrideMethod(c$,"remove",
function(){
if(this.expectedModCount==this._list.modCount){
try{
this._list.remove(this.lastPosition);
}catch(e){
if(Clazz_instanceOf(e,IndexOutOfBoundsException)){
throw new IllegalStateException();
}else{
throw e;
}
}
if(this._list.modCount!=this.expectedModCount){
this.expectedModCount++;
}if(this.pos==this.lastPosition){
this.pos--;
}this.lastPosition=-1;
}else{
throw new java.util.ConcurrentModificationException();
}});

c$=Clazz_p0p();
//};


//c$.$AbstractList$FullListIterator$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
//Clazz_prepareCallback(this,arguments);
Clazz_instantialize(this,arguments);
},java.util,"AbstractListFullListIterator",java.util.AbstractListSimpleListIterator,java.util.ListIterator);

//,Clazz_innerTypeInstance(java.util.AbstractList.SimpleListIterator,this,null,Clazz_inheritArgs));

Clazz_makeConstructor(c$,
function(a,b){
Clazz_superConstructor(this,java.util.AbstractListFullListIterator,[a]);
if(0<=b&&b<=this._list.size()){
this.pos=b-1;
}else{
throw new IndexOutOfBoundsException();
}},"java.util.AbstractList,~N");
Clazz_overrideMethod(c$,"add",
function(a){
if(this.expectedModCount==this._list.modCount){
try{
this._list.add(this.pos+1,a);
}catch(e){
if(Clazz_instanceOf(e,IndexOutOfBoundsException)){
throw new java.util.NoSuchElementException();
}else{
throw e;
}
}
this.pos++;
this.lastPosition=-1;
if(this._list.modCount!=this.expectedModCount){
this.expectedModCount++;
}}else{
throw new java.util.ConcurrentModificationException();
}},"~O");
Clazz_overrideMethod(c$,"hasPrevious",
function(){
return this.pos>=0;
});
Clazz_overrideMethod(c$,"nextIndex",
function(){
return this.pos+1;
});
Clazz_overrideMethod(c$,"previous",
function(){
if(this.expectedModCount==this._list.modCount){
try{
var a=this._list.get(this.pos);
this.lastPosition=this.pos;
this.pos--;
return a;
}catch(e){
if(Clazz_instanceOf(e,IndexOutOfBoundsException)){
throw new java.util.NoSuchElementException();
}else{
throw e;
}
}
}throw new java.util.ConcurrentModificationException();
});
Clazz_overrideMethod(c$,"previousIndex",
function(){
return this.pos;
});
Clazz_overrideMethod(c$,"set",
function(a){
if(this.expectedModCount==this._list.modCount){
try{
this._list.set(this.lastPosition,a);
}catch(e){
if(Clazz_instanceOf(e,IndexOutOfBoundsException)){
throw new IllegalStateException();
}else{
throw e;
}
}
}else{
throw new java.util.ConcurrentModificationException();
}},"~O");
c$=Clazz_p0p();
//};




Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.AbstractList,"SubAbstractListRandomAccess",java.util.AbstractList.SubAbstractList,java.util.RandomAccess);
c$=Clazz_p0p();




Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.fullList=null;
this.offset=0;
this.$size=0;
Clazz_instantialize(this,arguments);
},java.util.AbstractList,"SubAbstractList",java.util.AbstractList);
Clazz_makeConstructor(c$,
function(a,b,c){
Clazz_superConstructor(this,java.util.AbstractList.SubAbstractList);
this.fullList=a;
this.modCount=this.fullList.modCount;
this.offset=b;
this.$size=c-b;
},"java.util.AbstractList,~N,~N");
Clazz_defineMethod(c$,"add",
function(a,b){
if(this.modCount==this.fullList.modCount){
if(0<=a&&a<=this.$size){
this.fullList.add(a+this.offset,b);
this.$size++;
this.modCount=this.fullList.modCount;
}else{
throw new IndexOutOfBoundsException();
}}else{
throw new java.util.ConcurrentModificationException();
}},"~N,~O");
Clazz_defineMethod(c$,"addAll",
function(a,b){
if(this.modCount==this.fullList.modCount){
if(0<=a&&a<=this.$size){
var c=this.fullList.addAll(a+this.offset,b);
if(c){
this.$size+=b.size();
this.modCount=this.fullList.modCount;
}return c;
}throw new IndexOutOfBoundsException();
}throw new java.util.ConcurrentModificationException();
},"~N,java.util.Collection");
Clazz_defineMethod(c$,"addAll",
function(a){
if(this.modCount==this.fullList.modCount){
var b=this.fullList.addAll(this.offset+this.$size,a);
if(b){
this.$size+=a.size();
this.modCount=this.fullList.modCount;
}return b;
}throw new java.util.ConcurrentModificationException();
},"java.util.Collection");
Clazz_defineMethod(c$,"get",
function(a){
if(this.modCount==this.fullList.modCount){
if(0<=a&&a<this.$size){
return this.fullList.get(a+this.offset);
}throw new IndexOutOfBoundsException();
}throw new java.util.ConcurrentModificationException();
},"~N");
Clazz_overrideMethod(c$,"iterator",
function(){
return this.listIterator(0);
});
Clazz_defineMethod(c$,"listIterator",
function(a){
if(this.modCount==this.fullList.modCount){
if(0<=a&&a<=this.$size){
return new java.util.AbstractList.SubAbstractList.SubAbstractListIterator(this.fullList.listIterator(a+this.offset),this,this.offset,this.$size);
}throw new IndexOutOfBoundsException();
}throw new java.util.ConcurrentModificationException();
},"~N");
Clazz_defineMethod(c$,"remove",
function(a){
if(this.modCount==this.fullList.modCount){
if(0<=a&&a<this.$size){
var b=this.fullList.remove(a+this.offset);
this.$size--;
this.modCount=this.fullList.modCount;
return b;
}throw new IndexOutOfBoundsException();
}throw new java.util.ConcurrentModificationException();
},"~N");
Clazz_defineMethod(c$,"removeRange",
function(a,b){
if(a!=b){
if(this.modCount==this.fullList.modCount){
this.fullList.removeRange(a+this.offset,b+this.offset);
this.$size-=b-a;
this.modCount=this.fullList.modCount;
}else{
throw new java.util.ConcurrentModificationException();
}}},"~N,~N");
Clazz_defineMethod(c$,"set",
function(a,b){
if(this.modCount==this.fullList.modCount){
if(0<=a&&a<this.$size){
return this.fullList.set(a+this.offset,b);
}throw new IndexOutOfBoundsException();
}throw new java.util.ConcurrentModificationException();
},"~N,~O");
Clazz_overrideMethod(c$,"size",
function(){
return this.$size;
});
Clazz_defineMethod(c$,"sizeChanged",
function(a){
if(a){
this.$size++;
}else{
this.$size--;
}this.modCount=this.fullList.modCount;
},"~B");
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.subList=null;
this.iterator=null;
this.start=0;
this.end=0;
Clazz_instantialize(this,arguments);
},java.util.AbstractList.SubAbstractList,"SubAbstractListIterator",null,java.util.ListIterator);
Clazz_makeConstructor(c$,
function(a,b,c,d){
this.iterator=a;
this.subList=b;
this.start=c;
this.end=this.start+d;
},"java.util.ListIterator,java.util.AbstractList.SubAbstractList,~N,~N");
Clazz_defineMethod(c$,"add",
function(a){
this.iterator.add(a);
this.subList.sizeChanged(true);
this.end++;
},"~O");
Clazz_overrideMethod(c$,"hasNext",
function(){
return this.iterator.nextIndex()<this.end;
});
Clazz_overrideMethod(c$,"hasPrevious",
function(){
return this.iterator.previousIndex()>=this.start;
});
Clazz_defineMethod(c$,"next",
function(){
if(this.iterator.nextIndex()<this.end){
return this.iterator.next();
}throw new java.util.NoSuchElementException();
});
Clazz_defineMethod(c$,"nextIndex",
function(){
return this.iterator.nextIndex()-this.start;
});
Clazz_defineMethod(c$,"previous",
function(){
if(this.iterator.previousIndex()>=this.start){
return this.iterator.previous();
}throw new java.util.NoSuchElementException();
});
Clazz_defineMethod(c$,"previousIndex",
function(){
var a=this.iterator.previousIndex();
if(a>=this.start){
return a-this.start;
}return-1;
});
Clazz_defineMethod(c$,"remove",
function(){
this.iterator.remove();
this.subList.sizeChanged(false);
this.end--;
});
Clazz_defineMethod(c$,"set",
function(a){
this.iterator.set(a);
},"~O");
c$=Clazz_p0p();
c$=Clazz_p0p();
});
Clazz_load(["java.util.Map"],"java.util.AbstractMap",["java.lang.StringBuilder","$.UnsupportedOperationException","java.util.AbstractCollection","$.AbstractSet","$.Iterator"],function(){
c$=Clazz_decorateAsClass(function(){
this.$keySet=null;
this.valuesCollection=null;
Clazz_instantialize(this,arguments);
},java.util,"AbstractMap",null,java.util.Map);
Clazz_makeConstructor(c$,
function(){
});
Clazz_overrideMethod(c$,"clear",
function(){
this.entrySet().clear();
});
Clazz_overrideMethod(c$,"containsKey",
function(key){
var it=this.entrySet().iterator();
if(key!=null){
while(it.hasNext()){
if(key.equals(it.next().getKey())){
return true;
}}
}else{
while(it.hasNext()){
if(it.next().getKey()==null){
return true;
}}
}return false;
},"~O");
Clazz_overrideMethod(c$,"containsValue",
function(value){
var it=this.entrySet().iterator();
if(value!=null){
while(it.hasNext()){
if(value.equals(it.next().getValue())){
return true;
}}
}else{
while(it.hasNext()){
if(it.next().getValue()==null){
return true;
}}
}return false;
},"~O");
Clazz_overrideMethod(c$,"equals",
function(object){
if(this===object){
return true;
}if(Clazz_instanceOf(object,java.util.Map)){
var map=object;
if(this.size()!=map.size()){
return false;
}var objectSet=map.entrySet();
var it=this.entrySet().iterator();
while(it.hasNext()){
if(!objectSet.contains(it.next())){
return false;
}}
return true;
}return false;
},"~O");
Clazz_overrideMethod(c$,"get",
function(key){
var it=this.entrySet().iterator();
if(key!=null){
while(it.hasNext()){
var entry=it.next();
if(key.equals(entry.getKey())){
return entry.getValue();
}}
}else{
while(it.hasNext()){
var entry=it.next();
if(entry.getKey()==null){
return entry.getValue();
}}
}return null;
},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
var result=0;
var it=this.entrySet().iterator();
while(it.hasNext()){
result+=it.next().hashCode();
}
return result;
});
Clazz_overrideMethod(c$,"isEmpty",
function(){
return this.size()==0;
});
Clazz_overrideMethod(c$,"keySet",
function(){
if(this.$keySet==null){
this.$keySet=((Clazz_isClassDefined("java.util.AbstractMap$1")?0:java.util.AbstractMap.$AbstractMap$1$()),Clazz_innerTypeInstance(java.util.AbstractMap$1,this,null));
}return this.$keySet;
});
Clazz_overrideMethod(c$,"put",
function(key,value){
throw new UnsupportedOperationException();
},"~O,~O");
Clazz_overrideMethod(c$,"putAll",
function(map){
for(var entry,$entry=map.entrySet().iterator();$entry.hasNext()&&((entry=$entry.next())||true);){
this.put(entry.getKey(),entry.getValue());
}
},"java.util.Map");
Clazz_overrideMethod(c$,"remove",
function(key){
var it=this.entrySet().iterator();
if(key!=null){
while(it.hasNext()){
var entry=it.next();
if(key.equals(entry.getKey())){
it.remove();
return entry.getValue();
}}
}else{
while(it.hasNext()){
var entry=it.next();
if(entry.getKey()==null){
it.remove();
return entry.getValue();
}}
}return null;
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return this.entrySet().size();
});
Clazz_overrideMethod(c$,"toString",
function(){
if(this.isEmpty()){
return"{}";
}var buffer=new StringBuilder(this.size()*28);
buffer.append('{');
var it=this.entrySet().iterator();
while(it.hasNext()){
var entry=it.next();
var key=entry.getKey();
if(key!==this){
buffer.append(key);
}else{
buffer.append("(this Map)");
}buffer.append('=');
var value=entry.getValue();
if(value!==this){
buffer.append(value);
}else{
buffer.append("(this Map)");
}if(it.hasNext()){
buffer.append(", ");
}}
buffer.append('}');
return buffer.toString();
});
Clazz_overrideMethod(c$,"values",
function(){
if(this.valuesCollection==null){
this.valuesCollection=((Clazz_isClassDefined("java.util.AbstractMap$2")?0:java.util.AbstractMap.$AbstractMap$2$()),Clazz_innerTypeInstance(java.util.AbstractMap$2,this,null));
}return this.valuesCollection;
});
Clazz_defineMethod(c$,"clone",
function(){
var result=Clazz_superCall(this,java.util.AbstractMap,"clone",[]);
result.$keySet=null;
result.valuesCollection=null;
return result;
});
c$.$AbstractMap$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_declareAnonymous(java.util,"AbstractMap$1",java.util.AbstractSet);
Clazz_overrideMethod(c$,"contains",
function(object){
return this.b$["java.util.AbstractMap"].containsKey(object);
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return this.b$["java.util.AbstractMap"].size();
});
Clazz_overrideMethod(c$,"iterator",
function(){
return((Clazz_isClassDefined("java.util.AbstractMap$1$1")?0:java.util.AbstractMap.$AbstractMap$1$1$()),Clazz_innerTypeInstance(java.util.AbstractMap$1$1,this,null));
});
c$=Clazz_p0p();
};
c$.$AbstractMap$1$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this,arguments);
this.setIterator=null;
Clazz_instantialize(this,arguments);
},java.util,"AbstractMap$1$1",null,java.util.Iterator);
Clazz_prepareFields(c$,function(){
this.setIterator=this.b$["java.util.AbstractMap"].entrySet().iterator();
});
Clazz_overrideMethod(c$,"hasNext",
function(){
return this.setIterator.hasNext();
});
Clazz_overrideMethod(c$,"next",
function(){
return this.setIterator.next().getKey();
});
Clazz_overrideMethod(c$,"remove",
function(){
this.setIterator.remove();
});
c$=Clazz_p0p();
};
c$.$AbstractMap$2$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_declareAnonymous(java.util,"AbstractMap$2",java.util.AbstractCollection);
Clazz_overrideMethod(c$,"size",
function(){
return this.b$["java.util.AbstractMap"].size();
});
Clazz_overrideMethod(c$,"contains",
function(object){
return this.b$["java.util.AbstractMap"].containsValue(object);
},"~O");
Clazz_overrideMethod(c$,"iterator",
function(){
return((Clazz_isClassDefined("java.util.AbstractMap$2$1")?0:java.util.AbstractMap.$AbstractMap$2$1$()),Clazz_innerTypeInstance(java.util.AbstractMap$2$1,this,null));
});
c$=Clazz_p0p();
};
c$.$AbstractMap$2$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this,arguments);
this.setIterator=null;
Clazz_instantialize(this,arguments);
},java.util,"AbstractMap$2$1",null,java.util.Iterator);
Clazz_prepareFields(c$,function(){
this.setIterator=this.b$["java.util.AbstractMap"].entrySet().iterator();
});
Clazz_overrideMethod(c$,"hasNext",
function(){
return this.setIterator.hasNext();
});
Clazz_overrideMethod(c$,"next",
function(){
return this.setIterator.next().getValue();
});
Clazz_overrideMethod(c$,"remove",
function(){
this.setIterator.remove();
});
c$=Clazz_p0p();
};
});
Clazz_load(["java.util.AbstractCollection","$.Set"],"java.util.AbstractSet",null,function(){
c$=Clazz_declareType(java.util,"AbstractSet",java.util.AbstractCollection,java.util.Set);
Clazz_overrideMethod(c$,"equals",
function(object){
if(this===object){
return true;
}if(Clazz_instanceOf(object,java.util.Set)){
var s=object;
return this.size()==s.size()&&this.containsAll(s);
}return false;
},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
var result=0;
var it=this.iterator();
while(it.hasNext()){
var next=it.next();
result+=next==null?0:next.hashCode();
}
return result;
});
Clazz_overrideMethod(c$,"removeAll",
function(collection){
var result=false;
if(this.size()<=collection.size()){
var it=this.iterator();
while(it.hasNext()){
if(collection.contains(it.next())){
it.remove();
result=true;
}}
}else{
var it=collection.iterator();
while(it.hasNext()){
result=this.remove(it.next())||result;
}
}return result;
},"java.util.Collection");
});
Clazz_load(["java.util.AbstractList","$.List","$.RandomAccess"],"java.util.ArrayList",["java.lang.IllegalArgumentException","$.IndexOutOfBoundsException","java.lang.reflect.Array","java.util.Arrays"],function(){
c$=Clazz_decorateAsClass(function(){
this.firstIndex=0;
this.lastIndex=0;
this.array=null;
Clazz_instantialize(this,arguments);
},java.util,"ArrayList",java.util.AbstractList,[java.util.List,Cloneable,java.io.Serializable,java.util.RandomAccess]);

Clazz_overrideConstructor(c$,
function(){
this.setup(0);
});

Clazz_defineMethod(c$, "setup",
function(capacity){
//Clazz_superConstructor(this,java.util.ArrayList,[]);
this.firstIndex=this.lastIndex=0;
try{
this.array=this.newElementArray(capacity);
}catch(e){
if(Clazz_instanceOf(e,NegativeArraySizeException)){
throw new IllegalArgumentException();
}else{
throw e;
}
}
},"~N");
/*
Clazz_makeConstructor(c$,
function(collection){
Clazz_superConstructor(this,java.util.ArrayList,[]);
var size=collection.size();
this.firstIndex=this.lastIndex=0;
this.array=this.newElementArray(size+(Math.floor(size/10)));
this.addAll(collection);
},"java.util.Collection");

*/

Clazz_defineMethod(c$,"newElementArray",
($fz=function(size){
return new Array(size);
},$fz.isPrivate=true,$fz),"~N");

Clazz_overrideMethod(c$,"add",
function(location,object){

if (arguments.length == 1) {
	// coming from Java methods, e.g. Collections.list()
	// location is actually the object
	return this.add1(location);
}
var size=this.size();
if(0<location&&location<size){
if(this.firstIndex==0&&this.lastIndex==this.array.length){
this.growForInsert(location,1);
}else if((location<Math.floor(size/2)&&this.firstIndex>0)||this.lastIndex==this.array.length){
System.arraycopy(this.array,this.firstIndex,this.array,--this.firstIndex,location);
}else{
var index=location+this.firstIndex;
System.arraycopy(this.array,index,this.array,index+1,size-location);
this.lastIndex++;
}this.array[location+this.firstIndex]=object;
}else if(location==0){
if(this.firstIndex==0){
this.growAtFront(1);
}this.array[--this.firstIndex]=object;
}else if(location==size){
if(this.lastIndex==this.array.length){
this.growAtEnd(1);
}this.array[this.lastIndex++]=object;
}else{
throw new IndexOutOfBoundsException();
}this.modCount++;
},"~N,~O");

Clazz_overrideMethod(c$,"add1",
function(object){
if(this.lastIndex==this.array.length){
this.growAtEnd(1);
}this.array[this.lastIndex++]=object;
this.modCount++;
return true;
},"~O");

/* BH disallow addAll(int,List)
 * 
Clazz_defineMethod(c$,"addAll",
function(location,collection){
var size=this.size();
if(location<0||location>size){
throw new IndexOutOfBoundsException();
}var growSize=collection.size();
if(0<location&&location<size){
if(this.array.length-size<growSize){
this.growForInsert(location,growSize);
}else if((location<Math.floor(size/2)&&this.firstIndex>0)||this.lastIndex>this.array.length-growSize){
var newFirst=this.firstIndex-growSize;
if(newFirst<0){
var index=location+this.firstIndex;
System.arraycopy(this.array,index,this.array,index-newFirst,size-location);
this.lastIndex-=newFirst;
newFirst=0;
}System.arraycopy(this.array,this.firstIndex,this.array,newFirst,location);
this.firstIndex=newFirst;
}else{
var index=location+this.firstIndex;
System.arraycopy(this.array,index,this.array,index+growSize,size-location);
this.lastIndex+=growSize;
}}else if(location==0){
this.growAtFront(growSize);
this.firstIndex-=growSize;
}else if(location==size){
if(this.lastIndex>this.array.length-growSize){
this.growAtEnd(growSize);
}this.lastIndex+=growSize;
}if(growSize>0){
var it=collection.iterator();
var index=location+this.firstIndex;
var end=index+growSize;
while(index<end){
this.array[index++]=it.next();
}
this.modCount++;
return true;
}return false;
},"~N,java.util.Collection");

 */

Clazz_overrideMethod(c$,"addAll",
function(collection){
var growSize=collection.size();
if(growSize>0){
	if(this.lastIndex>this.array.length-growSize){
		this.growAtEnd(growSize);
}
var it=collection.iterator();
var end=this.lastIndex+growSize;
while(this.lastIndex<end){
	this.array[this.lastIndex++]=it.next();
}
this.modCount++;
return true;
}return false;
},"java.util.Collection");

Clazz_overrideMethod(c$,"clear",
function(){
if(this.firstIndex!=this.lastIndex){
this.fill(this.firstIndex,this.lastIndex);
this.firstIndex=this.lastIndex=0;
this.modCount++;
}});

Clazz_defineMethod(c$,"fill", function(i1, i2) { // BH
for (var i = i2; --i >= i1;)
this.array[i] = null;
},"~N,~N");

Clazz_defineMethod(c$,"clone",
function(){
try{
var newList=Clazz_superCall(this,java.util.ArrayList,"clone",[]);
newList.array=this.array.clone();
return newList;
}catch(e){
if(Clazz_instanceOf(e,CloneNotSupportedException)){
return null;
}else{
throw e;
}
}
});
Clazz_overrideMethod(c$,"contains",
function(object){
if(object!=null){
for(var i=this.firstIndex;i<this.lastIndex;i++){
if(object.equals(this.array[i])){
return true;
}}
}else{
for(var i=this.firstIndex;i<this.lastIndex;i++){
if(this.array[i]==null){
return true;
}}
}return false;
},"~O");
Clazz_defineMethod(c$,"ensureCapacity",
function(minimumCapacity){
if(this.array.length<minimumCapacity){
if(this.firstIndex>0){
this.growAtFront(minimumCapacity-this.array.length);
}else{
this.growAtEnd(minimumCapacity-this.array.length);
}}},"~N");
Clazz_overrideMethod(c$,"get",
function(location){
if(0<=location&&location<this.size()){
return this.array[this.firstIndex+location];
}throw new IndexOutOfBoundsException();
},"~N");


Clazz_defineMethod(c$,"growAtEnd",
($fz=function(required){
var size=this.size();
if(this.firstIndex>=required-(this.array.length-this.lastIndex)){
	var newLast=this.lastIndex-this.firstIndex;
	if(size>0){
		System.arraycopy(this.array,this.firstIndex,this.array,0,size);
		var start=newLast<this.firstIndex?this.firstIndex:newLast;
		this.fill(start,this.array.length);
	}
	this.firstIndex=0;
	this.lastIndex=newLast;
}else{
	var increment=Math.floor(size/2);
	if(required>increment){
		increment=required;
	}
	if(increment<12){
		increment=12;
	}
	var newArray=this.newElementArray(size+increment);
	if(size>0){
		System.arraycopy(this.array,this.firstIndex,newArray,this.firstIndex,size);
	}
	this.array=newArray;
}

},$fz.isPrivate=true,$fz),"~N");
Clazz_defineMethod(c$,"growAtFront",
($fz=function(required){
var size=this.size();
if(this.array.length-this.lastIndex>=required){
var newFirst=this.array.length-size;
if(size>0){
System.arraycopy(this.array,this.firstIndex,this.array,newFirst,size);
var length=this.firstIndex+size>newFirst?newFirst:this.firstIndex+size;
this.fill(this.firstIndex,length);
}this.firstIndex=newFirst;
this.lastIndex=this.array.length;
}else{
var increment=Math.floor(size/2);
if(required>increment){
increment=required;
}if(increment<12){
increment=12;
}var newArray=this.newElementArray(size+increment);
if(size>0){
System.arraycopy(this.array,this.firstIndex,newArray,newArray.length-size,size);
}this.firstIndex=newArray.length-size;
this.lastIndex=newArray.length;
this.array=newArray;
}},$fz.isPrivate=true,$fz),"~N");
Clazz_defineMethod(c$,"growForInsert",
($fz=function(location,required){
var size=this.size();
var increment=Math.floor(size/2);
if(required>increment){
increment=required;
}if(increment<12){
increment=12;
}var newArray=this.newElementArray(size+increment);
if(location<Math.floor(size/2)){
var newFirst=newArray.length-(size+required);
System.arraycopy(this.array,location,newArray,location+increment,size-location);
System.arraycopy(this.array,this.firstIndex,newArray,newFirst,location);
this.firstIndex=newFirst;
this.lastIndex=newArray.length;
}else{
System.arraycopy(this.array,this.firstIndex,newArray,0,location);
System.arraycopy(this.array,location,newArray,location+required,size-location);
this.firstIndex=0;
this.lastIndex+=required;
}this.array=newArray;
},$fz.isPrivate=true,$fz),"~N,~N");
Clazz_overrideMethod(c$,"indexOf",
function(object){
if(object!=null){
for(var i=this.firstIndex;i<this.lastIndex;i++){
if(object.equals(this.array[i])){
return i-this.firstIndex;
}}
}else{
for(var i=this.firstIndex;i<this.lastIndex;i++){
if(this.array[i]==null){
return i-this.firstIndex;
}}
}return-1;
},"~O");
Clazz_overrideMethod(c$,"isEmpty",
function(){
return this.lastIndex==this.firstIndex;
});
Clazz_overrideMethod(c$,"lastIndexOf",
function(object){
if(object!=null){
for(var i=this.lastIndex-1;i>=this.firstIndex;i--){
if(object.equals(this.array[i])){
return i-this.firstIndex;
}}
}else{
for(var i=this.lastIndex-1;i>=this.firstIndex;i--){
if(this.array[i]==null){
return i-this.firstIndex;
}}
}return-1;
},"~O");
Clazz_overrideMethod(c$,"remove",
function(location){
var result;
var size=this.size();
if(0<=location&&location<size){
if(location==size-1){
result=this.array[--this.lastIndex];
this.array[this.lastIndex]=null;
}else if(location==0){
result=this.array[this.firstIndex];
this.array[this.firstIndex++]=null;
}else{
var elementIndex=this.firstIndex+location;
result=this.array[elementIndex];
if(location<Math.floor(size/2)){
System.arraycopy(this.array,this.firstIndex,this.array,this.firstIndex+1,location);
this.array[this.firstIndex++]=null;
}else{
System.arraycopy(this.array,elementIndex+1,this.array,elementIndex,size-location-1);
this.array[--this.lastIndex]=null;
}}}else{
throw new IndexOutOfBoundsException();
}this.modCount++;
return result;
},"~N"); 

Clazz_defineMethod(c$, "removeObject", function(o) {
	var i = this.indexOf(o);
	if (i < 0)return null;
	return this.remove(i);
}, "~O");

Clazz_overrideMethod(c$,"removeRange",
function(start,end){
if(start>=0&&start<=end&&end<=this.size()){
if(start==end){
return;
}var size=this.size();
if(end==size){
	this.fill(this.firstIndex+start,this.lastIndex);
this.lastIndex=this.firstIndex+start;
}else if(start==0){
	this.fill(this.firstIndex,this.firstIndex+end);
this.firstIndex+=end;
}else{
System.arraycopy(this.array,this.firstIndex+end,this.array,this.firstIndex+start,size-end);
var newLast=this.lastIndex+start-end;
this.fill(newLast,this.lastIndex);
this.lastIndex=newLast;
}this.modCount++;
}else{
throw new IndexOutOfBoundsException();
}},"~N,~N");
Clazz_overrideMethod(c$,"set",
function(location,object){
if(0<=location&&location<this.size()){
var result=this.array[this.firstIndex+location];
this.array[this.firstIndex+location]=object;
return result;
}throw new IndexOutOfBoundsException();
},"~N,~O");
Clazz_overrideMethod(c$,"size",
function(){
return this.lastIndex-this.firstIndex;
});
/*
Clazz_defineMethod(c$,"toArray",
function(){
var size=this.size();
var result=new Array(size);
System.arraycopy(this.array,this.firstIndex,result,0,size);
return result;
});
*/

Clazz_overrideMethod(c$,"toArray",
function(contents){
var size=this.size();
if(!contents || size>contents.length)
	contents= new Array(size);
System.arraycopy(this.array,this.firstIndex,contents,0,size);
if(size<contents.length){
contents[size]=null;
}return contents;
},"~O");
Clazz_defineMethod(c$,"trimToSize",
function(){
var size=this.size();
var newArray=this.newElementArray(size);
System.arraycopy(this.array,this.firstIndex,newArray,0,size);
this.array=newArray;
this.firstIndex=0;
this.lastIndex=this.array.length;
});
});
// BH adjusted to have only one sort method.

Clazz_load(["java.util.AbstractList","$.RandomAccess"],"java.util.Arrays",["java.lang.ArrayIndexOutOfBoundsException","$.IllegalArgumentException","$.NullPointerException"],function(){
c$=Clazz_declareType(java.util,"Arrays");

c$.sort=Clazz_overrideMethod(c$,"sort",
function(a,c,d,e){
  switch (arguments.length) {
  case 1:
    var aux=a.sort(function(o1,o2){
      if(typeof o1=="string"||o1 instanceof Comparable){
        return o1.compareTo(o2);
      }
      return o1-o2;
      });
    for(var i=0;i<a.length;i++){
      a[i]=aux[i];
    }
    return;
  case 2:
    var aux=a.sort(function(o1,o2){
      if(c!=null){
        return c.compare(o1,o2);
      }else if(typeof o1=="string"||o1 instanceof Comparable){
        return o1.compareTo(o2);
      }
      return o1-o2;
      });
    for(var i=0;i<a.length;i++){
      a[i]=aux[i];
    }
    return;
  case 3:
    var fromIndex = c;
    var toIndex = d;
    this.rangeCheck(a.length,fromIndex,toIndex);
    var aux=new Array();
    for(var i=fromIndex;i<toIndex;i++){
      aux[i-fromIndex]=a[i];
    }
    aux=aux.sort(function(o1,o2){
      if(typeof o1=="string"||o1 instanceof Comparable){
        return o1.compareTo(o2);
      }
      return o1-o2;
      });
    for(var i=fromIndex;i<toIndex;i++){
      a[i]=aux[i-fromIndex];
    }
    return;
  case 4:  
    var fromIndex = c;
    var toIndex = d;
    c = e;
    this.rangeCheck(a.length,fromIndex,toIndex);
    var aux=new Array();
    for(var i=fromIndex;i<toIndex;i++){
      aux[i-fromIndex]=a[i];
    }
    aux=aux.sort(function(o1,o2){
      if(c!=null){
        return c.compare(o1,o2);
      }else if(typeof o1=="string"||o1 instanceof Comparable){
        return o1.compareTo(o2);
      }
      return o1-o2;
      });
    for(var i=fromIndex;i<toIndex;i++){
      a[i]=aux[i-fromIndex];
    }
  }
});

c$.rangeCheck=Clazz_defineMethod(c$,"rangeCheck",
($fz=function(arrayLen,fromIndex,toIndex){
if(fromIndex>toIndex)throw new IllegalArgumentException("fromIndex("+fromIndex+") > toIndex("+toIndex+")");
if(fromIndex<0)throw new ArrayIndexOutOfBoundsException(fromIndex);
if(toIndex>arrayLen)throw new ArrayIndexOutOfBoundsException(toIndex);
},$fz.isPrivate=true,$fz),"~N,~N,~N");
c$.binarySearch=Clazz_defineMethod(c$,"binarySearch",
function(a,key){
var low=0;
var high=a.length-1;
while(low<=high){
var mid=(low+high)>>1;
var midVal=a[mid];
if(midVal<key)low=mid+1;
else if(midVal>key)high=mid-1;
else return mid;
}
return-(low+1);
},"~A,~N");
c$.binarySearch=Clazz_defineMethod(c$,"binarySearch",
function(a,key){
var low=0;
var high=a.length-1;
while(low<=high){
var mid=(low+high)>>1;
var midVal=a[mid];
var cmp=(midVal).compareTo(key);
if(cmp<0)low=mid+1;
else if(cmp>0)high=mid-1;
else return mid;
}
return-(low+1);
},"~A,~O");
c$.binarySearch=Clazz_defineMethod(c$,"binarySearch",
function(a,key,c){
if(c==null)return java.util.Arrays.binarySearch(a,key);
var low=0;
var high=a.length-1;
while(low<=high){
var mid=(low+high)>>1;
var midVal=a[mid];
var cmp=c.compare(midVal,key);
if(cmp<0)low=mid+1;
else if(cmp>0)high=mid-1;
else return mid;
}
return-(low+1);
},"~A,~O,java.util.Comparator");
c$.equals=Clazz_defineMethod(c$,"equals",
function(a,a2){
if(a===a2)return true;
if(a==null||a2==null)return false;
var length=a.length;
if(a2.length!=length)return false;
for(var i=0;i<length;i++){
var o1=a[i];
var o2=a2[i];
{
if(!(o1==null?o2==null:(o1.equals==null?o1==o2:o1.equals(o2))))return false;
}}
return true;
},"~A,~A");

c$.fill=Clazz_overrideMethod(c$,"fill",
function(a,fromIndex,toIndex,val){
if (arguments.length == 2) {
		val = fromIndex;
		fromIndex = 0;
		toIndex = a.length;
	}	
	java.util.Arrays.rangeCheck(a.length,fromIndex,toIndex);
	for(var i=fromIndex;i<toIndex;i++)a[i]=val;
});

c$.asList=Clazz_defineMethod(c$,"asList",
function(a){
return new java.util.Arrays.ArrayList(a);
},"~A");
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.a=null;
Clazz_instantialize(this,arguments);
},java.util.Arrays,"ArrayList",java.util.AbstractList,[java.util.RandomAccess,java.io.Serializable]);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Arrays.ArrayList,[]);
if(a==null)throw new NullPointerException();
this.a=a;
},"~A");
Clazz_overrideMethod(c$,"size",
function(){
return this.a.length;
});
Clazz_defineMethod(c$,"toArray",
function(){
return this.a.clone();
});
Clazz_overrideMethod(c$,"get",
function(a){
return this.a[a];
},"~N");
Clazz_overrideMethod(c$,"set",
function(a,b){
var c=this.a[a];
this.a[a]=b;
return c;
},"~N,~O");
Clazz_overrideMethod(c$,"indexOf",
function(a){
if(a==null){
for(var b=0;b<this.a.length;b++)if(this.a[b]==null)return b;

}else{
for(var b=0;b<this.a.length;b++)if(a.equals(this.a[b]))return b;

}return-1;
},"~O");
Clazz_overrideMethod(c$,"contains",
function(a){
return this.indexOf(a)!=-1;
},"~O");
c$=Clazz_p0p();
Clazz_defineStatics(c$,
"INSERTIONSORT_THRESHOLD",7);
});
Clazz_load(["java.util.AbstractList","$.AbstractMap","$.AbstractSet","$.Collection","$.Iterator","$.List","$.ListIterator","$.Map","$.RandomAccess","$.Set","$.SortedMap","$.SortedSet","java.lang.NullPointerException","$.UnsupportedOperationException","java.lang.reflect.Array"],"java.util.Collections",["java.lang.ArrayIndexOutOfBoundsException","$.ClassCastException","$.IllegalArgumentException","$.IndexOutOfBoundsException","java.util.ArrayList","$.Arrays","$.Enumeration","java.util.Map.Entry","java.util.NoSuchElementException","$.Random"],function(){
c$=Clazz_declareType(java.util,"Collections");
c$.binarySearch=Clazz_defineMethod(c$,"binarySearch",
function(list,object){
if(list==null){
throw new NullPointerException();
}if(list.isEmpty()){
return-1;
}var key=object;
if(!(Clazz_instanceOf(list,java.util.RandomAccess))){
var it=list.listIterator();
while(it.hasNext()){
var result;
if((result=key.compareTo(it.next()))<=0){
if(result==0){
return it.previousIndex();
}return-it.previousIndex()-1;
}}
return-list.size()-1;
}var low=0;
var mid=list.size();
var high=mid-1;
var result=-1;
while(low<=high){
mid=(low+high)>>1;
if((result=key.compareTo(list.get(mid)))>0){
low=mid+1;
}else if(result==0){
return mid;
}else{
high=mid-1;
}}
return-mid-(result<0?1:2);
},"java.util.List,~O");
c$.binarySearch=Clazz_defineMethod(c$,"binarySearch",
function(list,object,comparator){
if(comparator==null){
return java.util.Collections.binarySearch(list,object);
}if(!(Clazz_instanceOf(list,java.util.RandomAccess))){
var it=list.listIterator();
while(it.hasNext()){
var result;
if((result=comparator.compare(object,it.next()))<=0){
if(result==0){
return it.previousIndex();
}return-it.previousIndex()-1;
}}
return-list.size()-1;
}var low=0;
var mid=list.size();
var high=mid-1;
var result=-1;
while(low<=high){
mid=(low+high)>>1;
if((result=comparator.compare(object,list.get(mid)))>0){
low=mid+1;
}else if(result==0){
return mid;
}else{
high=mid-1;
}}
return-mid-(result<0?1:2);
},"java.util.List,~O,java.util.Comparator");
c$.copy=Clazz_defineMethod(c$,"copy",
function(destination,source){
if(destination.size()<source.size()){
throw new ArrayIndexOutOfBoundsException();
}var srcIt=source.iterator();
var destIt=destination.listIterator();
while(srcIt.hasNext()){
try{
destIt.next();
}catch(e){
if(Clazz_instanceOf(e,java.util.NoSuchElementException)){
throw new ArrayIndexOutOfBoundsException();
}else{
throw e;
}
}
destIt.set(srcIt.next());
}
},"java.util.List,java.util.List");
c$.enumeration=Clazz_defineMethod(c$,"enumeration",
function(collection){
var c=collection;

if (!Clazz_isClassDefined("java.util.Collections$1"))
	java.util.Collections.$Collections$1$(c);

var x = Clazz_innerTypeInstance(java.util.Collections$1,this,null);

return x;
},"java.util.Collection");

c$.fill=Clazz_defineMethod(c$,"fill",
function(list,object){
var it=list.listIterator();
while(it.hasNext()){
it.next();
it.set(object);
}
},"java.util.List,~O");
c$.max=Clazz_defineMethod(c$,"max",
function(collection){
var it=collection.iterator();
var max=it.next();
while(it.hasNext()){
var next=it.next();
if(max.compareTo(next)<0){
max=next;
}}
return max;
},"java.util.Collection");
c$.max=Clazz_defineMethod(c$,"max",
function(collection,comparator){
var it=collection.iterator();
var max=it.next();
while(it.hasNext()){
var next=it.next();
if(comparator.compare(max,next)<0){
max=next;
}}
return max;
},"java.util.Collection,java.util.Comparator");
c$.min=Clazz_defineMethod(c$,"min",
function(collection){
var it=collection.iterator();
var min=it.next();
while(it.hasNext()){
var next=it.next();
if(min.compareTo(next)>0){
min=next;
}}
return min;
},"java.util.Collection");
c$.min=Clazz_defineMethod(c$,"min",
function(collection,comparator){
var it=collection.iterator();
var min=it.next();
while(it.hasNext()){
var next=it.next();
if(comparator.compare(min,next)>0){
min=next;
}}
return min;
},"java.util.Collection,java.util.Comparator");
c$.nCopies=Clazz_defineMethod(c$,"nCopies",
function(length,object){
return new java.util.Collections.CopiesList(length,object);
},"~N,~O");
c$.reverse=Clazz_defineMethod(c$,"reverse",
function(list){
var size=list.size();
var front=list.listIterator();
var back=list.listIterator(size);
for(var i=0;i<Math.floor(size/2);i++){
var frontNext=front.next();
var backPrev=back.previous();
front.set(backPrev);
back.set(frontNext);
}
},"java.util.List");
c$.reverseOrder=Clazz_defineMethod(c$,"reverseOrder",
function(){
return new java.util.Collections.ReverseComparator();
});
c$.reverseOrder=Clazz_defineMethod(c$,"reverseOrder",
function(c){
if(c==null){
return java.util.Collections.reverseOrder();
}return new java.util.Collections.ReverseComparatorWithComparator(c);
},"java.util.Comparator");
c$.shuffle=Clazz_defineMethod(c$,"shuffle",
function(list){
java.util.Collections.shuffle(list,new java.util.Random());
},"java.util.List");
c$.shuffle=Clazz_defineMethod(c$,"shuffle",
function(list,random){
if(!(Clazz_instanceOf(list,java.util.RandomAccess))){
var array=list.toArray();
for(var i=array.length-1;i>0;i--){
var index=random.nextInt()%(i+1);
if(index<0){
index=-index;
}var temp=array[i];
array[i]=array[index];
array[index]=temp;
}
var i=0;
var it=list.listIterator();
while(it.hasNext()){
it.next();
it.set(array[i++]);
}
}else{
var rawList=list;
for(var i=rawList.size()-1;i>0;i--){
var index=random.nextInt()%(i+1);
if(index<0){
index=-index;
}rawList.set(index,rawList.set(i,rawList.get(index)));
}
}},"java.util.List,java.util.Random");
c$.singleton=Clazz_defineMethod(c$,"singleton",
function(object){
return new java.util.Collections.SingletonSet(object);
},"~O");
c$.singletonList=Clazz_defineMethod(c$,"singletonList",
function(object){
return new java.util.Collections.SingletonList(object);
},"~O");
c$.singletonMap=Clazz_defineMethod(c$,"singletonMap",
function(key,value){
return new java.util.Collections.SingletonMap(key,value);
},"~O,~O");
c$.sort=Clazz_defineMethod(c$,"sort",
function(list){
var array=list.toArray();
java.util.Arrays.sort(array);
var i=0;
var it=list.listIterator();
while(it.hasNext()){
it.next();
it.set(array[i++]);
}
},"java.util.List");
c$.sort=Clazz_defineMethod(c$,"sort",
function(list,comparator){
var array=list.toArray(new Array(list.size()));
java.util.Arrays.sort(array,comparator);
var i=0;
var it=list.listIterator();
while(it.hasNext()){
it.next();
it.set(array[i++]);
}
},"java.util.List,java.util.Comparator");
c$.swap=Clazz_defineMethod(c$,"swap",
function(list,index1,index2){
if(list==null){
throw new NullPointerException();
}if(index1==index2){
return;
}var rawList=list;
rawList.set(index2,rawList.set(index1,rawList.get(index2)));
},"java.util.List,~N,~N");
c$.replaceAll=Clazz_defineMethod(c$,"replaceAll",
function(list,obj,obj2){
var index;
var found=false;
while((index=list.indexOf(obj))>-1){
found=true;
list.set(index,obj2);
}
return found;
},"java.util.List,~O,~O");
c$.rotate=Clazz_defineMethod(c$,"rotate",
function(lst,dist){
var list=lst;
var size=list.size();
if(size==0){
return;
}var normdist;
if(dist>0){
normdist=dist%size;
}else{
normdist=size-((dist%size)*(-1));
}if(normdist==0||normdist==size){
return;
}if(Clazz_instanceOf(list,java.util.RandomAccess)){
var temp=list.get(0);
var index=0;
var beginIndex=0;
for(var i=0;i<size;i++){
index=(index+normdist)%size;
temp=list.set(index,temp);
if(index==beginIndex){
index=++beginIndex;
temp=list.get(beginIndex);
}}
}else{
var divideIndex=(size-normdist)%size;
var sublist1=list.subList(0,divideIndex);
var sublist2=list.subList(divideIndex,size);
java.util.Collections.reverse(sublist1);
java.util.Collections.reverse(sublist2);
java.util.Collections.reverse(list);
}},"java.util.List,~N");
c$.indexOfSubList=Clazz_defineMethod(c$,"indexOfSubList",
function(list,sublist){
var size=list.size();
var sublistSize=sublist.size();
if(sublistSize>size){
return-1;
}if(sublistSize==0){
return 0;
}var firstObj=sublist.get(0);
var index=list.indexOf(firstObj);
if(index==-1){
return-1;
}while(index<size&&(size-index>=sublistSize)){
var listIt=list.listIterator(index);
if((firstObj==null)?listIt.next()==null:firstObj.equals(listIt.next())){
var sublistIt=sublist.listIterator(1);
var difFound=false;
while(sublistIt.hasNext()){
var element=sublistIt.next();
if(!listIt.hasNext()){
return-1;
}if((element==null)?listIt.next()!=null:!element.equals(listIt.next())){
difFound=true;
break;
}}
if(!difFound){
return index;
}}index++;
}
return-1;
},"java.util.List,java.util.List");
c$.lastIndexOfSubList=Clazz_defineMethod(c$,"lastIndexOfSubList",
function(list,sublist){
var sublistSize=sublist.size();
var size=list.size();
if(sublistSize>size){
return-1;
}if(sublistSize==0){
return size;
}var lastObj=sublist.get(sublistSize-1);
var index=list.lastIndexOf(lastObj);
while((index>-1)&&(index+1>=sublistSize)){
var listIt=list.listIterator(index+1);
if((lastObj==null)?listIt.previous()==null:lastObj.equals(listIt.previous())){
var sublistIt=sublist.listIterator(sublistSize-1);
var difFound=false;
while(sublistIt.hasPrevious()){
var element=sublistIt.previous();
if(!listIt.hasPrevious()){
return-1;
}if((element==null)?listIt.previous()!=null:!element.equals(listIt.previous())){
difFound=true;
break;
}}
if(!difFound){
return listIt.nextIndex();
}}index--;
}
return-1;
},"java.util.List,java.util.List");
c$.list=Clazz_defineMethod(c$,"list",
function(enumeration){
var list=new java.util.ArrayList();
while(enumeration.hasMoreElements()){
list.add(enumeration.nextElement());
}
return list;
},"java.util.Enumeration");
c$.synchronizedCollection=Clazz_defineMethod(c$,"synchronizedCollection",
function(collection){
if(collection==null){
throw new NullPointerException();
}return new java.util.Collections.SynchronizedCollection(collection);
},"java.util.Collection");
c$.synchronizedList=Clazz_defineMethod(c$,"synchronizedList",
function(list){
if(list==null){
throw new NullPointerException();
}if(Clazz_instanceOf(list,java.util.RandomAccess)){
return new java.util.Collections.SynchronizedRandomAccessList(list);
}return new java.util.Collections.SynchronizedList(list);
},"java.util.List");
c$.synchronizedMap=Clazz_defineMethod(c$,"synchronizedMap",
function(map){
if(map==null){
throw new NullPointerException();
}return new java.util.Collections.SynchronizedMap(map);
},"java.util.Map");
c$.synchronizedSet=Clazz_defineMethod(c$,"synchronizedSet",
function(set){
if(set==null){
throw new NullPointerException();
}return new java.util.Collections.SynchronizedSet(set);
},"java.util.Set");
c$.synchronizedSortedMap=Clazz_defineMethod(c$,"synchronizedSortedMap",
function(map){
if(map==null){
throw new NullPointerException();
}return new java.util.Collections.SynchronizedSortedMap(map);
},"java.util.SortedMap");
c$.synchronizedSortedSet=Clazz_defineMethod(c$,"synchronizedSortedSet",
function(set){
if(set==null){
throw new NullPointerException();
}return new java.util.Collections.SynchronizedSortedSet(set);
},"java.util.SortedSet");
c$.unmodifiableCollection=Clazz_defineMethod(c$,"unmodifiableCollection",
function(collection){
if(collection==null){
throw new NullPointerException();
}return new java.util.Collections.UnmodifiableCollection(collection);
},"java.util.Collection");
c$.unmodifiableList=Clazz_defineMethod(c$,"unmodifiableList",
function(list){
if(list==null){
throw new NullPointerException();
}if(Clazz_instanceOf(list,java.util.RandomAccess)){
return new java.util.Collections.UnmodifiableRandomAccessList(list);
}return new java.util.Collections.UnmodifiableList(list);
},"java.util.List");
c$.unmodifiableMap=Clazz_defineMethod(c$,"unmodifiableMap",
function(map){
if(map==null){
throw new NullPointerException();
}return new java.util.Collections.UnmodifiableMap(map);
},"java.util.Map");
c$.unmodifiableSet=Clazz_defineMethod(c$,"unmodifiableSet",
function(set){
if(set==null){
throw new NullPointerException();
}return new java.util.Collections.UnmodifiableSet(set);
},"java.util.Set");
c$.unmodifiableSortedMap=Clazz_defineMethod(c$,"unmodifiableSortedMap",
function(map){
if(map==null){
throw new NullPointerException();
}return new java.util.Collections.UnmodifiableSortedMap(map);
},"java.util.SortedMap");
c$.unmodifiableSortedSet=Clazz_defineMethod(c$,"unmodifiableSortedSet",
function(set){
if(set==null){
throw new NullPointerException();
}return new java.util.Collections.UnmodifiableSortedSet(set);
},"java.util.SortedSet");
c$.frequency=Clazz_defineMethod(c$,"frequency",
function(c,o){
if(c==null){
throw new NullPointerException();
}if(c.isEmpty()){
return 0;
}
var result=0;
var itr=c.iterator();
while(itr.hasNext()){
var e=itr.next();
if(o==null?e==null:o.equals(e)){
result++;
}}
return result;
},"java.util.Collection,~O");

c$.emptyList=Clazz_defineMethod(c$,"emptyList",
function(){
return java.util.Collections.EMPTY_LIST;
});
c$.emptySet=Clazz_defineMethod(c$,"emptySet",
function(){
return java.util.Collections.EMPTY_SET;
});
c$.emptyMap=Clazz_defineMethod(c$,"emptyMap",
function(){
return java.util.Collections.EMPTY_MAP;
});
c$.checkedCollection=Clazz_defineMethod(c$,"checkedCollection",
function(c,type){
return new java.util.Collections.CheckedCollection(c,type);
},"java.util.Collection,Class");
c$.checkedMap=Clazz_defineMethod(c$,"checkedMap",
function(m,keyType,valueType){
return new java.util.Collections.CheckedMap(m,keyType,valueType);
},"java.util.Map,Class,Class");
c$.checkedList=Clazz_defineMethod(c$,"checkedList",
function(list,type){
if(Clazz_instanceOf(list,java.util.RandomAccess)){
return new java.util.Collections.CheckedRandomAccessList(list,type);
}return new java.util.Collections.CheckedList(list,type);
},"java.util.List,Class");
c$.checkedSet=Clazz_defineMethod(c$,"checkedSet",
function(s,type){
return new java.util.Collections.CheckedSet(s,type);
},"java.util.Set,Class");
c$.checkedSortedMap=Clazz_defineMethod(c$,"checkedSortedMap",
function(m,keyType,valueType){
return new java.util.Collections.CheckedSortedMap(m,keyType,valueType);
},"java.util.SortedMap,Class,Class");
c$.checkedSortedSet=Clazz_defineMethod(c$,"checkedSortedSet",
function(s,type){
return new java.util.Collections.CheckedSortedSet(s,type);
},"java.util.SortedSet,Class");
c$.addAll=Clazz_defineMethod(c$,"addAll",
function(c,a){
var modified=false;
for(var i=0;i<a.length;i++){
modified=new Boolean(modified|c.add(a[i])).valueOf();
}
return modified;
},"java.util.Collection,~A");
c$.disjoint=Clazz_defineMethod(c$,"disjoint",
function(c1,c2){
if((Clazz_instanceOf(c1,java.util.Set))&&!(Clazz_instanceOf(c2,java.util.Set))||(c2.size())>c1.size()){
var tmp=c1;
c1=c2;
c2=tmp;
}var it=c1.iterator();
while(it.hasNext()){
if(c2.contains(it.next())){
return false;
}}
return true;
},"java.util.Collection,java.util.Collection");
c$.checkType=Clazz_defineMethod(c$,"checkType",
function(obj,type){
if(!type.isInstance(obj)){
throw new ClassCastException("Attempt to insert "+obj.getClass()+" element into collection with element type "+type);
}return obj;
},"~O,Class");

c$.$Collections$1$=function(c){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this,arguments);
this.it=null;
Clazz_instantialize(this,arguments);
},java.util,"Collections$1",null,java.util.Enumeration);

Clazz_prepareFields(c$,function(){
this.it=c.iterator();
});

Clazz_defineMethod(c$,"hasMoreElements",
function(){
return this.it.hasNext();
});
Clazz_defineMethod(c$,"nextElement",
function(){
return this.it.next();
});
c$=Clazz_p0p();
};

Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.n=0;
this.element=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"CopiesList",java.util.AbstractList,java.io.Serializable);
Clazz_makeConstructor(c$,
function(a,b){
Clazz_superConstructor(this,java.util.Collections.CopiesList,[]);
if(a<0){
throw new IllegalArgumentException();
}this.n=a;
this.element=b;
},"~N,~O");
Clazz_overrideMethod(c$,"contains",
function(a){
return this.element==null?a==null:this.element.equals(a);
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return this.n;
});
Clazz_overrideMethod(c$,"get",
function(a){
if(0<=a&&a<this.n){
return this.element;
}throw new IndexOutOfBoundsException();
},"~N");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"EmptyList",java.util.AbstractList,java.io.Serializable);
Clazz_overrideMethod(c$,"contains",
function(a){
return false;
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return 0;
});
Clazz_overrideMethod(c$,"get",
function(a){
throw new IndexOutOfBoundsException();
},"~N");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"EmptySet",java.util.AbstractSet,java.io.Serializable);
Clazz_overrideMethod(c$,"contains",
function(a){
return false;
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return 0;
});
Clazz_overrideMethod(c$,"iterator",
function(){
return((Clazz_isClassDefined("java.util.Collections$EmptySet$1")?0:java.util.Collections.EmptySet.$Collections$EmptySet$1$()),Clazz_innerTypeInstance(java.util.Collections$EmptySet$1,this,null));
});
c$.$Collections$EmptySet$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_declareAnonymous(java.util,"Collections$EmptySet$1",null,java.util.Iterator);
Clazz_overrideMethod(c$,"hasNext",
function(){
return false;
});
Clazz_overrideMethod(c$,"next",
function(){
throw new java.util.NoSuchElementException();
});
Clazz_overrideMethod(c$,"remove",
function(){
throw new UnsupportedOperationException();
});
c$=Clazz_p0p();
};
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"EmptyMap",java.util.AbstractMap,java.io.Serializable);
Clazz_overrideMethod(c$,"containsKey",
function(a){
return false;
},"~O");
Clazz_overrideMethod(c$,"containsValue",
function(a){
return false;
},"~O");
Clazz_overrideMethod(c$,"entrySet",
function(){
return java.util.Collections.EMPTY_SET;
});
Clazz_overrideMethod(c$,"get",
function(a){
return null;
},"~O");
Clazz_overrideMethod(c$,"keySet",
function(){
return java.util.Collections.EMPTY_SET;
});
Clazz_overrideMethod(c$,"values",
function(){
return java.util.Collections.EMPTY_LIST;
});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"ReverseComparator",null,[java.util.Comparator,java.io.Serializable]);
Clazz_overrideMethod(c$,"compare",
function(a,b){
var c=b;
return c.compareTo(a);
},"~O,~O");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.comparator=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"ReverseComparatorWithComparator",null,[java.util.Comparator,java.io.Serializable]);
Clazz_makeConstructor(c$,
function(a){
this.comparator=a;
},"java.util.Comparator");
Clazz_defineMethod(c$,"compare",
function(a,b){
return this.comparator.compare(b,a);
},"~O,~O");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.element=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"SingletonSet",java.util.AbstractSet,java.io.Serializable);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Collections.SingletonSet,[]);
this.element=a;
},"~O");
Clazz_overrideMethod(c$,"contains",
function(a){
return this.element==null?a==null:this.element.equals(a);
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return 1;
});
Clazz_overrideMethod(c$,"iterator",
function(){
return((Clazz_isClassDefined("java.util.Collections$SingletonSet$1")?0:java.util.Collections.SingletonSet.$Collections$SingletonSet$1$()),Clazz_innerTypeInstance(java.util.Collections$SingletonSet$1,this,null));
});
c$.$Collections$SingletonSet$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this,arguments);
this.$hasNext=true;
Clazz_instantialize(this,arguments);
},java.util,"Collections$SingletonSet$1",null,java.util.Iterator);
Clazz_overrideMethod(c$,"hasNext",
function(){
return this.$hasNext;
});
Clazz_overrideMethod(c$,"next",
function(){
if(this.$hasNext){
this.$hasNext=false;
return this.b$["java.util.Collections.SingletonSet"].element;
}throw new java.util.NoSuchElementException();
});
Clazz_overrideMethod(c$,"remove",
function(){
throw new UnsupportedOperationException();
});
c$=Clazz_p0p();
};
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.element=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"SingletonList",java.util.AbstractList,java.io.Serializable);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Collections.SingletonList,[]);
this.element=a;
},"~O");
Clazz_overrideMethod(c$,"contains",
function(a){
return this.element==null?a==null:this.element.equals(a);
},"~O");
Clazz_overrideMethod(c$,"get",
function(a){
if(a==0){
return this.element;
}throw new IndexOutOfBoundsException();
},"~N");
Clazz_overrideMethod(c$,"size",
function(){
return 1;
});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.k=null;
this.v=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"SingletonMap",java.util.AbstractMap,java.io.Serializable);
Clazz_makeConstructor(c$,
function(a,b){
Clazz_superConstructor(this,java.util.Collections.SingletonMap,[]);
this.k=a;
this.v=b;
},"~O,~O");
Clazz_overrideMethod(c$,"containsKey",
function(a){
return this.k==null?a==null:this.k.equals(a);
},"~O");
Clazz_overrideMethod(c$,"containsValue",
function(a){
return this.v==null?a==null:this.v.equals(a);
},"~O");
Clazz_overrideMethod(c$,"get",
function(a){
if(this.containsKey(a)){
return this.v;
}return null;
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return 1;
});
Clazz_overrideMethod(c$,"entrySet",
function(){
return((Clazz_isClassDefined("java.util.Collections$SingletonMap$1")?0:java.util.Collections.SingletonMap.$Collections$SingletonMap$1$()),Clazz_innerTypeInstance(java.util.Collections$SingletonMap$1,this,null));
});
c$.$Collections$SingletonMap$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_declareAnonymous(java.util,"Collections$SingletonMap$1",java.util.AbstractSet);
Clazz_overrideMethod(c$,"contains",
function(a){
if(Clazz_instanceOf(a,java.util.Map.Entry)){
var b=a;
return this.b$["java.util.Collections.SingletonMap"].containsKey(b.getKey())&&this.b$["java.util.Collections.SingletonMap"].containsValue(b.getValue());
}return false;
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return 1;
});
Clazz_overrideMethod(c$,"iterator",
function(){
return((Clazz_isClassDefined("java.util.Collections$SingletonMap$1$1")?0:java.util.Collections.$Collections$SingletonMap$1$1$()),Clazz_innerTypeInstance(java.util.Collections$SingletonMap$1$1,this,null));
});
c$=Clazz_p0p();
};
c$.$Collections$SingletonMap$1$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this,arguments);
this.$hasNext=true;
Clazz_instantialize(this,arguments);
},java.util,"Collections$SingletonMap$1$1",null,java.util.Iterator);
Clazz_overrideMethod(c$,"hasNext",
function(){
return this.$hasNext;
});
Clazz_overrideMethod(c$,"next",
function(){
if(this.$hasNext){
this.$hasNext=false;
return((Clazz_isClassDefined("java.util.Collections$SingletonMap$1$1$1")?0:java.util.Collections.$Collections$SingletonMap$1$1$1$()),Clazz_innerTypeInstance(java.util.Collections$SingletonMap$1$1$1,this,null));
}throw new java.util.NoSuchElementException();
});
Clazz_overrideMethod(c$,"remove",
function(){
throw new UnsupportedOperationException();
});
c$=Clazz_p0p();
};
c$.$Collections$SingletonMap$1$1$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_declareAnonymous(java.util,"Collections$SingletonMap$1$1$1",null,java.util.Map.Entry);
Clazz_overrideMethod(c$,"equals",
function(a){
return this.b$["java.util.Collections$SingletonMap$1"].contains(a);
},"~O");
Clazz_overrideMethod(c$,"getKey",
function(){
return this.b$["java.util.Collections.SingletonMap"].k;
});
Clazz_overrideMethod(c$,"getValue",
function(){
return this.b$["java.util.Collections.SingletonMap"].v;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return(this.b$["java.util.Collections.SingletonMap"].k==null?0:this.b$["java.util.Collections.SingletonMap"].k.hashCode())^(this.b$["java.util.Collections.SingletonMap"].v==null?0:this.b$["java.util.Collections.SingletonMap"].v.hashCode());
});
Clazz_overrideMethod(c$,"setValue",
function(a){
throw new UnsupportedOperationException();
},"~O");
c$=Clazz_p0p();
};
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.c=null;
this.mutex=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"SynchronizedCollection",null,[java.util.Collection,java.io.Serializable]);
Clazz_makeConstructor(c$,
function(a){
this.c=a;
this.mutex=this;
},"java.util.Collection");
Clazz_makeConstructor(c$,
function(a,b){
this.c=a;
this.mutex=b;
},"java.util.Collection,~O");
Clazz_defineMethod(c$,"add",
function(a){
{
return this.c.add(a);
}},"~O");
Clazz_defineMethod(c$,"addAll",
function(a){
{
return this.c.addAll(a);
}},"java.util.Collection");
Clazz_defineMethod(c$,"clear",
function(){
{
this.c.clear();
}});
Clazz_defineMethod(c$,"contains",
function(a){
{
return this.c.contains(a);
}},"~O");
Clazz_defineMethod(c$,"containsAll",
function(a){
{
return this.c.containsAll(a);
}},"java.util.Collection");
Clazz_defineMethod(c$,"isEmpty",
function(){
{
return this.c.isEmpty();
}});
Clazz_defineMethod(c$,"iterator",
function(){
{
return this.c.iterator();
}});
Clazz_defineMethod(c$,"remove",
function(a){
{
return this.c.remove(a);
}},"~O");
Clazz_defineMethod(c$,"removeAll",
function(a){
{
return this.c.removeAll(a);
}},"java.util.Collection");
Clazz_defineMethod(c$,"retainAll",
function(a){
{
return this.c.retainAll(a);
}},"java.util.Collection");
Clazz_defineMethod(c$,"size",
function(){
{
return this.c.size();
}});
Clazz_defineMethod(c$,"toArray",
function(){
{
return this.c.toArray();
}});
Clazz_defineMethod(c$,"toString",
function(){
{
return this.c.toString();
}});
Clazz_defineMethod(c$,"toArray",
function(a){
{
return this.c.toArray(a);
}},"~A");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"SynchronizedRandomAccessList",java.util.Collections.SynchronizedList,java.util.RandomAccess);
Clazz_overrideMethod(c$,"subList",
function(a,b){
{
return new java.util.Collections.SynchronizedRandomAccessList(this.list.subList(a,b),this.mutex);
}},"~N,~N");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.list=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"SynchronizedList",java.util.Collections.SynchronizedCollection,java.util.List);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Collections.SynchronizedList,[a]);
this.list=a;
},"java.util.List");
Clazz_makeConstructor(c$,
function(a,b){
Clazz_superConstructor(this,java.util.Collections.SynchronizedList,[a,b]);
this.list=a;
},"java.util.List,~O");
Clazz_defineMethod(c$,"add",
function(a,b){
{
this.list.add(a,b);
}},"~N,~O");
Clazz_defineMethod(c$,"addAll",
function(a,b){
{
return this.list.addAll(a,b);
}},"~N,java.util.Collection");
Clazz_overrideMethod(c$,"equals",
function(a){
{
return this.list.equals(a);
}},"~O");
Clazz_defineMethod(c$,"get",
function(a){
{
return this.list.get(a);
}},"~N");
Clazz_overrideMethod(c$,"hashCode",
function(){
{
return this.list.hashCode();
}});
Clazz_defineMethod(c$,"indexOf",
function(a){
{
return this.list.indexOf(a);
}},"~O");
Clazz_defineMethod(c$,"lastIndexOf",
function(a){
{
return this.list.lastIndexOf(a);
}},"~O");
//Clazz_defineMethod(c$,"listIterator",
//function(){
//{
//return this.list.listIterator();
//}});
Clazz_defineMethod(c$,"listIterator",
function(a){
{
a || (a = 0);
return this.list.listIterator(a);
}},"~N");
Clazz_defineMethod(c$,"remove",
function(a){
{
return this.list.remove(a);
}},"~N");
Clazz_defineMethod(c$,"set",
function(a,b){
{
return this.list.set(a,b);
}},"~N,~O");
Clazz_defineMethod(c$,"subList",
function(a,b){
{
return new java.util.Collections.SynchronizedList(this.list.subList(a,b),this.mutex);
}},"~N,~N");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.m=null;
this.mutex=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"SynchronizedMap",null,[java.util.Map,java.io.Serializable]);
Clazz_makeConstructor(c$,
function(a){
this.m=a;
this.mutex=this;
},"java.util.Map");
Clazz_makeConstructor(c$,
function(a,b){
this.m=a;
this.mutex=b;
},"java.util.Map,~O");
Clazz_defineMethod(c$,"clear",
function(){
{
this.m.clear();
}});
Clazz_defineMethod(c$,"containsKey",
function(a){
{
return this.m.containsKey(a);
}},"~O");
Clazz_defineMethod(c$,"containsValue",
function(a){
{
return this.m.containsValue(a);
}},"~O");
Clazz_defineMethod(c$,"entrySet",
function(){
{
return new java.util.Collections.SynchronizedSet(this.m.entrySet(),this.mutex);
}});
Clazz_overrideMethod(c$,"equals",
function(a){
{
return this.m.equals(a);
}},"~O");
Clazz_defineMethod(c$,"get",
function(a){
{
return this.m.get(a);
}},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
{
return this.m.hashCode();
}});
Clazz_defineMethod(c$,"isEmpty",
function(){
{
return this.m.isEmpty();
}});
Clazz_defineMethod(c$,"keySet",
function(){
{
return new java.util.Collections.SynchronizedSet(this.m.keySet(),this.mutex);
}});
Clazz_defineMethod(c$,"put",
function(a,b){
{
return this.m.put(a,b);
}},"~O,~O");
Clazz_defineMethod(c$,"putAll",
function(a){
{
this.m.putAll(a);
}},"java.util.Map");
Clazz_defineMethod(c$,"remove",
function(a){
{
return this.m.remove(a);
}},"~O");
Clazz_defineMethod(c$,"size",
function(){
{
return this.m.size();
}});
Clazz_defineMethod(c$,"values",
function(){
{
return new java.util.Collections.SynchronizedCollection(this.m.values(),this.mutex);
}});
Clazz_defineMethod(c$,"toString",
function(){
{
return this.m.toString();
}});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"SynchronizedSet",java.util.Collections.SynchronizedCollection,java.util.Set);
Clazz_overrideMethod(c$,"equals",
function(a){
{
return this.c.equals(a);
}},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
{
return this.c.hashCode();
}});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.sm=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"SynchronizedSortedMap",java.util.Collections.SynchronizedMap,java.util.SortedMap);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Collections.SynchronizedSortedMap,[a]);
this.sm=a;
},"java.util.SortedMap");
Clazz_makeConstructor(c$,
function(a,b){
Clazz_superConstructor(this,java.util.Collections.SynchronizedSortedMap,[a,b]);
this.sm=a;
},"java.util.SortedMap,~O");
Clazz_defineMethod(c$,"comparator",
function(){
{
return this.sm.comparator();
}});
Clazz_defineMethod(c$,"firstKey",
function(){
{
return this.sm.firstKey();
}});
Clazz_defineMethod(c$,"headMap",
function(a){
{
return new java.util.Collections.SynchronizedSortedMap(this.sm.headMap(a),this.mutex);
}},"~O");
Clazz_defineMethod(c$,"lastKey",
function(){
{
return this.sm.lastKey();
}});
Clazz_defineMethod(c$,"subMap",
function(a,b){
{
return new java.util.Collections.SynchronizedSortedMap(this.sm.subMap(a,b),this.mutex);
}},"~O,~O");
Clazz_defineMethod(c$,"tailMap",
function(a){
{
return new java.util.Collections.SynchronizedSortedMap(this.sm.tailMap(a),this.mutex);
}},"~O");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.ss=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"SynchronizedSortedSet",java.util.Collections.SynchronizedSet,java.util.SortedSet);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Collections.SynchronizedSortedSet,[a]);
this.ss=a;
},"java.util.SortedSet");
Clazz_makeConstructor(c$,
function(a,b){
Clazz_superConstructor(this,java.util.Collections.SynchronizedSortedSet,[a,b]);
this.ss=a;
},"java.util.SortedSet,~O");
Clazz_defineMethod(c$,"comparator",
function(){
{
return this.ss.comparator();
}});
Clazz_defineMethod(c$,"first",
function(){
{
return this.ss.first();
}});
Clazz_defineMethod(c$,"headSet",
function(a){
{
return new java.util.Collections.SynchronizedSortedSet(this.ss.headSet(a),this.mutex);
}},"~O");
Clazz_defineMethod(c$,"last",
function(){
{
return this.ss.last();
}});
Clazz_defineMethod(c$,"subSet",
function(a,b){
{
return new java.util.Collections.SynchronizedSortedSet(this.ss.subSet(a,b),this.mutex);
}},"~O,~O");
Clazz_defineMethod(c$,"tailSet",
function(a){
{
return new java.util.Collections.SynchronizedSortedSet(this.ss.tailSet(a),this.mutex);
}},"~O");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.c=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"UnmodifiableCollection",null,[java.util.Collection,java.io.Serializable]);
Clazz_makeConstructor(c$,
function(a){
this.c=a;
},"java.util.Collection");
Clazz_overrideMethod(c$,"add",
function(a){
throw new UnsupportedOperationException();
},"~O");
Clazz_overrideMethod(c$,"addAll",
function(a){
throw new UnsupportedOperationException();
},"java.util.Collection");
Clazz_overrideMethod(c$,"clear",
function(){
throw new UnsupportedOperationException();
});
Clazz_defineMethod(c$,"contains",
function(a){
return this.c.contains(a);
},"~O");
Clazz_defineMethod(c$,"containsAll",
function(a){
return this.c.containsAll(a);
},"java.util.Collection");
Clazz_defineMethod(c$,"isEmpty",
function(){
return this.c.isEmpty();
});
Clazz_defineMethod(c$,"iterator",
function(){
return((Clazz_isClassDefined("java.util.Collections$UnmodifiableCollection$1")?0:java.util.Collections.UnmodifiableCollection.$Collections$UnmodifiableCollection$1$()),Clazz_innerTypeInstance(java.util.Collections$UnmodifiableCollection$1,this,null));
});
Clazz_overrideMethod(c$,"remove",
function(a){
throw new UnsupportedOperationException();
},"~O");
Clazz_overrideMethod(c$,"removeAll",
function(a){
throw new UnsupportedOperationException();
},"java.util.Collection");
Clazz_overrideMethod(c$,"retainAll",
function(a){
throw new UnsupportedOperationException();
},"java.util.Collection");
Clazz_defineMethod(c$,"size",
function(){
return this.c.size();
});
Clazz_defineMethod(c$,"toArray",
function(){
return this.c.toArray();
});
Clazz_defineMethod(c$,"toArray",
function(a){
return this.c.toArray(a);
},"~A");
Clazz_defineMethod(c$,"toString",
function(){
return this.c.toString();
});
c$.$Collections$UnmodifiableCollection$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this,arguments);
this.iterator=null;
Clazz_instantialize(this,arguments);
},java.util,"Collections$UnmodifiableCollection$1",null,java.util.Iterator);
Clazz_prepareFields(c$,function(){
this.iterator=this.b$["java.util.Collections.UnmodifiableCollection"].c.iterator();
});
Clazz_defineMethod(c$,"hasNext",
function(){
return this.iterator.hasNext();
});
Clazz_defineMethod(c$,"next",
function(){
return this.iterator.next();
});
Clazz_overrideMethod(c$,"remove",
function(){
throw new UnsupportedOperationException();
});
c$=Clazz_p0p();
};
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"UnmodifiableRandomAccessList",java.util.Collections.UnmodifiableList,java.util.RandomAccess);
Clazz_overrideMethod(c$,"subList",
function(a,b){
return new java.util.Collections.UnmodifiableRandomAccessList(this.list.subList(a,b));
},"~N,~N");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.list=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"UnmodifiableList",java.util.Collections.UnmodifiableCollection,java.util.List);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Collections.UnmodifiableList,[a]);
this.list=a;
},"java.util.List");
Clazz_defineMethod(c$,"add",
function(a,b){
throw new UnsupportedOperationException();
},"~N,~O");
Clazz_defineMethod(c$,"addAll",
function(a,b){
throw new UnsupportedOperationException();
},"~N,java.util.Collection");
Clazz_overrideMethod(c$,"equals",
function(a){
return this.list.equals(a);
},"~O");
Clazz_defineMethod(c$,"get",
function(a){
return this.list.get(a);
},"~N");
Clazz_overrideMethod(c$,"hashcode",
function(){
return this.list.hashCode();
});
Clazz_defineMethod(c$,"indexOf",
function(a){
return this.list.indexOf(a);
},"~O");
Clazz_defineMethod(c$,"lastIndexOf",
function(a){
return this.list.lastIndexOf(a);
},"~O");
//Clazz_defineMethod(c$,"listIterator",
//function(){
//return this.listIterator(0);
//});
Clazz_defineMethod(c$,"listIterator",
function(a){
a || (a = 0);
return((Clazz_isClassDefined("java.util.Collections$UnmodifiableList$1")?0:java.util.Collections.UnmodifiableList.$Collections$UnmodifiableList$1$()),Clazz_innerTypeInstance(java.util.Collections$UnmodifiableList$1,this,null));
},"~N");
Clazz_defineMethod(c$,"remove",
function(a){
throw new UnsupportedOperationException();
},"~N");
Clazz_overrideMethod(c$,"set",
function(a,b){
throw new UnsupportedOperationException();
},"~N,~O");
Clazz_defineMethod(c$,"subList",
function(a,b){
return new java.util.Collections.UnmodifiableList(this.list.subList(a,b));
},"~N,~N");
c$.$Collections$UnmodifiableList$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this,arguments);
this.iterator=null;
Clazz_instantialize(this,arguments);
},java.util,"Collections$UnmodifiableList$1",null,java.util.ListIterator);
Clazz_prepareFields(c$,function(){
this.iterator=this.b$["java.util.Collections.UnmodifiableList"].list.listIterator(location);
});
Clazz_overrideMethod(c$,"add",
function(b){
throw new UnsupportedOperationException();
},"~O");
Clazz_defineMethod(c$,"hasNext",
function(){
return this.iterator.hasNext();
});
Clazz_defineMethod(c$,"hasPrevious",
function(){
return this.iterator.hasPrevious();
});
Clazz_defineMethod(c$,"next",
function(){
return this.iterator.next();
});
Clazz_defineMethod(c$,"nextIndex",
function(){
return this.iterator.nextIndex();
});
Clazz_defineMethod(c$,"previous",
function(){
return this.iterator.previous();
});
Clazz_defineMethod(c$,"previousIndex",
function(){
return this.iterator.previousIndex();
});
Clazz_overrideMethod(c$,"remove",
function(){
throw new UnsupportedOperationException();
});
Clazz_overrideMethod(c$,"set",
function(b){
throw new UnsupportedOperationException();
},"~O");
c$=Clazz_p0p();
};
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.m=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"UnmodifiableMap",null,[java.util.Map,java.io.Serializable]);
Clazz_makeConstructor(c$,
function(a){
this.m=a;
},"java.util.Map");
Clazz_overrideMethod(c$,"clear",
function(){
throw new UnsupportedOperationException();
});
Clazz_defineMethod(c$,"containsKey",
function(a){
return this.m.containsKey(a);
},"~O");
Clazz_defineMethod(c$,"containsValue",
function(a){
return this.m.containsValue(a);
},"~O");
Clazz_defineMethod(c$,"entrySet",
function(){
return new java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet(this.m.entrySet());
});
Clazz_overrideMethod(c$,"equals",
function(a){
return this.m.equals(a);
},"~O");
Clazz_defineMethod(c$,"get",
function(a){
return this.m.get(a);
},"~O");
Clazz_overrideMethod(c$,"hashcode",
function(){
return this.m.hashCode();
});
Clazz_defineMethod(c$,"isEmpty",
function(){
return this.m.isEmpty();
});
Clazz_defineMethod(c$,"keySet",
function(){
return new java.util.Collections.UnmodifiableSet(this.m.keySet());
});
Clazz_overrideMethod(c$,"put",
function(a,b){
throw new UnsupportedOperationException();
},"~O,~O");
Clazz_overrideMethod(c$,"putAll",
function(a){
throw new UnsupportedOperationException();
},"java.util.Map");
Clazz_overrideMethod(c$,"remove",
function(a){
throw new UnsupportedOperationException();
},"~O");
Clazz_defineMethod(c$,"size",
function(){
return this.m.size();
});
Clazz_defineMethod(c$,"values",
function(){
return new java.util.Collections.UnmodifiableCollection(this.m.values());
});
Clazz_defineMethod(c$,"toString",
function(){
return this.m.toString();
});
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections.UnmodifiableMap,"UnmodifiableEntrySet",java.util.Collections.UnmodifiableSet);
Clazz_overrideMethod(c$,"iterator",
function(){
return((Clazz_isClassDefined("java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$1")?0:java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet.$Collections$UnmodifiableMap$UnmodifiableEntrySet$1$()),Clazz_innerTypeInstance(java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$1,this,null));
});
Clazz_defineMethod(c$,"toArray",
function(){
var a=this.c.size();
var b=new Array(a);
var c=this.iterator();
for(var d=a;--d>=0;){
b[d]=c.next();
}
return b;
});
Clazz_defineMethod(c$,"toArray",
function(a){
var b=this.c.size();
var c=0;
var d=this.iterator();
if(b>a.length){
var e=a.getClass().getComponentType();
a=java.lang.reflect.Array.newInstance(e,b);
}while(c<b){
a[c++]=d.next();
}
if(c<a.length){
a[c]=null;
}return a;
},"~A");
c$.$Collections$UnmodifiableMap$UnmodifiableEntrySet$1$=function(){
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
Clazz_prepareCallback(this,arguments);
this.iterator=null;
Clazz_instantialize(this,arguments);
},java.util,"Collections$UnmodifiableMap$UnmodifiableEntrySet$1",null,java.util.Iterator);
Clazz_prepareFields(c$,function(){
this.iterator=this.b$["java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet"].c.iterator();
});
Clazz_defineMethod(c$,"hasNext",
function(){
return this.iterator.hasNext();
});
Clazz_defineMethod(c$,"next",
function(){
return new java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableMapEntry(this.iterator.next());
});
Clazz_overrideMethod(c$,"remove",
function(){
throw new UnsupportedOperationException();
});
c$=Clazz_p0p();
};
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.mapEntry=null;
Clazz_instantialize(this,arguments);
},java.util.Collections.UnmodifiableMap.UnmodifiableEntrySet,"UnmodifiableMapEntry",null,java.util.Map.Entry);
Clazz_makeConstructor(c$,
function(a){
this.mapEntry=a;
},"java.util.Map.Entry");
Clazz_overrideMethod(c$,"equals",
function(a){
return this.mapEntry.equals(a);
},"~O");
Clazz_defineMethod(c$,"getKey",
function(){
return this.mapEntry.getKey();
});
Clazz_defineMethod(c$,"getValue",
function(){
return this.mapEntry.getValue();
});
Clazz_overrideMethod(c$,"hashcode",
function(){
return this.mapEntry.hashCode();
});
Clazz_overrideMethod(c$,"setValue",
function(a){
throw new UnsupportedOperationException();
},"~O");
Clazz_defineMethod(c$,"toString",
function(){
return this.mapEntry.toString();
});
c$=Clazz_p0p();
c$=Clazz_p0p();
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"UnmodifiableSet",java.util.Collections.UnmodifiableCollection,java.util.Set);
Clazz_overrideMethod(c$,"equals",
function(a){
return this.c.equals(a);
},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
return this.c.hashCode();
});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.sm=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"UnmodifiableSortedMap",java.util.Collections.UnmodifiableMap,java.util.SortedMap);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Collections.UnmodifiableSortedMap,[a]);
this.sm=a;
},"java.util.SortedMap");
Clazz_defineMethod(c$,"comparator",
function(){
return this.sm.comparator();
});
Clazz_defineMethod(c$,"firstKey",
function(){
return this.sm.firstKey();
});
Clazz_defineMethod(c$,"headMap",
function(a){
return new java.util.Collections.UnmodifiableSortedMap(this.sm.headMap(a));
},"~O");
Clazz_defineMethod(c$,"lastKey",
function(){
return this.sm.lastKey();
});
Clazz_defineMethod(c$,"subMap",
function(a,b){
return new java.util.Collections.UnmodifiableSortedMap(this.sm.subMap(a,b));
},"~O,~O");
Clazz_defineMethod(c$,"tailMap",
function(a){
return new java.util.Collections.UnmodifiableSortedMap(this.sm.tailMap(a));
},"~O");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.ss=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"UnmodifiableSortedSet",java.util.Collections.UnmodifiableSet,java.util.SortedSet);
Clazz_makeConstructor(c$,
function(a){
Clazz_superConstructor(this,java.util.Collections.UnmodifiableSortedSet,[a]);
this.ss=a;
},"java.util.SortedSet");
Clazz_defineMethod(c$,"comparator",
function(){
return this.ss.comparator();
});
Clazz_defineMethod(c$,"first",
function(){
return this.ss.first();
});
Clazz_defineMethod(c$,"headSet",
function(a){
return new java.util.Collections.UnmodifiableSortedSet(this.ss.headSet(a));
},"~O");
Clazz_defineMethod(c$,"last",
function(){
return this.ss.last();
});
Clazz_defineMethod(c$,"subSet",
function(a,b){
return new java.util.Collections.UnmodifiableSortedSet(this.ss.subSet(a,b));
},"~O,~O");
Clazz_defineMethod(c$,"tailSet",
function(a){
return new java.util.Collections.UnmodifiableSortedSet(this.ss.tailSet(a));
},"~O");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.c=null;
this.type=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"CheckedCollection",null,[java.util.Collection,java.io.Serializable]);
Clazz_makeConstructor(c$,
function(a,b){
if(a==null||b==null){
throw new NullPointerException();
}this.c=a;
this.type=b;
},"java.util.Collection,Class");
Clazz_defineMethod(c$,"size",
function(){
return this.c.size();
});
Clazz_defineMethod(c$,"isEmpty",
function(){
return this.c.isEmpty();
});
Clazz_defineMethod(c$,"contains",
function(a){
return this.c.contains(a);
},"~O");
Clazz_defineMethod(c$,"iterator",
function(){
var a=this.c.iterator();
if(Clazz_instanceOf(a,java.util.ListIterator)){
a=new java.util.Collections.CheckedListIterator(a,this.type);
}return a;
});
Clazz_defineMethod(c$,"toArray",
function(){
return this.c.toArray();
});
Clazz_defineMethod(c$,"toArray",
function(a){
return this.c.toArray(a);
},"~A");
Clazz_defineMethod(c$,"add",
function(a){
return this.c.add(java.util.Collections.checkType(a,this.type));
},"~O");
Clazz_defineMethod(c$,"remove",
function(a){
return this.c.remove(a);
},"~O");
Clazz_defineMethod(c$,"containsAll",
function(a){
return this.c.containsAll(a);
},"java.util.Collection");
Clazz_overrideMethod(c$,"addAll",
function(a){
var b=a.size();
if(b==0){
return false;
}var c=new Array(b);
var d=a.iterator();
for(var e=0;e<b;e++){
c[e]=java.util.Collections.checkType(d.next(),this.type);
}
var f=false;
for(var g=0;g<b;g++){
f=new Boolean(f|this.c.add(c[g])).valueOf();
}
return f;
},"java.util.Collection");
Clazz_defineMethod(c$,"removeAll",
function(a){
return this.c.removeAll(a);
},"java.util.Collection");
Clazz_defineMethod(c$,"retainAll",
function(a){
return this.c.retainAll(a);
},"java.util.Collection");
Clazz_defineMethod(c$,"clear",
function(){
this.c.clear();
});
Clazz_defineMethod(c$,"toString",
function(){
return this.c.toString();
});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.i=null;
this.type=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"CheckedListIterator",null,java.util.ListIterator);
Clazz_makeConstructor(c$,
function(a,b){
this.i=a;
this.type=b;
},"java.util.ListIterator,Class");
Clazz_defineMethod(c$,"hasNext",
function(){
return this.i.hasNext();
});
Clazz_defineMethod(c$,"next",
function(){
return this.i.next();
});
Clazz_defineMethod(c$,"remove",
function(){
this.i.remove();
});
Clazz_defineMethod(c$,"hasPrevious",
function(){
return this.i.hasPrevious();
});
Clazz_defineMethod(c$,"previous",
function(){
return this.i.previous();
});
Clazz_defineMethod(c$,"nextIndex",
function(){
return this.i.nextIndex();
});
Clazz_defineMethod(c$,"previousIndex",
function(){
return this.i.previousIndex();
});
Clazz_defineMethod(c$,"set",
function(a){
this.i.set(java.util.Collections.checkType(a,this.type));
},"~O");
Clazz_defineMethod(c$,"add",
function(a){
this.i.add(java.util.Collections.checkType(a,this.type));
},"~O");
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.l=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"CheckedList",java.util.Collections.CheckedCollection,java.util.List);
Clazz_makeConstructor(c$,
function(a,b){
Clazz_superConstructor(this,java.util.Collections.CheckedList,[a,b]);
this.l=a;
},"java.util.List,Class");
Clazz_defineMethod(c$,"addAll",
function(a,b){
var c=b.size();
if(c==0){
return false;
}var d=new Array(c);
var e=b.iterator();
for(var f=0;f<c;f++){
d[f]=java.util.Collections.checkType(e.next(),this.type);
}
return this.l.addAll(a,java.util.Arrays.asList(d));
},"~N,java.util.Collection");
Clazz_defineMethod(c$,"get",
function(a){
return this.l.get(a);
},"~N");
Clazz_defineMethod(c$,"set",
function(a,b){
return this.l.set(a,java.util.Collections.checkType(b,this.type));
},"~N,~O");
Clazz_defineMethod(c$,"add",
function(a,b){
this.l.add(a,java.util.Collections.checkType(b,this.type));
},"~N,~O");
Clazz_defineMethod(c$,"remove",
function(a){
return this.l.remove(a);
},"~N");
Clazz_defineMethod(c$,"indexOf",
function(a){
return this.l.indexOf(a);
},"~O");
Clazz_defineMethod(c$,"lastIndexOf",
function(a){
return this.l.lastIndexOf(a);
},"~O");
//Clazz_defineMethod(c$,"listIterator",
//function(){
//return new java.util.Collections.CheckedListIterator(this.l.listIterator(),this.type);
//});
Clazz_defineMethod(c$,"listIterator",
function(a){
a || (a = 0);
return new java.util.Collections.CheckedListIterator(this.l.listIterator(a),this.type);
},"~N");
Clazz_defineMethod(c$,"subList",
function(a,b){
return java.util.Collections.checkedList(this.l.subList(a,b),this.type);
},"~N,~N");
Clazz_overrideMethod(c$,"equals",
function(a){
return this.l.equals(a);
},"~O");
Clazz_overrideMethod(c$,"hashcode",
function(){
return this.l.hashCode();
});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"CheckedRandomAccessList",java.util.Collections.CheckedList,java.util.RandomAccess);
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_declareType(java.util.Collections,"CheckedSet",java.util.Collections.CheckedCollection,java.util.Set);
Clazz_overrideMethod(c$,"equals",
function(a){
return this.c.equals(a);
},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
return this.c.hashCode();
});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.m=null;
this.keyType=null;
this.valueType=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"CheckedMap",null,[java.util.Map,java.io.Serializable]);
Clazz_makeConstructor(c$,
($fz=function(a,b,c){
if(a==null||b==null||c==null){
throw new NullPointerException();
}this.m=a;
this.keyType=b;
this.valueType=c;
},$fz.isPrivate=true,$fz),"java.util.Map,Class,Class");
Clazz_defineMethod(c$,"size",
function(){
return this.m.size();
});
Clazz_defineMethod(c$,"isEmpty",
function(){
return this.m.isEmpty();
});
Clazz_defineMethod(c$,"containsKey",
function(a){
return this.m.containsKey(a);
},"~O");
Clazz_defineMethod(c$,"containsValue",
function(a){
return this.m.containsValue(a);
},"~O");
Clazz_defineMethod(c$,"get",
function(a){
return this.m.get(a);
},"~O");
Clazz_defineMethod(c$,"put",
function(a,b){
return this.m.put(java.util.Collections.checkType(a,this.keyType),java.util.Collections.checkType(b,this.valueType));
},"~O,~O");
Clazz_defineMethod(c$,"remove",
function(a){
return this.m.remove(a);
},"~O");
Clazz_overrideMethod(c$,"putAll",
function(a){
var b=a.size();
if(b==0){
return;
}var c=new Array(b);
var d=a.entrySet().iterator();
for(var e=0;e<b;e++){
var f=d.next();
java.util.Collections.checkType(f.getKey(),this.keyType);
java.util.Collections.checkType(f.getValue(),this.valueType);
c[e]=f;
}
for(var f=0;f<b;f++){
this.m.put(c[f].getKey(),c[f].getValue());
}
},"java.util.Map");
Clazz_defineMethod(c$,"clear",
function(){
this.m.clear();
});
Clazz_defineMethod(c$,"keySet",
function(){
return this.m.keySet();
});
Clazz_defineMethod(c$,"values",
function(){
return this.m.values();
});
Clazz_defineMethod(c$,"entrySet",
function(){
return new java.util.Collections.CheckedMap.CheckedEntrySet(this.m.entrySet(),this.valueType);
});
Clazz_overrideMethod(c$,"equals",
function(a){
return this.m.equals(a);
},"~O");
Clazz_overrideMethod(c$,"hashcode",
function(){
return this.m.hashCode();
});
Clazz_defineMethod(c$,"toString",
function(){
return this.m.toString();
});
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.e=null;
this.valueType=null;
Clazz_instantialize(this,arguments);
},java.util.Collections.CheckedMap,"CheckedEntry",null,java.util.Map.Entry);
Clazz_makeConstructor(c$,
function(a,b){
if(a==null){
throw new NullPointerException();
}this.e=a;
this.valueType=b;
},"java.util.Map.Entry,Class");
Clazz_defineMethod(c$,"getKey",
function(){
return this.e.getKey();
});
Clazz_defineMethod(c$,"getValue",
function(){
return this.e.getValue();
});
Clazz_defineMethod(c$,"setValue",
function(a){
return this.e.setValue(java.util.Collections.checkType(a,this.valueType));
},"~O");
Clazz_overrideMethod(c$,"equals",
function(a){
return this.e.equals(a);
},"~O");
Clazz_overrideMethod(c$,"hashcode",
function(){
return this.e.hashCode();
});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.s=null;
this.valueType=null;
Clazz_instantialize(this,arguments);
},java.util.Collections.CheckedMap,"CheckedEntrySet",null,java.util.Set);
Clazz_makeConstructor(c$,
function(a,b){
this.s=a;
this.valueType=b;
},"java.util.Set,Class");
Clazz_defineMethod(c$,"iterator",
function(){
return new java.util.Collections.CheckedMap.CheckedEntrySet.CheckedEntryIterator(this.s.iterator(),this.valueType);
});
Clazz_defineMethod(c$,"toArray",
function(){
var a=this.size();
var b=new Array(a);
var c=this.iterator();
for(var d=0;d<a;d++){
b[d]=c.next();
}
return b;
});
Clazz_defineMethod(c$,"toArray",
function(a){
var b=this.size();
if(a.length<b){
var c=a.getClass().getComponentType();
a=java.lang.reflect.Array.newInstance(c,b);
}var c=this.iterator();
for(var d=0;d<b;d++){
a[d]=c.next();
}
if(b<a.length){
a[b]=null;
}return a;
},"~A");
Clazz_defineMethod(c$,"retainAll",
function(a){
return this.s.retainAll(a);
},"java.util.Collection");
Clazz_defineMethod(c$,"removeAll",
function(a){
return this.s.removeAll(a);
},"java.util.Collection");
Clazz_defineMethod(c$,"containsAll",
function(a){
return this.s.containsAll(a);
},"java.util.Collection");
Clazz_overrideMethod(c$,"addAll",
function(a){
throw new UnsupportedOperationException();
},"java.util.Collection");
Clazz_defineMethod(c$,"remove",
function(a){
return this.s.remove(a);
},"~O");
Clazz_defineMethod(c$,"contains",
function(a){
return this.s.contains(a);
},"~O");
Clazz_overrideMethod(c$,"add",
function(a){
throw new UnsupportedOperationException();
},"java.util.Map.Entry");
Clazz_defineMethod(c$,"isEmpty",
function(){
return this.s.isEmpty();
});
Clazz_defineMethod(c$,"clear",
function(){
this.s.clear();
});
Clazz_defineMethod(c$,"size",
function(){
return this.s.size();
});
Clazz_overrideMethod(c$,"hashcode",
function(){
return this.s.hashCode();
});
Clazz_overrideMethod(c$,"equals",
function(a){
return this.s.equals(a);
},"~O");
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.i=null;
this.valueType=null;
Clazz_instantialize(this,arguments);
},java.util.Collections.CheckedMap.CheckedEntrySet,"CheckedEntryIterator",null,java.util.Iterator);
Clazz_makeConstructor(c$,
function(a,b){
this.i=a;
this.valueType=b;
},"java.util.Iterator,Class");
Clazz_defineMethod(c$,"hasNext",
function(){
return this.i.hasNext();
});
Clazz_defineMethod(c$,"remove",
function(){
this.i.remove();
});
Clazz_defineMethod(c$,"next",
function(){
return new java.util.Collections.CheckedMap.CheckedEntry(this.i.next(),this.valueType);
});
c$=Clazz_p0p();
c$=Clazz_p0p();
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.ss=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"CheckedSortedSet",java.util.Collections.CheckedSet,java.util.SortedSet);
Clazz_makeConstructor(c$,
function(a,b){
Clazz_superConstructor(this,java.util.Collections.CheckedSortedSet,[a,b]);
this.ss=a;
},"java.util.SortedSet,Class");
Clazz_defineMethod(c$,"comparator",
function(){
return this.ss.comparator();
});
Clazz_defineMethod(c$,"subSet",
function(a,b){
return new java.util.Collections.CheckedSortedSet(this.ss.subSet(a,b),this.type);
},"~O,~O");
Clazz_defineMethod(c$,"headSet",
function(a){
return new java.util.Collections.CheckedSortedSet(this.ss.headSet(a),this.type);
},"~O");
Clazz_defineMethod(c$,"tailSet",
function(a){
return new java.util.Collections.CheckedSortedSet(this.ss.tailSet(a),this.type);
},"~O");
Clazz_defineMethod(c$,"first",
function(){
return this.ss.first();
});
Clazz_defineMethod(c$,"last",
function(){
return this.ss.last();
});
c$=Clazz_p0p();
Clazz_pu$h(self.c$);
c$=Clazz_decorateAsClass(function(){
this.sm=null;
Clazz_instantialize(this,arguments);
},java.util.Collections,"CheckedSortedMap",java.util.Collections.CheckedMap,java.util.SortedMap);
Clazz_makeConstructor(c$,
function(a,b,c){
Clazz_superConstructor(this,java.util.Collections.CheckedSortedMap,[a,b,c]);
this.sm=a;
},"java.util.SortedMap,Class,Class");
Clazz_defineMethod(c$,"comparator",
function(){
return this.sm.comparator();
});
Clazz_defineMethod(c$,"subMap",
function(a,b){
return new java.util.Collections.CheckedSortedMap(this.sm.subMap(a,b),this.keyType,this.valueType);
},"~O,~O");
Clazz_defineMethod(c$,"headMap",
function(a){
return new java.util.Collections.CheckedSortedMap(this.sm.headMap(a),this.keyType,this.valueType);
},"~O");
Clazz_defineMethod(c$,"tailMap",
function(a){
return new java.util.Collections.CheckedSortedMap(this.sm.tailMap(a),this.keyType,this.valueType);
},"~O");
Clazz_defineMethod(c$,"firstKey",
function(){
return this.sm.firstKey();
});
Clazz_defineMethod(c$,"lastKey",
function(){
return this.sm.lastKey();
});
c$=Clazz_p0p();
c$.EMPTY_LIST=c$.prototype.EMPTY_LIST=new java.util.Collections.EmptyList();
c$.EMPTY_SET=c$.prototype.EMPTY_SET=new java.util.Collections.EmptySet();
c$.EMPTY_MAP=c$.prototype.EMPTY_MAP=new java.util.Collections.EmptyMap();
});
c$=Clazz_declareType(java.util,"Dictionary");
Clazz_makeConstructor(c$,
function(){
});

// modified by Bob Hanson 3/21/2014 6:44:21 AM  to reduce this.b$[....] phrases to simply this.h$
// BH added ability to use a non-Java key for HTML elements, for example.
// BH 8/24/2014 8:48:58 PM all synchronization and inner classes removed


Clazz_load([],"java.util.HashtableIterator",[],function(){
c$=Clazz_decorateAsClass(function(){
this.position=0;
this.expectedModCount=0;
this.type=null;
this.lastEntry=null;
this.lastPosition=0;
this.canRemove=false;
Clazz_instantialize(this,arguments);
},java.util,"HashtableIterator",null,java.util.Iterator);
Clazz_makeConstructor(c$,
function(a){
this.type=a;
this.h$ = a.h$;
this.position=this.h$.lastSlot;
this.expectedModCount=this.h$.modCount;
},"java.util.AbstractSet");
Clazz_overrideMethod(c$,"hasNext",
function(){
if(this.lastEntry&&this.lastEntry.next){
return true;
}while(this.position>=this.h$.firstSlot){
if(this.h$.elementData[this.position]==null){
this.position--;
}else{
return true;
}}
return false;
});
Clazz_overrideMethod(c$,"next",
function(){
if(this.expectedModCount==this.h$.modCount){
if(this.lastEntry){
this.lastEntry=this.lastEntry.next;
}if(this.lastEntry==null){
while(this.position>=this.h$.firstSlot&&(this.lastEntry=this.h$.elementData[this.position])==null){
this.position--;
}
if(this.lastEntry){
this.lastPosition=this.position;
this.position--;
}}if(this.lastEntry){
this.canRemove=true;
return this.type.get(this.lastEntry);
}throw new java.util.NoSuchElementException();
}throw new java.util.ConcurrentModificationException();
});
Clazz_overrideMethod(c$,"remove",
function(){
if(this.expectedModCount==this.h$.modCount){
if(this.canRemove){
this.canRemove=false;
{
var a=false;
var b=this.h$.elementData[this.lastPosition];
if(b===this.lastEntry){
this.h$.elementData[this.lastPosition]=b.next;
a=true;
}else{
while(b&&b.next!==this.lastEntry){
b=b.next;
}
if(b){
b.next=this.lastEntry.next;
a=true;
}}if(a){
this.h$.modCount++;
this.h$.elementCount--;
this.expectedModCount++;
return;
}}}else{
throw new IllegalStateException();
}}throw new java.util.ConcurrentModificationException();
});
});



////////////////////////////


Clazz_load([],"java.util.HashtableEnumerator",[],function(){
c$=Clazz_decorateAsClass(function(){
this.key=false;
this.start=0;
this.entry=null;
Clazz_instantialize(this,arguments);
},java.util,"HashtableEnumerator",null,java.util.Enumeration);

Clazz_makeConstructor(c$,
function(a, b){
this.key = a;
this.h$ = b;
if (this.h$)this.start=this.h$.lastSlot+1;
},"~B,java.util.Hashtable");
Clazz_overrideMethod(c$,"hasMoreElements",
function(){
if (!this.h$)return false;
if(this.entry)return true;

while(--this.start>=this.h$.firstSlot){
if(this.h$.elementData[this.start]){
this.entry=this.h$.elementData[this.start];
return true;
}}
return false;
});
Clazz_overrideMethod(c$,"nextElement",
function(){
if(this.hasMoreElements()){
var a=this.key?this.entry.key:this.entry.value;
this.entry=this.entry.next;
return a;
}
throw new java.util.NoSuchElementException();
});
});

////////////////////////////

Clazz_load([],"java.util.HashtableEntrySet",[],function(){
c$=Clazz_decorateAsClass(function(){
Clazz_instantialize(this,arguments);
},java.util,"HashtableEntrySet",null,java.util.AbstractSet);

Clazz_makeConstructor(c$,
function(a){
this.h$ = a;
},"java.util.Hashtable");
Clazz_overrideMethod(c$,"size",
function(){
return this.h$.elementCount;
});
Clazz_overrideMethod(c$,"clear",
function(){
this.h$.clear();
});
Clazz_overrideMethod(c$,"remove",
function(object){
if(this.contains(object)){
this.h$.remove((object).getKey());
return true;
}return false;
},"~O");
Clazz_defineMethod(c$,"contains",
function(object){
var entry=this.h$.getEntry((object).getKey());
return object.equals(entry);
},"~O");

Clazz_overrideMethod(c$,"get",
function(entry){
return entry;
},"java.util.MapEntry");

Clazz_defineMethod(c$,"iterator",
function(){
return new java.util.HashtableIterator(this);
});
});


////////////////////////////

Clazz_load([],"java.util.HashtableKeySet",[],function(){
c$=Clazz_decorateAsClass(function(){
Clazz_instantialize(this,arguments);
},java.util,"HashtableKeySet",null,java.util.AbstractSet);

Clazz_makeConstructor(c$,
function(a){
this.h$ = a;
},"java.util.Hashtable");

Clazz_overrideMethod(c$,"contains",
function(object){
return this.h$.containsKey(object);
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return this.h$.elementCount;
});
Clazz_overrideMethod(c$,"clear",
function(){
this.h$.clear();
});
Clazz_overrideMethod(c$,"remove",
function(key){
if(this.h$.containsKey(key)){
this.h$.remove(key);
return true;
}return false;
},"~O");

Clazz_overrideMethod(c$,"get",
function(entry){
return entry.key;
},"java.util.MapEntry");

Clazz_overrideMethod(c$,"iterator",
function(){
return new java.util.HashtableIterator(this);
});
});

////////////////////////////

Clazz_load([],"java.util.HashtableValueCollection",[],function(){
c$=Clazz_decorateAsClass(function(){
Clazz_instantialize(this,arguments);
},java.util,"HashtableValueCollection",null,java.util.AbstractCollection);

Clazz_makeConstructor(c$,
function(a){
this.h$ = a;
},"java.util.Hashtable");
Clazz_overrideMethod(c$,"contains",
function(object){
return this.h$.contains(object);
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return this.h$.elementCount;
});
Clazz_overrideMethod(c$,"clear",
function(){
this.h$.clear();
});

Clazz_overrideMethod(c$,"get",
function(entry){
return entry.value;
},"java.util.MapEntry");

Clazz_overrideMethod(c$,"iterator",
function(){
return new java.util.HashtableIterator(this);
});
});
////////////////////////////


Clazz_load(["java.util.MapEntry"],"java.util.HashtableEntry",[],function(){
c$=Clazz_decorateAsClass(function(){
this.next=null;
this.hashcode=0;
Clazz_instantialize(this,arguments);
},java.util,"HashtableEntry",java.util.MapEntry);
Clazz_overrideConstructor(c$,
function(a,b){
this.key = a;
this.value = b;
this.hashcode=a.hashCode();
});
Clazz_defineMethod(c$,"clone",
function(){
var a=Clazz_superCall(this,java.util.HashtableEntry,"clone",[]);
if(this.next!=null){
a.next=this.next.clone();
}
return a;
});
Clazz_overrideMethod(c$,"setValue",
function(a){
if(a==null){
throw new NullPointerException();
}var b=this.value;
this.value=a;
return b;
},"~O");
Clazz_defineMethod(c$,"getKeyHash",
function(){
return this.key.hashCode();
});
Clazz_defineMethod(c$,"equalsKey",
function(a,b){
return this.hashcode==(!a.hashCode || a.hashCode())&&this.key.equals(a);
},"~O,~N");
Clazz_overrideMethod(c$,"toString",
function(){
return this.key+"="+this.value;
});
});



////////////////////////////


Clazz_load(["java.util.Dictionary","$.Enumeration","$.HashtableEnumerator","$.Iterator","$.Map","$.MapEntry","$.NoSuchElementException"],"java.util.Hashtable",["java.lang.IllegalArgumentException","$.IllegalStateException","$.NullPointerException","$.StringBuilder","java.util.AbstractCollection","$.AbstractSet","$.Arrays","$.Collections","$.ConcurrentModificationException","java.util.MapEntry.Type","java.util.HashtableEntry"],function(){
c$=Clazz_decorateAsClass(function(){
this.elementCount=0;
this.elementData=null;
this.loadFactor=0;
this.threshold=0;
this.firstSlot=0;
this.lastSlot=-1;
this.modCount=0;
Clazz_instantialize(this,arguments);
},java.util,"Hashtable",java.util.Dictionary,[java.util.Map,Cloneable,java.io.Serializable]);	
c$.newEntry=Clazz_defineMethod(c$,"newEntry",
($fz=function(key,value,hash){
return new java.util.HashtableEntry(key,value);
},$fz.isPrivate=true,$fz),"~O,~O,~N");
Clazz_overrideConstructor(c$,
function(){
this.elementCount=0;
this.elementData=this.newElementArray(11);
this.firstSlot=this.elementData.length;
this.loadFactor=0.75;
this.computeMaxSize();
});
Clazz_defineMethod(c$,"newElementArray",
($fz=function(size){
return new Array(size);
},$fz.isPrivate=true,$fz),"~N");
Clazz_overrideMethod(c$,"clear",
function(){
this.elementCount=0;
for (var i = this.elementData.length; --i >= 0;)
	  this.elementData[i] = null;
this.modCount++;
});
Clazz_defineMethod(c$,"clone",
function(){
try{
var hashtable=Clazz_superCall(this,java.util.Hashtable,"clone",[]);
hashtable.elementData=this.elementData.clone();
var entry;
for(var i=this.elementData.length;--i>=0;){
if((entry=this.elementData[i])){
hashtable.elementData[i]=entry.clone();
}}
return hashtable;
}catch(e){
if(Clazz_instanceOf(e,CloneNotSupportedException)){
return null;
}else{
throw e;
}
}
});
Clazz_defineMethod(c$,"computeMaxSize",
($fz=function(){
this.threshold=Math.round((this.elementData.length*this.loadFactor));
},$fz.isPrivate=true,$fz));
Clazz_defineMethod(c$,"contains",
function(value){
if(value==null){
throw new NullPointerException();
}for(var i=this.elementData.length;--i>=0;){
var entry=this.elementData[i];
while(entry){
if(value.equals(entry.value)){
return true;
}entry=entry.next;
}
}
return false;
},"~O");
Clazz_overrideMethod(c$,"containsKey",
function(key){
	if(!key.hashCode)  {
	  key.hashCode = function(){return 1};
	  if (!key.equals)
	  	key.equals = function(a) {return this == a};
	}
return this.getEntry(key)!=null	;
},"~O");
Clazz_overrideMethod(c$,"containsValue",
function(value){
return this.contains(value);
},"~O");
Clazz_overrideMethod(c$,"elements",
function(){
if(this.elementCount==0){
return java.util.Hashtable.EMPTY_ENUMERATION;
}
return new java.util.HashtableEnumerator(false, this);
});
Clazz_overrideMethod(c$,"entrySet",
function(){
return new java.util.HashtableEntrySet(this);
});
Clazz_overrideMethod(c$,"equals",
function(object){
if(this===object){
return true;
}if(Clazz_instanceOf(object,java.util.Map)){
var map=object;
if(this.size()!=map.size()){
return false;
}var entries=this.entrySet();
for(var e,$e=map.entrySet().iterator();$e.hasNext()&&((e=$e.next())||true);){
if(!entries.contains(e)){
return false;
}}
return true;
}return false;
},"~O");
Clazz_overrideMethod(c$,"get",
function(key){
	if(!key.hashCode) { 
	  key.hashCode = function(){return 1};
  	if (!key.equals)
  		key.equals = function(a) {return this == a};
	}
var hash=key.hashCode();
var index=(hash&0x7FFFFFFF)%this.elementData.length;
var entry=this.elementData[index];
while(entry){
if(entry.equalsKey(key,hash)){
return entry.value;
}entry=entry.next;
}
return null;
},"~O");
Clazz_defineMethod(c$,"getEntry",
function(key){
var hash=key.hashCode();
var index=(hash&0x7FFFFFFF)%this.elementData.length;
var entry=this.elementData[index];
while(entry){
if(entry.equalsKey(key,hash)){
return entry;
}entry=entry.next;
}
return null;
},"~O");
Clazz_overrideMethod(c$,"hashCode",
function(){
var result=0;
var it=this.entrySet().iterator();
while(it.hasNext()){
var entry=it.next();
var key=entry.getKey();
var value=entry.getValue();
var hash=(key!==this?key.hashCode():0)^(value!==this?(value!=null?value.hashCode():0):0);
result+=hash;
}
return result;
});
Clazz_overrideMethod(c$,"isEmpty",
function(){
return this.elementCount==0;
});
Clazz_overrideMethod(c$,"keys",
function(){
if(this.elementCount==0){
return java.util.Hashtable.EMPTY_ENUMERATION;
}
return new java.util.HashtableEnumerator(true, this); 
});
Clazz_overrideMethod(c$,"keySet",
function(){
return new java.util.HashtableKeySet(this);
});
Clazz_overrideMethod(c$,"put",
function(key,value){
if(key!=null&&value!=null){
	if(!key.hashCode)  {
	  key.hashCode = function(){return 1};
	  if (!key.equals)
	  	key.equals = function(a) {return this == a};
	}
	var hash=key.hashCode();
	var index=(hash&0x7FFFFFFF)%this.elementData.length;
	var entry=this.elementData[index];
	while(entry!=null&&!entry.equalsKey(key,hash)){
	entry=entry.next;
}
if(entry==null){
this.modCount++;
if(++this.elementCount>this.threshold){
this.rehash();
index=(hash&0x7FFFFFFF)%this.elementData.length;
}if(index<this.firstSlot){
this.firstSlot=index;
}if(index>this.lastSlot){
this.lastSlot=index;
}

entry=java.util.Hashtable.newEntry(key,value,hash);
entry.next=this.elementData[index];
this.elementData[index]=entry;
return null;
}var result=entry.value;
entry.value=value;
return result;
}throw new NullPointerException();
},"~O,~O");
Clazz_overrideMethod(c$,"putAll",
function(map){
for(var entry,$entry=map.entrySet().iterator();$entry.hasNext()&&((entry=$entry.next())||true);){
this.put(entry.getKey(),entry.getValue());
}
},"java.util.Map");

Clazz_defineMethod(c$,"rehash",
function(){
var length=(this.elementData.length<<1)+1;
if(length==0){
length=1;
}var newFirst=length;
var newLast=-1;
var newData=this.newElementArray(length);
for(var i=this.lastSlot+1;--i>=this.firstSlot;){
var entry=this.elementData[i];
while(entry!=null){
var index=(entry.getKeyHash()&0x7FFFFFFF)%length;
if(index<newFirst){
newFirst=index;
}if(index>newLast){
newLast=index;
}var next=entry.next;
entry.next=newData[index];
newData[index]=entry;
entry=next;
}
}
this.firstSlot=newFirst;
this.lastSlot=newLast;
this.elementData=newData;
this.computeMaxSize();
});
Clazz_overrideMethod(c$,"remove",
function(key){
var hash=key.hashCode();
var index=(hash&0x7FFFFFFF)%this.elementData.length;
var last=null;
var entry=this.elementData[index];
while(entry!=null&&!entry.equalsKey(key,hash)){
last=entry;
entry=entry.next;
}
if(entry!=null){
this.modCount++;
if(last==null){
this.elementData[index]=entry.next;
}else{
last.next=entry.next;
}this.elementCount--;
var result=entry.value;
entry.value=null;
return result;
}return null;
},"~O");
Clazz_overrideMethod(c$,"size",
function(){
return this.elementCount;
});
Clazz_overrideMethod(c$,"toString",
function(){
if(this.isEmpty()){
return"{}";
}var buffer=new StringBuilder(this.size()*28);
buffer.append('{');
for(var i=this.lastSlot;i>=this.firstSlot;i--){
var entry=this.elementData[i];
while(entry!=null){
if(entry.key!==this){
buffer.append(entry.key);
}else{
buffer.append("(this Map)");
}buffer.append('=');
if(entry.value!==this){
buffer.append(entry.value);
}else{
buffer.append("(this Map)");
}buffer.append(", ");
entry=entry.next;
}
}
if(this.elementCount>0){
buffer.setLength(buffer.length()-2);
}buffer.append('}');
return buffer.toString();
});
Clazz_overrideMethod(c$,"values",
function(){
return new java.util.HashtableValueCollection(this);
});
java.util.Hashtable.EMPTY_ENUMERATION = new java.util.HashtableEnumerator();
});
Clazz_load(["java.util.Map"],"java.util.MapEntry",null,function(){
c$=Clazz_decorateAsClass(function(){
this.key=null;
this.value=null;
Clazz_instantialize(this,arguments);
},java.util,"MapEntry",null,[java.util.Map.Entry,Cloneable]);
Clazz_makeConstructor(c$,
function(theKey){
this.key=theKey;
},"~O");
Clazz_makeConstructor(c$,
function(theKey,theValue){
this.key=theKey;
this.value=theValue;
},"~O,~O");
Clazz_defineMethod(c$,"clone",
function(){
try{
return Clazz_superCall(this,java.util.MapEntry,"clone",[]);
}catch(e){
if(Clazz_instanceOf(e,CloneNotSupportedException)){
return null;
}else{
throw e;
}
}
});
Clazz_overrideMethod(c$,"equals",
function(object){
if(this===object){
return true;
}if(Clazz_instanceOf(object,java.util.Map.Entry)){
var entry=object;
return(this.key==null?entry.getKey()==null:this.key.equals(entry.getKey()))&&(this.value==null?entry.getValue()==null:this.value.equals(entry.getValue()));
}return false;
},"~O");
Clazz_overrideMethod(c$,"getKey",
function(){
return this.key;
});
Clazz_overrideMethod(c$,"getValue",
function(){
return this.value;
});
Clazz_overrideMethod(c$,"hashCode",
function(){
return(this.key==null?0:this.key.hashCode())^(this.value==null?0:this.value.hashCode());
});
Clazz_overrideMethod(c$,"setValue",
function(object){
var result=this.value;
this.value=object;
return result;
},"~O");
Clazz_overrideMethod(c$,"toString",
function(){
return this.key+"="+this.value;
});
Clazz_declareInterface(java.util.MapEntry,"Type");
});
Clazz_load(["java.util.Hashtable"],"java.util.Properties",["java.lang.NullPointerException","$.StringBuffer"],function(){
c$=Clazz_decorateAsClass(function(){
this.builder=null;
this.defaults=null;
Clazz_instantialize(this,arguments);
},java.util,"Properties",java.util.Hashtable);

Clazz_makeConstructor(c$,
function(properties){
Clazz_superConstructor(this,java.util.Properties,[]);
this.defaults=properties;
},"java.util.Properties");
Clazz_defineMethod(c$,"dumpString",
($fz=function(buffer,string,key){
var i=0;
if(!key&&i<string.length&&(string.charAt(i)).charCodeAt(0)==(' ').charCodeAt(0)){
buffer.append("\\ ");
i++;
}for(;i<string.length;i++){
var ch=string.charAt(i);
switch(ch){
case'\t':
buffer.append("\\t");
break;
case'\n':
buffer.append("\\n");
break;
case'\f':
buffer.append("\\f");
break;
case'\r':
buffer.append("\\r");
break;
default:
if("\\#!=:".indexOf(ch)>=0||(key&&(ch).charCodeAt(0)==(' ').charCodeAt(0))){
buffer.append('\\');
}if((ch).charCodeAt(0)>=(' ').charCodeAt (0) && (ch).charCodeAt (0) <= ('~').charCodeAt(0)){
buffer.append(ch);
}else{
var hex=Integer.toHexString(ch.charCodeAt(0));
buffer.append("\\u");
for(var j=0;j<4-hex.length;j++){
buffer.append("0");
}
buffer.append(hex);
}}
}
},$fz.isPrivate=true,$fz),"StringBuilder,~S,~B");
Clazz_defineMethod(c$,"getProperty",
function(name){
var result=this.get(name);
var property=Clazz_instanceOf(result,String)?result:null;
if(property==null&&this.defaults!=null){
property=this.defaults.getProperty(name);
}return property;
},"~S");
Clazz_defineMethod(c$,"getProperty",
function(name,defaultValue){
var result=this.get(name);
var property=Clazz_instanceOf(result,String)?result:null;
if(property==null&&this.defaults!=null){
property=this.defaults.getProperty(name);
}if(property==null){
return defaultValue;
}return property;
},"~S,~S");
Clazz_defineMethod(c$,"list",
function(out){
if(out==null){
throw new NullPointerException();
}var buffer=new StringBuffer(80);
var keys=this.propertyNames();
while(keys.hasMoreElements()){
var key=keys.nextElement();
buffer.append(key);
buffer.append('=');
var property=this.get(key);
var def=this.defaults;
while(property==null){
property=def.get(key);
def=def.defaults;
}
if(property.length>40){
buffer.append(property.substring(0,37));
buffer.append("...");
}else{
buffer.append(property);
}out.println(buffer.toString());
buffer.setLength(0);
}
},"java.io.PrintStream");
Clazz_defineMethod(c$,"list",
function(writer){
if(writer==null){
throw new NullPointerException();
}var buffer=new StringBuffer(80);
var keys=this.propertyNames();
while(keys.hasMoreElements()){
var key=keys.nextElement();
buffer.append(key);
buffer.append('=');
var property=this.get(key);
var def=this.defaults;
while(property==null){
property=def.get(key);
def=def.defaults;
}
if(property.length>40){
buffer.append(property.substring(0,37));
buffer.append("...");
}else{
buffer.append(property);
}writer.println(buffer.toString());
buffer.setLength(0);
}
},"java.io.PrintWriter");
Clazz_defineMethod(c$,"load",
function($in){

},"java.io.InputStream");
Clazz_defineMethod(c$,"propertyNames",
function(){
if(this.defaults==null){
return this.keys();
}var set=new java.util.Hashtable(this.defaults.size()+this.size());
var keys=this.defaults.propertyNames();
while(keys.hasMoreElements()){
set.put(keys.nextElement(),set);
}
keys=this.keys();
while(keys.hasMoreElements()){
set.put(keys.nextElement(),set);
}
return set.keys();
});
Clazz_defineMethod(c$,"save",
function(out,comment){
try{
this.store(out,comment);
}catch(e){
if(Clazz_instanceOf(e,java.io.IOException)){
}else{
throw e;
}
}
},"java.io.OutputStream,~S");
Clazz_defineMethod(c$,"setProperty",
function(name,value){
return this.put(name,value);
},"~S,~S");
Clazz_defineMethod(c$,"store",
function(out,comment){

},"java.io.OutputStream,~S");
Clazz_defineMethod(c$,"loadFromXML",
function($in){

},"java.io.InputStream");
Clazz_defineMethod(c$,"storeToXML",
function(os,comment){

},"java.io.OutputStream,~S");
Clazz_defineMethod(c$,"storeToXML",
function(os,comment,encoding){

},"java.io.OutputStream,~S,~S");
Clazz_defineMethod(c$,"substitutePredefinedEntries",
($fz=function(s){
return s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll("\u0027","&apos;").replaceAll("\"","&quot;");
},$fz.isPrivate=true,$fz),"~S");
Clazz_defineStatics(c$,
"PROP_DTD_NAME","http://java.sun.com/dtd/properties.dtd",
"PROP_DTD","<?xml version=\"1.0\" encoding=\"UTF-8\"?>    <!ELEMENT properties (comment?, entry*) >    <!ATTLIST properties version CDATA #FIXED \"1.0\" >    <!ELEMENT comment (#PCDATA) >    <!ELEMENT entry (#PCDATA) >    <!ATTLIST entry key CDATA #REQUIRED >",
"NONE",0,
"SLASH",1,
"UNICODE",2,
"CONTINUE",3,
"KEY_DONE",4,
"IGNORE",5,
"lineSeparator",null);

});
Clazz_load(null,"java.util.Random",["java.lang.IllegalArgumentException"],function(){
c$=Clazz_decorateAsClass(function(){
this.haveNextNextGaussian=false;
this.seed=0;
this.nextNextGaussian=0;
Clazz_instantialize(this,arguments);
},java.util,"Random",null,java.io.Serializable);
Clazz_makeConstructor(c$,
function(){
this.setSeed(System.currentTimeMillis());
});
Clazz_makeConstructor(c$,
function(seed){
this.setSeed(seed);
},"~N");
Clazz_defineMethod(c$,"next",
function(bits){
this.seed=(this.seed*25214903917+0xb)&(281474976710655);
return(this.seed>>>(48-bits));
},"~N");
Clazz_defineMethod(c$,"nextBoolean",
function(){
return Math.random()>0.5;
});
Clazz_defineMethod(c$,"nextBytes",
function(buf){
for(var i=0;i<bytes.length;i++){
bytes[i]=Math.round(0x100*Math.random());
}
},"~A");
Clazz_defineMethod(c$,"nextDouble",
function(){
return Math.random();
});
Clazz_defineMethod(c$,"nextFloat",
function(){
return Math.random();
});
Clazz_defineMethod(c$,"nextGaussian",
function(){
if(this.haveNextNextGaussian){
this.haveNextNextGaussian=false;
return this.nextNextGaussian;
}var v1;
var v2;
var s;
do{
v1=2*this.nextDouble()-1;
v2=2*this.nextDouble()-1;
s=v1*v1+v2*v2;
}while(s>=1);
var norm=Math.sqrt(-2*Math.log(s)/s);
this.nextNextGaussian=v2*norm;
this.haveNextNextGaussian=true;
return v1*norm;
});
Clazz_defineMethod(c$,"nextInt",
function(){
return Math.ceil(0xffff*Math.random())-0x8000;
});
Clazz_defineMethod(c$,"nextInt",
function(n){
if(n>0){
if((n&-n)==n){
return((n*this.next(31))>>31);
}var bits;
var val;
do{
bits=this.next(31);
val=bits%n;
}while(bits-val+(n-1)<0);
return val;
}throw new IllegalArgumentException();
},"~N");
Clazz_defineMethod(c$,"nextLong",
function(){
return Math.ceil(0xffffffff*Math.random())-0x80000000;
});
Clazz_defineMethod(c$,"setSeed",
function(seed){
this.seed=(seed^25214903917)&(281474976710655);
this.haveNextNextGaussian=false;
},"~N");
Clazz_defineStatics(c$,
"multiplier",0x5deece66d);
});
Clazz_load(["java.util.Map"],"java.util.SortedMap",null,function(){
Clazz_declareInterface(java.util,"SortedMap",java.util.Map);
});
Clazz_load(["java.util.Set"],"java.util.SortedSet",null,function(){
Clazz_declareInterface(java.util,"SortedSet",java.util.Set);
});
Clazz_load(["java.util.Enumeration"],"java.util.StringTokenizer",["java.lang.NullPointerException","java.util.NoSuchElementException"],function(){
c$=Clazz_decorateAsClass(function(){
this.string=null;
this.delimiters=null;
this.returnDelimiters=false;
this.position=0;
Clazz_instantialize(this,arguments);
},java.util,"StringTokenizer",null,java.util.Enumeration);
Clazz_makeConstructor(c$,
function(string){
this.construct(string," \t\n\r\f",false);
},"~S");
Clazz_makeConstructor(c$,
function(string,delimiters){
this.construct(string,delimiters,false);
},"~S,~S");
Clazz_makeConstructor(c$,
function(string,delimiters,returnDelimiters){
if(string!=null){
this.string=string;
this.delimiters=delimiters;
this.returnDelimiters=returnDelimiters;
this.position=0;
}else throw new NullPointerException();
},"~S,~S,~B");
Clazz_defineMethod(c$,"countTokens",
function(){
var count=0;
var inToken=false;
for(var i=this.position,length=this.string.length;i<length;i++){
if(this.delimiters.indexOf(this.string.charAt(i),0)>=0){
if(this.returnDelimiters)count++;
if(inToken){
count++;
inToken=false;
}}else{
inToken=true;
}}
if(inToken)count++;
return count;
});
Clazz_overrideMethod(c$,"hasMoreElements",
function(){
return this.hasMoreTokens();
});
Clazz_defineMethod(c$,"hasMoreTokens",
function(){
var length=this.string.length;
if(this.position<length){
if(this.returnDelimiters)return true;
for(var i=this.position;i<length;i++)if(this.delimiters.indexOf(this.string.charAt(i),0)==-1)return true;

}return false;
});
Clazz_overrideMethod(c$,"nextElement",
function(){
return this.nextToken();
});
Clazz_defineMethod(c$,"nextToken",
function(){
var i=this.position;
var length=this.string.length;
if(i<length){
if(this.returnDelimiters){
if(this.delimiters.indexOf(this.string.charAt(this.position),0)>=0)return String.valueOf(this.string.charAt(this.position++));
for(this.position++;this.position<length;this.position++)if(this.delimiters.indexOf(this.string.charAt(this.position),0)>=0)return this.string.substring(i,this.position);

return this.string.substring(i);
}while(i<length&&this.delimiters.indexOf(this.string.charAt(i),0)>=0)i++;

this.position=i;
if(i<length){
for(this.position++;this.position<length;this.position++)if(this.delimiters.indexOf(this.string.charAt(this.position),0)>=0)return this.string.substring(i,this.position);

return this.string.substring(i);
}}throw new java.util.NoSuchElementException();
});
Clazz_defineMethod(c$,"nextToken",
function(delims){
this.delimiters=delims;
return this.nextToken();
},"~S");
});
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "BytePoster");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "EventManager");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "FontManager");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "GenericColor");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "GenericFileInterface");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "GenericMenuInterface");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "GenericMouseInterface");
Clazz_declarePackage ("javajs.api");
Clazz_load (["javajs.api.FontManager"], "javajs.api.GenericPlatform", null, function () {
c$ = Clazz_declareInterface (javajs.api, "GenericPlatform", javajs.api.FontManager);
Clazz_defineStatics (c$,
"CURSOR_DEFAULT", 0,
"CURSOR_CROSSHAIR", 1,
"CURSOR_WAIT", 3,
"CURSOR_ZOOM", 8,
"CURSOR_HAND", 12,
"CURSOR_MOVE", 13);
});
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "JSInterface");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "JSONEncodable");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "PlatformViewer");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "ZInputStream");
Clazz_declarePackage ("javajs.awt");
Clazz_load (["javajs.api.GenericColor"], "javajs.awt.Color", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.argb = 0;
Clazz_instantialize (this, arguments);
}, javajs.awt, "Color", null, javajs.api.GenericColor);
Clazz_overrideMethod (c$, "getRGB", 
function () {
return this.argb & 0x00FFFFFF;
});
Clazz_overrideMethod (c$, "getOpacity255", 
function () {
return ((this.argb >> 24) & 0xFF);
});
Clazz_overrideMethod (c$, "setOpacity255", 
function (a) {
this.argb = this.argb & 0xFFFFFF | ((a & 0xFF) << 24);
}, "~N");
c$.get1 = Clazz_defineMethod (c$, "get1", 
function (rgb) {
var c =  new javajs.awt.Color ();
c.argb = rgb | 0xFF000000;
return c;
}, "~N");
c$.get3 = Clazz_defineMethod (c$, "get3", 
function (r, g, b) {
return  new javajs.awt.Color ().set4 (r, g, b, 0xFF);
}, "~N,~N,~N");
c$.get4 = Clazz_defineMethod (c$, "get4", 
function (r, g, b, a) {
return  new javajs.awt.Color ().set4 (r, g, b, a);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "set4", 
 function (r, g, b, a) {
this.argb = ((a << 24) | (r << 16) | (g << 8) | b) & 0xFFFFFFFF;
return this;
}, "~N,~N,~N,~N");
Clazz_overrideMethod (c$, "toString", 
function () {
var s = ("00000000" + Integer.toHexString (this.argb));
return "[0x" + s.substring (s.length - 8, s.length) + "]";
});
});
Clazz_declarePackage ("javajs.awt");
c$ = Clazz_decorateAsClass (function () {
this.width = 0;
this.height = 0;
Clazz_instantialize (this, arguments);
}, javajs.awt, "Dimension");
Clazz_makeConstructor (c$, 
function (w, h) {
this.set (w, h);
}, "~N,~N");
Clazz_defineMethod (c$, "set", 
function (w, h) {
this.width = w;
this.height = h;
return this;
}, "~N,~N");
Clazz_declarePackage ("javajs.awt.event");
c$ = Clazz_decorateAsClass (function () {
this.source = null;
Clazz_instantialize (this, arguments);
}, javajs.awt.event, "Event");
Clazz_defineMethod (c$, "getSource", 
function () {
return this.source;
});
Clazz_defineStatics (c$,
"MOUSE_LEFT", 16,
"MOUSE_MIDDLE", 8,
"MOUSE_RIGHT", 4,
"MOUSE_WHEEL", 32,
"MAC_COMMAND", 20,
"BUTTON_MASK", 28,
"MOUSE_DOWN", 501,
"MOUSE_UP", 502,
"MOUSE_MOVE", 503,
"MOUSE_ENTER", 504,
"MOUSE_EXIT", 505,
"MOUSE_DRAG", 506,
"SHIFT_MASK", 1,
"ALT_MASK", 8,
"CTRL_MASK", 2,
"CTRL_ALT", 10,
"CTRL_SHIFT", 3,
"META_MASK", 4,
"VK_SHIFT", 16,
"VK_ALT", 18,
"VK_CONTROL", 17,
"VK_META", 157,
"VK_LEFT", 37,
"VK_RIGHT", 39,
"VK_PERIOD", 46,
"VK_SPACE", 32,
"VK_DOWN", 40,
"VK_UP", 38,
"VK_ESCAPE", 27,
"VK_DELETE", 127,
"VK_BACK_SPACE", 8,
"VK_PAGE_DOWN", 34,
"VK_PAGE_UP", 33,
"MOVED", 0,
"DRAGGED", 1,
"CLICKED", 2,
"WHEELED", 3,
"PRESSED", 4,
"RELEASED", 5);
Clazz_declarePackage ("javajs.awt");
Clazz_load (null, "javajs.awt.Font", ["JU.AU"], function () {
c$ = Clazz_decorateAsClass (function () {
this.fid = 0;
this.fontFace = null;
this.fontStyle = null;
this.fontSizeNominal = 0;
this.idFontFace = 0;
this.idFontStyle = 0;
this.fontSize = 0;
this.font = null;
this.fontMetrics = null;
this.manager = null;
this.ascent = 0;
this.descent = 0;
this.isBold = false;
this.isItalic = false;
Clazz_instantialize (this, arguments);
}, javajs.awt, "Font");
Clazz_makeConstructor (c$, 
 function (manager, fid, idFontFace, idFontStyle, fontSize, fontSizeNominal, graphics) {
this.manager = manager;
this.fid = fid;
this.fontFace = javajs.awt.Font.fontFaces[idFontFace];
this.fontStyle = javajs.awt.Font.fontStyles[idFontStyle];
this.idFontFace = idFontFace;
this.idFontStyle = idFontStyle;
this.fontSize = fontSize;
this.isBold = (idFontStyle & 1) == 1;
this.isItalic = (idFontStyle & 2) == 2;
this.fontSizeNominal = fontSizeNominal;
this.font = manager.newFont (javajs.awt.Font.fontFaces[idFontFace], this.isBold, this.isItalic, fontSize);
this.fontMetrics = manager.getFontMetrics (this, graphics);
this.descent = manager.getFontDescent (this.fontMetrics);
this.ascent = manager.getFontAscent (this.fontMetrics);
}, "javajs.api.FontManager,~N,~N,~N,~N,~N,~O");
c$.getFont3D = Clazz_defineMethod (c$, "getFont3D", 
function (fontID) {
return javajs.awt.Font.font3ds[fontID & 0xFF];
}, "~N");
c$.createFont3D = Clazz_defineMethod (c$, "createFont3D", 
function (fontface, fontstyle, fontsize, fontsizeNominal, manager, graphicsForMetrics) {
if (fontsize > 0xFF) fontsize = 0xFF;
var fontsizeX16 = (Clazz_floatToInt (fontsize)) << 4;
var fontkey = ((fontface & 3) | ((fontstyle & 3) << 2) | (fontsizeX16 << 4));
for (var i = javajs.awt.Font.fontkeyCount; --i > 0; ) if (fontkey == javajs.awt.Font.fontkeys[i] && javajs.awt.Font.font3ds[i].fontSizeNominal == fontsizeNominal) return javajs.awt.Font.font3ds[i];

var fontIndexNext = javajs.awt.Font.fontkeyCount++;
if (fontIndexNext == javajs.awt.Font.fontkeys.length) javajs.awt.Font.fontkeys = JU.AU.arrayCopyI (javajs.awt.Font.fontkeys, fontIndexNext + 8);
javajs.awt.Font.font3ds = JU.AU.arrayCopyObject (javajs.awt.Font.font3ds, fontIndexNext + 8);
var font3d =  new javajs.awt.Font (manager, fontIndexNext, fontface, fontstyle, fontsize, fontsizeNominal, graphicsForMetrics);
javajs.awt.Font.font3ds[fontIndexNext] = font3d;
javajs.awt.Font.fontkeys[fontIndexNext] = fontkey;
return font3d;
}, "~N,~N,~N,~N,javajs.api.FontManager,~O");
c$.getFontFaceID = Clazz_defineMethod (c$, "getFontFaceID", 
function (fontface) {
return ("Monospaced".equalsIgnoreCase (fontface) ? 2 : "Serif".equalsIgnoreCase (fontface) ? 1 : 0);
}, "~S");
c$.getFontStyleID = Clazz_defineMethod (c$, "getFontStyleID", 
function (fontstyle) {
for (var i = 4; --i >= 0; ) if (javajs.awt.Font.fontStyles[i].equalsIgnoreCase (fontstyle)) return i;

return -1;
}, "~S");
Clazz_defineMethod (c$, "getAscent", 
function () {
return this.ascent;
});
Clazz_defineMethod (c$, "getDescent", 
function () {
return this.descent;
});
Clazz_defineMethod (c$, "getHeight", 
function () {
return this.getAscent () + this.getDescent ();
});
Clazz_defineMethod (c$, "getFontMetrics", 
function () {
return this.fontMetrics;
});
Clazz_defineMethod (c$, "stringWidth", 
function (text) {
return this.manager.fontStringWidth (this, text);
}, "~S");
Clazz_defineMethod (c$, "getInfo", 
function () {
return this.fontSizeNominal + " " + this.fontFace + " " + this.fontStyle;
});
Clazz_defineStatics (c$,
"FONT_ALLOCATION_UNIT", 8,
"fontkeyCount", 1,
"fontkeys",  Clazz_newIntArray (8, 0));
c$.font3ds = c$.prototype.font3ds =  new Array (8);
Clazz_defineStatics (c$,
"FONT_FACE_SANS", 0,
"FONT_FACE_SERIF", 1,
"FONT_FACE_MONO", 2,
"fontFaces", ["SansSerif", "Serif", "Monospaced", ""],
"FONT_STYLE_PLAIN", 0,
"FONT_STYLE_BOLD", 1,
"FONT_STYLE_ITALIC", 2,
"FONT_STYLE_BOLDITALIC", 3,
"fontStyles", ["Plain", "Bold", "Italic", "BoldItalic"]);
});
Clazz_declarePackage ("JU");
Clazz_load (["javajs.api.JSONEncodable"], "JU.A4", ["JU.T3"], function () {
c$ = Clazz_decorateAsClass (function () {
this.x = 0;
this.y = 0;
this.z = 0;
this.angle = 0;
Clazz_instantialize (this, arguments);
}, JU, "A4", null, [javajs.api.JSONEncodable, java.io.Serializable]);
Clazz_makeConstructor (c$, 
function () {
this.z = 1.0;
});
c$.new4 = Clazz_defineMethod (c$, "new4", 
function (x, y, z, angle) {
var a =  new JU.A4 ();
a.set4 (x, y, z, angle);
return a;
}, "~N,~N,~N,~N");
c$.newAA = Clazz_defineMethod (c$, "newAA", 
function (a1) {
var a =  new JU.A4 ();
a.set4 (a1.x, a1.y, a1.z, a1.angle);
return a;
}, "JU.A4");
c$.newVA = Clazz_defineMethod (c$, "newVA", 
function (axis, angle) {
var a =  new JU.A4 ();
a.setVA (axis, angle);
return a;
}, "JU.V3,~N");
Clazz_defineMethod (c$, "setVA", 
function (axis, angle) {
this.x = axis.x;
this.y = axis.y;
this.z = axis.z;
this.angle = angle;
}, "JU.V3,~N");
Clazz_defineMethod (c$, "set4", 
function (x, y, z, angle) {
this.x = x;
this.y = y;
this.z = z;
this.angle = angle;
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "setAA", 
function (a) {
this.x = a.x;
this.y = a.y;
this.z = a.z;
this.angle = a.angle;
}, "JU.A4");
Clazz_defineMethod (c$, "setM", 
function (m1) {
this.setFromMat (m1.m00, m1.m01, m1.m02, m1.m10, m1.m11, m1.m12, m1.m20, m1.m21, m1.m22);
}, "JU.M3");
Clazz_defineMethod (c$, "setFromMat", 
 function (m00, m01, m02, m10, m11, m12, m20, m21, m22) {
var cos = (m00 + m11 + m22 - 1.0) * 0.5;
this.x = (m21 - m12);
this.y = (m02 - m20);
this.z = (m10 - m01);
var sin = 0.5 * Math.sqrt (this.x * this.x + this.y * this.y + this.z * this.z);
this.angle = Math.atan2 (sin, cos);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "hashCode", 
function () {
return JU.T3.floatToIntBits0 (this.x) ^ JU.T3.floatToIntBits0 (this.y) ^ JU.T3.floatToIntBits0 (this.z) ^ JU.T3.floatToIntBits0 (this.angle);
});
Clazz_overrideMethod (c$, "equals", 
function (o) {
if (!(Clazz_instanceOf (o, JU.A4))) return false;
var a1 = o;
return this.x == a1.x && this.y == a1.y && this.z == a1.z && this.angle == a1.angle;
}, "~O");
Clazz_overrideMethod (c$, "toString", 
function () {
return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.angle + ")";
});
Clazz_overrideMethod (c$, "toJSON", 
function () {
return "[" + this.x + "," + this.y + "," + this.z + "," + (this.angle * 180.0 / 3.141592653589793) + "]";
});
});
Clazz_declarePackage ("JU");
Clazz_load (["java.net.URLConnection"], "JU.AjaxURLConnection", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.bytesOut = null;
this.postOut = "";
Clazz_instantialize (this, arguments);
}, JU, "AjaxURLConnection", java.net.URLConnection);
Clazz_defineMethod (c$, "doAjax", 
 function () {
{
return Jmol._doAjax(this.url, this.postOut, this.bytesOut);
}});
Clazz_overrideMethod (c$, "connect", 
function () {
});
Clazz_defineMethod (c$, "outputBytes", 
function (bytes) {
this.bytesOut = bytes;
}, "~A");
Clazz_defineMethod (c$, "outputString", 
function (post) {
this.postOut = post;
}, "~S");
Clazz_defineMethod (c$, "getContents", 
function () {
return this.doAjax ();
});
});
Clazz_declarePackage ("JU");
Clazz_load (["java.net.URLStreamHandler"], "JU.AjaxURLStreamHandler", ["JU.AjaxURLConnection", "$.SB"], function () {
c$ = Clazz_decorateAsClass (function () {
this.protocol = null;
Clazz_instantialize (this, arguments);
}, JU, "AjaxURLStreamHandler", java.net.URLStreamHandler);
Clazz_makeConstructor (c$, 
function (protocol) {
Clazz_superConstructor (this, JU.AjaxURLStreamHandler, []);
this.protocol = protocol;
}, "~S");
Clazz_overrideMethod (c$, "openConnection", 
function (url) {
return  new JU.AjaxURLConnection (url);
}, "java.net.URL");
Clazz_overrideMethod (c$, "toExternalForm", 
function (u) {
var result =  new JU.SB ();
result.append (u.getProtocol ());
result.append (":");
if (u.getAuthority () != null && u.getAuthority ().length > 0) {
result.append ("//");
result.append (u.getAuthority ());
}if (u.getPath () != null) {
result.append (u.getPath ());
}if (u.getQuery () != null) {
result.append ("?");
result.append (u.getQuery ());
}if (u.getRef () != null) {
result.append ("#");
result.append (u.getRef ());
}return result.toString ();
}, "java.net.URL");
});
Clazz_declarePackage ("JU");
Clazz_load (["java.net.URLStreamHandlerFactory", "java.util.Hashtable"], "JU.AjaxURLStreamHandlerFactory", ["JU.AjaxURLStreamHandler"], function () {
c$ = Clazz_decorateAsClass (function () {
this.htFactories = null;
Clazz_instantialize (this, arguments);
}, JU, "AjaxURLStreamHandlerFactory", null, java.net.URLStreamHandlerFactory);
Clazz_prepareFields (c$, function () {
this.htFactories =  new java.util.Hashtable ();
});
Clazz_overrideMethod (c$, "createURLStreamHandler", 
function (protocol) {
var fac = this.htFactories.get (protocol);
if (fac == null) this.htFactories.put (protocol, fac =  new JU.AjaxURLStreamHandler (protocol));
return (fac.protocol == null ? null : fac);
}, "~S");
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.AU", ["java.util.Arrays", "JU.Lst"], function () {
c$ = Clazz_declareType (JU, "AU");
c$.ensureLength = Clazz_defineMethod (c$, "ensureLength", 
function (array, minimumLength) {
if (array != null && JU.AU.getLength (array) >= minimumLength) return array;
return JU.AU.arrayCopyObject (array, minimumLength);
}, "~O,~N");
c$.ensureLengthS = Clazz_defineMethod (c$, "ensureLengthS", 
function (array, minimumLength) {
if (array != null && array.length >= minimumLength) return array;
return JU.AU.arrayCopyS (array, minimumLength);
}, "~A,~N");
c$.ensureLengthA = Clazz_defineMethod (c$, "ensureLengthA", 
function (array, minimumLength) {
if (array != null && array.length >= minimumLength) return array;
return JU.AU.arrayCopyF (array, minimumLength);
}, "~A,~N");
c$.ensureLengthI = Clazz_defineMethod (c$, "ensureLengthI", 
function (array, minimumLength) {
if (array != null && array.length >= minimumLength) return array;
return JU.AU.arrayCopyI (array, minimumLength);
}, "~A,~N");
c$.ensureLengthShort = Clazz_defineMethod (c$, "ensureLengthShort", 
function (array, minimumLength) {
if (array != null && array.length >= minimumLength) return array;
return JU.AU.arrayCopyShort (array, minimumLength);
}, "~A,~N");
c$.ensureLengthByte = Clazz_defineMethod (c$, "ensureLengthByte", 
function (array, minimumLength) {
if (array != null && array.length >= minimumLength) return array;
return JU.AU.arrayCopyByte (array, minimumLength);
}, "~A,~N");
c$.doubleLength = Clazz_defineMethod (c$, "doubleLength", 
function (array) {
return JU.AU.arrayCopyObject (array, (array == null ? 16 : 2 * JU.AU.getLength (array)));
}, "~O");
c$.doubleLengthS = Clazz_defineMethod (c$, "doubleLengthS", 
function (array) {
return JU.AU.arrayCopyS (array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthF = Clazz_defineMethod (c$, "doubleLengthF", 
function (array) {
return JU.AU.arrayCopyF (array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthI = Clazz_defineMethod (c$, "doubleLengthI", 
function (array) {
return JU.AU.arrayCopyI (array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthShort = Clazz_defineMethod (c$, "doubleLengthShort", 
function (array) {
return JU.AU.arrayCopyShort (array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthByte = Clazz_defineMethod (c$, "doubleLengthByte", 
function (array) {
return JU.AU.arrayCopyByte (array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.doubleLengthBool = Clazz_defineMethod (c$, "doubleLengthBool", 
function (array) {
return JU.AU.arrayCopyBool (array, (array == null ? 16 : 2 * array.length));
}, "~A");
c$.deleteElements = Clazz_defineMethod (c$, "deleteElements", 
function (array, firstElement, nElements) {
if (nElements == 0 || array == null) return array;
var oldLength = JU.AU.getLength (array);
if (firstElement >= oldLength) return array;
var n = oldLength - (firstElement + nElements);
if (n < 0) n = 0;
var t = JU.AU.newInstanceO (array, firstElement + n);
if (firstElement > 0) System.arraycopy (array, 0, t, 0, firstElement);
if (n > 0) System.arraycopy (array, firstElement + nElements, t, firstElement, n);
return t;
}, "~O,~N,~N");
c$.arrayCopyObject = Clazz_defineMethod (c$, "arrayCopyObject", 
function (array, newLength) {
if (array == null) {
return null;
}var oldLength = JU.AU.getLength (array);
if (newLength == oldLength) return array;
var t = JU.AU.newInstanceO (array, newLength);
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
return t;
}, "~O,~N");
c$.newInstanceO = Clazz_defineMethod (c$, "newInstanceO", 
 function (array, n) {
{
return new Array(n);
}}, "~O,~N");
c$.getLength = Clazz_defineMethod (c$, "getLength", 
function (array) {
{
return array.length
}}, "~O");
c$.arrayCopyS = Clazz_defineMethod (c$, "arrayCopyS", 
function (array, newLength) {
if (newLength < 0) newLength = array.length;
var t =  new Array (newLength);
if (array != null) {
var oldLength = array.length;
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyII = Clazz_defineMethod (c$, "arrayCopyII", 
function (array, newLength) {
var t = JU.AU.newInt2 (newLength);
if (array != null) {
var oldLength = array.length;
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyPt = Clazz_defineMethod (c$, "arrayCopyPt", 
function (array, newLength) {
if (newLength < 0) newLength = array.length;
var t =  new Array (newLength);
if (array != null) {
var oldLength = array.length;
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyF = Clazz_defineMethod (c$, "arrayCopyF", 
function (array, newLength) {
if (newLength < 0) newLength = array.length;
var t =  Clazz_newFloatArray (newLength, 0);
if (array != null) {
var oldLength = array.length;
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyI = Clazz_defineMethod (c$, "arrayCopyI", 
function (array, newLength) {
if (newLength < 0) newLength = array.length;
var t =  Clazz_newIntArray (newLength, 0);
if (array != null) {
var oldLength = array.length;
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyRangeI = Clazz_defineMethod (c$, "arrayCopyRangeI", 
function (array, i0, n) {
if (array == null) return null;
var oldLength = array.length;
if (n == -1) n = oldLength;
if (n == -2) n = Clazz_doubleToInt (oldLength / 2);
n = n - i0;
var t =  Clazz_newIntArray (n, 0);
System.arraycopy (array, i0, t, 0, n);
return t;
}, "~A,~N,~N");
c$.arrayCopyRangeRevI = Clazz_defineMethod (c$, "arrayCopyRangeRevI", 
function (array, i0, n) {
if (array == null) return null;
var t = JU.AU.arrayCopyRangeI (array, i0, n);
if (n < 0) n = array.length;
for (var i = Clazz_doubleToInt (n / 2); --i >= 0; ) JU.AU.swapInt (t, i, n - 1 - i);

return t;
}, "~A,~N,~N");
c$.arrayCopyShort = Clazz_defineMethod (c$, "arrayCopyShort", 
function (array, newLength) {
if (newLength < 0) newLength = array.length;
var t =  Clazz_newShortArray (newLength, 0);
if (array != null) {
var oldLength = array.length;
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyByte = Clazz_defineMethod (c$, "arrayCopyByte", 
function (array, newLength) {
if (newLength < 0) newLength = array.length;
var t =  Clazz_newByteArray (newLength, 0);
if (array != null) {
var oldLength = array.length;
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.arrayCopyBool = Clazz_defineMethod (c$, "arrayCopyBool", 
function (array, newLength) {
if (newLength < 0) newLength = array.length;
var t =  Clazz_newBooleanArray (newLength, false);
if (array != null) {
var oldLength = array.length;
System.arraycopy (array, 0, t, 0, oldLength < newLength ? oldLength : newLength);
}return t;
}, "~A,~N");
c$.swapInt = Clazz_defineMethod (c$, "swapInt", 
function (array, indexA, indexB) {
var t = array[indexA];
array[indexA] = array[indexB];
array[indexB] = t;
}, "~A,~N,~N");
c$.dumpArray = Clazz_defineMethod (c$, "dumpArray", 
function (msg, A, x1, x2, y1, y2) {
var s = "dumpArray: " + msg + "\n";
for (var x = x1; x <= x2; x++) s += "\t*" + x + "*";

for (var y = y2; y >= y1; y--) {
s += "\n*" + y + "*";
for (var x = x1; x <= x2; x++) s += "\t" + (x < A.length && y < A[x].length ? A[x][y] : NaN);

}
return s;
}, "~S,~A,~N,~N,~N,~N");
c$.dumpIntArray = Clazz_defineMethod (c$, "dumpIntArray", 
function (A, n) {
var str = "";
for (var i = 0; i < n; i++) str += " " + A[i];

return str;
}, "~A,~N");
c$.sortedItem = Clazz_defineMethod (c$, "sortedItem", 
function (v, n) {
if (v.size () == 0) return null;
if (v.size () == 1) return v.get (0);
var keys = v.toArray ( new Array (v.size ()));
java.util.Arrays.sort (keys);
return keys[n % keys.length];
}, "JU.Lst,~N");
c$.createArrayOfArrayList = Clazz_defineMethod (c$, "createArrayOfArrayList", 
function (size) {
return  new Array (size);
}, "~N");
c$.createArrayOfHashtable = Clazz_defineMethod (c$, "createArrayOfHashtable", 
function (size) {
return  new Array (size);
}, "~N");
c$.swap = Clazz_defineMethod (c$, "swap", 
function (o, i, j) {
var oi = o[i];
o[i] = o[j];
o[j] = oi;
}, "~A,~N,~N");
c$.newFloat2 = Clazz_defineMethod (c$, "newFloat2", 
function (n) {
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newInt2 = Clazz_defineMethod (c$, "newInt2", 
function (n) {
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newInt3 = Clazz_defineMethod (c$, "newInt3", 
function (nx, ny) {
{
return Clazz_newArray(nx, null);
}}, "~N,~N");
c$.newFloat3 = Clazz_defineMethod (c$, "newFloat3", 
function (nx, ny) {
{
return Clazz_newArray(nx, null);
}}, "~N,~N");
c$.newInt4 = Clazz_defineMethod (c$, "newInt4", 
function (n) {
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newShort2 = Clazz_defineMethod (c$, "newShort2", 
function (n) {
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newByte2 = Clazz_defineMethod (c$, "newByte2", 
function (n) {
{
return Clazz_newArray(n, null);
}}, "~N");
c$.newDouble2 = Clazz_defineMethod (c$, "newDouble2", 
function (n) {
{
return Clazz_newArray(n, null);
}}, "~N");
c$.removeMapKeys = Clazz_defineMethod (c$, "removeMapKeys", 
function (map, root) {
var list =  new JU.Lst ();
for (var key, $key = map.keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) if (key.startsWith (root)) list.addLast (key);

for (var i = list.size (); --i >= 0; ) map.remove (list.get (i));

return list.size ();
}, "java.util.Map,~S");
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.Base64", ["JU.SB"], function () {
c$ = Clazz_declareType (JU, "Base64");
c$.getBytes64 = Clazz_defineMethod (c$, "getBytes64", 
function (bytes) {
return JU.Base64.getBase64 (bytes).toBytes (0, -1);
}, "~A");
c$.getBase64 = Clazz_defineMethod (c$, "getBase64", 
function (bytes) {
var nBytes = bytes.length;
var sout =  new JU.SB ();
if (nBytes == 0) return sout;
for (var i = 0, nPad = 0; i < nBytes && nPad == 0; ) {
if (i % 75 == 0 && i != 0) sout.append ("\r\n");
nPad = (i + 2 == nBytes ? 1 : i + 1 == nBytes ? 2 : 0);
var outbytes = ((bytes[i++] << 16) & 0xFF0000) | ((nPad == 2 ? 0 : bytes[i++] << 8) & 0x00FF00) | ((nPad >= 1 ? 0 : bytes[i++]) & 0x0000FF);
sout.appendC (JU.Base64.base64.charAt ((outbytes >> 18) & 0x3F));
sout.appendC (JU.Base64.base64.charAt ((outbytes >> 12) & 0x3F));
sout.appendC (nPad == 2 ? '=' : JU.Base64.base64.charAt ((outbytes >> 6) & 0x3F));
sout.appendC (nPad >= 1 ? '=' : JU.Base64.base64.charAt (outbytes & 0x3F));
}
return sout;
}, "~A");
c$.decodeBase64 = Clazz_defineMethod (c$, "decodeBase64", 
function (strBase64) {
var nBytes = 0;
var ch;
var pt0 = strBase64.indexOf (";base64,") + 1;
if (pt0 > 0) pt0 += 7;
var chars64 = strBase64.toCharArray ();
var len64 = chars64.length;
if (len64 == 0) return  Clazz_newByteArray (0, 0);
for (var i = len64; --i >= pt0; ) nBytes += ((ch = (chars64[i]).charCodeAt (0) & 0x7F) == 65 || JU.Base64.decode64[ch] > 0 ? 3 : 0);

nBytes = nBytes >> 2;
var bytes =  Clazz_newByteArray (nBytes, 0);
var offset = 18;
for (var i = pt0, pt = 0, b = 0; i < len64; i++) {
if (JU.Base64.decode64[ch = (chars64[i]).charCodeAt (0) & 0x7F] > 0 || ch == 65 || ch == 61) {
b |= JU.Base64.decode64[ch] << offset;
offset -= 6;
if (offset < 0) {
bytes[pt++] = ((b & 0xFF0000) >> 16);
if (pt < nBytes) bytes[pt++] = ((b & 0xFF00) >> 8);
if (pt < nBytes) bytes[pt++] = (b & 0xFF);
offset = 18;
b = 0;
}}}
return bytes;
}, "~S");
Clazz_defineStatics (c$,
"base64", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
"decode64", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 62, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 63, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0]);
});
Clazz_declarePackage ("JU");
Clazz_load (["javajs.api.JSONEncodable"], "JU.BS", ["java.lang.IndexOutOfBoundsException", "$.NegativeArraySizeException", "JU.PT", "$.SB"], function () {
c$ = Clazz_decorateAsClass (function () {
this.words = null;
this.wordsInUse = 0;
this.sizeIsSticky = false;
Clazz_instantialize (this, arguments);
}, JU, "BS", null, [Cloneable, javajs.api.JSONEncodable]);
c$.wordIndex = Clazz_defineMethod (c$, "wordIndex", 
 function (bitIndex) {
return bitIndex >> 5;
}, "~N");
Clazz_defineMethod (c$, "recalculateWordsInUse", 
 function () {
var i;
for (i = this.wordsInUse - 1; i >= 0; i--) if (this.words[i] != 0) break;

this.wordsInUse = i + 1;
});
Clazz_makeConstructor (c$, 
function () {
this.initWords (32);
this.sizeIsSticky = false;
});
c$.newN = Clazz_defineMethod (c$, "newN", 
function (nbits) {
var bs =  new JU.BS ();
bs.init (nbits);
return bs;
}, "~N");
Clazz_defineMethod (c$, "init", 
 function (nbits) {
if (nbits < 0) throw  new NegativeArraySizeException ("nbits < 0: " + nbits);
this.initWords (nbits);
this.sizeIsSticky = true;
}, "~N");
Clazz_defineMethod (c$, "initWords", 
 function (nbits) {
this.words =  Clazz_newIntArray (JU.BS.wordIndex (nbits - 1) + 1, 0);
}, "~N");
Clazz_defineMethod (c$, "ensureCapacity", 
 function (wordsRequired) {
if (this.words.length < wordsRequired) {
var request = Math.max (2 * this.words.length, wordsRequired);
this.setLength (request);
this.sizeIsSticky = false;
}}, "~N");
Clazz_defineMethod (c$, "expandTo", 
 function (wordIndex) {
var wordsRequired = wordIndex + 1;
if (this.wordsInUse < wordsRequired) {
this.ensureCapacity (wordsRequired);
this.wordsInUse = wordsRequired;
}}, "~N");
Clazz_defineMethod (c$, "set", 
function (bitIndex) {
if (bitIndex < 0) throw  new IndexOutOfBoundsException ("bitIndex < 0: " + bitIndex);
var wordIndex = JU.BS.wordIndex (bitIndex);
this.expandTo (wordIndex);
this.words[wordIndex] |= (1 << bitIndex);
}, "~N");
Clazz_defineMethod (c$, "setBitTo", 
function (bitIndex, value) {
if (value) this.set (bitIndex);
 else this.clear (bitIndex);
}, "~N,~B");
Clazz_defineMethod (c$, "setBits", 
function (fromIndex, toIndex) {
if (fromIndex == toIndex) return;
var startWordIndex = JU.BS.wordIndex (fromIndex);
var endWordIndex = JU.BS.wordIndex (toIndex - 1);
this.expandTo (endWordIndex);
var firstWordMask = -1 << fromIndex;
var lastWordMask = -1 >>> -toIndex;
if (startWordIndex == endWordIndex) {
this.words[startWordIndex] |= (firstWordMask & lastWordMask);
} else {
this.words[startWordIndex] |= firstWordMask;
for (var i = startWordIndex + 1; i < endWordIndex; i++) this.words[i] = -1;

this.words[endWordIndex] |= lastWordMask;
}}, "~N,~N");
Clazz_defineMethod (c$, "clear", 
function (bitIndex) {
if (bitIndex < 0) throw  new IndexOutOfBoundsException ("bitIndex < 0: " + bitIndex);
var wordIndex = JU.BS.wordIndex (bitIndex);
if (wordIndex >= this.wordsInUse) return;
this.words[wordIndex] &= ~(1 << bitIndex);
this.recalculateWordsInUse ();
}, "~N");
Clazz_defineMethod (c$, "clearBits", 
function (fromIndex, toIndex) {
if (fromIndex == toIndex) return;
var startWordIndex = JU.BS.wordIndex (fromIndex);
if (startWordIndex >= this.wordsInUse) return;
var endWordIndex = JU.BS.wordIndex (toIndex - 1);
if (endWordIndex >= this.wordsInUse) {
toIndex = this.length ();
endWordIndex = this.wordsInUse - 1;
}var firstWordMask = -1 << fromIndex;
var lastWordMask = -1 >>> -toIndex;
if (startWordIndex == endWordIndex) {
this.words[startWordIndex] &= ~(firstWordMask & lastWordMask);
} else {
this.words[startWordIndex] &= ~firstWordMask;
for (var i = startWordIndex + 1; i < endWordIndex; i++) this.words[i] = 0;

this.words[endWordIndex] &= ~lastWordMask;
}this.recalculateWordsInUse ();
}, "~N,~N");
Clazz_defineMethod (c$, "clearAll", 
function () {
while (this.wordsInUse > 0) this.words[--this.wordsInUse] = 0;

});
Clazz_defineMethod (c$, "get", 
function (bitIndex) {
if (bitIndex < 0) throw  new IndexOutOfBoundsException ("bitIndex < 0: " + bitIndex);
var wordIndex = JU.BS.wordIndex (bitIndex);
return (wordIndex < this.wordsInUse) && ((this.words[wordIndex] & (1 << bitIndex)) != 0);
}, "~N");
Clazz_defineMethod (c$, "nextSetBit", 
function (fromIndex) {
if (fromIndex < 0) throw  new IndexOutOfBoundsException ("fromIndex < 0: " + fromIndex);
var u = JU.BS.wordIndex (fromIndex);
if (u >= this.wordsInUse) return -1;
var word = this.words[u] & (-1 << fromIndex);
while (true) {
if (word != 0) return (u * 32) + Integer.numberOfTrailingZeros (word);
if (++u == this.wordsInUse) return -1;
word = this.words[u];
}
}, "~N");
Clazz_defineMethod (c$, "nextClearBit", 
function (fromIndex) {
if (fromIndex < 0) throw  new IndexOutOfBoundsException ("fromIndex < 0: " + fromIndex);
var u = JU.BS.wordIndex (fromIndex);
if (u >= this.wordsInUse) return fromIndex;
var word = ~this.words[u] & (-1 << fromIndex);
while (true) {
if (word != 0) return (u * 32) + Integer.numberOfTrailingZeros (word);
if (++u == this.wordsInUse) return this.wordsInUse * 32;
word = ~this.words[u];
}
}, "~N");
Clazz_defineMethod (c$, "length", 
function () {
if (this.wordsInUse == 0) return 0;
return 32 * (this.wordsInUse - 1) + (32 - Integer.numberOfLeadingZeros (this.words[this.wordsInUse - 1]));
});
Clazz_defineMethod (c$, "isEmpty", 
function () {
return this.wordsInUse == 0;
});
Clazz_defineMethod (c$, "intersects", 
function (set) {
for (var i = Math.min (this.wordsInUse, set.wordsInUse) - 1; i >= 0; i--) if ((this.words[i] & set.words[i]) != 0) return true;

return false;
}, "JU.BS");
Clazz_defineMethod (c$, "cardinality", 
function () {
var sum = 0;
for (var i = 0; i < this.wordsInUse; i++) sum += Integer.bitCount (this.words[i]);

return sum;
});
Clazz_defineMethod (c$, "and", 
function (set) {
if (this === set) return;
while (this.wordsInUse > set.wordsInUse) this.words[--this.wordsInUse] = 0;

for (var i = 0; i < this.wordsInUse; i++) this.words[i] &= set.words[i];

this.recalculateWordsInUse ();
}, "JU.BS");
Clazz_defineMethod (c$, "or", 
function (set) {
if (this === set) return;
var wordsInCommon = Math.min (this.wordsInUse, set.wordsInUse);
if (this.wordsInUse < set.wordsInUse) {
this.ensureCapacity (set.wordsInUse);
this.wordsInUse = set.wordsInUse;
}for (var i = 0; i < wordsInCommon; i++) this.words[i] |= set.words[i];

if (wordsInCommon < set.wordsInUse) System.arraycopy (set.words, wordsInCommon, this.words, wordsInCommon, this.wordsInUse - wordsInCommon);
}, "JU.BS");
Clazz_defineMethod (c$, "xor", 
function (set) {
var wordsInCommon = Math.min (this.wordsInUse, set.wordsInUse);
if (this.wordsInUse < set.wordsInUse) {
this.ensureCapacity (set.wordsInUse);
this.wordsInUse = set.wordsInUse;
}for (var i = 0; i < wordsInCommon; i++) this.words[i] ^= set.words[i];

if (wordsInCommon < set.wordsInUse) System.arraycopy (set.words, wordsInCommon, this.words, wordsInCommon, set.wordsInUse - wordsInCommon);
this.recalculateWordsInUse ();
}, "JU.BS");
Clazz_defineMethod (c$, "andNot", 
function (set) {
for (var i = Math.min (this.wordsInUse, set.wordsInUse) - 1; i >= 0; i--) this.words[i] &= ~set.words[i];

this.recalculateWordsInUse ();
}, "JU.BS");
Clazz_overrideMethod (c$, "hashCode", 
function () {
var h = 1234;
for (var i = this.wordsInUse; --i >= 0; ) h ^= this.words[i] * (i + 1);

return ((h >> 32) ^ h);
});
Clazz_defineMethod (c$, "size", 
function () {
return this.words.length * 32;
});
Clazz_overrideMethod (c$, "equals", 
function (obj) {
if (!(Clazz_instanceOf (obj, JU.BS))) return false;
if (this === obj) return true;
var set = obj;
if (this.wordsInUse != set.wordsInUse) return false;
for (var i = 0; i < this.wordsInUse; i++) if (this.words[i] != set.words[i]) return false;

return true;
}, "~O");
Clazz_overrideMethod (c$, "clone", 
function () {
if (!this.sizeIsSticky && this.wordsInUse != this.words.length) this.setLength (this.wordsInUse);
return JU.BS.copy (this);
});
Clazz_defineMethod (c$, "setLength", 
 function (n) {
var a =  Clazz_newIntArray (n, 0);
System.arraycopy (this.words, 0, a, 0, Math.min (this.wordsInUse, n));
this.words = a;
}, "~N");
Clazz_overrideMethod (c$, "toString", 
function () {
return JU.BS.escape (this, '{', '}');
});
c$.copy = Clazz_defineMethod (c$, "copy", 
function (bitsetToCopy) {
var bs;
{
bs = Clazz_clone(bitsetToCopy);
}var wordCount = bitsetToCopy.wordsInUse;
if (wordCount == 0) {
bs.words = JU.BS.emptyBitmap;
} else {
bs.words =  Clazz_newIntArray (bs.wordsInUse = wordCount, 0);
System.arraycopy (bitsetToCopy.words, 0, bs.words, 0, wordCount);
}return bs;
}, "JU.BS");
Clazz_defineMethod (c$, "cardinalityN", 
function (max) {
var n = this.cardinality ();
for (var i = this.length (); --i >= max; ) if (this.get (i)) n--;

return n;
}, "~N");
Clazz_overrideMethod (c$, "toJSON", 
function () {
var numBits = (this.wordsInUse > 128) ? this.cardinality () : this.wordsInUse * 32;
var b = JU.SB.newN (6 * numBits + 2);
b.appendC ('[');
var i = this.nextSetBit (0);
if (i != -1) {
b.appendI (i);
for (i = this.nextSetBit (i + 1); i >= 0; i = this.nextSetBit (i + 1)) {
var endOfRun = this.nextClearBit (i);
do {
b.append (", ").appendI (i);
} while (++i < endOfRun);
}
}b.appendC (']');
return b.toString ();
});
c$.escape = Clazz_defineMethod (c$, "escape", 
function (bs, chOpen, chClose) {
if (bs == null) return chOpen + "{}" + chClose;
var s =  new JU.SB ();
s.append (chOpen + "{");
var imax = bs.length ();
var iLast = -1;
var iFirst = -2;
var i = -1;
while (++i <= imax) {
var isSet = bs.get (i);
if (i == imax || iLast >= 0 && !isSet) {
if (iLast >= 0 && iFirst != iLast) s.append ((iFirst == iLast - 1 ? " " : ":") + iLast);
if (i == imax) break;
iLast = -1;
}if (bs.get (i)) {
if (iLast < 0) {
s.append ((iFirst == -2 ? "" : " ") + i);
iFirst = i;
}iLast = i;
}}
s.append ("}").appendC (chClose);
return s.toString ();
}, "JU.BS,~S,~S");
c$.unescape = Clazz_defineMethod (c$, "unescape", 
function (str) {
var ch;
var len;
if (str == null || (len = (str = str.trim ()).length) < 4 || str.equalsIgnoreCase ("({null})") || (ch = str.charAt (0)) != '(' && ch != '[' || str.charAt (len - 1) != (ch == '(' ? ')' : ']') || str.charAt (1) != '{' || str.indexOf ('}') != len - 2) return null;
len -= 2;
for (var i = len; --i >= 2; ) if (!JU.PT.isDigit (ch = str.charAt (i)) && ch != ' ' && ch != '\t' && ch != ':') return null;

var lastN = len;
while (JU.PT.isDigit (str.charAt (--lastN))) {
}
if (++lastN == len) lastN = 0;
 else try {
lastN = Integer.parseInt (str.substring (lastN, len));
} catch (e) {
if (Clazz_exceptionOf (e, NumberFormatException)) {
return null;
} else {
throw e;
}
}
var bs = JU.BS.newN (lastN);
lastN = -1;
var iPrev = -1;
var iThis = -2;
for (var i = 2; i <= len; i++) {
switch (ch = str.charAt (i)) {
case '\t':
case ' ':
case '}':
if (iThis < 0) break;
if (iThis < lastN) return null;
lastN = iThis;
if (iPrev < 0) iPrev = iThis;
bs.setBits (iPrev, iThis + 1);
iPrev = -1;
iThis = -2;
break;
case ':':
iPrev = lastN = iThis;
iThis = -2;
break;
default:
if (JU.PT.isDigit (ch)) {
if (iThis < 0) iThis = 0;
iThis = (iThis * 10) + (ch.charCodeAt (0) - 48);
}}
}
return (iPrev >= 0 ? null : bs);
}, "~S");
Clazz_defineStatics (c$,
"ADDRESS_BITS_PER_WORD", 5,
"BITS_PER_WORD", 32,
"WORD_MASK", 0xffffffff,
"emptyBitmap",  Clazz_newIntArray (0, 0));
});
Clazz_declarePackage ("JU");
Clazz_load (["java.util.Hashtable"], "JU.CU", ["JU.P3", "$.PT"], function () {
c$ = Clazz_declareType (JU, "CU");
c$.toRGBHexString = Clazz_defineMethod (c$, "toRGBHexString", 
function (c) {
var rgb = c.getRGB ();
if (rgb == 0) return "000000";
var r = "00" + Integer.toHexString ((rgb >> 16) & 0xFF);
r = r.substring (r.length - 2);
var g = "00" + Integer.toHexString ((rgb >> 8) & 0xFF);
g = g.substring (g.length - 2);
var b = "00" + Integer.toHexString (rgb & 0xFF);
b = b.substring (b.length - 2);
return r + g + b;
}, "javajs.api.GenericColor");
c$.toCSSString = Clazz_defineMethod (c$, "toCSSString", 
function (c) {
var opacity = c.getOpacity255 ();
if (opacity == 255) return "#" + JU.CU.toRGBHexString (c);
var rgb = c.getRGB ();
return "rgba(" + ((rgb >> 16) & 0xFF) + "," + ((rgb >> 8) & 0xff) + "," + (rgb & 0xff) + "," + opacity / 255 + ")";
}, "javajs.api.GenericColor");
c$.getArgbFromString = Clazz_defineMethod (c$, "getArgbFromString", 
function (strColor) {
var len = 0;
if (strColor == null || (len = strColor.length) == 0) return 0;
if (strColor.charAt (0) == '[' && strColor.charAt (len - 1) == ']') {
var check;
if (strColor.indexOf (",") >= 0) {
var tokens = JU.PT.split (strColor.substring (1, strColor.length - 1), ",");
if (tokens.length != 3) return 0;
var red = JU.PT.parseFloat (tokens[0]);
var grn = JU.PT.parseFloat (tokens[1]);
var blu = JU.PT.parseFloat (tokens[2]);
return JU.CU.colorTriadToFFRGB (red, grn, blu);
}switch (len) {
case 9:
check = "x";
break;
case 10:
check = "0x";
break;
default:
return 0;
}
if (strColor.indexOf (check) != 1) return 0;
strColor = "#" + strColor.substring (len - 7, len - 1);
len = 7;
}if (len == 7 && strColor.charAt (0) == '#') {
try {
return JU.PT.parseIntRadix (strColor.substring (1, 7), 16) | 0xFF000000;
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return 0;
} else {
throw e;
}
}
}var boxedArgb = JU.CU.mapJavaScriptColors.get (strColor.toLowerCase ());
return (boxedArgb == null ? 0 : boxedArgb.intValue ());
}, "~S");
c$.colorTriadToFFRGB = Clazz_defineMethod (c$, "colorTriadToFFRGB", 
function (x, y, z) {
if (x <= 1 && y <= 1 && z <= 1) {
if (x > 0) x = x * 256 - 1;
if (y > 0) y = y * 256 - 1;
if (z > 0) z = z * 256 - 1;
}return JU.CU.rgb (Clazz_floatToInt (x), Clazz_floatToInt (y), Clazz_floatToInt (z));
}, "~N,~N,~N");
c$.rgb = Clazz_defineMethod (c$, "rgb", 
function (red, grn, blu) {
return 0xFF000000 | (red << 16) | (grn << 8) | blu;
}, "~N,~N,~N");
c$.colorPtFromString = Clazz_defineMethod (c$, "colorPtFromString", 
function (colorName) {
return JU.CU.colorPtFromInt (JU.CU.getArgbFromString (colorName), null);
}, "~S");
c$.colorPtFromInt = Clazz_defineMethod (c$, "colorPtFromInt", 
function (color, pt) {
if (pt == null) pt =  new JU.P3 ();
pt.set ((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF);
return pt;
}, "~N,JU.P3");
c$.colorPtToFFRGB = Clazz_defineMethod (c$, "colorPtToFFRGB", 
function (pt) {
return JU.CU.colorTriadToFFRGB (pt.x, pt.y, pt.z);
}, "JU.T3");
c$.toRGB3f = Clazz_defineMethod (c$, "toRGB3f", 
function (c, f) {
f[0] = ((c >> 16) & 0xFF) / 255;
f[1] = ((c >> 8) & 0xFF) / 255;
f[2] = (c & 0xFF) / 255;
}, "~N,~A");
c$.toFFGGGfromRGB = Clazz_defineMethod (c$, "toFFGGGfromRGB", 
function (rgb) {
var grey = (Clazz_doubleToInt (((2989 * ((rgb >> 16) & 0xFF)) + (5870 * ((rgb >> 8) & 0xFF)) + (1140 * (rgb & 0xFF)) + 5000) / 10000)) & 0xFFFFFF;
return JU.CU.rgb (grey, grey, grey);
}, "~N");
c$.rgbToHSL = Clazz_defineMethod (c$, "rgbToHSL", 
function (rgb, doRound) {
var r = rgb.x / 255;
var g = rgb.y / 255;
var b = rgb.z / 255;
var min = Math.min (r, Math.min (g, b));
var max = Math.max (r, Math.max (g, b));
var p = (max + min);
var q = (max - min);
var h = (60 * ((q == 0 ? 0 : max == r ? ((g - b) / q + 6) : max == g ? (b - r) / q + 2 : (r - g) / q + 4))) % 360;
var s = q / (q == 0 ? 1 : p <= 1 ? p : 2 - p);
return (doRound ? JU.P3.new3 (Math.round (h * 10) / 10, Math.round (s * 1000) / 10, Math.round (p * 500) / 10) : JU.P3.new3 (h, s * 100, p * 50));
}, "JU.P3,~B");
c$.hslToRGB = Clazz_defineMethod (c$, "hslToRGB", 
function (hsl) {
var h = Math.max (0, Math.min (360, hsl.x)) / 60;
var s = Math.max (0, Math.min (100, hsl.y)) / 100;
var l = Math.max (0, Math.min (100, hsl.z)) / 100;
var p = l - (l < 0.5 ? l : 1 - l) * s;
var q = 2 * (l - p);
var r = JU.CU.toRGB (p, q, h + 2);
var g = JU.CU.toRGB (p, q, h);
var b = JU.CU.toRGB (p, q, h - 2);
return JU.P3.new3 (Math.round (r * 255), Math.round (g * 255), Math.round (b * 255));
}, "JU.P3");
c$.toRGB = Clazz_defineMethod (c$, "toRGB", 
 function (p, q, h) {
return ((h = (h + (h < 0 ? 6 : h > 6 ? -6 : 0))) < 1 ? p + q * h : h < 3 ? p + q : h < 4 ? p + q * (4 - h) : p);
}, "~N,~N,~N");
Clazz_defineStatics (c$,
"colorNames", ["black", "pewhite", "pecyan", "pepurple", "pegreen", "peblue", "peviolet", "pebrown", "pepink", "peyellow", "pedarkgreen", "peorange", "pelightblue", "pedarkcyan", "pedarkgray", "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen", "bluetint", "greenblue", "greentint", "grey", "pinktint", "redorange", "yellowtint"],
"colorArgbs", [0xFF000000, 0xFFffffff, 0xFF00ffff, 0xFFd020ff, 0xFF00ff00, 0xFF6060ff, 0xFFff80c0, 0xFFa42028, 0xFFffd8d8, 0xFFffff00, 0xFF00c000, 0xFFffb000, 0xFFb0b0ff, 0xFF00a0a0, 0xFF606060, 0xFFF0F8FF, 0xFFFAEBD7, 0xFF00FFFF, 0xFF7FFFD4, 0xFFF0FFFF, 0xFFF5F5DC, 0xFFFFE4C4, 0xFFFFEBCD, 0xFF0000FF, 0xFF8A2BE2, 0xFFA52A2A, 0xFFDEB887, 0xFF5F9EA0, 0xFF7FFF00, 0xFFD2691E, 0xFFFF7F50, 0xFF6495ED, 0xFFFFF8DC, 0xFFDC143C, 0xFF00FFFF, 0xFF00008B, 0xFF008B8B, 0xFFB8860B, 0xFFA9A9A9, 0xFF006400, 0xFFBDB76B, 0xFF8B008B, 0xFF556B2F, 0xFFFF8C00, 0xFF9932CC, 0xFF8B0000, 0xFFE9967A, 0xFF8FBC8F, 0xFF483D8B, 0xFF2F4F4F, 0xFF00CED1, 0xFF9400D3, 0xFFFF1493, 0xFF00BFFF, 0xFF696969, 0xFF1E90FF, 0xFFB22222, 0xFFFFFAF0, 0xFF228B22, 0xFFFF00FF, 0xFFDCDCDC, 0xFFF8F8FF, 0xFFFFD700, 0xFFDAA520, 0xFF808080, 0xFF008000, 0xFFADFF2F, 0xFFF0FFF0, 0xFFFF69B4, 0xFFCD5C5C, 0xFF4B0082, 0xFFFFFFF0, 0xFFF0E68C, 0xFFE6E6FA, 0xFFFFF0F5, 0xFF7CFC00, 0xFFFFFACD, 0xFFADD8E6, 0xFFF08080, 0xFFE0FFFF, 0xFFFAFAD2, 0xFF90EE90, 0xFFD3D3D3, 0xFFFFB6C1, 0xFFFFA07A, 0xFF20B2AA, 0xFF87CEFA, 0xFF778899, 0xFFB0C4DE, 0xFFFFFFE0, 0xFF00FF00, 0xFF32CD32, 0xFFFAF0E6, 0xFFFF00FF, 0xFF800000, 0xFF66CDAA, 0xFF0000CD, 0xFFBA55D3, 0xFF9370DB, 0xFF3CB371, 0xFF7B68EE, 0xFF00FA9A, 0xFF48D1CC, 0xFFC71585, 0xFF191970, 0xFFF5FFFA, 0xFFFFE4E1, 0xFFFFE4B5, 0xFFFFDEAD, 0xFF000080, 0xFFFDF5E6, 0xFF808000, 0xFF6B8E23, 0xFFFFA500, 0xFFFF4500, 0xFFDA70D6, 0xFFEEE8AA, 0xFF98FB98, 0xFFAFEEEE, 0xFFDB7093, 0xFFFFEFD5, 0xFFFFDAB9, 0xFFCD853F, 0xFFFFC0CB, 0xFFDDA0DD, 0xFFB0E0E6, 0xFF800080, 0xFFFF0000, 0xFFBC8F8F, 0xFF4169E1, 0xFF8B4513, 0xFFFA8072, 0xFFF4A460, 0xFF2E8B57, 0xFFFFF5EE, 0xFFA0522D, 0xFFC0C0C0, 0xFF87CEEB, 0xFF6A5ACD, 0xFF708090, 0xFFFFFAFA, 0xFF00FF7F, 0xFF4682B4, 0xFFD2B48C, 0xFF008080, 0xFFD8BFD8, 0xFFFF6347, 0xFF40E0D0, 0xFFEE82EE, 0xFFF5DEB3, 0xFFFFFFFF, 0xFFF5F5F5, 0xFFFFFF00, 0xFF9ACD32, 0xFFAFD7FF, 0xFF2E8B57, 0xFF98FFB3, 0xFF808080, 0xFFFFABBB, 0xFFFF4500, 0xFFF6F675]);
c$.mapJavaScriptColors = c$.prototype.mapJavaScriptColors =  new java.util.Hashtable ();
{
for (var i = JU.CU.colorNames.length; --i >= 0; ) JU.CU.mapJavaScriptColors.put (JU.CU.colorNames[i], Integer.$valueOf (JU.CU.colorArgbs[i]));

}});
Clazz_declarePackage ("JU");
Clazz_load (["java.lang.Boolean"], "JU.DF", ["java.lang.Double", "$.Float", "JU.PT", "$.SB"], function () {
c$ = Clazz_declareType (JU, "DF");
c$.setUseNumberLocalization = Clazz_defineMethod (c$, "setUseNumberLocalization", 
function (TF) {
JU.DF.useNumberLocalization[0] = (TF ? Boolean.TRUE : Boolean.FALSE);
}, "~B");
c$.formatDecimalDbl = Clazz_defineMethod (c$, "formatDecimalDbl", 
function (value, decimalDigits) {
if (decimalDigits == 2147483647 || value == -Infinity || value == Infinity || Double.isNaN (value)) return "" + value;
return JU.DF.formatDecimal (value, decimalDigits);
}, "~N,~N");
c$.formatDecimal = Clazz_defineMethod (c$, "formatDecimal", 
function (value, decimalDigits) {
if (decimalDigits == 2147483647 || value == -Infinity || value == Infinity || Float.isNaN (value)) return "" + value;
var n;
if (decimalDigits < 0) {
decimalDigits = -decimalDigits;
if (decimalDigits > JU.DF.formattingStrings.length) decimalDigits = JU.DF.formattingStrings.length;
if (value == 0) return JU.DF.formattingStrings[decimalDigits] + "E+0";
n = 0;
var d;
if (Math.abs (value) < 1) {
n = 10;
d = value * 1e-10;
} else {
n = -10;
d = value * 1e10;
}var s = ("" + d).toUpperCase ();
var i = s.indexOf ("E");
n = JU.PT.parseInt (s.substring (i + 1)) + n;
return (i < 0 ? "" + value : JU.DF.formatDecimal (JU.PT.parseFloat (s.substring (0, i)), decimalDigits - 1) + "E" + (n >= 0 ? "+" : "") + n);
}if (decimalDigits >= JU.DF.formattingStrings.length) decimalDigits = JU.DF.formattingStrings.length - 1;
var s1 = ("" + value).toUpperCase ();
var isNeg = s1.startsWith ("-");
if (isNeg) s1 = s1.substring (1);
var pt = s1.indexOf (".");
if (pt < 0) return s1 + JU.DF.formattingStrings[decimalDigits].substring (1);
var pt1 = s1.indexOf ("E-");
if (pt1 > 0) {
n = JU.PT.parseInt (s1.substring (pt1 + 1));
s1 = "0." + "0000000000000000000000000000000000000000".substring (0, -n - 1) + s1.substring (0, 1) + s1.substring (2, pt1);
pt = 1;
}pt1 = s1.indexOf ("E");
if (pt1 > 0) {
n = JU.PT.parseInt (s1.substring (pt1 + 1));
s1 = s1.substring (0, 1) + s1.substring (2, pt1) + "0000000000000000000000000000000000000000";
s1 = s1.substring (0, n + 1) + "." + s1.substring (n + 1);
pt = s1.indexOf (".");
}var len = s1.length;
var pt2 = decimalDigits + pt + 1;
if (pt2 < len && s1.charAt (pt2) >= '5') {
return JU.DF.formatDecimal (value + (isNeg ? -1 : 1) * JU.DF.formatAdds[decimalDigits], decimalDigits);
}var sb = JU.SB.newS (s1.substring (0, (decimalDigits == 0 ? pt : ++pt)));
for (var i = 0; i < decimalDigits; i++, pt++) {
if (pt < len) sb.appendC (s1.charAt (pt));
 else sb.appendC ('0');
}
s1 = (isNeg ? "-" : "") + sb;
return (Boolean.TRUE.equals (JU.DF.useNumberLocalization[0]) ? s1 : s1.$replace (',', '.'));
}, "~N,~N");
c$.formatDecimalTrimmed = Clazz_defineMethod (c$, "formatDecimalTrimmed", 
function (x, precision) {
var str = JU.DF.formatDecimalDbl (x, precision);
var m = str.length - 1;
var zero = '0';
while (m >= 0 && str.charAt (m) == zero) m--;

return str.substring (0, m + 1);
}, "~N,~N");
Clazz_defineStatics (c$,
"formattingStrings", ["0", "0.0", "0.00", "0.000", "0.0000", "0.00000", "0.000000", "0.0000000", "0.00000000", "0.000000000"],
"zeros", "0000000000000000000000000000000000000000",
"formatAdds", [0.5, 0.05, 0.005, 0.0005, 0.00005, 0.000005, 0.0000005, 0.00000005, 0.000000005, 0.0000000005]);
c$.useNumberLocalization = c$.prototype.useNumberLocalization = [Boolean.TRUE];
});
Clazz_declarePackage ("JU");
Clazz_load (["java.lang.Enum"], "JU.Encoding", null, function () {
c$ = Clazz_declareType (JU, "Encoding", Enum);
Clazz_defineEnumConstant (c$, "NONE", 0, []);
Clazz_defineEnumConstant (c$, "UTF8", 1, []);
Clazz_defineEnumConstant (c$, "UTF_16BE", 2, []);
Clazz_defineEnumConstant (c$, "UTF_16LE", 3, []);
Clazz_defineEnumConstant (c$, "UTF_32BE", 4, []);
Clazz_defineEnumConstant (c$, "UTF_32LE", 5, []);
});
Clazz_declarePackage ("JU");
Clazz_load (["java.util.ArrayList"], "JU.Lst", null, function () {
c$ = Clazz_declareType (JU, "Lst", java.util.ArrayList);
Clazz_defineMethod (c$, "addLast", 
function (v) {
{
return this.add1(v);
}}, "~O");
Clazz_defineMethod (c$, "removeObj", 
function (v) {
{
return this.removeObject(v);
}}, "~O");
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.M34", ["java.lang.ArrayIndexOutOfBoundsException"], function () {
c$ = Clazz_decorateAsClass (function () {
this.m00 = 0;
this.m01 = 0;
this.m02 = 0;
this.m10 = 0;
this.m11 = 0;
this.m12 = 0;
this.m20 = 0;
this.m21 = 0;
this.m22 = 0;
Clazz_instantialize (this, arguments);
}, JU, "M34");
Clazz_defineMethod (c$, "setAA33", 
function (a) {
var x = a.x;
var y = a.y;
var z = a.z;
var angle = a.angle;
var n = Math.sqrt (x * x + y * y + z * z);
n = 1 / n;
x *= n;
y *= n;
z *= n;
var c = Math.cos (angle);
var s = Math.sin (angle);
var omc = 1.0 - c;
this.m00 = (c + x * x * omc);
this.m11 = (c + y * y * omc);
this.m22 = (c + z * z * omc);
var tmp1 = x * y * omc;
var tmp2 = z * s;
this.m01 = (tmp1 - tmp2);
this.m10 = (tmp1 + tmp2);
tmp1 = x * z * omc;
tmp2 = y * s;
this.m02 = (tmp1 + tmp2);
this.m20 = (tmp1 - tmp2);
tmp1 = y * z * omc;
tmp2 = x * s;
this.m12 = (tmp1 - tmp2);
this.m21 = (tmp1 + tmp2);
}, "JU.A4");
Clazz_defineMethod (c$, "rotate", 
function (t) {
this.rotate2 (t, t);
}, "JU.T3");
Clazz_defineMethod (c$, "rotate2", 
function (t, result) {
result.set (this.m00 * t.x + this.m01 * t.y + this.m02 * t.z, this.m10 * t.x + this.m11 * t.y + this.m12 * t.z, this.m20 * t.x + this.m21 * t.y + this.m22 * t.z);
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "setM33", 
function (m1) {
this.m00 = m1.m00;
this.m01 = m1.m01;
this.m02 = m1.m02;
this.m10 = m1.m10;
this.m11 = m1.m11;
this.m12 = m1.m12;
this.m20 = m1.m20;
this.m21 = m1.m21;
this.m22 = m1.m22;
}, "JU.M34");
Clazz_defineMethod (c$, "clear33", 
function () {
this.m00 = this.m01 = this.m02 = this.m10 = this.m11 = this.m12 = this.m20 = this.m21 = this.m22 = 0.0;
});
Clazz_defineMethod (c$, "set33", 
function (row, col, v) {
switch (row) {
case 0:
switch (col) {
case 0:
this.m00 = v;
return;
case 1:
this.m01 = v;
return;
case 2:
this.m02 = v;
return;
}
break;
case 1:
switch (col) {
case 0:
this.m10 = v;
return;
case 1:
this.m11 = v;
return;
case 2:
this.m12 = v;
return;
}
break;
case 2:
switch (col) {
case 0:
this.m20 = v;
return;
case 1:
this.m21 = v;
return;
case 2:
this.m22 = v;
return;
}
break;
}
this.err ();
}, "~N,~N,~N");
Clazz_defineMethod (c$, "get33", 
function (row, col) {
switch (row) {
case 0:
switch (col) {
case 0:
return this.m00;
case 1:
return this.m01;
case 2:
return this.m02;
}
break;
case 1:
switch (col) {
case 0:
return this.m10;
case 1:
return this.m11;
case 2:
return this.m12;
}
break;
case 2:
switch (col) {
case 0:
return this.m20;
case 1:
return this.m21;
case 2:
return this.m22;
}
break;
}
this.err ();
return 0;
}, "~N,~N");
Clazz_defineMethod (c$, "setRow33", 
function (row, v) {
switch (row) {
case 0:
this.m00 = v[0];
this.m01 = v[1];
this.m02 = v[2];
return;
case 1:
this.m10 = v[0];
this.m11 = v[1];
this.m12 = v[2];
return;
case 2:
this.m20 = v[0];
this.m21 = v[1];
this.m22 = v[2];
return;
default:
this.err ();
}
}, "~N,~A");
Clazz_defineMethod (c$, "getRow33", 
function (row, v) {
switch (row) {
case 0:
v[0] = this.m00;
v[1] = this.m01;
v[2] = this.m02;
return;
case 1:
v[0] = this.m10;
v[1] = this.m11;
v[2] = this.m12;
return;
case 2:
v[0] = this.m20;
v[1] = this.m21;
v[2] = this.m22;
return;
}
this.err ();
}, "~N,~A");
Clazz_defineMethod (c$, "setColumn33", 
function (column, v) {
switch (column) {
case 0:
this.m00 = v[0];
this.m10 = v[1];
this.m20 = v[2];
break;
case 1:
this.m01 = v[0];
this.m11 = v[1];
this.m21 = v[2];
break;
case 2:
this.m02 = v[0];
this.m12 = v[1];
this.m22 = v[2];
break;
default:
this.err ();
}
}, "~N,~A");
Clazz_defineMethod (c$, "getColumn33", 
function (column, v) {
switch (column) {
case 0:
v[0] = this.m00;
v[1] = this.m10;
v[2] = this.m20;
break;
case 1:
v[0] = this.m01;
v[1] = this.m11;
v[2] = this.m21;
break;
case 2:
v[0] = this.m02;
v[1] = this.m12;
v[2] = this.m22;
break;
default:
this.err ();
}
}, "~N,~A");
Clazz_defineMethod (c$, "add33", 
function (m1) {
this.m00 += m1.m00;
this.m01 += m1.m01;
this.m02 += m1.m02;
this.m10 += m1.m10;
this.m11 += m1.m11;
this.m12 += m1.m12;
this.m20 += m1.m20;
this.m21 += m1.m21;
this.m22 += m1.m22;
}, "JU.M34");
Clazz_defineMethod (c$, "sub33", 
function (m1) {
this.m00 -= m1.m00;
this.m01 -= m1.m01;
this.m02 -= m1.m02;
this.m10 -= m1.m10;
this.m11 -= m1.m11;
this.m12 -= m1.m12;
this.m20 -= m1.m20;
this.m21 -= m1.m21;
this.m22 -= m1.m22;
}, "JU.M34");
Clazz_defineMethod (c$, "mul33", 
function (x) {
this.m00 *= x;
this.m01 *= x;
this.m02 *= x;
this.m10 *= x;
this.m11 *= x;
this.m12 *= x;
this.m20 *= x;
this.m21 *= x;
this.m22 *= x;
}, "~N");
Clazz_defineMethod (c$, "transpose33", 
function () {
var tmp = this.m01;
this.m01 = this.m10;
this.m10 = tmp;
tmp = this.m02;
this.m02 = this.m20;
this.m20 = tmp;
tmp = this.m12;
this.m12 = this.m21;
this.m21 = tmp;
});
Clazz_defineMethod (c$, "setXRot", 
function (angle) {
var c = Math.cos (angle);
var s = Math.sin (angle);
this.m00 = 1.0;
this.m01 = 0.0;
this.m02 = 0.0;
this.m10 = 0.0;
this.m11 = c;
this.m12 = -s;
this.m20 = 0.0;
this.m21 = s;
this.m22 = c;
}, "~N");
Clazz_defineMethod (c$, "setYRot", 
function (angle) {
var c = Math.cos (angle);
var s = Math.sin (angle);
this.m00 = c;
this.m01 = 0.0;
this.m02 = s;
this.m10 = 0.0;
this.m11 = 1.0;
this.m12 = 0.0;
this.m20 = -s;
this.m21 = 0.0;
this.m22 = c;
}, "~N");
Clazz_defineMethod (c$, "setZRot", 
function (angle) {
var c = Math.cos (angle);
var s = Math.sin (angle);
this.m00 = c;
this.m01 = -s;
this.m02 = 0.0;
this.m10 = s;
this.m11 = c;
this.m12 = 0.0;
this.m20 = 0.0;
this.m21 = 0.0;
this.m22 = 1.0;
}, "~N");
Clazz_defineMethod (c$, "determinant3", 
function () {
return this.m00 * (this.m11 * this.m22 - this.m21 * this.m12) - this.m01 * (this.m10 * this.m22 - this.m20 * this.m12) + this.m02 * (this.m10 * this.m21 - this.m20 * this.m11);
});
Clazz_defineMethod (c$, "err", 
function () {
throw  new ArrayIndexOutOfBoundsException ("matrix column/row out of bounds");
});
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.M34"], "JU.M3", ["JU.T3"], function () {
c$ = Clazz_declareType (JU, "M3", JU.M34, java.io.Serializable);
c$.newA9 = Clazz_defineMethod (c$, "newA9", 
function (v) {
var m =  new JU.M3 ();
m.setA (v);
return m;
}, "~A");
c$.newM3 = Clazz_defineMethod (c$, "newM3", 
function (m1) {
var m =  new JU.M3 ();
if (m1 == null) {
m.setScale (1);
return m;
}m.m00 = m1.m00;
m.m01 = m1.m01;
m.m02 = m1.m02;
m.m10 = m1.m10;
m.m11 = m1.m11;
m.m12 = m1.m12;
m.m20 = m1.m20;
m.m21 = m1.m21;
m.m22 = m1.m22;
return m;
}, "JU.M3");
Clazz_defineMethod (c$, "setScale", 
function (scale) {
this.clear33 ();
this.m00 = this.m11 = this.m22 = scale;
}, "~N");
Clazz_defineMethod (c$, "setM3", 
function (m1) {
this.setM33 (m1);
}, "JU.M34");
Clazz_defineMethod (c$, "setA", 
function (m) {
this.m00 = m[0];
this.m01 = m[1];
this.m02 = m[2];
this.m10 = m[3];
this.m11 = m[4];
this.m12 = m[5];
this.m20 = m[6];
this.m21 = m[7];
this.m22 = m[8];
}, "~A");
Clazz_defineMethod (c$, "setElement", 
function (row, col, v) {
this.set33 (row, col, v);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getElement", 
function (row, col) {
return this.get33 (row, col);
}, "~N,~N");
Clazz_defineMethod (c$, "setRow", 
function (row, x, y, z) {
switch (row) {
case 0:
this.m00 = x;
this.m01 = y;
this.m02 = z;
return;
case 1:
this.m10 = x;
this.m11 = y;
this.m12 = z;
return;
case 2:
this.m20 = x;
this.m21 = y;
this.m22 = z;
return;
default:
this.err ();
}
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "setRowV", 
function (row, v) {
switch (row) {
case 0:
this.m00 = v.x;
this.m01 = v.y;
this.m02 = v.z;
return;
case 1:
this.m10 = v.x;
this.m11 = v.y;
this.m12 = v.z;
return;
case 2:
this.m20 = v.x;
this.m21 = v.y;
this.m22 = v.z;
return;
default:
this.err ();
}
}, "~N,JU.T3");
Clazz_defineMethod (c$, "setRowA", 
function (row, v) {
this.setRow33 (row, v);
}, "~N,~A");
Clazz_overrideMethod (c$, "getRow", 
function (row, v) {
this.getRow33 (row, v);
}, "~N,~A");
Clazz_defineMethod (c$, "setColumn3", 
function (column, x, y, z) {
switch (column) {
case 0:
this.m00 = x;
this.m10 = y;
this.m20 = z;
break;
case 1:
this.m01 = x;
this.m11 = y;
this.m21 = z;
break;
case 2:
this.m02 = x;
this.m12 = y;
this.m22 = z;
break;
default:
this.err ();
}
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "setColumnV", 
function (column, v) {
switch (column) {
case 0:
this.m00 = v.x;
this.m10 = v.y;
this.m20 = v.z;
break;
case 1:
this.m01 = v.x;
this.m11 = v.y;
this.m21 = v.z;
break;
case 2:
this.m02 = v.x;
this.m12 = v.y;
this.m22 = v.z;
break;
default:
this.err ();
}
}, "~N,JU.T3");
Clazz_defineMethod (c$, "getColumnV", 
function (column, v) {
switch (column) {
case 0:
v.x = this.m00;
v.y = this.m10;
v.z = this.m20;
break;
case 1:
v.x = this.m01;
v.y = this.m11;
v.z = this.m21;
break;
case 2:
v.x = this.m02;
v.y = this.m12;
v.z = this.m22;
break;
default:
this.err ();
}
}, "~N,JU.T3");
Clazz_defineMethod (c$, "setColumnA", 
function (column, v) {
this.setColumn33 (column, v);
}, "~N,~A");
Clazz_defineMethod (c$, "getColumn", 
function (column, v) {
this.getColumn33 (column, v);
}, "~N,~A");
Clazz_defineMethod (c$, "add", 
function (m1) {
this.add33 (m1);
}, "JU.M3");
Clazz_defineMethod (c$, "sub", 
function (m1) {
this.sub33 (m1);
}, "JU.M3");
Clazz_defineMethod (c$, "transpose", 
function () {
this.transpose33 ();
});
Clazz_defineMethod (c$, "transposeM", 
function (m1) {
this.setM33 (m1);
this.transpose33 ();
}, "JU.M3");
Clazz_defineMethod (c$, "invertM", 
function (m1) {
this.setM33 (m1);
this.invert ();
}, "JU.M3");
Clazz_defineMethod (c$, "invert", 
function () {
var s = this.determinant3 ();
if (s == 0.0) return;
s = 1 / s;
this.set9 (this.m11 * this.m22 - this.m12 * this.m21, this.m02 * this.m21 - this.m01 * this.m22, this.m01 * this.m12 - this.m02 * this.m11, this.m12 * this.m20 - this.m10 * this.m22, this.m00 * this.m22 - this.m02 * this.m20, this.m02 * this.m10 - this.m00 * this.m12, this.m10 * this.m21 - this.m11 * this.m20, this.m01 * this.m20 - this.m00 * this.m21, this.m00 * this.m11 - this.m01 * this.m10);
this.scale (s);
});
Clazz_defineMethod (c$, "setAsXRotation", 
function (angle) {
this.setXRot (angle);
return this;
}, "~N");
Clazz_defineMethod (c$, "setAsYRotation", 
function (angle) {
this.setYRot (angle);
return this;
}, "~N");
Clazz_defineMethod (c$, "setAsZRotation", 
function (angle) {
this.setZRot (angle);
return this;
}, "~N");
Clazz_defineMethod (c$, "scale", 
function (scalar) {
this.mul33 (scalar);
}, "~N");
Clazz_defineMethod (c$, "mul", 
function (m1) {
this.mul2 (this, m1);
}, "JU.M3");
Clazz_defineMethod (c$, "mul2", 
function (m1, m2) {
this.set9 (m1.m00 * m2.m00 + m1.m01 * m2.m10 + m1.m02 * m2.m20, m1.m00 * m2.m01 + m1.m01 * m2.m11 + m1.m02 * m2.m21, m1.m00 * m2.m02 + m1.m01 * m2.m12 + m1.m02 * m2.m22, m1.m10 * m2.m00 + m1.m11 * m2.m10 + m1.m12 * m2.m20, m1.m10 * m2.m01 + m1.m11 * m2.m11 + m1.m12 * m2.m21, m1.m10 * m2.m02 + m1.m11 * m2.m12 + m1.m12 * m2.m22, m1.m20 * m2.m00 + m1.m21 * m2.m10 + m1.m22 * m2.m20, m1.m20 * m2.m01 + m1.m21 * m2.m11 + m1.m22 * m2.m21, m1.m20 * m2.m02 + m1.m21 * m2.m12 + m1.m22 * m2.m22);
}, "JU.M3,JU.M3");
Clazz_overrideMethod (c$, "equals", 
function (o) {
if (!(Clazz_instanceOf (o, JU.M3))) return false;
var m = o;
return this.m00 == m.m00 && this.m01 == m.m01 && this.m02 == m.m02 && this.m10 == m.m10 && this.m11 == m.m11 && this.m12 == m.m12 && this.m20 == m.m20 && this.m21 == m.m21 && this.m22 == m.m22;
}, "~O");
Clazz_overrideMethod (c$, "hashCode", 
function () {
return JU.T3.floatToIntBits0 (this.m00) ^ JU.T3.floatToIntBits0 (this.m01) ^ JU.T3.floatToIntBits0 (this.m02) ^ JU.T3.floatToIntBits0 (this.m10) ^ JU.T3.floatToIntBits0 (this.m11) ^ JU.T3.floatToIntBits0 (this.m12) ^ JU.T3.floatToIntBits0 (this.m20) ^ JU.T3.floatToIntBits0 (this.m21) ^ JU.T3.floatToIntBits0 (this.m22);
});
Clazz_defineMethod (c$, "setZero", 
function () {
this.clear33 ();
});
Clazz_defineMethod (c$, "set9", 
 function (m00, m01, m02, m10, m11, m12, m20, m21, m22) {
this.m00 = m00;
this.m01 = m01;
this.m02 = m02;
this.m10 = m10;
this.m11 = m11;
this.m12 = m12;
this.m20 = m20;
this.m21 = m21;
this.m22 = m22;
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "toString", 
function () {
return "[\n  [" + this.m00 + "\t" + this.m01 + "\t" + this.m02 + "]" + "\n  [" + this.m10 + "\t" + this.m11 + "\t" + this.m12 + "]" + "\n  [" + this.m20 + "\t" + this.m21 + "\t" + this.m22 + "] ]";
});
Clazz_defineMethod (c$, "setAA", 
function (a) {
this.setAA33 (a);
return this;
}, "JU.A4");
Clazz_defineMethod (c$, "setAsBallRotation", 
function (responseFactor, dx, dy) {
var r = Math.sqrt (dx * dx + dy * dy);
var th = r * responseFactor;
if (th == 0) {
this.setScale (1);
return false;
}var c = Math.cos (th);
var s = Math.sin (th);
var nx = -dy / r;
var ny = dx / r;
var c1 = c - 1;
this.m00 = 1 + c1 * nx * nx;
this.m01 = this.m10 = c1 * nx * ny;
this.m20 = -(this.m02 = s * nx);
this.m11 = 1 + c1 * ny * ny;
this.m21 = -(this.m12 = s * ny);
this.m22 = c;
return true;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "isRotation", 
function () {
return (Math.abs (this.determinant3 () - 1) < 0.001);
});
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.M34"], "JU.M4", ["JU.T3"], function () {
c$ = Clazz_decorateAsClass (function () {
this.m03 = 0;
this.m13 = 0;
this.m23 = 0;
this.m30 = 0;
this.m31 = 0;
this.m32 = 0;
this.m33 = 0;
Clazz_instantialize (this, arguments);
}, JU, "M4", JU.M34);
c$.newA16 = Clazz_defineMethod (c$, "newA16", 
function (v) {
var m =  new JU.M4 ();
m.m00 = v[0];
m.m01 = v[1];
m.m02 = v[2];
m.m03 = v[3];
m.m10 = v[4];
m.m11 = v[5];
m.m12 = v[6];
m.m13 = v[7];
m.m20 = v[8];
m.m21 = v[9];
m.m22 = v[10];
m.m23 = v[11];
m.m30 = v[12];
m.m31 = v[13];
m.m32 = v[14];
m.m33 = v[15];
return m;
}, "~A");
c$.newM4 = Clazz_defineMethod (c$, "newM4", 
function (m1) {
var m =  new JU.M4 ();
if (m1 == null) {
m.setIdentity ();
return m;
}m.setToM3 (m1);
m.m03 = m1.m03;
m.m13 = m1.m13;
m.m23 = m1.m23;
m.m30 = m1.m30;
m.m31 = m1.m31;
m.m32 = m1.m32;
m.m33 = m1.m33;
return m;
}, "JU.M4");
c$.newMV = Clazz_defineMethod (c$, "newMV", 
function (m1, t) {
var m =  new JU.M4 ();
m.setMV (m1, t);
return m;
}, "JU.M3,JU.T3");
Clazz_defineMethod (c$, "setZero", 
function () {
this.clear33 ();
this.m03 = this.m13 = this.m23 = this.m30 = this.m31 = this.m32 = this.m33 = 0.0;
});
Clazz_defineMethod (c$, "setIdentity", 
function () {
this.setZero ();
this.m00 = this.m11 = this.m22 = this.m33 = 1.0;
});
Clazz_defineMethod (c$, "setM4", 
function (m1) {
this.setM33 (m1);
this.m03 = m1.m03;
this.m13 = m1.m13;
this.m23 = m1.m23;
this.m30 = m1.m30;
this.m31 = m1.m31;
this.m32 = m1.m32;
this.m33 = m1.m33;
return this;
}, "JU.M4");
Clazz_defineMethod (c$, "setMV", 
function (m1, t) {
this.setM33 (m1);
this.setTranslation (t);
this.m33 = 1;
}, "JU.M3,JU.T3");
Clazz_defineMethod (c$, "setToM3", 
function (m1) {
this.setM33 (m1);
this.m03 = this.m13 = this.m23 = this.m30 = this.m31 = this.m32 = 0.0;
this.m33 = 1.0;
}, "JU.M34");
Clazz_defineMethod (c$, "setToAA", 
function (a) {
this.setIdentity ();
this.setAA33 (a);
}, "JU.A4");
Clazz_defineMethod (c$, "setA", 
function (m) {
this.m00 = m[0];
this.m01 = m[1];
this.m02 = m[2];
this.m03 = m[3];
this.m10 = m[4];
this.m11 = m[5];
this.m12 = m[6];
this.m13 = m[7];
this.m20 = m[8];
this.m21 = m[9];
this.m22 = m[10];
this.m23 = m[11];
this.m30 = m[12];
this.m31 = m[13];
this.m32 = m[14];
this.m33 = m[15];
}, "~A");
Clazz_defineMethod (c$, "setTranslation", 
function (trans) {
this.m03 = trans.x;
this.m13 = trans.y;
this.m23 = trans.z;
}, "JU.T3");
Clazz_defineMethod (c$, "setElement", 
function (row, col, v) {
if (row < 3 && col < 3) {
this.set33 (row, col, v);
return;
}if (row > 3 || col > 3) this.err ();
switch (row) {
case 0:
this.m03 = v;
return;
case 1:
this.m13 = v;
return;
case 2:
this.m23 = v;
return;
}
switch (col) {
case 0:
this.m30 = v;
return;
case 1:
this.m31 = v;
return;
case 2:
this.m32 = v;
return;
case 3:
this.m33 = v;
return;
}
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getElement", 
function (row, col) {
if (row < 3 && col < 3) return this.get33 (row, col);
if (row > 3 || col > 3) {
this.err ();
return 0;
}switch (row) {
case 0:
return this.m03;
case 1:
return this.m13;
case 2:
return this.m23;
default:
switch (col) {
case 0:
return this.m30;
case 1:
return this.m31;
case 2:
return this.m32;
default:
return this.m33;
}
}
}, "~N,~N");
Clazz_defineMethod (c$, "getTranslation", 
function (trans) {
trans.x = this.m03;
trans.y = this.m13;
trans.z = this.m23;
}, "JU.T3");
Clazz_defineMethod (c$, "getRotationScale", 
function (m1) {
m1.m00 = this.m00;
m1.m01 = this.m01;
m1.m02 = this.m02;
m1.m10 = this.m10;
m1.m11 = this.m11;
m1.m12 = this.m12;
m1.m20 = this.m20;
m1.m21 = this.m21;
m1.m22 = this.m22;
}, "JU.M3");
Clazz_defineMethod (c$, "setRotationScale", 
function (m1) {
this.m00 = m1.m00;
this.m01 = m1.m01;
this.m02 = m1.m02;
this.m10 = m1.m10;
this.m11 = m1.m11;
this.m12 = m1.m12;
this.m20 = m1.m20;
this.m21 = m1.m21;
this.m22 = m1.m22;
}, "JU.M3");
Clazz_defineMethod (c$, "setRowA", 
function (row, v) {
if (row < 3) this.setRow33 (row, v);
switch (row) {
case 0:
this.m03 = v[3];
return;
case 1:
this.m13 = v[3];
return;
case 2:
this.m23 = v[3];
return;
case 3:
this.m30 = v[0];
this.m31 = v[1];
this.m32 = v[2];
this.m33 = v[3];
return;
}
this.err ();
}, "~N,~A");
Clazz_overrideMethod (c$, "getRow", 
function (row, v) {
if (row < 3) this.getRow33 (row, v);
switch (row) {
case 0:
v[3] = this.m03;
return;
case 1:
v[3] = this.m13;
return;
case 2:
v[3] = this.m23;
return;
case 3:
v[0] = this.m30;
v[1] = this.m31;
v[2] = this.m32;
v[3] = this.m33;
return;
}
this.err ();
}, "~N,~A");
Clazz_defineMethod (c$, "setColumn4", 
function (column, x, y, z, w) {
if (column == 0) {
this.m00 = x;
this.m10 = y;
this.m20 = z;
this.m30 = w;
} else if (column == 1) {
this.m01 = x;
this.m11 = y;
this.m21 = z;
this.m31 = w;
} else if (column == 2) {
this.m02 = x;
this.m12 = y;
this.m22 = z;
this.m32 = w;
} else if (column == 3) {
this.m03 = x;
this.m13 = y;
this.m23 = z;
this.m33 = w;
} else {
this.err ();
}}, "~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "setColumnA", 
function (column, v) {
if (column < 3) this.setColumn33 (column, v);
switch (column) {
case 0:
this.m30 = v[3];
return;
case 1:
this.m31 = v[3];
return;
case 2:
this.m32 = v[3];
return;
case 3:
this.m03 = v[0];
this.m13 = v[1];
this.m23 = v[2];
this.m33 = v[3];
return;
default:
this.err ();
}
}, "~N,~A");
Clazz_defineMethod (c$, "getColumn", 
function (column, v) {
if (column < 3) this.getColumn33 (column, v);
switch (column) {
case 0:
v[3] = this.m30;
return;
case 1:
v[3] = this.m31;
return;
case 2:
v[3] = this.m32;
return;
case 3:
v[0] = this.m03;
v[1] = this.m13;
v[2] = this.m23;
v[3] = this.m33;
return;
default:
this.err ();
}
}, "~N,~A");
Clazz_defineMethod (c$, "sub", 
function (m1) {
this.sub33 (m1);
this.m03 -= m1.m03;
this.m13 -= m1.m13;
this.m23 -= m1.m23;
this.m30 -= m1.m30;
this.m31 -= m1.m31;
this.m32 -= m1.m32;
this.m33 -= m1.m33;
}, "JU.M4");
Clazz_defineMethod (c$, "transpose", 
function () {
this.transpose33 ();
var tmp = this.m03;
this.m03 = this.m30;
this.m30 = tmp;
tmp = this.m13;
this.m13 = this.m31;
this.m31 = tmp;
tmp = this.m23;
this.m23 = this.m32;
this.m32 = tmp;
});
Clazz_defineMethod (c$, "invert", 
function () {
var s = this.determinant4 ();
if (s == 0.0) return this;
s = 1 / s;
this.set (this.m11 * (this.m22 * this.m33 - this.m23 * this.m32) + this.m12 * (this.m23 * this.m31 - this.m21 * this.m33) + this.m13 * (this.m21 * this.m32 - this.m22 * this.m31), this.m21 * (this.m02 * this.m33 - this.m03 * this.m32) + this.m22 * (this.m03 * this.m31 - this.m01 * this.m33) + this.m23 * (this.m01 * this.m32 - this.m02 * this.m31), this.m31 * (this.m02 * this.m13 - this.m03 * this.m12) + this.m32 * (this.m03 * this.m11 - this.m01 * this.m13) + this.m33 * (this.m01 * this.m12 - this.m02 * this.m11), this.m01 * (this.m13 * this.m22 - this.m12 * this.m23) + this.m02 * (this.m11 * this.m23 - this.m13 * this.m21) + this.m03 * (this.m12 * this.m21 - this.m11 * this.m22), this.m12 * (this.m20 * this.m33 - this.m23 * this.m30) + this.m13 * (this.m22 * this.m30 - this.m20 * this.m32) + this.m10 * (this.m23 * this.m32 - this.m22 * this.m33), this.m22 * (this.m00 * this.m33 - this.m03 * this.m30) + this.m23 * (this.m02 * this.m30 - this.m00 * this.m32) + this.m20 * (this.m03 * this.m32 - this.m02 * this.m33), this.m32 * (this.m00 * this.m13 - this.m03 * this.m10) + this.m33 * (this.m02 * this.m10 - this.m00 * this.m12) + this.m30 * (this.m03 * this.m12 - this.m02 * this.m13), this.m02 * (this.m13 * this.m20 - this.m10 * this.m23) + this.m03 * (this.m10 * this.m22 - this.m12 * this.m20) + this.m00 * (this.m12 * this.m23 - this.m13 * this.m22), this.m13 * (this.m20 * this.m31 - this.m21 * this.m30) + this.m10 * (this.m21 * this.m33 - this.m23 * this.m31) + this.m11 * (this.m23 * this.m30 - this.m20 * this.m33), this.m23 * (this.m00 * this.m31 - this.m01 * this.m30) + this.m20 * (this.m01 * this.m33 - this.m03 * this.m31) + this.m21 * (this.m03 * this.m30 - this.m00 * this.m33), this.m33 * (this.m00 * this.m11 - this.m01 * this.m10) + this.m30 * (this.m01 * this.m13 - this.m03 * this.m11) + this.m31 * (this.m03 * this.m10 - this.m00 * this.m13), this.m03 * (this.m11 * this.m20 - this.m10 * this.m21) + this.m00 * (this.m13 * this.m21 - this.m11 * this.m23) + this.m01 * (this.m10 * this.m23 - this.m13 * this.m20), this.m10 * (this.m22 * this.m31 - this.m21 * this.m32) + this.m11 * (this.m20 * this.m32 - this.m22 * this.m30) + this.m12 * (this.m21 * this.m30 - this.m20 * this.m31), this.m20 * (this.m02 * this.m31 - this.m01 * this.m32) + this.m21 * (this.m00 * this.m32 - this.m02 * this.m30) + this.m22 * (this.m01 * this.m30 - this.m00 * this.m31), this.m30 * (this.m02 * this.m11 - this.m01 * this.m12) + this.m31 * (this.m00 * this.m12 - this.m02 * this.m10) + this.m32 * (this.m01 * this.m10 - this.m00 * this.m11), this.m00 * (this.m11 * this.m22 - this.m12 * this.m21) + this.m01 * (this.m12 * this.m20 - this.m10 * this.m22) + this.m02 * (this.m10 * this.m21 - this.m11 * this.m20));
this.scale (s);
return this;
});
Clazz_defineMethod (c$, "set", 
 function (m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
this.m00 = m00;
this.m01 = m01;
this.m02 = m02;
this.m03 = m03;
this.m10 = m10;
this.m11 = m11;
this.m12 = m12;
this.m13 = m13;
this.m20 = m20;
this.m21 = m21;
this.m22 = m22;
this.m23 = m23;
this.m30 = m30;
this.m31 = m31;
this.m32 = m32;
this.m33 = m33;
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "determinant4", 
function () {
return (this.m00 * this.m11 - this.m01 * this.m10) * (this.m22 * this.m33 - this.m23 * this.m32) - (this.m00 * this.m12 - this.m02 * this.m10) * (this.m21 * this.m33 - this.m23 * this.m31) + (this.m00 * this.m13 - this.m03 * this.m10) * (this.m21 * this.m32 - this.m22 * this.m31) + (this.m01 * this.m12 - this.m02 * this.m11) * (this.m20 * this.m33 - this.m23 * this.m30) - (this.m01 * this.m13 - this.m03 * this.m11) * (this.m20 * this.m32 - this.m22 * this.m30) + (this.m02 * this.m13 - this.m03 * this.m12) * (this.m20 * this.m31 - this.m21 * this.m30);
});
Clazz_defineMethod (c$, "scale", 
 function (scalar) {
this.mul33 (scalar);
this.m03 *= scalar;
this.m13 *= scalar;
this.m23 *= scalar;
this.m30 *= scalar;
this.m31 *= scalar;
this.m32 *= scalar;
this.m33 *= scalar;
}, "~N");
Clazz_defineMethod (c$, "mul", 
function (m1) {
this.mul2 (this, m1);
}, "JU.M4");
Clazz_defineMethod (c$, "mul2", 
function (m1, m2) {
this.set (m1.m00 * m2.m00 + m1.m01 * m2.m10 + m1.m02 * m2.m20 + m1.m03 * m2.m30, m1.m00 * m2.m01 + m1.m01 * m2.m11 + m1.m02 * m2.m21 + m1.m03 * m2.m31, m1.m00 * m2.m02 + m1.m01 * m2.m12 + m1.m02 * m2.m22 + m1.m03 * m2.m32, m1.m00 * m2.m03 + m1.m01 * m2.m13 + m1.m02 * m2.m23 + m1.m03 * m2.m33, m1.m10 * m2.m00 + m1.m11 * m2.m10 + m1.m12 * m2.m20 + m1.m13 * m2.m30, m1.m10 * m2.m01 + m1.m11 * m2.m11 + m1.m12 * m2.m21 + m1.m13 * m2.m31, m1.m10 * m2.m02 + m1.m11 * m2.m12 + m1.m12 * m2.m22 + m1.m13 * m2.m32, m1.m10 * m2.m03 + m1.m11 * m2.m13 + m1.m12 * m2.m23 + m1.m13 * m2.m33, m1.m20 * m2.m00 + m1.m21 * m2.m10 + m1.m22 * m2.m20 + m1.m23 * m2.m30, m1.m20 * m2.m01 + m1.m21 * m2.m11 + m1.m22 * m2.m21 + m1.m23 * m2.m31, m1.m20 * m2.m02 + m1.m21 * m2.m12 + m1.m22 * m2.m22 + m1.m23 * m2.m32, m1.m20 * m2.m03 + m1.m21 * m2.m13 + m1.m22 * m2.m23 + m1.m23 * m2.m33, m1.m30 * m2.m00 + m1.m31 * m2.m10 + m1.m32 * m2.m20 + m1.m33 * m2.m30, m1.m30 * m2.m01 + m1.m31 * m2.m11 + m1.m32 * m2.m21 + m1.m33 * m2.m31, m1.m30 * m2.m02 + m1.m31 * m2.m12 + m1.m32 * m2.m22 + m1.m33 * m2.m32, m1.m30 * m2.m03 + m1.m31 * m2.m13 + m1.m32 * m2.m23 + m1.m33 * m2.m33);
}, "JU.M4,JU.M4");
Clazz_defineMethod (c$, "transform", 
function (vec) {
this.transform2 (vec, vec);
}, "JU.T4");
Clazz_defineMethod (c$, "transform2", 
function (vec, vecOut) {
vecOut.set4 (this.m00 * vec.x + this.m01 * vec.y + this.m02 * vec.z + this.m03 * vec.w, this.m10 * vec.x + this.m11 * vec.y + this.m12 * vec.z + this.m13 * vec.w, this.m20 * vec.x + this.m21 * vec.y + this.m22 * vec.z + this.m23 * vec.w, this.m30 * vec.x + this.m31 * vec.y + this.m32 * vec.z + this.m33 * vec.w);
}, "JU.T4,JU.T4");
Clazz_defineMethod (c$, "rotTrans", 
function (point) {
this.rotTrans2 (point, point);
}, "JU.T3");
Clazz_defineMethod (c$, "rotTrans2", 
function (point, pointOut) {
pointOut.set (this.m00 * point.x + this.m01 * point.y + this.m02 * point.z + this.m03, this.m10 * point.x + this.m11 * point.y + this.m12 * point.z + this.m13, this.m20 * point.x + this.m21 * point.y + this.m22 * point.z + this.m23);
return pointOut;
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "setAsXYRotation", 
function (angle) {
this.setIdentity ();
var c = Math.cos (angle);
var s = Math.sin (angle);
this.m22 = c;
this.m23 = -s;
this.m32 = s;
this.m33 = c;
return this;
}, "~N");
Clazz_defineMethod (c$, "setAsYZRotation", 
function (angle) {
this.setIdentity ();
var c = Math.cos (angle);
var s = Math.sin (angle);
this.m00 = c;
this.m03 = -s;
this.m30 = s;
this.m33 = c;
return this;
}, "~N");
Clazz_defineMethod (c$, "setAsXZRotation", 
function (angle) {
this.setIdentity ();
var c = Math.cos (angle);
var s = Math.sin (angle);
this.m11 = c;
this.m13 = -s;
this.m31 = s;
this.m33 = c;
return this;
}, "~N");
Clazz_overrideMethod (c$, "equals", 
function (o) {
if (!(Clazz_instanceOf (o, JU.M4))) return false;
var m = o;
return (this.m00 == m.m00 && this.m01 == m.m01 && this.m02 == m.m02 && this.m03 == m.m03 && this.m10 == m.m10 && this.m11 == m.m11 && this.m12 == m.m12 && this.m13 == m.m13 && this.m20 == m.m20 && this.m21 == m.m21 && this.m22 == m.m22 && this.m23 == m.m23 && this.m30 == m.m30 && this.m31 == m.m31 && this.m32 == m.m32 && this.m33 == m.m33);
}, "~O");
Clazz_overrideMethod (c$, "hashCode", 
function () {
return JU.T3.floatToIntBits0 (this.m00) ^ JU.T3.floatToIntBits0 (this.m01) ^ JU.T3.floatToIntBits0 (this.m02) ^ JU.T3.floatToIntBits0 (this.m03) ^ JU.T3.floatToIntBits0 (this.m10) ^ JU.T3.floatToIntBits0 (this.m11) ^ JU.T3.floatToIntBits0 (this.m12) ^ JU.T3.floatToIntBits0 (this.m13) ^ JU.T3.floatToIntBits0 (this.m20) ^ JU.T3.floatToIntBits0 (this.m21) ^ JU.T3.floatToIntBits0 (this.m22) ^ JU.T3.floatToIntBits0 (this.m23) ^ JU.T3.floatToIntBits0 (this.m30) ^ JU.T3.floatToIntBits0 (this.m31) ^ JU.T3.floatToIntBits0 (this.m32) ^ JU.T3.floatToIntBits0 (this.m33);
});
Clazz_overrideMethod (c$, "toString", 
function () {
return "[\n  [" + this.m00 + "\t" + this.m01 + "\t" + this.m02 + "\t" + this.m03 + "]" + "\n  [" + this.m10 + "\t" + this.m11 + "\t" + this.m12 + "\t" + this.m13 + "]" + "\n  [" + this.m20 + "\t" + this.m21 + "\t" + this.m22 + "\t" + this.m23 + "]" + "\n  [" + this.m30 + "\t" + this.m31 + "\t" + this.m32 + "\t" + this.m33 + "] ]";
});
});
Clazz_declarePackage ("JU");
Clazz_load (["java.io.OutputStream"], "JU.OC", ["java.io.BufferedWriter", "$.ByteArrayOutputStream", "$.OutputStreamWriter", "JU.Base64", "$.SB"], function () {
c$ = Clazz_decorateAsClass (function () {
this.bytePoster = null;
this.fileName = null;
this.bw = null;
this.isLocalFile = false;
this.byteCount = 0;
this.isCanceled = false;
this.closed = false;
this.os = null;
this.sb = null;
this.type = null;
this.$isBase64 = false;
this.os0 = null;
this.bytes = null;
Clazz_instantialize (this, arguments);
}, JU, "OC", java.io.OutputStream);
Clazz_defineMethod (c$, "setParams", 
function (bytePoster, fileName, asWriter, os) {
this.bytePoster = bytePoster;
this.fileName = fileName;
this.$isBase64 = ";base64,".equals (fileName);
if (this.$isBase64) {
fileName = null;
this.os0 = os;
os = null;
}this.os = os;
this.isLocalFile = (fileName != null && !JU.OC.isRemote (fileName));
if (asWriter && !this.$isBase64 && os != null) this.bw =  new java.io.BufferedWriter ( new java.io.OutputStreamWriter (os));
return this;
}, "javajs.api.BytePoster,~S,~B,java.io.OutputStream");
Clazz_defineMethod (c$, "setBytes", 
function (b) {
this.bytes = b;
return this;
}, "~A");
Clazz_defineMethod (c$, "getFileName", 
function () {
return this.fileName;
});
Clazz_defineMethod (c$, "getName", 
function () {
return (this.fileName == null ? null : this.fileName.substring (this.fileName.lastIndexOf ("/") + 1));
});
Clazz_defineMethod (c$, "getByteCount", 
function () {
return this.byteCount;
});
Clazz_defineMethod (c$, "setType", 
function (type) {
this.type = type;
}, "~S");
Clazz_defineMethod (c$, "getType", 
function () {
return this.type;
});
Clazz_defineMethod (c$, "append", 
function (s) {
try {
if (this.bw != null) {
this.bw.write (s);
} else if (this.os == null) {
if (this.sb == null) this.sb =  new JU.SB ();
this.sb.append (s);
} else {
var b = s.getBytes ();
this.os.write (b, 0, b.length);
this.byteCount += b.length;
return this;
}} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
} else {
throw e;
}
}
this.byteCount += s.length;
return this;
}, "~S");
Clazz_defineMethod (c$, "reset", 
function () {
this.sb = null;
this.initOS ();
});
Clazz_defineMethod (c$, "initOS", 
 function () {
if (this.sb != null) {
var s = this.sb.toString ();
this.reset ();
this.append (s);
return;
}try {
{
this.os = null;
}if (this.os == null) this.os =  new java.io.ByteArrayOutputStream ();
if (this.bw != null) {
this.bw.close ();
this.bw =  new java.io.BufferedWriter ( new java.io.OutputStreamWriter (this.os));
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
System.out.println (e.toString ());
} else {
throw e;
}
}
this.byteCount = 0;
});
Clazz_overrideMethod (c$, "write", 
function (buf, i, len) {
if (this.os == null) this.initOS ();
try {
this.os.write (buf, i, len);
} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
} else {
throw e;
}
}
this.byteCount += len;
}, "~A,~N,~N");
Clazz_overrideMethod (c$, "writeByteAsInt", 
function (b) {
if (this.os == null) this.initOS ();
{
this.os.writeByteAsInt(b);
}this.byteCount++;
}, "~N");
Clazz_defineMethod (c$, "cancel", 
function () {
this.isCanceled = true;
this.closeChannel ();
});
Clazz_defineMethod (c$, "closeChannel", 
function () {
if (this.closed) return null;
try {
if (this.bw != null) {
this.bw.flush ();
this.bw.close ();
} else if (this.os != null) {
this.os.flush ();
this.os.close ();
}if (this.os0 != null && this.isCanceled) {
this.os0.flush ();
this.os0.close ();
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
if (this.isCanceled) {
this.closed = true;
return null;
}if (this.fileName == null) {
if (this.$isBase64) {
var s = this.getBase64 ();
if (this.os0 != null) {
this.os = this.os0;
this.append (s);
}this.sb =  new JU.SB ();
this.sb.append (s);
this.$isBase64 = false;
return this.closeChannel ();
}return (this.sb == null ? null : this.sb.toString ());
}this.closed = true;
{
var data = (this.sb == null ? this.toByteArray() :
this.sb.toString()); if (typeof this.fileName == "function") {
this.fileName(data); } else { Jmol._doAjax(this.fileName,
null, data); }
}return null;
});
Clazz_defineMethod (c$, "isBase64", 
function () {
return this.$isBase64;
});
Clazz_defineMethod (c$, "getBase64", 
function () {
return JU.Base64.getBase64 (this.toByteArray ()).toString ();
});
Clazz_defineMethod (c$, "toByteArray", 
function () {
return (this.bytes != null ? this.bytes : Clazz_instanceOf (this.os, java.io.ByteArrayOutputStream) ? (this.os).toByteArray () : null);
});
Clazz_defineMethod (c$, "close", 
function () {
this.closeChannel ();
});
Clazz_overrideMethod (c$, "toString", 
function () {
if (this.bw != null) try {
this.bw.flush ();
} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
} else {
throw e;
}
}
if (this.sb != null) return this.closeChannel ();
return this.byteCount + " bytes";
});
Clazz_defineMethod (c$, "postByteArray", 
 function () {
var bytes = (this.sb == null ? this.toByteArray () : this.sb.toString ().getBytes ());
return this.bytePoster.postByteArray (this.fileName, bytes);
});
c$.isRemote = Clazz_defineMethod (c$, "isRemote", 
function (fileName) {
if (fileName == null) return false;
var itype = JU.OC.urlTypeIndex (fileName);
return (itype >= 0 && itype != 4);
}, "~S");
c$.isLocal = Clazz_defineMethod (c$, "isLocal", 
function (fileName) {
if (fileName == null) return false;
var itype = JU.OC.urlTypeIndex (fileName);
return (itype < 0 || itype == 4);
}, "~S");
c$.urlTypeIndex = Clazz_defineMethod (c$, "urlTypeIndex", 
function (name) {
if (name == null) return -2;
for (var i = 0; i < JU.OC.urlPrefixes.length; ++i) {
if (name.startsWith (JU.OC.urlPrefixes[i])) {
return i;
}}
return -1;
}, "~S");
Clazz_defineStatics (c$,
"urlPrefixes", ["http:", "https:", "sftp:", "ftp:", "file:"],
"URL_LOCAL", 4);
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.T3"], "JU.P3", null, function () {
c$ = Clazz_declareType (JU, "P3", JU.T3);
c$.newP = Clazz_defineMethod (c$, "newP", 
function (t) {
var p =  new JU.P3 ();
p.x = t.x;
p.y = t.y;
p.z = t.z;
return p;
}, "JU.T3");
c$.getUnlikely = Clazz_defineMethod (c$, "getUnlikely", 
function () {
return (JU.P3.unlikely == null ? JU.P3.unlikely = JU.P3.new3 (3.141592653589793, 2.718281828459045, (8.539734222673566)) : JU.P3.unlikely);
});
c$.new3 = Clazz_defineMethod (c$, "new3", 
function (x, y, z) {
var p =  new JU.P3 ();
p.x = x;
p.y = y;
p.z = z;
return p;
}, "~N,~N,~N");
Clazz_defineStatics (c$,
"unlikely", null);
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.T3i"], "JU.P3i", null, function () {
c$ = Clazz_declareType (JU, "P3i", JU.T3i);
c$.new3 = Clazz_defineMethod (c$, "new3", 
function (x, y, z) {
var pt =  new JU.P3i ();
pt.x = x;
pt.y = y;
pt.z = z;
return pt;
}, "~N,~N,~N");
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.T4"], "JU.P4", null, function () {
c$ = Clazz_declareType (JU, "P4", JU.T4);
c$.new4 = Clazz_defineMethod (c$, "new4", 
function (x, y, z, w) {
var pt =  new JU.P4 ();
pt.set4 (x, y, z, w);
return pt;
}, "~N,~N,~N,~N");
c$.newPt = Clazz_defineMethod (c$, "newPt", 
function (value) {
var pt =  new JU.P4 ();
pt.set4 (value.x, value.y, value.z, value.w);
return pt;
}, "JU.P4");
Clazz_defineMethod (c$, "distance4", 
function (p1) {
var dx = this.x - p1.x;
var dy = this.y - p1.y;
var dz = this.z - p1.z;
var dw = this.w - p1.w;
return Math.sqrt (dx * dx + dy * dy + dz * dz + dw * dw);
}, "JU.P4");
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.PT", ["java.lang.Boolean", "$.Double", "$.Float", "$.Number", "java.util.Map", "javajs.api.JSONEncodable", "JU.AU", "$.DF", "$.Lst", "$.M34", "$.M4", "$.SB"], function () {
c$ = Clazz_declareType (JU, "PT");
c$.parseInt = Clazz_defineMethod (c$, "parseInt", 
function (str) {
return JU.PT.parseIntNext (str, [0]);
}, "~S");
c$.parseIntNext = Clazz_defineMethod (c$, "parseIntNext", 
function (str, next) {
var cch = str.length;
if (next[0] < 0 || next[0] >= cch) return -2147483648;
return JU.PT.parseIntChecked (str, cch, next);
}, "~S,~A");
c$.parseIntChecked = Clazz_defineMethod (c$, "parseIntChecked", 
function (str, ichMax, next) {
var digitSeen = false;
var value = 0;
var ich = next[0];
if (ich < 0) return -2147483648;
var ch;
while (ich < ichMax && JU.PT.isWhiteSpace (str, ich)) ++ich;

var negative = false;
if (ich < ichMax && str.charCodeAt (ich) == 45) {
negative = true;
++ich;
}while (ich < ichMax && (ch = str.charCodeAt (ich)) >= 48 && ch <= 57) {
value = value * 10 + (ch - 48);
digitSeen = true;
++ich;
}
if (!digitSeen) value = -2147483648;
 else if (negative) value = -value;
next[0] = ich;
return value;
}, "~S,~N,~A");
c$.isWhiteSpace = Clazz_defineMethod (c$, "isWhiteSpace", 
function (str, ich) {
var ch;
return (ich >= 0 && ((ch = str.charAt (ich)) == ' ' || ch == '\t' || ch == '\n'));
}, "~S,~N");
c$.parseFloatChecked = Clazz_defineMethod (c$, "parseFloatChecked", 
function (str, ichMax, next, isStrict) {
var digitSeen = false;
var ich = next[0];
if (isStrict && str.indexOf ('\n') != str.lastIndexOf ('\n')) return NaN;
while (ich < ichMax && JU.PT.isWhiteSpace (str, ich)) ++ich;

var negative = false;
if (ich < ichMax && str.charAt (ich) == '-') {
++ich;
negative = true;
}var ch = 0;
var ival = 0;
var ival2 = 0;
while (ich < ichMax && (ch = str.charCodeAt (ich)) >= 48 && ch <= 57) {
ival = (ival * 10) + (ch - 48) * 1;
++ich;
digitSeen = true;
}
var isDecimal = false;
var iscale = 0;
var nzero = (ival == 0 ? -1 : 0);
if (ch == 46) {
isDecimal = true;
while (++ich < ichMax && (ch = str.charCodeAt (ich)) >= 48 && ch <= 57) {
digitSeen = true;
if (nzero < 0) {
if (ch == 48) {
nzero--;
continue;
}nzero = -nzero;
}if (iscale < JU.PT.decimalScale.length) {
ival2 = (ival2 * 10) + (ch - 48) * 1;
iscale++;
}}
}var value;
if (!digitSeen) {
value = NaN;
} else if (ival2 > 0) {
value = ival2 * JU.PT.decimalScale[iscale - 1];
if (nzero > 1) {
if (nzero - 2 < JU.PT.decimalScale.length) {
value *= JU.PT.decimalScale[nzero - 2];
} else {
value *= Math.pow (10, 1 - nzero);
}} else {
value += ival;
}} else {
value = ival;
}var isExponent = false;
if (ich < ichMax && (ch == 69 || ch == 101 || ch == 68)) {
isExponent = true;
if (++ich >= ichMax) return NaN;
ch = str.charCodeAt (ich);
if ((ch == 43) && (++ich >= ichMax)) return NaN;
next[0] = ich;
var exponent = JU.PT.parseIntChecked (str, ichMax, next);
if (exponent == -2147483648) return NaN;
if (exponent > 0 && exponent <= JU.PT.tensScale.length) value *= JU.PT.tensScale[exponent - 1];
 else if (exponent < 0 && -exponent <= JU.PT.decimalScale.length) value *= JU.PT.decimalScale[-exponent - 1];
 else if (exponent != 0) value *= Math.pow (10, exponent);
} else {
next[0] = ich;
}if (negative) value = -value;
if (value == Infinity) value = 3.4028235E38;
return (!isStrict || (!isExponent || isDecimal) && JU.PT.checkTrailingText (str, next[0], ichMax) ? value : NaN);
}, "~S,~N,~A,~B");
c$.checkTrailingText = Clazz_defineMethod (c$, "checkTrailingText", 
function (str, ich, ichMax) {
var ch;
while (ich < ichMax && (JU.PT.isWhitespace (ch = str.charAt (ich)) || ch == ';')) ++ich;

return (ich == ichMax);
}, "~S,~N,~N");
c$.parseFloatArray = Clazz_defineMethod (c$, "parseFloatArray", 
function (str) {
return JU.PT.parseFloatArrayNext (str,  Clazz_newIntArray (1, 0), null, null, null);
}, "~S");
c$.parseFloatArrayInfested = Clazz_defineMethod (c$, "parseFloatArrayInfested", 
function (tokens, data) {
var len = data.length;
var nTokens = tokens.length;
var n = 0;
var max = 0;
for (var i = 0; i >= 0 && i < len && n < nTokens; i++) {
var f;
while (Float.isNaN (f = JU.PT.parseFloat (tokens[n++])) && n < nTokens) {
}
if (!Float.isNaN (f)) data[(max = i)] = f;
if (n == nTokens) break;
}
return max + 1;
}, "~A,~A");
c$.parseFloatArrayNext = Clazz_defineMethod (c$, "parseFloatArrayNext", 
function (str, next, f, strStart, strEnd) {
var n = 0;
var pt = next[0];
if (pt >= 0) {
if (strStart != null) {
var p = str.indexOf (strStart, pt);
if (p >= 0) next[0] = p + strStart.length;
}str = str.substring (next[0]);
pt = (strEnd == null ? -1 : str.indexOf (strEnd));
if (pt < 0) pt = str.length;
 else str = str.substring (0, pt);
next[0] += pt + 1;
var tokens = JU.PT.getTokens (str);
if (f == null) f =  Clazz_newFloatArray (tokens.length, 0);
n = JU.PT.parseFloatArrayInfested (tokens, f);
}if (f == null) return  Clazz_newFloatArray (0, 0);
for (var i = n; i < f.length; i++) f[i] = NaN;

return f;
}, "~S,~A,~A,~S,~S");
c$.parseFloatRange = Clazz_defineMethod (c$, "parseFloatRange", 
function (str, ichMax, next) {
var cch = str.length;
if (ichMax > cch) ichMax = cch;
if (next[0] < 0 || next[0] >= ichMax) return NaN;
return JU.PT.parseFloatChecked (str, ichMax, next, false);
}, "~S,~N,~A");
c$.parseFloatNext = Clazz_defineMethod (c$, "parseFloatNext", 
function (str, next) {
var cch = (str == null ? -1 : str.length);
if (next[0] < 0 || next[0] >= cch) return NaN;
return JU.PT.parseFloatChecked (str, cch, next, false);
}, "~S,~A");
c$.parseFloatStrict = Clazz_defineMethod (c$, "parseFloatStrict", 
function (str) {
var cch = str.length;
if (cch == 0) return NaN;
return JU.PT.parseFloatChecked (str, cch, [0], true);
}, "~S");
c$.parseFloat = Clazz_defineMethod (c$, "parseFloat", 
function (str) {
return JU.PT.parseFloatNext (str, [0]);
}, "~S");
c$.parseIntRadix = Clazz_defineMethod (c$, "parseIntRadix", 
function (s, i) {
{
return Integer.parseIntRadix(s, i);
}}, "~S,~N");
c$.getTokens = Clazz_defineMethod (c$, "getTokens", 
function (line) {
return JU.PT.getTokensAt (line, 0);
}, "~S");
c$.parseToken = Clazz_defineMethod (c$, "parseToken", 
function (str) {
return JU.PT.parseTokenNext (str, [0]);
}, "~S");
c$.parseTrimmed = Clazz_defineMethod (c$, "parseTrimmed", 
function (str) {
return JU.PT.parseTrimmedRange (str, 0, str.length);
}, "~S");
c$.parseTrimmedAt = Clazz_defineMethod (c$, "parseTrimmedAt", 
function (str, ichStart) {
return JU.PT.parseTrimmedRange (str, ichStart, str.length);
}, "~S,~N");
c$.parseTrimmedRange = Clazz_defineMethod (c$, "parseTrimmedRange", 
function (str, ichStart, ichMax) {
var cch = str.length;
if (ichMax < cch) cch = ichMax;
if (cch < ichStart) return "";
return JU.PT.parseTrimmedChecked (str, ichStart, cch);
}, "~S,~N,~N");
c$.getTokensAt = Clazz_defineMethod (c$, "getTokensAt", 
function (line, ich) {
if (line == null) return null;
var cchLine = line.length;
if (ich < 0 || ich > cchLine) return null;
var tokenCount = JU.PT.countTokens (line, ich);
var tokens =  new Array (tokenCount);
var next =  Clazz_newIntArray (1, 0);
next[0] = ich;
for (var i = 0; i < tokenCount; ++i) tokens[i] = JU.PT.parseTokenChecked (line, cchLine, next);

return tokens;
}, "~S,~N");
c$.countTokens = Clazz_defineMethod (c$, "countTokens", 
function (line, ich) {
var tokenCount = 0;
if (line != null) {
var ichMax = line.length;
while (true) {
while (ich < ichMax && JU.PT.isWhiteSpace (line, ich)) ++ich;

if (ich == ichMax) break;
++tokenCount;
do {
++ich;
} while (ich < ichMax && !JU.PT.isWhiteSpace (line, ich));
}
}return tokenCount;
}, "~S,~N");
c$.parseTokenNext = Clazz_defineMethod (c$, "parseTokenNext", 
function (str, next) {
var cch = str.length;
if (next[0] < 0 || next[0] >= cch) return null;
return JU.PT.parseTokenChecked (str, cch, next);
}, "~S,~A");
c$.parseTokenRange = Clazz_defineMethod (c$, "parseTokenRange", 
function (str, ichMax, next) {
var cch = str.length;
if (ichMax > cch) ichMax = cch;
if (next[0] < 0 || next[0] >= ichMax) return null;
return JU.PT.parseTokenChecked (str, ichMax, next);
}, "~S,~N,~A");
c$.parseTokenChecked = Clazz_defineMethod (c$, "parseTokenChecked", 
function (str, ichMax, next) {
var ich = next[0];
while (ich < ichMax && JU.PT.isWhiteSpace (str, ich)) ++ich;

var ichNonWhite = ich;
while (ich < ichMax && !JU.PT.isWhiteSpace (str, ich)) ++ich;

next[0] = ich;
if (ichNonWhite == ich) return null;
return str.substring (ichNonWhite, ich);
}, "~S,~N,~A");
c$.parseTrimmedChecked = Clazz_defineMethod (c$, "parseTrimmedChecked", 
function (str, ich, ichMax) {
while (ich < ichMax && JU.PT.isWhiteSpace (str, ich)) ++ich;

var ichLast = ichMax - 1;
while (ichLast >= ich && JU.PT.isWhiteSpace (str, ichLast)) --ichLast;

if (ichLast < ich) return "";
return str.substring (ich, ichLast + 1);
}, "~S,~N,~N");
c$.dVal = Clazz_defineMethod (c$, "dVal", 
function (s) {
{
if(s==null)
throw new NumberFormatException("null");
var d=parseFloat(s);
if(isNaN(d))
throw new NumberFormatException("Not a Number : "+s);
return d
}}, "~S");
c$.fVal = Clazz_defineMethod (c$, "fVal", 
function (s) {
{
return this.dVal(s);
}}, "~S");
c$.parseIntRange = Clazz_defineMethod (c$, "parseIntRange", 
function (str, ichMax, next) {
var cch = str.length;
if (ichMax > cch) ichMax = cch;
if (next[0] < 0 || next[0] >= ichMax) return -2147483648;
return JU.PT.parseIntChecked (str, ichMax, next);
}, "~S,~N,~A");
c$.parseFloatArrayData = Clazz_defineMethod (c$, "parseFloatArrayData", 
function (tokens, data) {
JU.PT.parseFloatArrayDataN (tokens, data, data.length);
}, "~A,~A");
c$.parseFloatArrayDataN = Clazz_defineMethod (c$, "parseFloatArrayDataN", 
function (tokens, data, nData) {
for (var i = nData; --i >= 0; ) data[i] = (i >= tokens.length ? NaN : JU.PT.parseFloat (tokens[i]));

}, "~A,~A,~N");
c$.split = Clazz_defineMethod (c$, "split", 
function (text, run) {
if (text.length == 0) return  new Array (0);
var n = 1;
var i = text.indexOf (run);
var lines;
var runLen = run.length;
if (i < 0 || runLen == 0) {
lines =  new Array (1);
lines[0] = text;
return lines;
}var len = text.length - runLen;
for (; i >= 0 && i < len; n++) i = text.indexOf (run, i + runLen);

lines =  new Array (n);
i = 0;
var ipt = 0;
var pt = 0;
for (; (ipt = text.indexOf (run, i)) >= 0 && pt + 1 < n; ) {
lines[pt++] = text.substring (i, ipt);
i = ipt + runLen;
}
if (text.indexOf (run, len) != len) len += runLen;
lines[pt] = text.substring (i, len);
return lines;
}, "~S,~S");
c$.getQuotedStringAt = Clazz_defineMethod (c$, "getQuotedStringAt", 
function (line, ipt0) {
var next = [ipt0];
return JU.PT.getQuotedStringNext (line, next);
}, "~S,~N");
c$.getQuotedStringNext = Clazz_defineMethod (c$, "getQuotedStringNext", 
function (line, next) {
var i = next[0];
if (i < 0 || (i = line.indexOf ("\"", i)) < 0) return "";
var pt = i + 1;
var len = line.length;
while (++i < len && line.charAt (i) != '"') if (line.charAt (i) == '\\') i++;

next[0] = i + 1;
return line.substring (pt, i);
}, "~S,~A");
c$.getCSVString = Clazz_defineMethod (c$, "getCSVString", 
function (line, next) {
var i = next[1];
if (i < 0 || (i = line.indexOf ("\"", i)) < 0) return null;
var pt = next[0] = i;
var len = line.length;
var escaped = false;
var haveEscape = false;
while (++i < len && (line.charAt (i) != '"' || (escaped = (i + 1 < len && line.charAt (i + 1) == '"')))) if (escaped) {
escaped = false;
haveEscape = true;
i++;
}
if (i >= len) {
next[1] = -1;
return null;
}next[1] = i + 1;
var s = line.substring (pt + 1, i);
return (haveEscape ? JU.PT.rep (JU.PT.rep (s, "\"\"", "\0"), "\0", "\"") : s);
}, "~S,~A");
c$.isOneOf = Clazz_defineMethod (c$, "isOneOf", 
function (key, semiList) {
if (semiList.length == 0) return false;
if (semiList.charAt (0) != ';') semiList = ";" + semiList + ";";
return key.indexOf (";") < 0 && semiList.indexOf (';' + key + ';') >= 0;
}, "~S,~S");
c$.getQuotedAttribute = Clazz_defineMethod (c$, "getQuotedAttribute", 
function (info, name) {
var i = info.indexOf (name + "=");
return (i < 0 ? null : JU.PT.getQuotedStringAt (info, i));
}, "~S,~S");
c$.approx = Clazz_defineMethod (c$, "approx", 
function (f, n) {
return Math.round (f * n) / n;
}, "~N,~N");
c$.rep = Clazz_defineMethod (c$, "rep", 
function (str, strFrom, strTo) {
if (str == null || strFrom.length == 0 || str.indexOf (strFrom) < 0) return str;
var isOnce = (strTo.indexOf (strFrom) >= 0);
do {
str = str.$replace (strFrom, strTo);
} while (!isOnce && str.indexOf (strFrom) >= 0);
return str;
}, "~S,~S,~S");
c$.formatF = Clazz_defineMethod (c$, "formatF", 
function (value, width, precision, alignLeft, zeroPad) {
return JU.PT.formatS (JU.DF.formatDecimal (value, precision), width, 0, alignLeft, zeroPad);
}, "~N,~N,~N,~B,~B");
c$.formatD = Clazz_defineMethod (c$, "formatD", 
function (value, width, precision, alignLeft, zeroPad, allowOverflow) {
return JU.PT.formatS (JU.DF.formatDecimal (value, -1 - precision), width, 0, alignLeft, zeroPad);
}, "~N,~N,~N,~B,~B,~B");
c$.formatS = Clazz_defineMethod (c$, "formatS", 
function (value, width, precision, alignLeft, zeroPad) {
if (value == null) return "";
var len = value.length;
if (precision != 2147483647 && precision > 0 && precision < len) value = value.substring (0, precision);
 else if (precision < 0 && len + precision >= 0) value = value.substring (len + precision + 1);
var padLength = width - value.length;
if (padLength <= 0) return value;
var isNeg = (zeroPad && !alignLeft && value.charAt (0) == '-');
var padChar = (zeroPad ? '0' : ' ');
var padChar0 = (isNeg ? '-' : padChar);
var sb =  new JU.SB ();
if (alignLeft) sb.append (value);
sb.appendC (padChar0);
for (var i = padLength; --i > 0; ) sb.appendC (padChar);

if (!alignLeft) sb.append (isNeg ? padChar + value.substring (1) : value);
return sb.toString ();
}, "~S,~N,~N,~B,~B");
c$.replaceWithCharacter = Clazz_defineMethod (c$, "replaceWithCharacter", 
function (str, strFrom, chTo) {
if (str == null) return null;
for (var i = strFrom.length; --i >= 0; ) str = str.$replace (strFrom.charAt (i), chTo);

return str;
}, "~S,~S,~S");
c$.replaceAllCharacters = Clazz_defineMethod (c$, "replaceAllCharacters", 
function (str, strFrom, strTo) {
for (var i = strFrom.length; --i >= 0; ) {
var chFrom = strFrom.substring (i, i + 1);
str = JU.PT.rep (str, chFrom, strTo);
}
return str;
}, "~S,~S,~S");
c$.trim = Clazz_defineMethod (c$, "trim", 
function (str, chars) {
if (chars.length == 0) return str.trim ();
var len = str.length;
var k = 0;
while (k < len && chars.indexOf (str.charAt (k)) >= 0) k++;

var m = str.length - 1;
while (m > k && chars.indexOf (str.charAt (m)) >= 0) m--;

return str.substring (k, m + 1);
}, "~S,~S");
c$.trimQuotes = Clazz_defineMethod (c$, "trimQuotes", 
function (value) {
return (value != null && value.length > 1 && value.startsWith ("\"") && value.endsWith ("\"") ? value.substring (1, value.length - 1) : value);
}, "~S");
c$.isNonStringPrimitive = Clazz_defineMethod (c$, "isNonStringPrimitive", 
function (info) {
return Clazz_instanceOf (info, Number) || Clazz_instanceOf (info, Boolean);
}, "~O");
c$.arrayGet = Clazz_defineMethod (c$, "arrayGet", 
 function (info, i) {
{
return info[i];
}}, "~O,~N");
c$.toJSON = Clazz_defineMethod (c$, "toJSON", 
function (infoType, info) {
if (info == null) return JU.PT.packageJSON (infoType, null);
if (JU.PT.isNonStringPrimitive (info)) return JU.PT.packageJSON (infoType, info.toString ());
var s = null;
var sb = null;
while (true) {
if (Clazz_instanceOf (info, String)) {
s = info;
{
if (typeof s == "undefined") s = "null"
}if (s.indexOf ("{\"") != 0) {
s = JU.PT.rep (s, "\"", "\\\"");
s = JU.PT.rep (s, "\n", "\\n");
s = "\"" + s + "\"";
}break;
}if (Clazz_instanceOf (info, javajs.api.JSONEncodable)) {
if ((s = (info).toJSON ()) == null) s = "null";
break;
}sb =  new JU.SB ();
if (Clazz_instanceOf (info, java.util.Map)) {
sb.append ("{ ");
var sep = "";
for (var key, $key = (info).keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) {
sb.append (sep).append (JU.PT.packageJSON (key, JU.PT.toJSON (null, (info).get (key))));
sep = ",";
}
sb.append (" }");
break;
}if (Clazz_instanceOf (info, JU.Lst)) {
sb.append ("[ ");
var n = (info).size ();
for (var i = 0; i < n; i++) {
if (i > 0) sb.appendC (',');
sb.append (JU.PT.toJSON (null, (info).get (i)));
}
sb.append (" ]");
break;
}if (Clazz_instanceOf (info, JU.M34)) {
var len = (Clazz_instanceOf (info, JU.M4) ? 4 : 3);
var x =  Clazz_newFloatArray (len, 0);
var m = info;
sb.appendC ('[');
for (var i = 0; i < len; i++) {
if (i > 0) sb.appendC (',');
m.getRow (i, x);
sb.append (JU.PT.toJSON (null, x));
}
sb.appendC (']');
break;
}s = JU.PT.nonArrayString (info);
if (s == null) {
sb.append ("[");
var n = JU.AU.getLength (info);
for (var i = 0; i < n; i++) {
if (i > 0) sb.appendC (',');
sb.append (JU.PT.toJSON (null, JU.PT.arrayGet (info, i)));
}
sb.append ("]");
break;
}info = info.toString ();
}
return JU.PT.packageJSON (infoType, (s == null ? sb.toString () : s));
}, "~S,~O");
c$.nonArrayString = Clazz_defineMethod (c$, "nonArrayString", 
function (x) {
{
var s = x.toString(); return (s.startsWith("[object") &&
s.endsWith("Array]") ? null : s);
}}, "~O");
c$.byteArrayToJSON = Clazz_defineMethod (c$, "byteArrayToJSON", 
function (data) {
var sb =  new JU.SB ();
sb.append ("[");
var n = data.length;
for (var i = 0; i < n; i++) {
if (i > 0) sb.appendC (',');
sb.appendI (data[i] & 0xFF);
}
sb.append ("]");
return sb.toString ();
}, "~A");
c$.packageJSON = Clazz_defineMethod (c$, "packageJSON", 
function (infoType, info) {
return (infoType == null ? info : "\"" + infoType + "\": " + info);
}, "~S,~S");
c$.isAS = Clazz_defineMethod (c$, "isAS", 
function (x) {
{
return Clazz_isAS(x);
}}, "~O");
c$.isASS = Clazz_defineMethod (c$, "isASS", 
function (x) {
{
return Clazz_isASS(x);
}}, "~O");
c$.isAP = Clazz_defineMethod (c$, "isAP", 
function (x) {
{
return Clazz_isAP(x);
}}, "~O");
c$.isAF = Clazz_defineMethod (c$, "isAF", 
function (x) {
{
return Clazz_isAF(x);
}}, "~O");
c$.isAFloat = Clazz_defineMethod (c$, "isAFloat", 
function (x) {
{
return Clazz_isAFloat(x);
}}, "~O");
c$.isAD = Clazz_defineMethod (c$, "isAD", 
function (x) {
{
return Clazz_isAF(x);
}}, "~O");
c$.isADD = Clazz_defineMethod (c$, "isADD", 
function (x) {
{
return Clazz_isAFF(x);
}}, "~O");
c$.isAB = Clazz_defineMethod (c$, "isAB", 
function (x) {
{
return Clazz_isAI(x);
}}, "~O");
c$.isAI = Clazz_defineMethod (c$, "isAI", 
function (x) {
{
return Clazz_isAI(x);
}}, "~O");
c$.isAII = Clazz_defineMethod (c$, "isAII", 
function (x) {
{
return Clazz_isAII(x);
}}, "~O");
c$.isAFF = Clazz_defineMethod (c$, "isAFF", 
function (x) {
{
return Clazz_isAFF(x);
}}, "~O");
c$.isAFFF = Clazz_defineMethod (c$, "isAFFF", 
function (x) {
{
return Clazz_isAFFF(x);
}}, "~O");
c$.escapeUrl = Clazz_defineMethod (c$, "escapeUrl", 
function (url) {
url = JU.PT.rep (url, "\n", "");
url = JU.PT.rep (url, "%", "%25");
url = JU.PT.rep (url, "#", "%23");
url = JU.PT.rep (url, "[", "%5B");
url = JU.PT.rep (url, "]", "%5D");
url = JU.PT.rep (url, " ", "%20");
return url;
}, "~S");
c$.esc = Clazz_defineMethod (c$, "esc", 
function (str) {
if (str == null || str.length == 0) return "\"\"";
var haveEscape = false;
var i = 0;
for (; i < "\\\\\tt\rr\nn\"\"".length; i += 2) if (str.indexOf ("\\\\\tt\rr\nn\"\"".charAt (i)) >= 0) {
haveEscape = true;
break;
}
if (haveEscape) while (i < "\\\\\tt\rr\nn\"\"".length) {
var pt = -1;
var ch = "\\\\\tt\rr\nn\"\"".charAt (i++);
var ch2 = "\\\\\tt\rr\nn\"\"".charAt (i++);
var sb =  new JU.SB ();
var pt0 = 0;
while ((pt = str.indexOf (ch, pt + 1)) >= 0) {
sb.append (str.substring (pt0, pt)).appendC ('\\').appendC (ch2);
pt0 = pt + 1;
}
sb.append (str.substring (pt0, str.length));
str = sb.toString ();
}
return "\"" + JU.PT.escUnicode (str) + "\"";
}, "~S");
c$.escUnicode = Clazz_defineMethod (c$, "escUnicode", 
function (str) {
for (var i = str.length; --i >= 0; ) if (str.charCodeAt (i) > 0x7F) {
var s = "0000" + Integer.toHexString (str.charCodeAt (i));
str = str.substring (0, i) + "\\u" + s.substring (s.length - 4) + str.substring (i + 1);
}
return str;
}, "~S");
c$.escF = Clazz_defineMethod (c$, "escF", 
function (f) {
var sf = "" + f;
{
if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0)
sf += ".0";
}return sf;
}, "~N");
c$.join = Clazz_defineMethod (c$, "join", 
function (s, c, i0) {
if (s.length < i0) return null;
var sb =  new JU.SB ();
sb.append (s[i0++]);
for (var i = i0; i < s.length; i++) sb.appendC (c).append (s[i]);

return sb.toString ();
}, "~A,~S,~N");
c$.isLike = Clazz_defineMethod (c$, "isLike", 
function (a, b) {
var areEqual = a.equals (b);
if (areEqual) return true;
var isStart = b.startsWith ("*");
var isEnd = b.endsWith ("*");
return (!isStart && !isEnd) ? areEqual : isStart && isEnd ? b.length == 1 || a.contains (b.substring (1, b.length - 1)) : isStart ? a.endsWith (b.substring (1)) : a.startsWith (b.substring (0, b.length - 1));
}, "~S,~S");
c$.getMapValueNoCase = Clazz_defineMethod (c$, "getMapValueNoCase", 
function (h, key) {
if ("this".equals (key)) return h;
var val = h.get (key);
if (val == null) for (var e, $e = h.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) if (e.getKey ().equalsIgnoreCase (key)) return e.getValue ();

return val;
}, "java.util.Map,~S");
c$.getMapSubset = Clazz_defineMethod (c$, "getMapSubset", 
function (h, key, h2) {
var val = h.get (key);
if (val != null) {
h2.put (key, val);
return;
}for (var e, $e = h.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
var k = e.getKey ();
if (JU.PT.isLike (k, key)) h2.put (k, e.getValue ());
}
}, "java.util.Map,~S,java.util.Map");
c$.clean = Clazz_defineMethod (c$, "clean", 
function (s) {
return JU.PT.rep (JU.PT.replaceAllCharacters (s, " \t\n\r", " "), "  ", " ").trim ();
}, "~S");
c$.fdup = Clazz_defineMethod (c$, "fdup", 
function (f, pt, n) {
var ch;
var count = 0;
for (var i = pt; --i >= 1; ) {
if (JU.PT.isDigit (ch = f.charAt (i))) continue;
switch (ch) {
case '.':
if (count++ != 0) return f;
continue;
case '-':
if (i != 1 && f.charAt (i - 1) != '.') return f;
continue;
default:
return f;
}
}
var s = f.substring (0, pt + 1);
var sb =  new JU.SB ();
for (var i = 0; i < n; i++) sb.append (s);

sb.append (f.substring (pt + 1));
return sb.toString ();
}, "~S,~N,~N");
c$.formatString = Clazz_defineMethod (c$, "formatString", 
function (strFormat, key, strT, floatT, doubleT, doOne) {
if (strFormat == null) return null;
if ("".equals (strFormat)) return "";
var len = key.length;
if (strFormat.indexOf ("%") < 0 || len == 0 || strFormat.indexOf (key) < 0) return strFormat;
var strLabel = "";
var ich;
var ichPercent;
var ichKey;
for (ich = 0; (ichPercent = strFormat.indexOf ('%', ich)) >= 0 && (ichKey = strFormat.indexOf (key, ichPercent + 1)) >= 0; ) {
if (ich != ichPercent) strLabel += strFormat.substring (ich, ichPercent);
ich = ichPercent + 1;
if (ichKey > ichPercent + 6) {
strLabel += '%';
continue;
}try {
var alignLeft = false;
if (strFormat.charAt (ich) == '-') {
alignLeft = true;
++ich;
}var zeroPad = false;
if (strFormat.charAt (ich) == '0') {
zeroPad = true;
++ich;
}var ch;
var width = 0;
while ((ch = strFormat.charAt (ich)) >= '0' && (ch <= '9')) {
width = (10 * width) + (ch.charCodeAt (0) - 48);
++ich;
}
var precision = 2147483647;
var isExponential = false;
if (strFormat.charAt (ich) == '.') {
++ich;
if ((ch = strFormat.charAt (ich)) == '-') {
isExponential = true;
++ich;
}if ((ch = strFormat.charAt (ich)) >= '0' && ch <= '9') {
precision = ch.charCodeAt (0) - 48;
++ich;
}if (isExponential) precision = -precision - (strT == null ? 1 : 0);
}var st = strFormat.substring (ich, ich + len);
if (!st.equals (key)) {
ich = ichPercent + 1;
strLabel += '%';
continue;
}ich += len;
if (!Float.isNaN (floatT)) strLabel += JU.PT.formatF (floatT, width, precision, alignLeft, zeroPad);
 else if (strT != null) strLabel += JU.PT.formatS (strT, width, precision, alignLeft, zeroPad);
 else if (!Double.isNaN (doubleT)) strLabel += JU.PT.formatD (doubleT, width, precision, alignLeft, zeroPad, true);
if (doOne) break;
} catch (ioobe) {
if (Clazz_exceptionOf (ioobe, IndexOutOfBoundsException)) {
ich = ichPercent;
break;
} else {
throw ioobe;
}
}
}
strLabel += strFormat.substring (ich);
return strLabel;
}, "~S,~S,~S,~N,~N,~B");
c$.formatStringS = Clazz_defineMethod (c$, "formatStringS", 
function (strFormat, key, strT) {
return JU.PT.formatString (strFormat, key, strT, NaN, NaN, false);
}, "~S,~S,~S");
c$.formatStringF = Clazz_defineMethod (c$, "formatStringF", 
function (strFormat, key, floatT) {
return JU.PT.formatString (strFormat, key, null, floatT, NaN, false);
}, "~S,~S,~N");
c$.formatStringI = Clazz_defineMethod (c$, "formatStringI", 
function (strFormat, key, intT) {
return JU.PT.formatString (strFormat, key, "" + intT, NaN, NaN, false);
}, "~S,~S,~N");
c$.sprintf = Clazz_defineMethod (c$, "sprintf", 
function (strFormat, list, values) {
if (values == null) return strFormat;
var n = list.length;
if (n == values.length) try {
for (var o = 0; o < n; o++) {
if (values[o] == null) continue;
switch (list.charAt (o)) {
case 's':
strFormat = JU.PT.formatString (strFormat, "s", values[o], NaN, NaN, true);
break;
case 'f':
strFormat = JU.PT.formatString (strFormat, "f", null, (values[o]).floatValue (), NaN, true);
break;
case 'i':
strFormat = JU.PT.formatString (strFormat, "d", "" + values[o], NaN, NaN, true);
strFormat = JU.PT.formatString (strFormat, "i", "" + values[o], NaN, NaN, true);
break;
case 'd':
strFormat = JU.PT.formatString (strFormat, "e", null, NaN, (values[o]).doubleValue (), true);
break;
case 'p':
var pVal = values[o];
strFormat = JU.PT.formatString (strFormat, "p", null, pVal.x, NaN, true);
strFormat = JU.PT.formatString (strFormat, "p", null, pVal.y, NaN, true);
strFormat = JU.PT.formatString (strFormat, "p", null, pVal.z, NaN, true);
break;
case 'q':
var qVal = values[o];
strFormat = JU.PT.formatString (strFormat, "q", null, qVal.x, NaN, true);
strFormat = JU.PT.formatString (strFormat, "q", null, qVal.y, NaN, true);
strFormat = JU.PT.formatString (strFormat, "q", null, qVal.z, NaN, true);
strFormat = JU.PT.formatString (strFormat, "q", null, qVal.w, NaN, true);
break;
case 'S':
var sVal = values[o];
for (var i = 0; i < sVal.length; i++) strFormat = JU.PT.formatString (strFormat, "s", sVal[i], NaN, NaN, true);

break;
case 'F':
var fVal = values[o];
for (var i = 0; i < fVal.length; i++) strFormat = JU.PT.formatString (strFormat, "f", null, fVal[i], NaN, true);

break;
case 'I':
var iVal = values[o];
for (var i = 0; i < iVal.length; i++) strFormat = JU.PT.formatString (strFormat, "d", "" + iVal[i], NaN, NaN, true);

for (var i = 0; i < iVal.length; i++) strFormat = JU.PT.formatString (strFormat, "i", "" + iVal[i], NaN, NaN, true);

break;
case 'D':
var dVal = values[o];
for (var i = 0; i < dVal.length; i++) strFormat = JU.PT.formatString (strFormat, "e", null, NaN, dVal[i], true);

}
}
return JU.PT.rep (strFormat, "%%", "%");
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
System.out.println ("TextFormat.sprintf error " + list + " " + strFormat);
return JU.PT.rep (strFormat, "%", "?");
}, "~S,~S,~A");
c$.formatCheck = Clazz_defineMethod (c$, "formatCheck", 
function (strFormat) {
if (strFormat == null || strFormat.indexOf ('p') < 0 && strFormat.indexOf ('q') < 0) return strFormat;
strFormat = JU.PT.rep (strFormat, "%%", "\1");
strFormat = JU.PT.rep (strFormat, "%p", "%6.2p");
strFormat = JU.PT.rep (strFormat, "%q", "%6.2q");
var format = JU.PT.split (strFormat, "%");
var sb =  new JU.SB ();
sb.append (format[0]);
for (var i = 1; i < format.length; i++) {
var f = "%" + format[i];
var pt;
if (f.length >= 3) {
if ((pt = f.indexOf ('p')) >= 0) f = JU.PT.fdup (f, pt, 3);
if ((pt = f.indexOf ('q')) >= 0) f = JU.PT.fdup (f, pt, 4);
}sb.append (f);
}
return sb.toString ().$replace ('\1', '%');
}, "~S");
c$.leftJustify = Clazz_defineMethod (c$, "leftJustify", 
function (s, s1, s2) {
s.append (s2);
var n = s1.length - s2.length;
if (n > 0) s.append (s1.substring (0, n));
}, "JU.SB,~S,~S");
c$.rightJustify = Clazz_defineMethod (c$, "rightJustify", 
function (s, s1, s2) {
var n = s1.length - s2.length;
if (n > 0) s.append (s1.substring (0, n));
s.append (s2);
}, "JU.SB,~S,~S");
c$.safeTruncate = Clazz_defineMethod (c$, "safeTruncate", 
function (f, n) {
if (f > -0.001 && f < 0.001) f = 0;
return (f + "         ").substring (0, n);
}, "~N,~N");
c$.isWild = Clazz_defineMethod (c$, "isWild", 
function (s) {
return s != null && (s.indexOf ("*") >= 0 || s.indexOf ("?") >= 0);
}, "~S");
c$.isMatch = Clazz_defineMethod (c$, "isMatch", 
function (search, match, checkStar, allowInitialStar) {
if (search.equals (match)) return true;
var mLen = match.length;
if (mLen == 0) return false;
var isStar0 = (checkStar && allowInitialStar ? match.charAt (0) == '*' : false);
if (mLen == 1 && isStar0) return true;
var isStar1 = (checkStar && match.endsWith ("*"));
var haveQ = (match.indexOf ('?') >= 0);
if (!haveQ) {
if (isStar0) return (isStar1 ? (mLen < 3 || search.indexOf (match.substring (1, mLen - 1)) >= 0) : search.endsWith (match.substring (1)));
 else if (isStar1) return search.startsWith (match.substring (0, mLen - 1));
}var sLen = search.length;
var qqqq = "????";
var nq = 4;
while (nq < sLen) {
qqqq += qqqq;
nq += 4;
}
if (checkStar) {
if (isStar0) {
match = qqqq + match.substring (1);
mLen += nq - 1;
}if (isStar1) {
match = match.substring (0, mLen - 1) + qqqq;
mLen += nq - 1;
}}if (mLen < sLen) return false;
var ich = 0;
while (mLen > sLen) {
if (allowInitialStar && match.charAt (ich) == '?') {
++ich;
} else if (match.charAt (ich + mLen - 1) != '?') {
return false;
}--mLen;
}
for (var i = sLen; --i >= 0; ) {
var chm = match.charAt (ich + i);
if (chm == '?') continue;
var chs = search.charAt (i);
if (chm != chs && (chm != '\1' || chs != '?')) return false;
}
return true;
}, "~S,~S,~B,~B");
c$.replaceQuotedStrings = Clazz_defineMethod (c$, "replaceQuotedStrings", 
function (s, list, newList) {
var n = list.size ();
for (var i = 0; i < n; i++) {
var name = list.get (i);
var newName = newList.get (i);
if (!newName.equals (name)) s = JU.PT.rep (s, "\"" + name + "\"", "\"" + newName + "\"");
}
return s;
}, "~S,JU.Lst,JU.Lst");
c$.replaceStrings = Clazz_defineMethod (c$, "replaceStrings", 
function (s, list, newList) {
var n = list.size ();
for (var i = 0; i < n; i++) {
var name = list.get (i);
var newName = newList.get (i);
if (!newName.equals (name)) s = JU.PT.rep (s, name, newName);
}
return s;
}, "~S,JU.Lst,JU.Lst");
c$.isDigit = Clazz_defineMethod (c$, "isDigit", 
function (ch) {
var c = (ch).charCodeAt (0);
return (48 <= c && c <= 57);
}, "~S");
c$.isUpperCase = Clazz_defineMethod (c$, "isUpperCase", 
function (ch) {
var c = (ch).charCodeAt (0);
return (65 <= c && c <= 90);
}, "~S");
c$.isLowerCase = Clazz_defineMethod (c$, "isLowerCase", 
function (ch) {
var c = (ch).charCodeAt (0);
return (97 <= c && c <= 122);
}, "~S");
c$.isLetter = Clazz_defineMethod (c$, "isLetter", 
function (ch) {
var c = (ch).charCodeAt (0);
return (65 <= c && c <= 90 || 97 <= c && c <= 122);
}, "~S");
c$.isLetterOrDigit = Clazz_defineMethod (c$, "isLetterOrDigit", 
function (ch) {
var c = (ch).charCodeAt (0);
return (65 <= c && c <= 90 || 97 <= c && c <= 122 || 48 <= c && c <= 57);
}, "~S");
c$.isWhitespace = Clazz_defineMethod (c$, "isWhitespace", 
function (ch) {
var c = (ch).charCodeAt (0);
return (c >= 0x1c && c <= 0x20 || c >= 0x9 && c <= 0xd);
}, "~S");
c$.fixPtFloats = Clazz_defineMethod (c$, "fixPtFloats", 
function (pt, f) {
pt.x = Math.round (pt.x * f) / f;
pt.y = Math.round (pt.y * f) / f;
pt.z = Math.round (pt.z * f) / f;
}, "JU.T3,~N");
c$.fixDouble = Clazz_defineMethod (c$, "fixDouble", 
function (d, f) {
return Math.round (d * f) / f;
}, "~N,~N");
c$.parseFloatFraction = Clazz_defineMethod (c$, "parseFloatFraction", 
function (s) {
var pt = s.indexOf ("/");
return (pt < 0 ? JU.PT.parseFloat (s) : JU.PT.parseFloat (s.substring (0, pt)) / JU.PT.parseFloat (s.substring (pt + 1)));
}, "~S");
Clazz_defineStatics (c$,
"tensScale", [10, 100, 1000, 10000, 100000, 1000000],
"decimalScale", [0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001, 0.00000001, 0.000000001],
"FLOAT_MIN_SAFE", 2E-45,
"escapable", "\\\\\tt\rr\nn\"\"",
"FRACTIONAL_PRECISION", 100000,
"CARTESIAN_PRECISION", 10000);
});
Clazz_declarePackage ("JU");
c$ = Clazz_decorateAsClass (function () {
this.sb = null;
this.s = null;
Clazz_instantialize (this, arguments);
}, JU, "SB");
Clazz_makeConstructor (c$, 
function () {
{
this.s = "";
}});
c$.newN = Clazz_defineMethod (c$, "newN", 
function (n) {
{
return new JU.SB();
}}, "~N");
c$.newS = Clazz_defineMethod (c$, "newS", 
function (s) {
{
var sb = new JU.SB();
sb.s = s;
return sb;
}}, "~S");
Clazz_defineMethod (c$, "append", 
function (s) {
{
this.s += s
}return this;
}, "~S");
Clazz_defineMethod (c$, "appendC", 
function (c) {
{
this.s += c;
}return this;
}, "~S");
Clazz_defineMethod (c$, "appendI", 
function (i) {
{
this.s += i
}return this;
}, "~N");
Clazz_defineMethod (c$, "appendB", 
function (b) {
{
this.s += b
}return this;
}, "~B");
Clazz_defineMethod (c$, "appendF", 
function (f) {
{
var sf = "" + f;
if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0)
sf += ".0" ;
this.s += sf;
}return this;
}, "~N");
Clazz_defineMethod (c$, "appendD", 
function (d) {
{
var sf = "" + d;
if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0)
sf += ".0" ;
this.s += sf;
}return this;
}, "~N");
Clazz_defineMethod (c$, "appendSB", 
function (buf) {
{
this.s += buf.s;
}return this;
}, "JU.SB");
Clazz_defineMethod (c$, "appendO", 
function (data) {
if (data != null) {
{
this.s += data.toString();
}}return this;
}, "~O");
Clazz_defineMethod (c$, "appendCB", 
function (cb, off, len) {
{
for (var i = len,j=off; --i >= 0;)
this.s += cb[j++];
}}, "~A,~N,~N");
Clazz_overrideMethod (c$, "toString", 
function () {
{
return this.s;
}});
Clazz_defineMethod (c$, "length", 
function () {
{
return this.s.length;
}});
Clazz_defineMethod (c$, "indexOf", 
function (s) {
{
return this.s.indexOf(s);
}}, "~S");
Clazz_defineMethod (c$, "charAt", 
function (i) {
{
return this.s.charAt(i);
}}, "~N");
Clazz_defineMethod (c$, "charCodeAt", 
function (i) {
{
return this.s.charCodeAt(i);
}}, "~N");
Clazz_defineMethod (c$, "setLength", 
function (n) {
{
this.s = this.s.substring(0, n);
}}, "~N");
Clazz_defineMethod (c$, "lastIndexOf", 
function (s) {
{
return this.s.lastIndexOf(s);
}}, "~S");
Clazz_defineMethod (c$, "indexOf2", 
function (s, i) {
{
return this.s.indexOf(s, i);
}}, "~S,~N");
Clazz_defineMethod (c$, "substring", 
function (i) {
{
return this.s.substring(i);
}}, "~N");
Clazz_defineMethod (c$, "substring2", 
function (i, j) {
{
return this.s.substring(i, j);
}}, "~N,~N");
Clazz_defineMethod (c$, "toBytes", 
function (off, len) {
if (len < 0) len = this.length () - off;
var b =  Clazz_newByteArray (len, 0);
for (var i = off + len, j = i - off; --i >= off; ) b[--j] = (this.charAt (i)).charCodeAt (0);

return b;
}, "~N,~N");
Clazz_declarePackage ("JU");
Clazz_load (["javajs.api.JSONEncodable"], "JU.T3", ["java.lang.Float"], function () {
c$ = Clazz_decorateAsClass (function () {
this.x = 0;
this.y = 0;
this.z = 0;
Clazz_instantialize (this, arguments);
}, JU, "T3", null, [javajs.api.JSONEncodable, java.io.Serializable]);
Clazz_defineMethod (c$, "set", 
function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setA", 
function (t) {
this.x = t[0];
this.y = t[1];
this.z = t[2];
}, "~A");
Clazz_defineMethod (c$, "setT", 
function (t1) {
this.x = t1.x;
this.y = t1.y;
this.z = t1.z;
}, "JU.T3");
Clazz_defineMethod (c$, "add2", 
function (t1, t2) {
this.x = t1.x + t2.x;
this.y = t1.y + t2.y;
this.z = t1.z + t2.z;
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "add", 
function (t1) {
this.x += t1.x;
this.y += t1.y;
this.z += t1.z;
}, "JU.T3");
Clazz_defineMethod (c$, "distanceSquared", 
function (p1) {
var dx = this.x - p1.x;
var dy = this.y - p1.y;
var dz = this.z - p1.z;
return (dx * dx + dy * dy + dz * dz);
}, "JU.T3");
Clazz_defineMethod (c$, "distance", 
function (p1) {
return Math.sqrt (this.distanceSquared (p1));
}, "JU.T3");
Clazz_defineMethod (c$, "sub2", 
function (t1, t2) {
this.x = t1.x - t2.x;
this.y = t1.y - t2.y;
this.z = t1.z - t2.z;
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "sub", 
function (t1) {
this.x -= t1.x;
this.y -= t1.y;
this.z -= t1.z;
}, "JU.T3");
Clazz_defineMethod (c$, "scale", 
function (s) {
this.x *= s;
this.y *= s;
this.z *= s;
}, "~N");
Clazz_defineMethod (c$, "add3", 
function (a, b, c) {
this.x += a;
this.y += b;
this.z += c;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "scaleT", 
function (p) {
this.x *= p.x;
this.y *= p.y;
this.z *= p.z;
}, "JU.T3");
Clazz_defineMethod (c$, "scaleAdd2", 
function (s, t1, t2) {
this.x = s * t1.x + t2.x;
this.y = s * t1.y + t2.y;
this.z = s * t1.z + t2.z;
}, "~N,JU.T3,JU.T3");
Clazz_defineMethod (c$, "ave", 
function (a, b) {
this.x = (a.x + b.x) / 2;
this.y = (a.y + b.y) / 2;
this.z = (a.z + b.z) / 2;
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "dot", 
function (v) {
return this.x * v.x + this.y * v.y + this.z * v.z;
}, "JU.T3");
Clazz_defineMethod (c$, "lengthSquared", 
function () {
return this.x * this.x + this.y * this.y + this.z * this.z;
});
Clazz_defineMethod (c$, "length", 
function () {
return Math.sqrt (this.lengthSquared ());
});
Clazz_defineMethod (c$, "normalize", 
function () {
var d = this.length ();
this.x /= d;
this.y /= d;
this.z /= d;
});
Clazz_defineMethod (c$, "cross", 
function (v1, v2) {
this.set (v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
}, "JU.T3,JU.T3");
Clazz_overrideMethod (c$, "hashCode", 
function () {
var bits = 1;
bits = 31 * bits + JU.T3.floatToIntBits0 (this.x);
bits = 31 * bits + JU.T3.floatToIntBits0 (this.y);
bits = 31 * bits + JU.T3.floatToIntBits0 (this.z);
return (bits ^ (bits >> 32));
});
c$.floatToIntBits0 = Clazz_defineMethod (c$, "floatToIntBits0", 
function (f) {
return (f == 0 ? 0 : Float.floatToIntBits (f));
}, "~N");
Clazz_overrideMethod (c$, "equals", 
function (t1) {
if (!(Clazz_instanceOf (t1, JU.T3))) return false;
var t2 = t1;
return (this.x == t2.x && this.y == t2.y && this.z == t2.z);
}, "~O");
Clazz_overrideMethod (c$, "toString", 
function () {
return "{" + this.x + ", " + this.y + ", " + this.z + "}";
});
Clazz_overrideMethod (c$, "toJSON", 
function () {
return "[" + this.x + "," + this.y + "," + this.z + "]";
});
});
Clazz_declarePackage ("JU");
c$ = Clazz_decorateAsClass (function () {
this.x = 0;
this.y = 0;
this.z = 0;
Clazz_instantialize (this, arguments);
}, JU, "T3i", null, java.io.Serializable);
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "set", 
function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setT", 
function (t1) {
this.x = t1.x;
this.y = t1.y;
this.z = t1.z;
}, "JU.T3i");
Clazz_defineMethod (c$, "add", 
function (t) {
this.x += t.x;
this.y += t.y;
this.z += t.z;
}, "JU.T3i");
Clazz_defineMethod (c$, "scaleAdd", 
function (s, t1, t2) {
this.x = s * t1.x + t2.x;
this.y = s * t1.y + t2.y;
this.z = s * t1.z + t2.z;
}, "~N,JU.T3i,JU.T3i");
Clazz_overrideMethod (c$, "hashCode", 
function () {
return this.x ^ this.y ^ this.z;
});
Clazz_overrideMethod (c$, "equals", 
function (o) {
if (!(Clazz_instanceOf (o, JU.T3i))) return false;
var t = o;
return (this.x == t.x && this.y == t.y && this.z == t.z);
}, "~O");
Clazz_overrideMethod (c$, "toString", 
function () {
return "(" + this.x + ", " + this.y + ", " + this.z + ")";
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.T3"], "JU.T4", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.w = 0;
Clazz_instantialize (this, arguments);
}, JU, "T4", JU.T3);
Clazz_defineMethod (c$, "set4", 
function (x, y, z, w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "scale4", 
function (s) {
this.scale (s);
this.w *= s;
}, "~N");
Clazz_overrideMethod (c$, "hashCode", 
function () {
return JU.T3.floatToIntBits0 (this.x) ^ JU.T3.floatToIntBits0 (this.y) ^ JU.T3.floatToIntBits0 (this.z) ^ JU.T3.floatToIntBits0 (this.w);
});
Clazz_overrideMethod (c$, "equals", 
function (o) {
if (!(Clazz_instanceOf (o, JU.T4))) return false;
var t = o;
return (this.x == t.x && this.y == t.y && this.z == t.z && this.w == t.w);
}, "~O");
Clazz_overrideMethod (c$, "toString", 
function () {
return "(" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + ")";
});
Clazz_overrideMethod (c$, "toJSON", 
function () {
return "[" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + "]";
});
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.T3"], "JU.V3", null, function () {
c$ = Clazz_declareType (JU, "V3", JU.T3);
Clazz_makeConstructor (c$, 
function () {
});
c$.newV = Clazz_defineMethod (c$, "newV", 
function (t) {
return JU.V3.new3 (t.x, t.y, t.z);
}, "JU.T3");
c$.newVsub = Clazz_defineMethod (c$, "newVsub", 
function (t1, t2) {
return JU.V3.new3 (t1.x - t2.x, t1.y - t2.y, t1.z - t2.z);
}, "JU.T3,JU.T3");
c$.new3 = Clazz_defineMethod (c$, "new3", 
function (x, y, z) {
var v =  new JU.V3 ();
v.x = x;
v.y = y;
v.z = z;
return v;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "angle", 
function (v1) {
var xx = this.y * v1.z - this.z * v1.y;
var yy = this.z * v1.x - this.x * v1.z;
var zz = this.x * v1.y - this.y * v1.x;
var cross = Math.sqrt (xx * xx + yy * yy + zz * zz);
return Math.abs (Math.atan2 (cross, this.dot (v1)));
}, "JU.V3");
});
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "GenericBinaryDocument");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "GenericZipTools");
Clazz_declarePackage ("javajs.api");
Clazz_declareInterface (javajs.api, "GenericLineReader");
Clazz_declarePackage ("javajs.api");
c$ = Clazz_declareInterface (javajs.api, "GenericCifDataParser");
Clazz_defineStatics (c$,
"NONE", -1);
Clazz_declarePackage ("javajs.api");
c$ = Clazz_declareType (javajs.api, "Interface");
c$.getInterface = Clazz_defineMethod (c$, "getInterface", 
function (name) {
try {
var x = Clazz._4Name (name);
return (x == null ? null : x.newInstance ());
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
System.out.println ("Interface.java Error creating instance for " + name + ": \n" + e);
return null;
} else {
throw e;
}
}
}, "~S");
Clazz_declarePackage ("JU");
c$ = Clazz_decorateAsClass (function () {
this.data = null;
Clazz_instantialize (this, arguments);
}, JU, "BArray");
Clazz_makeConstructor (c$, 
function (data) {
this.data = data;
}, "~A");
Clazz_overrideMethod (c$, "equals", 
function (o) {
if (Clazz_instanceOf (o, JU.BArray)) {
var d = (o).data;
if (d.length == this.data.length) {
for (var i = 0; i < d.length; i++) if (d[i] != this.data[i]) return false;

return true;
}}return false;
}, "~O");
Clazz_defineMethod (c$, "hashCode", 
function () {
return this.data.hashCode ();
});
Clazz_overrideMethod (c$, "toString", 
function () {
return  String.instantialize (this.data);
});
Clazz_declarePackage ("JU");
c$ = Clazz_decorateAsClass (function () {
this.buf = null;
this.cchBuf = 0;
this.ichCurrent = 0;
Clazz_instantialize (this, arguments);
}, JU, "LimitedLineReader");
Clazz_makeConstructor (c$, 
function (bufferedReader, readLimit) {
bufferedReader.mark (readLimit + 1);
this.buf =  Clazz_newCharArray (readLimit, '\0');
this.cchBuf = Math.max (bufferedReader.read (this.buf, 0, readLimit), 0);
this.ichCurrent = 0;
bufferedReader.reset ();
}, "java.io.BufferedReader,~N");
Clazz_defineMethod (c$, "getHeader", 
function (n) {
return (n == 0 ?  String.instantialize (this.buf) :  String.instantialize (this.buf, 0, Math.min (this.cchBuf, n)));
}, "~N");
Clazz_defineMethod (c$, "readLineWithNewline", 
function () {
while (this.ichCurrent < this.cchBuf) {
var ichBeginningOfLine = this.ichCurrent;
var ch = String.fromCharCode (0);
while (this.ichCurrent < this.cchBuf && (ch = this.buf[this.ichCurrent++]) != '\r' && ch != '\n') {
}
if (ch == '\r' && this.ichCurrent < this.cchBuf && this.buf[this.ichCurrent] == '\n') ++this.ichCurrent;
var cchLine = this.ichCurrent - ichBeginningOfLine;
if (this.buf[ichBeginningOfLine] == '#') continue;
return  String.instantialize (this.buf, ichBeginningOfLine, cchLine);
}
return "";
});
Clazz_declarePackage ("JU");
c$ = Clazz_decorateAsClass (function () {
this.a = null;
this.m = 0;
this.n = 0;
if (!Clazz_isClassDefined ("JU.Matrix.LUDecomp")) {
JU.Matrix.$Matrix$LUDecomp$ ();
}
Clazz_instantialize (this, arguments);
}, JU, "Matrix", null, Cloneable);
Clazz_makeConstructor (c$, 
function (a, m, n) {
this.a = (a == null ?  Clazz_newDoubleArray (m, n, 0) : a);
this.m = m;
this.n = n;
}, "~A,~N,~N");
Clazz_defineMethod (c$, "getRowDimension", 
function () {
return this.m;
});
Clazz_defineMethod (c$, "getColumnDimension", 
function () {
return this.n;
});
Clazz_defineMethod (c$, "getArray", 
function () {
return this.a;
});
Clazz_defineMethod (c$, "getArrayCopy", 
function () {
var x =  Clazz_newDoubleArray (this.m, this.n, 0);
for (var i = this.m; --i >= 0; ) for (var j = this.n; --j >= 0; ) x[i][j] = this.a[i][j];


return x;
});
Clazz_defineMethod (c$, "copy", 
function () {
var x =  new JU.Matrix (null, this.m, this.n);
var c = x.a;
for (var i = this.m; --i >= 0; ) for (var j = this.n; --j >= 0; ) c[i][j] = this.a[i][j];


return x;
});
Clazz_overrideMethod (c$, "clone", 
function () {
return this.copy ();
});
Clazz_defineMethod (c$, "getSubmatrix", 
function (i0, j0, nrows, ncols) {
var x =  new JU.Matrix (null, nrows, ncols);
var xa = x.a;
for (var i = nrows; --i >= 0; ) for (var j = ncols; --j >= 0; ) xa[i][j] = this.a[i0 + i][j0 + j];


return x;
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "getMatrixSelected", 
function (r, n) {
var x =  new JU.Matrix (null, r.length, n);
var xa = x.a;
for (var i = r.length; --i >= 0; ) {
var b = this.a[r[i]];
for (var j = n; --j >= 0; ) xa[i][j] = b[j];

}
return x;
}, "~A,~N");
Clazz_defineMethod (c$, "transpose", 
function () {
var x =  new JU.Matrix (null, this.n, this.m);
var c = x.a;
for (var i = this.m; --i >= 0; ) for (var j = this.n; --j >= 0; ) c[j][i] = this.a[i][j];


return x;
});
Clazz_defineMethod (c$, "add", 
function (b) {
return this.scaleAdd (b, 1);
}, "JU.Matrix");
Clazz_defineMethod (c$, "sub", 
function (b) {
return this.scaleAdd (b, -1);
}, "JU.Matrix");
Clazz_defineMethod (c$, "scaleAdd", 
function (b, scale) {
var x =  new JU.Matrix (null, this.m, this.n);
var xa = x.a;
var ba = b.a;
for (var i = this.m; --i >= 0; ) for (var j = this.n; --j >= 0; ) xa[i][j] = ba[i][j] * scale + this.a[i][j];


return x;
}, "JU.Matrix,~N");
Clazz_defineMethod (c$, "mul", 
function (b) {
if (b.m != this.n) return null;
var x =  new JU.Matrix (null, this.m, b.n);
var xa = x.a;
var ba = b.a;
for (var j = b.n; --j >= 0; ) for (var i = this.m; --i >= 0; ) {
var arowi = this.a[i];
var s = 0;
for (var k = this.n; --k >= 0; ) s += arowi[k] * ba[k][j];

xa[i][j] = s;
}

return x;
}, "JU.Matrix");
Clazz_defineMethod (c$, "inverse", 
function () {
return Clazz_innerTypeInstance (JU.Matrix.LUDecomp, this, null, this.m, this.n).solve (JU.Matrix.identity (this.m, this.m), this.n);
});
Clazz_defineMethod (c$, "trace", 
function () {
var t = 0;
for (var i = Math.min (this.m, this.n); --i >= 0; ) t += this.a[i][i];

return t;
});
c$.identity = Clazz_defineMethod (c$, "identity", 
function (m, n) {
var x =  new JU.Matrix (null, m, n);
var xa = x.a;
for (var i = Math.min (m, n); --i >= 0; ) xa[i][i] = 1;

return x;
}, "~N,~N");
Clazz_defineMethod (c$, "getRotation", 
function () {
return this.getSubmatrix (0, 0, this.m - 1, this.n - 1);
});
Clazz_defineMethod (c$, "getTranslation", 
function () {
return this.getSubmatrix (0, this.n - 1, this.m - 1, 1);
});
c$.newT = Clazz_defineMethod (c$, "newT", 
function (r, asColumn) {
return (asColumn ?  new JU.Matrix ([[r.x], [r.y], [r.z]], 3, 1) :  new JU.Matrix ([[r.x, r.y, r.z]], 1, 3));
}, "JU.T3,~B");
Clazz_overrideMethod (c$, "toString", 
function () {
var s = "[\n";
for (var i = 0; i < this.m; i++) {
s += "  [";
for (var j = 0; j < this.n; j++) s += " " + this.a[i][j];

s += "]\n";
}
s += "]";
return s;
});
c$.$Matrix$LUDecomp$ = function () {
Clazz_pu$h(self.c$);
c$ = Clazz_decorateAsClass (function () {
Clazz_prepareCallback (this, arguments);
this.LU = null;
this.piv = null;
this.pivsign = 0;
Clazz_instantialize (this, arguments);
}, JU.Matrix, "LUDecomp");
Clazz_makeConstructor (c$, 
function (a, b) {
this.LU = this.b$["JU.Matrix"].getArrayCopy ();
this.piv =  Clazz_newIntArray (a, 0);
for (var c = a; --c >= 0; ) this.piv[c] = c;

this.pivsign = 1;
var d;
var e =  Clazz_newDoubleArray (a, 0);
for (var f = 0; f < b; f++) {
for (var g = a; --g >= 0; ) e[g] = this.LU[g][f];

for (var h = a; --h >= 0; ) {
d = this.LU[h];
var i = Math.min (h, f);
var j = 0.0;
for (var k = i; --k >= 0; ) j += d[k] * e[k];

d[f] = e[h] -= j;
}
var i = f;
for (var j = a; --j > f; ) if (Math.abs (e[j]) > Math.abs (e[i])) i = j;

if (i != f) {
for (var k = b; --k >= 0; ) {
var l = this.LU[i][k];
this.LU[i][k] = this.LU[f][k];
this.LU[f][k] = l;
}
var l = this.piv[i];
this.piv[i] = this.piv[f];
this.piv[f] = l;
this.pivsign = -this.pivsign;
}if ( new Boolean (f < a & this.LU[f][f] != 0.0).valueOf ()) for (var k = a; --k > f; ) this.LU[k][f] /= this.LU[f][f];

}
}, "~N,~N");
Clazz_defineMethod (c$, "solve", 
function (a, b) {
for (var c = 0; c < b; c++) if (this.LU[c][c] == 0) return null;

var d = a.n;
var e = a.getMatrixSelected (this.piv, d);
var f = e.a;
for (var g = 0; g < b; g++) for (var h = g + 1; h < b; h++) for (var i = 0; i < d; i++) f[h][i] -= f[g][i] * this.LU[h][g];



for (var j = b; --j >= 0; ) {
for (var k = d; --k >= 0; ) f[j][k] /= this.LU[j][j];

for (var l = j; --l >= 0; ) for (var m = d; --m >= 0; ) f[l][m] -= f[j][m] * this.LU[l][j];


}
return e;
}, "JU.Matrix,~N");
c$ = Clazz_p0p ();
};
Clazz_declarePackage ("JU");
Clazz_load (["JU.P4"], "JU.Quat", ["java.lang.Float", "JU.A4", "$.M3", "$.V3"], function () {
c$ = Clazz_decorateAsClass (function () {
this.q0 = 0;
this.q1 = 0;
this.q2 = 0;
this.q3 = 0;
this.mat = null;
Clazz_instantialize (this, arguments);
}, JU, "Quat");
Clazz_makeConstructor (c$, 
function () {
this.q0 = 1;
});
c$.newQ = Clazz_defineMethod (c$, "newQ", 
function (q) {
var q1 =  new JU.Quat ();
q1.set (q);
return q1;
}, "JU.Quat");
c$.newVA = Clazz_defineMethod (c$, "newVA", 
function (v, theta) {
var q =  new JU.Quat ();
q.setTA (v, theta);
return q;
}, "JU.T3,~N");
c$.newM = Clazz_defineMethod (c$, "newM", 
function (mat) {
var q =  new JU.Quat ();
q.setM (JU.M3.newM3 (mat));
return q;
}, "JU.M3");
c$.newAA = Clazz_defineMethod (c$, "newAA", 
function (a) {
var q =  new JU.Quat ();
q.setAA (a);
return q;
}, "JU.A4");
c$.newP4 = Clazz_defineMethod (c$, "newP4", 
function (pt) {
var q =  new JU.Quat ();
q.setP4 (pt);
return q;
}, "JU.P4");
c$.new4 = Clazz_defineMethod (c$, "new4", 
function (q1, q2, q3, q0) {
var q =  new JU.Quat ();
if (q0 < -1) {
q.q0 = -1;
return q;
}if (q0 > 1) {
q.q0 = 1;
return q;
}q.q0 = q0;
q.q1 = q1;
q.q2 = q2;
q.q3 = q3;
return q;
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "set", 
function (q) {
this.q0 = q.q0;
this.q1 = q.q1;
this.q2 = q.q2;
this.q3 = q.q3;
}, "JU.Quat");
Clazz_defineMethod (c$, "setP4", 
 function (pt) {
var factor = (pt == null ? 0 : pt.distance4 (JU.Quat.qZero));
if (factor == 0) {
this.q0 = 1;
return;
}this.q0 = pt.w / factor;
this.q1 = pt.x / factor;
this.q2 = pt.y / factor;
this.q3 = pt.z / factor;
}, "JU.P4");
Clazz_defineMethod (c$, "setTA", 
function (pt, theta) {
if (pt.x == 0 && pt.y == 0 && pt.z == 0) {
this.q0 = 1;
return;
}var fact = (Math.sin (theta / 2 * 0.017453292519943295) / Math.sqrt (pt.x * pt.x + pt.y * pt.y + pt.z * pt.z));
this.q0 = (Math.cos (theta / 2 * 0.017453292519943295));
this.q1 = (pt.x * fact);
this.q2 = (pt.y * fact);
this.q3 = (pt.z * fact);
}, "JU.T3,~N");
Clazz_defineMethod (c$, "setAA", 
function (a) {
var aa = JU.A4.newAA (a);
if (aa.angle == 0) aa.y = 1;
this.setM ( new JU.M3 ().setAA (aa));
}, "JU.A4");
Clazz_defineMethod (c$, "setM", 
 function (mat) {
this.mat = mat;
var trace = mat.m00 + mat.m11 + mat.m22;
var temp;
var w;
var x;
var y;
var z;
if (trace >= 0.5) {
w = Math.sqrt (1.0 + trace);
x = (mat.m21 - mat.m12) / w;
y = (mat.m02 - mat.m20) / w;
z = (mat.m10 - mat.m01) / w;
} else if ((temp = mat.m00 + mat.m00 - trace) >= 0.5) {
x = Math.sqrt (1.0 + temp);
w = (mat.m21 - mat.m12) / x;
y = (mat.m10 + mat.m01) / x;
z = (mat.m20 + mat.m02) / x;
} else if ((temp = mat.m11 + mat.m11 - trace) >= 0.5 || mat.m11 > mat.m22) {
y = Math.sqrt (1.0 + temp);
w = (mat.m02 - mat.m20) / y;
x = (mat.m10 + mat.m01) / y;
z = (mat.m21 + mat.m12) / y;
} else {
z = Math.sqrt (1.0 + mat.m22 + mat.m22 - trace);
w = (mat.m10 - mat.m01) / z;
x = (mat.m20 + mat.m02) / z;
y = (mat.m21 + mat.m12) / z;
}this.q0 = (w * 0.5);
this.q1 = (x * 0.5);
this.q2 = (y * 0.5);
this.q3 = (z * 0.5);
}, "JU.M3");
Clazz_defineMethod (c$, "setRef", 
function (qref) {
if (qref == null) {
this.mul (this.getFixFactor ());
return;
}if (this.dot (qref) >= 0) return;
this.q0 *= -1;
this.q1 *= -1;
this.q2 *= -1;
this.q3 *= -1;
}, "JU.Quat");
c$.getQuaternionFrame = Clazz_defineMethod (c$, "getQuaternionFrame", 
function (center, x, xy) {
var vA = JU.V3.newV (x);
var vB = JU.V3.newV (xy);
if (center != null) {
vA.sub (center);
vB.sub (center);
}return JU.Quat.getQuaternionFrameV (vA, vB, null, false);
}, "JU.P3,JU.T3,JU.T3");
c$.getQuaternionFrameV = Clazz_defineMethod (c$, "getQuaternionFrameV", 
function (vA, vB, vC, yBased) {
if (vC == null) {
vC =  new JU.V3 ();
vC.cross (vA, vB);
if (yBased) vA.cross (vB, vC);
}var vBprime =  new JU.V3 ();
vBprime.cross (vC, vA);
vA.normalize ();
vBprime.normalize ();
vC.normalize ();
var mat =  new JU.M3 ();
mat.setColumnV (0, vA);
mat.setColumnV (1, vBprime);
mat.setColumnV (2, vC);
var q = JU.Quat.newM (mat);
return q;
}, "JU.V3,JU.V3,JU.V3,~B");
Clazz_defineMethod (c$, "getMatrix", 
function () {
if (this.mat == null) this.setMatrix ();
return this.mat;
});
Clazz_defineMethod (c$, "setMatrix", 
 function () {
this.mat =  new JU.M3 ();
this.mat.m00 = this.q0 * this.q0 + this.q1 * this.q1 - this.q2 * this.q2 - this.q3 * this.q3;
this.mat.m01 = 2 * this.q1 * this.q2 - 2 * this.q0 * this.q3;
this.mat.m02 = 2 * this.q1 * this.q3 + 2 * this.q0 * this.q2;
this.mat.m10 = 2 * this.q1 * this.q2 + 2 * this.q0 * this.q3;
this.mat.m11 = this.q0 * this.q0 - this.q1 * this.q1 + this.q2 * this.q2 - this.q3 * this.q3;
this.mat.m12 = 2 * this.q2 * this.q3 - 2 * this.q0 * this.q1;
this.mat.m20 = 2 * this.q1 * this.q3 - 2 * this.q0 * this.q2;
this.mat.m21 = 2 * this.q2 * this.q3 + 2 * this.q0 * this.q1;
this.mat.m22 = this.q0 * this.q0 - this.q1 * this.q1 - this.q2 * this.q2 + this.q3 * this.q3;
});
Clazz_defineMethod (c$, "add", 
function (x) {
return JU.Quat.newVA (this.getNormal (), this.getTheta () + x);
}, "~N");
Clazz_defineMethod (c$, "mul", 
function (x) {
return (x == 1 ? JU.Quat.new4 (this.q1, this.q2, this.q3, this.q0) : JU.Quat.newVA (this.getNormal (), this.getTheta () * x));
}, "~N");
Clazz_defineMethod (c$, "mulQ", 
function (p) {
return JU.Quat.new4 (this.q0 * p.q1 + this.q1 * p.q0 + this.q2 * p.q3 - this.q3 * p.q2, this.q0 * p.q2 + this.q2 * p.q0 + this.q3 * p.q1 - this.q1 * p.q3, this.q0 * p.q3 + this.q3 * p.q0 + this.q1 * p.q2 - this.q2 * p.q1, this.q0 * p.q0 - this.q1 * p.q1 - this.q2 * p.q2 - this.q3 * p.q3);
}, "JU.Quat");
Clazz_defineMethod (c$, "div", 
function (p) {
return this.mulQ (p.inv ());
}, "JU.Quat");
Clazz_defineMethod (c$, "divLeft", 
function (p) {
return this.inv ().mulQ (p);
}, "JU.Quat");
Clazz_defineMethod (c$, "dot", 
function (q) {
return this.q0 * q.q0 + this.q1 * q.q1 + this.q2 * q.q2 + this.q3 * q.q3;
}, "JU.Quat");
Clazz_defineMethod (c$, "inv", 
function () {
return JU.Quat.new4 (-this.q1, -this.q2, -this.q3, this.q0);
});
Clazz_defineMethod (c$, "negate", 
function () {
return JU.Quat.new4 (-this.q1, -this.q2, -this.q3, -this.q0);
});
Clazz_defineMethod (c$, "getFixFactor", 
 function () {
return (this.q0 < 0 || this.q0 == 0 && (this.q1 < 0 || this.q1 == 0 && (this.q2 < 0 || this.q2 == 0 && this.q3 < 0)) ? -1 : 1);
});
Clazz_defineMethod (c$, "getVector", 
function (i) {
return this.getVectorScaled (i, 1);
}, "~N");
Clazz_defineMethod (c$, "getVectorScaled", 
function (i, scale) {
if (i == -1) {
scale *= this.getFixFactor ();
return JU.V3.new3 (this.q1 * scale, this.q2 * scale, this.q3 * scale);
}if (this.mat == null) this.setMatrix ();
var v =  new JU.V3 ();
this.mat.getColumnV (i, v);
if (scale != 1) v.scale (scale);
return v;
}, "~N,~N");
Clazz_defineMethod (c$, "getNormal", 
function () {
var v = JU.Quat.getRawNormal (this);
v.scale (this.getFixFactor ());
return v;
});
c$.getRawNormal = Clazz_defineMethod (c$, "getRawNormal", 
 function (q) {
var v = JU.V3.new3 (q.q1, q.q2, q.q3);
if (v.length () == 0) return JU.V3.new3 (0, 0, 1);
v.normalize ();
return v;
}, "JU.Quat");
Clazz_defineMethod (c$, "getTheta", 
function () {
return (Math.acos (Math.abs (this.q0)) * 2 * 180 / 3.141592653589793);
});
Clazz_defineMethod (c$, "getThetaRadians", 
function () {
return (Math.acos (Math.abs (this.q0)) * 2);
});
Clazz_defineMethod (c$, "getNormalDirected", 
function (v0) {
var v = this.getNormal ();
if (v.x * v0.x + v.y * v0.y + v.z * v0.z < 0) {
v.scale (-1);
}return v;
}, "JU.V3");
Clazz_defineMethod (c$, "get3dProjection", 
function (v3d) {
v3d.set (this.q1, this.q2, this.q3);
return v3d;
}, "JU.V3");
Clazz_defineMethod (c$, "getThetaDirected", 
function (axisAngle) {
var theta = this.getTheta ();
var v = this.getNormal ();
if (axisAngle.x * this.q1 + axisAngle.y * this.q2 + axisAngle.z * this.q3 < 0) {
v.scale (-1);
theta = -theta;
}axisAngle.set4 (v.x, v.y, v.z, theta);
return axisAngle;
}, "JU.P4");
Clazz_defineMethod (c$, "getThetaDirectedV", 
function (vector) {
var theta = this.getTheta ();
var v = this.getNormal ();
if (vector.x * this.q1 + vector.y * this.q2 + vector.z * this.q3 < 0) {
v.scale (-1);
theta = -theta;
}return theta;
}, "JU.V3");
Clazz_defineMethod (c$, "toPoint4f", 
function () {
return JU.P4.new4 (this.q1, this.q2, this.q3, this.q0);
});
Clazz_defineMethod (c$, "toAxisAngle4f", 
function () {
var theta = 2 * Math.acos (Math.abs (this.q0));
var sinTheta2 = Math.sin (theta / 2);
var v = this.getNormal ();
if (sinTheta2 < 0) {
v.scale (-1);
theta = 3.141592653589793 - theta;
}return JU.A4.newVA (v, theta);
});
Clazz_defineMethod (c$, "transform2", 
function (pt, ptNew) {
if (this.mat == null) this.setMatrix ();
this.mat.rotate2 (pt, ptNew);
return ptNew;
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "leftDifference", 
function (q2) {
var q2adjusted = (this.dot (q2) < 0 ? q2.negate () : q2);
return this.inv ().mulQ (q2adjusted);
}, "JU.Quat");
Clazz_defineMethod (c$, "rightDifference", 
function (q2) {
var q2adjusted = (this.dot (q2) < 0 ? q2.negate () : q2);
return this.mulQ (q2adjusted.inv ());
}, "JU.Quat");
Clazz_overrideMethod (c$, "toString", 
function () {
return "{" + this.q1 + " " + this.q2 + " " + this.q3 + " " + this.q0 + "}";
});
c$.div = Clazz_defineMethod (c$, "div", 
function (data1, data2, nMax, isRelative) {
var n;
if (data1 == null || data2 == null || (n = Math.min (data1.length, data2.length)) == 0) return null;
if (nMax > 0 && n > nMax) n = nMax;
var dqs =  new Array (n);
for (var i = 0; i < n; i++) {
if (data1[i] == null || data2[i] == null) return null;
dqs[i] = (isRelative ? data1[i].divLeft (data2[i]) : data1[i].div (data2[i]));
}
return dqs;
}, "~A,~A,~N,~B");
c$.sphereMean = Clazz_defineMethod (c$, "sphereMean", 
function (data, retStddev, criterion) {
if (data == null || data.length == 0) return  new JU.Quat ();
if (retStddev == null) retStddev =  Clazz_newFloatArray (1, 0);
if (data.length == 1) {
retStddev[0] = 0;
return JU.Quat.newQ (data[0]);
}var diff = 3.4028235E38;
var lastStddev = 3.4028235E38;
var qMean = JU.Quat.simpleAverage (data);
var maxIter = 100;
var iter = 0;
while (diff > criterion && lastStddev != 0 && iter < maxIter) {
qMean = JU.Quat.newMean (data, qMean);
retStddev[0] = JU.Quat.stdDev (data, qMean);
diff = Math.abs (retStddev[0] - lastStddev);
lastStddev = retStddev[0];
}
return qMean;
}, "~A,~A,~N");
c$.simpleAverage = Clazz_defineMethod (c$, "simpleAverage", 
 function (ndata) {
var mean = JU.V3.new3 (0, 0, 1);
var v = ndata[0].getNormal ();
mean.add (v);
for (var i = ndata.length; --i >= 0; ) mean.add (ndata[i].getNormalDirected (mean));

mean.sub (v);
mean.normalize ();
var f = 0;
for (var i = ndata.length; --i >= 0; ) f += Math.abs (ndata[i].get3dProjection (v).dot (mean));

if (f != 0) mean.scale (f / ndata.length);
f = Math.sqrt (1 - mean.lengthSquared ());
if (Float.isNaN (f)) f = 0;
return JU.Quat.newP4 (JU.P4.new4 (mean.x, mean.y, mean.z, f));
}, "~A");
c$.newMean = Clazz_defineMethod (c$, "newMean", 
 function (data, mean) {
var sum =  new JU.V3 ();
var v;
var q;
var dq;
for (var i = data.length; --i >= 0; ) {
q = data[i];
dq = q.div (mean);
v = dq.getNormal ();
v.scale (dq.getTheta ());
sum.add (v);
}
sum.scale (1 / data.length);
var dqMean = JU.Quat.newVA (sum, sum.length ());
return dqMean.mulQ (mean);
}, "~A,JU.Quat");
c$.stdDev = Clazz_defineMethod (c$, "stdDev", 
 function (data, mean) {
var sum2 = 0;
var n = data.length;
for (var i = n; --i >= 0; ) {
var theta = data[i].div (mean).getTheta ();
sum2 += theta * theta;
}
return Math.sqrt (sum2 / n);
}, "~A,JU.Quat");
Clazz_defineMethod (c$, "getEulerZYZ", 
function () {
var rA;
var rB;
var rG;
if (this.q1 == 0 && this.q2 == 0) {
var theta = this.getTheta ();
return [this.q3 < 0 ? -theta : theta, 0, 0];
}rA = Math.atan2 (2 * (this.q2 * this.q3 + this.q0 * this.q1), 2 * (-this.q1 * this.q3 + this.q0 * this.q2));
rB = Math.acos (this.q3 * this.q3 - this.q2 * this.q2 - this.q1 * this.q1 + this.q0 * this.q0);
rG = Math.atan2 (2 * (this.q2 * this.q3 - this.q0 * this.q1), 2 * (this.q0 * this.q2 + this.q1 * this.q3));
return [(rA / 0.017453292519943295), (rB / 0.017453292519943295), (rG / 0.017453292519943295)];
});
Clazz_defineMethod (c$, "getEulerZXZ", 
function () {
var rA;
var rB;
var rG;
if (this.q1 == 0 && this.q2 == 0) {
var theta = this.getTheta ();
return [this.q3 < 0 ? -theta : theta, 0, 0];
}rA = Math.atan2 (2 * (this.q1 * this.q3 - this.q0 * this.q2), 2 * (this.q0 * this.q1 + this.q2 * this.q3));
rB = Math.acos (this.q3 * this.q3 - this.q2 * this.q2 - this.q1 * this.q1 + this.q0 * this.q0);
rG = Math.atan2 (2 * (this.q1 * this.q3 + this.q0 * this.q2), 2 * (-this.q2 * this.q3 + this.q0 * this.q1));
return [(rA / 0.017453292519943295), (rB / 0.017453292519943295), (rG / 0.017453292519943295)];
});
c$.qZero = c$.prototype.qZero =  new JU.P4 ();
Clazz_defineStatics (c$,
"RAD_PER_DEG", 0.017453292519943295);
});
Clazz_declarePackage ("JU");
Clazz_load (["javajs.api.GenericLineReader"], "JU.Rdr", ["java.io.BufferedInputStream", "$.BufferedReader", "$.ByteArrayInputStream", "$.InputStreamReader", "$.StringReader", "JU.AU", "$.Base64", "$.Encoding", "$.SB"], function () {
c$ = Clazz_decorateAsClass (function () {
this.reader = null;
Clazz_instantialize (this, arguments);
}, JU, "Rdr", null, javajs.api.GenericLineReader);
Clazz_makeConstructor (c$, 
function (reader) {
this.reader = reader;
}, "java.io.BufferedReader");
Clazz_overrideMethod (c$, "readNextLine", 
function () {
return this.reader.readLine ();
});
c$.readCifData = Clazz_defineMethod (c$, "readCifData", 
function (parser, br) {
return parser.set (null, br).getAllCifData ();
}, "javajs.api.GenericCifDataParser,java.io.BufferedReader");
c$.fixUTF = Clazz_defineMethod (c$, "fixUTF", 
function (bytes) {
var encoding = JU.Rdr.getUTFEncoding (bytes);
if (encoding !== JU.Encoding.NONE) try {
var s =  String.instantialize (bytes, encoding.name ().$replace ('_', '-'));
switch (encoding) {
case JU.Encoding.UTF8:
case JU.Encoding.UTF_16BE:
case JU.Encoding.UTF_16LE:
s = s.substring (1);
break;
default:
break;
}
return s;
} catch (e) {
if (Clazz_exceptionOf (e, java.io.UnsupportedEncodingException)) {
System.out.println (e);
} else {
throw e;
}
}
return  String.instantialize (bytes);
}, "~A");
c$.getUTFEncoding = Clazz_defineMethod (c$, "getUTFEncoding", 
 function (bytes) {
if (bytes.length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) return JU.Encoding.UTF8;
if (bytes.length >= 4 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == 0xFE && bytes[3] == 0xFF) return JU.Encoding.UTF_32BE;
if (bytes.length >= 4 && bytes[0] == 0xFF && bytes[1] == 0xFE && bytes[2] == 0 && bytes[3] == 0) return JU.Encoding.UTF_32LE;
if (bytes.length >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE) return JU.Encoding.UTF_16LE;
if (bytes.length >= 2 && bytes[0] == 0xFE && bytes[1] == 0xFF) return JU.Encoding.UTF_16BE;
return JU.Encoding.NONE;
}, "~A");
c$.getUTFEncodingForStream = Clazz_defineMethod (c$, "getUTFEncodingForStream", 
 function (is) {
{
is.resetStream();
}var abMagic =  Clazz_newByteArray (4, 0);
abMagic[3] = 1;
try {
is.mark (5);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return JU.Encoding.NONE;
} else {
throw e;
}
}
is.read (abMagic, 0, 4);
is.reset ();
return JU.Rdr.getUTFEncoding (abMagic);
}, "java.io.BufferedInputStream");
c$.isBase64 = Clazz_defineMethod (c$, "isBase64", 
function (sb) {
return (sb.indexOf (";base64,") == 0);
}, "JU.SB");
c$.isCompoundDocumentS = Clazz_defineMethod (c$, "isCompoundDocumentS", 
function (is) {
return JU.Rdr.isCompoundDocumentB (JU.Rdr.getMagic (is, 8));
}, "java.io.InputStream");
c$.isCompoundDocumentB = Clazz_defineMethod (c$, "isCompoundDocumentB", 
function (bytes) {
return (bytes.length >= 8 && bytes[0] == 0xD0 && bytes[1] == 0xCF && bytes[2] == 0x11 && bytes[3] == 0xE0 && bytes[4] == 0xA1 && bytes[5] == 0xB1 && bytes[6] == 0x1A && bytes[7] == 0xE1);
}, "~A");
c$.isGzipS = Clazz_defineMethod (c$, "isGzipS", 
function (is) {
return JU.Rdr.isGzipB (JU.Rdr.getMagic (is, 2));
}, "java.io.InputStream");
c$.isGzipB = Clazz_defineMethod (c$, "isGzipB", 
function (bytes) {
return (bytes != null && bytes.length >= 2 && bytes[0] == 0x1F && bytes[1] == 0x8B);
}, "~A");
c$.isPickleS = Clazz_defineMethod (c$, "isPickleS", 
function (is) {
return JU.Rdr.isPickleB (JU.Rdr.getMagic (is, 2));
}, "java.io.InputStream");
c$.isPickleB = Clazz_defineMethod (c$, "isPickleB", 
function (bytes) {
return (bytes != null && bytes.length >= 2 && bytes[0] == 0x7D && bytes[1] == 0x71);
}, "~A");
c$.isPngZipStream = Clazz_defineMethod (c$, "isPngZipStream", 
function (is) {
return JU.Rdr.isPngZipB (JU.Rdr.getMagic (is, 55));
}, "java.io.InputStream");
c$.isPngZipB = Clazz_defineMethod (c$, "isPngZipB", 
function (bytes) {
return (bytes[50] == 0 && bytes[51] == 0x50 && bytes[52] == 0x4E && bytes[53] == 0x47 && bytes[54] == 0x4A);
}, "~A");
c$.isZipS = Clazz_defineMethod (c$, "isZipS", 
function (is) {
return JU.Rdr.isZipB (JU.Rdr.getMagic (is, 4));
}, "java.io.InputStream");
c$.isZipB = Clazz_defineMethod (c$, "isZipB", 
function (bytes) {
return (bytes.length >= 4 && bytes[0] == 0x50 && bytes[1] == 0x4B && bytes[2] == 0x03 && bytes[3] == 0x04);
}, "~A");
c$.getMagic = Clazz_defineMethod (c$, "getMagic", 
 function (is, n) {
var abMagic =  Clazz_newByteArray (n, 0);
{
is.resetStream();
}try {
is.mark (n + 1);
is.read (abMagic, 0, n);
} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
} else {
throw e;
}
}
try {
is.reset ();
} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
} else {
throw e;
}
}
return abMagic;
}, "java.io.InputStream,~N");
c$.getBIS = Clazz_defineMethod (c$, "getBIS", 
function (bytes) {
return  new java.io.BufferedInputStream ( new java.io.ByteArrayInputStream (bytes));
}, "~A");
c$.getBR = Clazz_defineMethod (c$, "getBR", 
function (string) {
return  new java.io.BufferedReader ( new java.io.StringReader (string));
}, "~S");
c$.getUnzippedInputStream = Clazz_defineMethod (c$, "getUnzippedInputStream", 
function (jzt, bis) {
while (JU.Rdr.isGzipS (bis)) bis =  new java.io.BufferedInputStream (JU.Rdr.newGZIPInputStream (jzt, bis));

return bis;
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream");
c$.getBytesFromSB = Clazz_defineMethod (c$, "getBytesFromSB", 
function (sb) {
return (JU.Rdr.isBase64 (sb) ? JU.Base64.decodeBase64 (sb.substring (8)) : sb.toBytes (0, -1));
}, "JU.SB");
c$.getStreamAsBytes = Clazz_defineMethod (c$, "getStreamAsBytes", 
function (bis, out) {
var buf =  Clazz_newByteArray (1024, 0);
var bytes = (out == null ?  Clazz_newByteArray (4096, 0) : null);
var len = 0;
var totalLen = 0;
while ((len = bis.read (buf, 0, 1024)) > 0) {
totalLen += len;
if (out == null) {
if (totalLen >= bytes.length) bytes = JU.AU.ensureLengthByte (bytes, totalLen * 2);
System.arraycopy (buf, 0, bytes, totalLen - len, len);
} else {
out.write (buf, 0, len);
}}
bis.close ();
if (out == null) {
return JU.AU.arrayCopyByte (bytes, totalLen);
}return totalLen + " bytes";
}, "java.io.BufferedInputStream,JU.OC");
c$.getBufferedReader = Clazz_defineMethod (c$, "getBufferedReader", 
function (bis, charSet) {
if (JU.Rdr.getUTFEncodingForStream (bis) === JU.Encoding.NONE) return  new java.io.BufferedReader ( new java.io.InputStreamReader (bis, (charSet == null ? "UTF-8" : charSet)));
var bytes = JU.Rdr.getLimitedStreamBytes (bis, -1);
bis.close ();
return JU.Rdr.getBR (charSet == null ? JU.Rdr.fixUTF (bytes) :  String.instantialize (bytes, charSet));
}, "java.io.BufferedInputStream,~S");
c$.getLimitedStreamBytes = Clazz_defineMethod (c$, "getLimitedStreamBytes", 
function (is, n) {
var buflen = (n > 0 && n < 1024 ? n : 1024);
var buf =  Clazz_newByteArray (buflen, 0);
var bytes =  Clazz_newByteArray (n < 0 ? 4096 : n, 0);
var len = 0;
var totalLen = 0;
if (n < 0) n = 2147483647;
while (totalLen < n && (len = is.read (buf, 0, buflen)) > 0) {
totalLen += len;
if (totalLen > bytes.length) bytes = JU.AU.ensureLengthByte (bytes, totalLen * 2);
System.arraycopy (buf, 0, bytes, totalLen - len, len);
if (n != 2147483647 && totalLen + buflen > bytes.length) buflen = bytes.length - totalLen;
}
if (totalLen == bytes.length) return bytes;
buf =  Clazz_newByteArray (totalLen, 0);
System.arraycopy (bytes, 0, buf, 0, totalLen);
return buf;
}, "java.io.InputStream,~N");
c$.StreamToUTF8String = Clazz_defineMethod (c$, "StreamToUTF8String", 
function (bis) {
var data =  new Array (1);
try {
JU.Rdr.readAllAsString (JU.Rdr.getBufferedReader (bis, "UTF-8"), -1, true, data, 0);
} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
} else {
throw e;
}
}
return data[0];
}, "java.io.BufferedInputStream");
c$.readAllAsString = Clazz_defineMethod (c$, "readAllAsString", 
function (br, nBytesMax, allowBinary, data, i) {
try {
var sb = JU.SB.newN (8192);
var line;
if (nBytesMax < 0) {
line = br.readLine ();
if (allowBinary || line != null && line.indexOf ('\0') < 0 && (line.length != 4 || line.charCodeAt (0) != 65533 || line.indexOf ("PNG") != 1)) {
sb.append (line).appendC ('\n');
while ((line = br.readLine ()) != null) sb.append (line).appendC ('\n');

}} else {
var n = 0;
var len;
while (n < nBytesMax && (line = br.readLine ()) != null) {
if (nBytesMax - n < (len = line.length) + 1) line = line.substring (0, nBytesMax - n - 1);
sb.append (line).appendC ('\n');
n += len + 1;
}
}br.close ();
data[i] = sb.toString ();
return true;
} catch (ioe) {
if (Clazz_exceptionOf (ioe, Exception)) {
data[i] = ioe.toString ();
return false;
} else {
throw ioe;
}
}
}, "java.io.BufferedReader,~N,~B,~A,~N");
c$.getPngZipPointAndCount = Clazz_defineMethod (c$, "getPngZipPointAndCount", 
function (bis, pt_count) {
bis.mark (75);
try {
var data = JU.Rdr.getLimitedStreamBytes (bis, 74);
bis.reset ();
var pt = 0;
for (var i = 64, f = 1; --i > 54; f *= 10) pt += (data[i] - 48) * f;

var n = 0;
for (var i = 74, f = 1; --i > 64; f *= 10) n += (data[i] - 48) * f;

pt_count[0] = pt;
pt_count[1] = n;
} catch (e) {
pt_count[1] = 0;
}
}, "java.io.BufferedInputStream,~A");
c$.getPngZipStream = Clazz_defineMethod (c$, "getPngZipStream", 
function (bis, asNewStream) {
if (!JU.Rdr.isPngZipStream (bis)) return bis;
var data =  Clazz_newByteArray (0, 0);
bis.mark (75);
try {
var pt_count =  Clazz_newIntArray (2, 0);
JU.Rdr.getPngZipPointAndCount (bis, pt_count);
if (pt_count[1] != 0) {
var pt = pt_count[0];
while (pt > 0) pt -= bis.skip (pt);

if (!asNewStream) return bis;
data = JU.Rdr.getLimitedStreamBytes (bis, pt_count[1]);
}} catch (e) {
} finally {
try {
if (asNewStream) bis.close ();
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}
return JU.Rdr.getBIS (data);
}, "java.io.BufferedInputStream,~B");
c$.readFileAsMap = Clazz_defineMethod (c$, "readFileAsMap", 
function (jzt, is, bdata, name) {
jzt.readFileAsMap (is, bdata, name);
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream,java.util.Map,~S");
c$.getZipDirectoryAsStringAndClose = Clazz_defineMethod (c$, "getZipDirectoryAsStringAndClose", 
function (jzt, t) {
return jzt.getZipDirectoryAsStringAndClose (t);
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream");
c$.newGZIPInputStream = Clazz_defineMethod (c$, "newGZIPInputStream", 
function (jzt, bis) {
return jzt.newGZIPInputStream (bis);
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream");
c$.newZipInputStream = Clazz_defineMethod (c$, "newZipInputStream", 
function (jzt, $in) {
return jzt.newZipInputStream ($in);
}, "javajs.api.GenericZipTools,java.io.InputStream");
c$.getZipFileDirectory = Clazz_defineMethod (c$, "getZipFileDirectory", 
function (jzt, bis, subFileList, listPtr, asBufferedInputStream) {
return jzt.getZipFileDirectory (jzt, bis, subFileList, listPtr, asBufferedInputStream);
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream,~A,~N,~B");
c$.getZipDirectoryAndClose = Clazz_defineMethod (c$, "getZipDirectoryAndClose", 
function (jzt, t, manifestID) {
return jzt.getZipDirectoryAndClose (t, manifestID);
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream,~S");
c$.getAllZipData = Clazz_defineMethod (c$, "getAllZipData", 
function (jzt, bis, subFileList, replace, string, fileData) {
jzt.getAllZipData (bis, subFileList, replace, string, fileData);
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream,~A,~S,~S,java.util.Map");
c$.getZipFileContentsAsBytes = Clazz_defineMethod (c$, "getZipFileContentsAsBytes", 
function (jzt, bis, subFileList, i) {
return jzt.getZipFileContentsAsBytes (bis, subFileList, i);
}, "javajs.api.GenericZipTools,java.io.BufferedInputStream,~A,~N");
c$.addZipEntry = Clazz_defineMethod (c$, "addZipEntry", 
function (jzt, zos, fileName) {
jzt.addZipEntry (zos, fileName);
}, "javajs.api.GenericZipTools,~O,~S");
c$.closeZipEntry = Clazz_defineMethod (c$, "closeZipEntry", 
function (jzt, zos) {
jzt.closeZipEntry (zos);
}, "javajs.api.GenericZipTools,~O");
c$.getZipOutputStream = Clazz_defineMethod (c$, "getZipOutputStream", 
function (jzt, bos) {
return jzt.getZipOutputStream (bos);
}, "javajs.api.GenericZipTools,~O");
c$.getCrcValue = Clazz_defineMethod (c$, "getCrcValue", 
function (jzt, bytes) {
return jzt.getCrcValue (bytes);
}, "javajs.api.GenericZipTools,~A");
c$.getZipRoot = Clazz_defineMethod (c$, "getZipRoot", 
function (fileName) {
var pt = fileName.indexOf ("|");
return (pt < 0 ? fileName : fileName.substring (0, pt));
}, "~S");
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.T3d", ["java.lang.Double"], function () {
c$ = Clazz_decorateAsClass (function () {
this.x = 0;
this.y = 0;
this.z = 0;
Clazz_instantialize (this, arguments);
}, JU, "T3d", null, java.io.Serializable);
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "set", 
function (x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setA", 
function (t) {
this.x = t[0];
this.y = t[1];
this.z = t[2];
}, "~A");
Clazz_defineMethod (c$, "setT", 
function (t1) {
this.x = t1.x;
this.y = t1.y;
this.z = t1.z;
}, "JU.T3d");
Clazz_defineMethod (c$, "add2", 
function (t1, t2) {
this.x = t1.x + t2.x;
this.y = t1.y + t2.y;
this.z = t1.z + t2.z;
}, "JU.T3d,JU.T3d");
Clazz_defineMethod (c$, "add", 
function (t1) {
this.x += t1.x;
this.y += t1.y;
this.z += t1.z;
}, "JU.T3d");
Clazz_defineMethod (c$, "sub2", 
function (t1, t2) {
this.x = t1.x - t2.x;
this.y = t1.y - t2.y;
this.z = t1.z - t2.z;
}, "JU.T3d,JU.T3d");
Clazz_defineMethod (c$, "sub", 
function (t1) {
this.x -= t1.x;
this.y -= t1.y;
this.z -= t1.z;
}, "JU.T3d");
Clazz_defineMethod (c$, "scale", 
function (s) {
this.x *= s;
this.y *= s;
this.z *= s;
}, "~N");
Clazz_defineMethod (c$, "scaleAdd", 
function (s, t1, t2) {
this.x = s * t1.x + t2.x;
this.y = s * t1.y + t2.y;
this.z = s * t1.z + t2.z;
}, "~N,JU.T3d,JU.T3d");
Clazz_overrideMethod (c$, "hashCode", 
function () {
var xbits = JU.T3d.doubleToLongBits0 (this.x);
var ybits = JU.T3d.doubleToLongBits0 (this.y);
var zbits = JU.T3d.doubleToLongBits0 (this.z);
return (xbits ^ (xbits >> 32) ^ ybits ^ (ybits >> 32) ^ zbits ^ (zbits >> 32));
});
c$.doubleToLongBits0 = Clazz_defineMethod (c$, "doubleToLongBits0", 
function (d) {
return (d == 0 ? 0 : Double.doubleToLongBits (d));
}, "~N");
Clazz_overrideMethod (c$, "equals", 
function (t1) {
if (!(Clazz_instanceOf (t1, JU.T3d))) return false;
var t2 = t1;
return (this.x == t2.x && this.y == t2.y && this.z == t2.z);
}, "~O");
Clazz_overrideMethod (c$, "toString", 
function () {
return "{" + this.x + ", " + this.y + ", " + this.z + "}";
});
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.T3d"], "JU.V3d", null, function () {
c$ = Clazz_declareType (JU, "V3d", JU.T3d);
Clazz_defineMethod (c$, "cross", 
function (v1, v2) {
this.set (v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x);
}, "JU.V3d,JU.V3d");
Clazz_defineMethod (c$, "normalize", 
function () {
var d = this.length ();
this.x /= d;
this.y /= d;
this.z /= d;
});
Clazz_defineMethod (c$, "dot", 
function (v) {
return this.x * v.x + this.y * v.y + this.z * v.z;
}, "JU.V3d");
Clazz_defineMethod (c$, "lengthSquared", 
function () {
return this.x * this.x + this.y * this.y + this.z * this.z;
});
Clazz_defineMethod (c$, "length", 
function () {
return Math.sqrt (this.lengthSquared ());
});
});
Clazz_declarePackage ("J.adapter.readers.molxyz");
Clazz_load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.molxyz.MolReader", ["java.lang.Exception", "$.Float", "JU.PT", "J.adapter.smarter.Atom", "J.api.JmolAdapter", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.is2D = false;
this.haveAtomSerials = false;
this.dimension = null;
this.allow2D = true;
this.iatom0 = 0;
this.vr = null;
Clazz_instantialize (this, arguments);
}, J.adapter.readers.molxyz, "MolReader", J.adapter.smarter.AtomSetCollectionReader);
Clazz_overrideMethod (c$, "initializeReader", 
function () {
this.is2D = this.checkFilterKey ("2D");
});
Clazz_overrideMethod (c$, "checkLine", 
function () {
var isMDL = (this.line.startsWith ("$MDL"));
if (isMDL) {
this.discardLinesUntilStartsWith ("$HDR");
this.rd ();
if (this.line == null) {
JU.Logger.warn ("$HDR not found in MDL RG file");
this.continuing = false;
return false;
}} else if (this.line.equals ("M  END")) return true;
if (this.doGetModel (++this.modelNumber, null)) {
this.iatom0 = this.asc.ac;
this.processMolSdHeader ();
this.processCtab (isMDL);
this.vr = null;
if (this.isLastModel (this.modelNumber)) {
this.continuing = false;
return false;
}}if (this.line != null && this.line.indexOf ("$$$$") < 0) this.discardLinesUntilStartsWith ("$$$$");
return true;
});
Clazz_overrideMethod (c$, "finalizeSubclassReader", 
function () {
this.finalizeReaderMR ();
});
Clazz_defineMethod (c$, "finalizeReaderMR", 
function () {
if (this.is2D) this.set2D ();
this.isTrajectory = false;
this.finalizeReaderASCR ();
});
Clazz_defineMethod (c$, "processMolSdHeader", 
 function () {
var header = "";
var thisDataSetName = this.line;
header += this.line + "\n";
this.asc.setCollectionName (this.line);
this.rd ();
if (this.line == null) return;
header += this.line + "\n";
this.dimension = (this.line.length < 22 ? "3D" : this.line.substring (20, 22));
if (!this.allow2D && this.dimension.equals ("2D")) throw  new Exception ("File is 2D, not 3D");
this.asc.setInfo ("dimension", this.dimension);
this.rd ();
if (this.line == null) return;
header += this.line + "\n";
JU.Logger.info (header);
this.checkCurrentLineForScript ();
this.asc.setInfo ("fileHeader", header);
this.newAtomSet (thisDataSetName);
});
Clazz_defineMethod (c$, "processCtab", 
 function (isMDL) {
if (isMDL) this.discardLinesUntilStartsWith ("$CTAB");
if (this.rd () == null) return;
if (this.line.indexOf ("V3000") >= 0) {
this.is2D = (this.dimension.equals ("2D"));
this.vr = (this.getInterface ("J.adapter.readers.molxyz.V3000Rdr")).set (this);
this.discardLinesUntilContains ("COUNTS");
this.vr.readAtomsAndBonds (this.getTokens ());
} else {
this.readAtomsAndBonds (this.parseIntRange (this.line, 0, 3), this.parseIntRange (this.line, 3, 6));
}this.applySymmetryAndSetTrajectory ();
}, "~B");
Clazz_defineMethod (c$, "readAtomsAndBonds", 
 function (ac, bc) {
for (var i = 0; i < ac; ++i) {
this.rd ();
var len = this.line.length;
var elementSymbol;
var x;
var y;
var z;
var charge = 0;
var isotope = 0;
var iAtom = -2147483648;
x = this.parseFloatRange (this.line, 0, 10);
y = this.parseFloatRange (this.line, 10, 20);
z = this.parseFloatRange (this.line, 20, 30);
if (len < 34) {
elementSymbol = this.line.substring (31).trim ();
} else {
elementSymbol = this.line.substring (31, 34).trim ();
if (len >= 39) {
var code = this.parseIntRange (this.line, 36, 39);
if (code >= 1 && code <= 7) charge = 4 - code;
code = this.parseIntRange (this.line, 34, 36);
if (code != 0 && code >= -3 && code <= 4) {
isotope = J.api.JmolAdapter.getNaturalIsotope (J.api.JmolAdapter.getElementNumber (elementSymbol));
switch (isotope) {
case 0:
break;
case 1:
isotope = -code;
break;
default:
isotope += code;
}
}if (iAtom == -2147483648 && this.haveAtomSerials) iAtom = i + 1;
}}this.addMolAtom (iAtom, isotope, elementSymbol, charge, x, y, z);
}
for (var i = 0; i < bc; ++i) {
this.rd ();
var iAtom1;
var iAtom2;
var stereo = 0;
iAtom1 = this.line.substring (0, 3).trim ();
iAtom2 = this.line.substring (3, 6).trim ();
var order = this.parseIntRange (this.line, 6, 9);
if (this.is2D && order == 1 && this.line.length >= 12) stereo = this.parseIntRange (this.line, 9, 12);
order = this.fixOrder (order, stereo);
if (this.haveAtomSerials) this.asc.addNewBondFromNames (iAtom1, iAtom2, order);
 else this.asc.addNewBondWithOrder (this.iatom0 + this.parseIntStr (iAtom1) - 1, this.iatom0 + this.parseIntStr (iAtom2) - 1, order);
}
while (this.rd () != null && this.line.indexOf ("$$$$") != 0) {
if (this.line.toUpperCase ().contains ("_PARTIAL_CHARGES")) {
try {
var atoms = this.asc.atoms;
for (var i = this.parseIntStr (this.rd ()); --i >= 0; ) {
var tokens = JU.PT.getTokens (this.rd ());
var atomIndex = this.parseIntStr (tokens[0]) + this.iatom0 - 1;
var partialCharge = this.parseFloatStr (tokens[1]);
if (!Float.isNaN (partialCharge)) atoms[atomIndex].partialCharge = partialCharge;
}
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return;
} else {
throw e;
}
}
}}
}, "~N,~N");
Clazz_defineMethod (c$, "addMolAtom", 
function (iAtom, isotope, elementSymbol, charge, x, y, z) {
switch (isotope) {
case 0:
break;
case -1:
elementSymbol = "D";
break;
case -2:
elementSymbol = "T";
break;
default:
elementSymbol = isotope + elementSymbol;
}
if (this.is2D && z != 0) this.is2D = false;
var atom =  new J.adapter.smarter.Atom ();
atom.elementSymbol = elementSymbol;
atom.formalCharge = charge;
this.setAtomCoordXYZ (atom, x, y, z);
if (iAtom == -2147483648) {
this.asc.addAtom (atom);
} else {
this.haveAtomSerials = true;
atom.atomSerial = iAtom;
this.asc.addAtomWithMappedSerialNumber (atom);
}}, "~N,~N,~S,~N,~N,~N,~N");
Clazz_defineMethod (c$, "fixOrder", 
function (order, stereo) {
switch (order) {
default:
case 0:
case -10:
return 1;
case 1:
switch (stereo) {
case 1:
return 1025;
case 3:
case 6:
return 1041;
}
break;
case 2:
case 3:
break;
case 4:
return 515;
case 5:
return 66;
case 6:
return 513;
case 7:
return 514;
case 8:
case 9:
return 33;
}
return order;
}, "~N,~N");
Clazz_defineMethod (c$, "addMolBond", 
function (iAtom1, iAtom2, order, stereo) {
order = this.fixOrder (order, stereo);
if (this.haveAtomSerials) this.asc.addNewBondFromNames (iAtom1, iAtom2, order);
 else this.asc.addNewBondWithOrder (this.iatom0 + this.parseIntStr (iAtom1) - 1, this.iatom0 + this.parseIntStr (iAtom2) - 1, order);
}, "~S,~S,~N,~N");
});
Clazz_declarePackage ("J.adapter.readers.molxyz");
Clazz_load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.molxyz.XyzReader", ["java.lang.Float", "JU.Logger"], function () {
c$ = Clazz_declareType (J.adapter.readers.molxyz, "XyzReader", J.adapter.smarter.AtomSetCollectionReader);
Clazz_overrideMethod (c$, "checkLine", 
function () {
var modelAtomCount = this.parseIntStr (this.line);
if (modelAtomCount == -2147483648) {
this.continuing = false;
return false;
}this.vibrationNumber = ++this.modelNumber;
if (this.desiredVibrationNumber <= 0 ? this.doGetModel (this.modelNumber, null) : this.doGetVibration (this.vibrationNumber)) {
this.rd ();
this.checkCurrentLineForScript ();
this.asc.newAtomSet ();
var name = this.line;
this.readAtoms (modelAtomCount);
this.applySymmetryAndSetTrajectory ();
this.asc.setAtomSetName (name);
if (this.isLastModel (this.modelNumber)) {
this.continuing = false;
return false;
}} else {
this.skipAtomSet (modelAtomCount);
}this.discardLinesUntilNonBlank ();
return false;
});
Clazz_overrideMethod (c$, "finalizeSubclassReader", 
function () {
this.isTrajectory = false;
this.finalizeReaderASCR ();
});
Clazz_defineMethod (c$, "skipAtomSet", 
 function (modelAtomCount) {
this.rd ();
for (var i = modelAtomCount; --i >= 0; ) this.rd ();

}, "~N");
Clazz_defineMethod (c$, "readAtoms", 
 function (modelAtomCount) {
for (var i = 0; i < modelAtomCount; ++i) {
this.rd ();
var tokens = this.getTokens ();
if (tokens.length < 4) {
JU.Logger.warn ("line cannot be read for XYZ atom data: " + this.line);
continue;
}var atom = this.addAtomXYZSymName (tokens, 1, null, null);
this.setElementAndIsotope (atom, tokens[0]);
var vpt = 4;
switch (tokens.length) {
case 4:
continue;
case 5:
case 6:
case 8:
case 9:
if (tokens[4].indexOf (".") >= 0) {
atom.partialCharge = this.parseFloatStr (tokens[4]);
} else {
var charge = this.parseIntStr (tokens[4]);
if (charge != -2147483648) atom.formalCharge = charge;
}switch (tokens.length) {
case 5:
continue;
case 6:
atom.radius = this.parseFloatStr (tokens[5]);
continue;
case 9:
atom.atomSerial = this.parseIntStr (tokens[8]);
}
vpt++;
default:
var vx = this.parseFloatStr (tokens[vpt++]);
var vy = this.parseFloatStr (tokens[vpt++]);
var vz = this.parseFloatStr (tokens[vpt++]);
if (Float.isNaN (vx) || Float.isNaN (vy) || Float.isNaN (vz)) continue;
this.asc.addVibrationVector (atom.index, vx, vy, vz);
}
}
}, "~N");
});
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["JU.P3"], "J.adapter.smarter.Atom", ["JU.AU", "$.Lst", "$.V3", "JU.Vibration"], function () {
c$ = Clazz_decorateAsClass (function () {
this.atomSetIndex = 0;
this.index = 0;
this.bsSymmetry = null;
this.atomSite = 0;
this.elementSymbol = null;
this.elementNumber = -1;
this.atomName = null;
this.formalCharge = -2147483648;
this.partialCharge = NaN;
this.vib = null;
this.bfactor = NaN;
this.foccupancy = 1;
this.radius = NaN;
this.isHetero = false;
this.atomSerial = -2147483648;
this.chainID = 0;
this.altLoc = '\0';
this.group3 = null;
this.sequenceNumber = -2147483648;
this.insertionCode = '\0';
this.anisoBorU = null;
this.tensors = null;
this.ignoreSymmetry = false;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "Atom", JU.P3, Cloneable);
Clazz_defineMethod (c$, "addTensor", 
function (tensor, type, reset) {
if (tensor == null) return null;
if (reset || this.tensors == null) this.tensors =  new JU.Lst ();
this.tensors.addLast (tensor);
if (type != null) tensor.setType (type);
return tensor;
}, "JU.Tensor,~S,~B");
Clazz_overrideConstructor (c$, 
function () {
this.set (NaN, NaN, NaN);
});
Clazz_defineMethod (c$, "getClone", 
function () {
var a = this.clone ();
if (this.vib != null) {
if (Clazz_instanceOf (this.vib, JU.Vibration)) {
a.vib = (this.vib).clone ();
} else {
a.vib = JU.V3.newV (a.vib);
}}if (this.anisoBorU != null) a.anisoBorU = JU.AU.arrayCopyF (this.anisoBorU, -1);
if (this.tensors != null) {
a.tensors =  new JU.Lst ();
for (var i = this.tensors.size (); --i >= 0; ) a.tensors.addLast ((this.tensors.get (i)).copyTensor ());

}return a;
});
Clazz_defineMethod (c$, "getElementSymbol", 
function () {
if (this.elementSymbol == null) if (this.atomName != null) {
var len = this.atomName.length;
var ichFirst = 0;
var chFirst = String.fromCharCode (0);
while (ichFirst < len && !J.adapter.smarter.Atom.isValidSymChar1 (chFirst = this.atomName.charAt (ichFirst))) ++ichFirst;

switch (len - ichFirst) {
case 0:
break;
default:
var chSecond = this.atomName.charAt (ichFirst + 1);
if (J.adapter.smarter.Atom.isValidSymNoCase (chFirst, chSecond)) {
this.elementSymbol = "" + chFirst + chSecond;
break;
}case 1:
if (J.adapter.smarter.Atom.isValidSym1 (chFirst)) this.elementSymbol = "" + chFirst;
break;
}
}return this.elementSymbol;
});
c$.isValidSym1 = Clazz_defineMethod (c$, "isValidSym1", 
function (ch) {
return (ch >= 'A' && ch <= 'Z' && J.adapter.smarter.Atom.elementCharMasks[ch.charCodeAt (0) - 65] < 0);
}, "~S");
c$.isValidSym2 = Clazz_defineMethod (c$, "isValidSym2", 
function (ch1, ch2) {
return (ch1 >= 'A' && ch1 <= 'Z' && ch2 >= 'a' && ch2 <= 'z' && ((J.adapter.smarter.Atom.elementCharMasks[ch1.charCodeAt (0) - 65] >> (ch2.charCodeAt (0) - 97)) & 1) != 0);
}, "~S,~S");
c$.isValidSymNoCase = Clazz_defineMethod (c$, "isValidSymNoCase", 
function (ch1, ch2) {
return J.adapter.smarter.Atom.isValidSym2 (ch1, ch2 < 'a' ? String.fromCharCode (ch2.charCodeAt (0) + 32) : ch2);
}, "~S,~S");
c$.isValidSymChar1 = Clazz_defineMethod (c$, "isValidSymChar1", 
 function (ch) {
return (ch >= 'A' && ch <= 'Z' && J.adapter.smarter.Atom.elementCharMasks[ch.charCodeAt (0) - 65] != 0);
}, "~S");
Clazz_defineStatics (c$,
"elementCharMasks", [1972292, -2147351151, -2146019271, -2130706430, 1441792, -2147348464, 25, -2147205008, -2147344384, 0, -2147352576, 1179905, 548936, -2147434213, -2147221504, -2145759221, 0, 1056947, -2147339946, -2147477097, -2147483648, -2147483648, -2147483648, 8388624, -2147483646, 139264]);
});
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["J.api.JmolAdapterAtomIterator"], "J.adapter.smarter.AtomIterator", ["java.lang.Float", "J.api.JmolAdapter"], function () {
c$ = Clazz_decorateAsClass (function () {
this.iatom = 0;
this.atom = null;
this.ac = 0;
this.atoms = null;
this.bsAtoms = null;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "AtomIterator", null, J.api.JmolAdapterAtomIterator);
Clazz_makeConstructor (c$, 
function (asc) {
this.ac = asc.ac;
this.atoms = asc.atoms;
this.bsAtoms = asc.bsAtoms;
this.iatom = 0;
}, "J.adapter.smarter.AtomSetCollection");
Clazz_overrideMethod (c$, "hasNext", 
function () {
if (this.iatom == this.ac) return false;
while ((this.atom = this.atoms[this.iatom++]) == null || (this.bsAtoms != null && !this.bsAtoms.get (this.atom.index))) if (this.iatom == this.ac) return false;

this.atoms[this.iatom - 1] = null;
return true;
});
Clazz_overrideMethod (c$, "getAtomSetIndex", 
function () {
return this.atom.atomSetIndex;
});
Clazz_overrideMethod (c$, "getSymmetry", 
function () {
return this.atom.bsSymmetry;
});
Clazz_overrideMethod (c$, "getAtomSite", 
function () {
return this.atom.atomSite + 1;
});
Clazz_overrideMethod (c$, "getUniqueID", 
function () {
return Integer.$valueOf (this.atom.index);
});
Clazz_overrideMethod (c$, "getElementNumber", 
function () {
return (this.atom.elementNumber > 0 ? this.atom.elementNumber : J.api.JmolAdapter.getElementNumber (this.atom.getElementSymbol ()));
});
Clazz_overrideMethod (c$, "getAtomName", 
function () {
return this.atom.atomName;
});
Clazz_overrideMethod (c$, "getFormalCharge", 
function () {
return this.atom.formalCharge;
});
Clazz_overrideMethod (c$, "getPartialCharge", 
function () {
return this.atom.partialCharge;
});
Clazz_overrideMethod (c$, "getTensors", 
function () {
return this.atom.tensors;
});
Clazz_overrideMethod (c$, "getRadius", 
function () {
return this.atom.radius;
});
Clazz_overrideMethod (c$, "getVib", 
function () {
return (this.atom.vib == null || Float.isNaN (this.atom.vib.z) ? null : this.atom.vib);
});
Clazz_overrideMethod (c$, "getSeqID", 
function () {
return (this.atom.vib == null || !Float.isNaN (this.atom.vib.y) || this.atom.vib.z != 1095761940 ? 0 : Clazz_floatToInt (this.atom.vib.x));
});
Clazz_overrideMethod (c$, "getBfactor", 
function () {
return this.atom.bfactor;
});
Clazz_overrideMethod (c$, "getOccupancy", 
function () {
return this.atom.foccupancy * 100;
});
Clazz_overrideMethod (c$, "getIsHetero", 
function () {
return this.atom.isHetero;
});
Clazz_overrideMethod (c$, "getSerial", 
function () {
return this.atom.atomSerial;
});
Clazz_overrideMethod (c$, "getChainID", 
function () {
return this.atom.chainID;
});
Clazz_overrideMethod (c$, "getAltLoc", 
function () {
return J.api.JmolAdapter.canonizeAlternateLocationID (this.atom.altLoc);
});
Clazz_overrideMethod (c$, "getGroup3", 
function () {
return this.atom.group3;
});
Clazz_overrideMethod (c$, "getSequenceNumber", 
function () {
return this.atom.sequenceNumber;
});
Clazz_overrideMethod (c$, "getInsertionCode", 
function () {
return J.api.JmolAdapter.canonizeInsertionCode (this.atom.insertionCode);
});
Clazz_overrideMethod (c$, "getXYZ", 
function () {
return this.atom;
});
});
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["java.util.Hashtable"], "J.adapter.smarter.AtomSetCollection", ["java.lang.Boolean", "$.Float", "java.util.Collections", "$.Properties", "JU.AU", "$.BS", "$.Lst", "$.P3", "$.V3", "J.adapter.smarter.Atom", "$.Bond", "$.SmarterJmolAdapter", "J.api.Interface", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.reader = null;
this.bsAtoms = null;
this.fileTypeName = null;
this.collectionName = null;
this.atomSetInfo = null;
this.atoms = null;
this.ac = 0;
this.bonds = null;
this.bondCount = 0;
this.structures = null;
this.structureCount = 0;
this.atomSetCount = 0;
this.iSet = -1;
this.atomSetNumbers = null;
this.atomSetAtomIndexes = null;
this.atomSetAtomCounts = null;
this.atomSetBondCounts = null;
this.atomSetAuxiliaryInfo = null;
this.errorMessage = null;
this.coordinatesAreFractional = false;
this.isTrajectory = false;
this.trajectoryStepCount = 0;
this.trajectorySteps = null;
this.vibrationSteps = null;
this.trajectoryNames = null;
this.doFixPeriodic = false;
this.allowMultiple = false;
this.readerList = null;
this.bsStructuredModels = null;
this.haveAnisou = false;
this.baseSymmetryAtomCount = 0;
this.checkLatticeOnly = false;
this.xtalSymmetry = null;
this.bondIndex0 = 0;
this.checkSpecial = true;
this.atomSymbolicMap = null;
this.haveUnitCell = false;
this.vibScale = 0;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "AtomSetCollection");
Clazz_prepareFields (c$, function () {
this.atomSetInfo =  new java.util.Hashtable ();
this.atoms =  new Array (256);
this.bonds =  new Array (256);
this.structures =  new Array (16);
this.atomSetNumbers =  Clazz_newIntArray (16, 0);
this.atomSetAtomIndexes =  Clazz_newIntArray (16, 0);
this.atomSetAtomCounts =  Clazz_newIntArray (16, 0);
this.atomSetBondCounts =  Clazz_newIntArray (16, 0);
this.atomSetAuxiliaryInfo =  new Array (16);
this.atomSymbolicMap =  new java.util.Hashtable ();
});
Clazz_defineMethod (c$, "setCollectionName", 
function (collectionName) {
if (collectionName == null || (collectionName = collectionName.trim ()).length == 0) return;
this.collectionName = collectionName;
}, "~S");
Clazz_defineMethod (c$, "clearGlobalBoolean", 
function (globalIndex) {
this.atomSetInfo.remove (J.adapter.smarter.AtomSetCollection.globalBooleans[globalIndex]);
}, "~N");
Clazz_defineMethod (c$, "setGlobalBoolean", 
function (globalIndex) {
this.setInfo (J.adapter.smarter.AtomSetCollection.globalBooleans[globalIndex], Boolean.TRUE);
}, "~N");
Clazz_defineMethod (c$, "getGlobalBoolean", 
function (globalIndex) {
return (this.atomSetInfo.get (J.adapter.smarter.AtomSetCollection.globalBooleans[globalIndex]) === Boolean.TRUE);
}, "~N");
Clazz_makeConstructor (c$, 
function (fileTypeName, reader, array, list) {
this.fileTypeName = fileTypeName;
this.reader = reader;
this.allowMultiple = (reader == null || reader.desiredVibrationNumber < 0);
var p =  new java.util.Properties ();
p.put ("PATH_KEY", ".PATH");
p.put ("PATH_SEPARATOR", J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR);
this.setInfo ("properties", p);
if (array != null) {
var n = 0;
this.readerList =  new JU.Lst ();
for (var i = 0; i < array.length; i++) if (array[i].ac > 0 || array[i].reader != null && array[i].reader.mustFinalizeModelSet) this.appendAtomSetCollection (n++, array[i]);

if (n > 1) this.setInfo ("isMultiFile", Boolean.TRUE);
} else if (list != null) {
this.setInfo ("isMultiFile", Boolean.TRUE);
this.appendAtomSetCollectionList (list);
}}, "~S,J.adapter.smarter.AtomSetCollectionReader,~A,JU.Lst");
Clazz_defineMethod (c$, "appendAtomSetCollectionList", 
 function (list) {
var n = list.size ();
if (n == 0) {
this.errorMessage = "No file found!";
return;
}for (var i = 0; i < n; i++) {
var o = list.get (i);
if (Clazz_instanceOf (o, JU.Lst)) this.appendAtomSetCollectionList (o);
 else this.appendAtomSetCollection (i, o);
}
}, "JU.Lst");
Clazz_defineMethod (c$, "setTrajectory", 
function () {
if (!this.isTrajectory) this.trajectorySteps =  new JU.Lst ();
this.isTrajectory = true;
var n = (this.bsAtoms == null ? this.ac : this.bsAtoms.cardinality ());
if (n == 0) return;
var trajectoryStep =  new Array (n);
var haveVibrations = (n > 0 && this.atoms[0].vib != null && !Float.isNaN (this.atoms[0].vib.z));
var vibrationStep = (haveVibrations ?  new Array (n) : null);
var prevSteps = (this.trajectoryStepCount == 0 ? null : this.trajectorySteps.get (this.trajectoryStepCount - 1));
for (var i = 0, ii = 0; i < this.ac; i++) {
if (this.bsAtoms != null && !this.bsAtoms.get (i)) continue;
var pt = JU.P3.newP (this.atoms[i]);
if (this.doFixPeriodic && prevSteps != null) pt = J.adapter.smarter.AtomSetCollection.fixPeriodic (pt, prevSteps[i]);
trajectoryStep[ii] = pt;
if (haveVibrations) vibrationStep[ii] = this.atoms[i].vib;
ii++;
}
if (haveVibrations) {
if (this.vibrationSteps == null) {
this.vibrationSteps =  new JU.Lst ();
for (var i = 0; i < this.trajectoryStepCount; i++) this.vibrationSteps.addLast (null);

}this.vibrationSteps.addLast (vibrationStep);
}this.trajectorySteps.addLast (trajectoryStep);
this.trajectoryStepCount++;
});
Clazz_defineMethod (c$, "appendAtomSetCollection", 
function (collectionIndex, collection) {
if (collection.reader != null && collection.reader.mustFinalizeModelSet) this.readerList.addLast (collection.reader);
var existingAtomsCount = this.ac;
this.setInfo ("loadState", collection.atomSetInfo.get ("loadState"));
if (collection.bsAtoms != null) {
if (this.bsAtoms == null) this.bsAtoms =  new JU.BS ();
for (var i = collection.bsAtoms.nextSetBit (0); i >= 0; i = collection.bsAtoms.nextSetBit (i + 1)) this.bsAtoms.set (existingAtomsCount + i);

}var clonedAtoms = 0;
var atomSetCount0 = this.atomSetCount;
for (var atomSetNum = 0; atomSetNum < collection.atomSetCount; atomSetNum++) {
this.newAtomSet ();
var info = this.atomSetAuxiliaryInfo[this.iSet] = collection.atomSetAuxiliaryInfo[atomSetNum];
var atomInfo = info.get ("PDB_CONECT_firstAtom_count_max");
if (atomInfo != null) atomInfo[0] += existingAtomsCount;
this.setCurrentModelInfo ("title", collection.collectionName);
this.setAtomSetName (collection.getAtomSetName (atomSetNum));
for (var atomNum = 0; atomNum < collection.atomSetAtomCounts[atomSetNum]; atomNum++) {
try {
if (this.bsAtoms != null) this.bsAtoms.set (this.ac);
this.newCloneAtom (collection.atoms[clonedAtoms]);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
this.errorMessage = "appendAtomCollection error: " + e;
} else {
throw e;
}
}
clonedAtoms++;
}
this.atomSetNumbers[this.iSet] = (collectionIndex < 0 ? this.iSet + 1 : ((collectionIndex + 1) * 1000000) + collection.atomSetNumbers[atomSetNum]);
}
for (var bondNum = 0; bondNum < collection.bondCount; bondNum++) {
var bond = collection.bonds[bondNum];
this.addNewBondWithOrder (bond.atomIndex1 + existingAtomsCount, bond.atomIndex2 + existingAtomsCount, bond.order);
}
for (var i = J.adapter.smarter.AtomSetCollection.globalBooleans.length; --i >= 0; ) if (collection.getGlobalBoolean (i)) this.setGlobalBoolean (i);

for (var i = 0; i < collection.structureCount; i++) {
var s = collection.structures[i];
this.addStructure (s);
s.modelStartEnd[0] += atomSetCount0;
s.modelStartEnd[1] += atomSetCount0;
}
}, "~N,J.adapter.smarter.AtomSetCollection");
Clazz_defineMethod (c$, "setNoAutoBond", 
function () {
this.setInfo ("noAutoBond", Boolean.TRUE);
});
Clazz_defineMethod (c$, "freeze", 
function (reverseModels) {
if (this.atomSetCount == 1 && this.collectionName == null) this.collectionName = this.getAtomSetAuxiliaryInfoValue (0, "name");
if (reverseModels) this.reverseAtomSets ();
if (this.trajectoryStepCount > 1) this.finalizeTrajectory ();
this.getList (true);
this.getList (false);
for (var i = 0; i < this.atomSetCount; i++) {
this.setModelInfoForSet ("initialAtomCount", Integer.$valueOf (this.atomSetAtomCounts[i]), i);
this.setModelInfoForSet ("initialBondCount", Integer.$valueOf (this.atomSetBondCounts[i]), i);
}
}, "~B");
Clazz_defineMethod (c$, "reverseAtomSets", 
 function () {
this.reverseArray (this.atomSetAtomIndexes);
this.reverseArray (this.atomSetNumbers);
this.reverseArray (this.atomSetAtomCounts);
this.reverseArray (this.atomSetBondCounts);
J.adapter.smarter.AtomSetCollection.reverseList (this.trajectorySteps);
J.adapter.smarter.AtomSetCollection.reverseList (this.trajectoryNames);
J.adapter.smarter.AtomSetCollection.reverseList (this.vibrationSteps);
this.reverseObject (this.atomSetAuxiliaryInfo);
for (var i = 0; i < this.ac; i++) this.atoms[i].atomSetIndex = this.atomSetCount - 1 - this.atoms[i].atomSetIndex;

for (var i = 0; i < this.structureCount; i++) {
var m = this.structures[i].modelStartEnd[0];
if (m >= 0) {
this.structures[i].modelStartEnd[0] = this.atomSetCount - 1 - this.structures[i].modelStartEnd[1];
this.structures[i].modelStartEnd[1] = this.atomSetCount - 1 - m;
}}
for (var i = 0; i < this.bondCount; i++) this.bonds[i].atomSetIndex = this.atomSetCount - 1 - this.atoms[this.bonds[i].atomIndex1].atomSetIndex;

this.reverseSets (this.bonds, this.bondCount);
var lists = JU.AU.createArrayOfArrayList (this.atomSetCount);
for (var i = 0; i < this.atomSetCount; i++) lists[i] =  new JU.Lst ();

for (var i = 0; i < this.ac; i++) lists[this.atoms[i].atomSetIndex].addLast (this.atoms[i]);

var newIndex =  Clazz_newIntArray (this.ac, 0);
var n = this.ac;
for (var i = this.atomSetCount; --i >= 0; ) for (var j = lists[i].size (); --j >= 0; ) {
var a = this.atoms[--n] = lists[i].get (j);
newIndex[a.index] = n;
a.index = n;
}

for (var i = 0; i < this.bondCount; i++) {
this.bonds[i].atomIndex1 = newIndex[this.bonds[i].atomIndex1];
this.bonds[i].atomIndex2 = newIndex[this.bonds[i].atomIndex2];
}
for (var i = 0; i < this.atomSetCount; i++) {
var conect = this.getAtomSetAuxiliaryInfoValue (i, "PDB_CONECT_firstAtom_count_max");
if (conect == null) continue;
conect[0] = newIndex[conect[0]];
conect[1] = this.atomSetAtomCounts[i];
}
});
Clazz_defineMethod (c$, "reverseSets", 
 function (o, n) {
var lists = JU.AU.createArrayOfArrayList (this.atomSetCount);
for (var i = 0; i < this.atomSetCount; i++) lists[i] =  new JU.Lst ();

for (var i = 0; i < n; i++) {
var index = o[i].atomSetIndex;
if (index < 0) return;
lists[o[i].atomSetIndex].addLast (o[i]);
}
for (var i = this.atomSetCount; --i >= 0; ) for (var j = lists[i].size (); --j >= 0; ) o[--n] = lists[i].get (j);


}, "~A,~N");
Clazz_defineMethod (c$, "reverseObject", 
 function (o) {
var n = this.atomSetCount;
for (var i = Clazz_doubleToInt (n / 2); --i >= 0; ) JU.AU.swap (o, i, n - 1 - i);

}, "~A");
c$.reverseList = Clazz_defineMethod (c$, "reverseList", 
 function (list) {
if (list == null) return;
java.util.Collections.reverse (list);
}, "JU.Lst");
Clazz_defineMethod (c$, "reverseArray", 
 function (a) {
var n = this.atomSetCount;
for (var i = Clazz_doubleToInt (n / 2); --i >= 0; ) JU.AU.swapInt (a, i, n - 1 - i);

}, "~A");
Clazz_defineMethod (c$, "getList", 
 function (isAltLoc) {
var i;
for (i = this.ac; --i >= 0; ) if (this.atoms[i] != null && (isAltLoc ? this.atoms[i].altLoc : this.atoms[i].insertionCode) != '\0') break;

if (i < 0) return;
var lists =  new Array (this.atomSetCount);
for (i = 0; i < this.atomSetCount; i++) lists[i] = "";

var pt;
for (i = 0; i < this.ac; i++) {
if (this.atoms[i] == null) continue;
var id = (isAltLoc ? this.atoms[i].altLoc : this.atoms[i].insertionCode);
if (id != '\0' && lists[pt = this.atoms[i].atomSetIndex].indexOf (id) < 0) lists[pt] += id;
}
var type = (isAltLoc ? "altLocs" : "insertionCodes");
for (i = 0; i < this.atomSetCount; i++) if (lists[i].length > 0) this.setModelInfoForSet (type, lists[i], i);

}, "~B");
Clazz_defineMethod (c$, "finish", 
function () {
if (this.reader != null) this.reader.finalizeModelSet ();
 else if (this.readerList != null) for (var i = 0; i < this.readerList.size (); i++) this.readerList.get (i).finalizeModelSet ();

this.atoms = null;
this.atomSetAtomCounts =  Clazz_newIntArray (16, 0);
this.atomSetAuxiliaryInfo =  new Array (16);
this.atomSetInfo =  new java.util.Hashtable ();
this.atomSetCount = 0;
this.atomSetNumbers =  Clazz_newIntArray (16, 0);
this.atomSymbolicMap =  new java.util.Hashtable ();
this.bonds = null;
this.iSet = -1;
this.readerList = null;
this.xtalSymmetry = null;
this.structures =  new Array (16);
this.structureCount = 0;
this.trajectorySteps = null;
this.vibrationSteps = null;
});
Clazz_defineMethod (c$, "discardPreviousAtoms", 
function () {
for (var i = this.ac; --i >= 0; ) this.atoms[i] = null;

this.ac = 0;
this.atomSymbolicMap.clear ();
this.atomSetCount = 0;
this.iSet = -1;
for (var i = this.atomSetAuxiliaryInfo.length; --i >= 0; ) {
this.atomSetAtomCounts[i] = 0;
this.atomSetBondCounts[i] = 0;
this.atomSetAuxiliaryInfo[i] = null;
}
});
Clazz_defineMethod (c$, "removeAtomSet", 
function (imodel) {
if (this.bsAtoms == null) {
this.bsAtoms =  new JU.BS ();
this.bsAtoms.setBits (0, this.ac);
}var i0 = this.atomSetAtomIndexes[imodel];
var nAtoms = this.atomSetAtomCounts[imodel];
var i1 = i0 + nAtoms;
this.bsAtoms.clearBits (i0, i1);
for (var i = i1; i < this.ac; i++) this.atoms[i].atomSetIndex--;

for (var i = imodel + 1; i < this.atomSetCount; i++) {
this.atomSetAuxiliaryInfo[i - 1] = this.atomSetAuxiliaryInfo[i];
this.atomSetAtomIndexes[i - 1] = this.atomSetAtomIndexes[i];
this.atomSetBondCounts[i - 1] = this.atomSetBondCounts[i];
this.atomSetAtomCounts[i - 1] = this.atomSetAtomCounts[i];
this.atomSetNumbers[i - 1] = this.atomSetNumbers[i];
}
var n = 0;
for (var i = 0; i < this.structureCount; i++) {
var s = this.structures[i];
if (s.modelStartEnd[0] == imodel && s.modelStartEnd[1] == imodel) {
this.structures[i] = null;
n++;
}}
if (n > 0) {
var ss =  new Array (this.structureCount - n);
for (var i = 0, pt = 0; i < this.structureCount; i++) if (this.structures[i] != null) ss[pt++] = this.structures[i];

this.structures = ss;
}for (var i = 0; i < this.bondCount; i++) this.bonds[i].atomSetIndex = this.atoms[this.bonds[i].atomIndex1].atomSetIndex;

this.atomSetAuxiliaryInfo[--this.atomSetCount] = null;
}, "~N");
Clazz_defineMethod (c$, "removeCurrentAtomSet", 
function () {
if (this.iSet < 0) return;
this.iSet--;
this.atomSetCount--;
});
Clazz_defineMethod (c$, "getHydrogenAtomCount", 
function () {
var n = 0;
for (var i = 0; i < this.ac; i++) if (this.atoms[i].elementNumber == 1 || this.atoms[i].elementSymbol.equals ("H")) n++;

return n;
});
Clazz_defineMethod (c$, "newCloneAtom", 
function (atom) {
var clone = atom.getClone ();
this.addAtom (clone);
return clone;
}, "J.adapter.smarter.Atom");
Clazz_defineMethod (c$, "cloneFirstAtomSet", 
function (atomCount) {
if (!this.allowMultiple) return 0;
this.newAtomSet ();
if (atomCount == 0) atomCount = this.atomSetAtomCounts[0];
for (var i = 0; i < atomCount; ++i) this.newCloneAtom (this.atoms[i]);

return this.ac;
}, "~N");
Clazz_defineMethod (c$, "cloneAtomSetWithBonds", 
function (isLast) {
var nBonds = this.atomSetBondCounts[isLast ? this.iSet : 0];
var atomIncrement = (isLast ? this.cloneLastAtomSet () : this.cloneFirstAtomSet (0));
if (atomIncrement > 0) for (var i = 0; i < nBonds; i++) {
var bond = this.bonds[this.bondCount - nBonds];
this.addNewBondWithOrder (bond.atomIndex1 + atomIncrement, bond.atomIndex2 + atomIncrement, bond.order);
}
}, "~B");
Clazz_defineMethod (c$, "cloneLastAtomSet", 
function () {
return this.cloneLastAtomSetFromPoints (0, null);
});
Clazz_defineMethod (c$, "cloneLastAtomSetFromPoints", 
function (ac, pts) {
if (!this.allowMultiple) return 0;
var count = (ac > 0 ? ac : this.getLastAtomSetAtomCount ());
var atomIndex = this.getLastAtomSetAtomIndex ();
this.newAtomSet ();
for (var i = 0; i < count; ++i) {
var atom = this.newCloneAtom (this.atoms[atomIndex++]);
if (pts != null) atom.setT (pts[i]);
}
return count;
}, "~N,~A");
Clazz_defineMethod (c$, "getLastAtomSetAtomCount", 
function () {
return this.atomSetAtomCounts[this.iSet];
});
Clazz_defineMethod (c$, "getLastAtomSetAtomIndex", 
function () {
return this.ac - this.atomSetAtomCounts[this.iSet];
});
Clazz_defineMethod (c$, "addNewAtom", 
function () {
return this.addAtom ( new J.adapter.smarter.Atom ());
});
Clazz_defineMethod (c$, "addAtom", 
function (atom) {
if (this.ac == this.atoms.length) {
if (this.ac > 200000) this.atoms = JU.AU.ensureLength (this.atoms, this.ac + 50000);
 else this.atoms = JU.AU.doubleLength (this.atoms);
}if (this.atomSetCount == 0) this.newAtomSet ();
atom.index = this.ac;
this.atoms[this.ac++] = atom;
atom.atomSetIndex = this.iSet;
atom.atomSite = this.atomSetAtomCounts[this.iSet]++;
return atom;
}, "J.adapter.smarter.Atom");
Clazz_defineMethod (c$, "addAtomWithMappedName", 
function (atom) {
var atomName = this.addAtom (atom).atomName;
if (atomName != null) this.atomSymbolicMap.put (atomName, atom);
}, "J.adapter.smarter.Atom");
Clazz_defineMethod (c$, "addAtomWithMappedSerialNumber", 
function (atom) {
var atomSerial = this.addAtom (atom).atomSerial;
if (atomSerial != -2147483648) this.atomSymbolicMap.put ("" + atomSerial, atom);
}, "J.adapter.smarter.Atom");
Clazz_defineMethod (c$, "getAtomFromName", 
function (atomName) {
return this.atomSymbolicMap.get (atomName);
}, "~S");
Clazz_defineMethod (c$, "getAtomIndex", 
function (name) {
var a = this.atomSymbolicMap.get (name);
return (a == null ? -1 : a.index);
}, "~S");
Clazz_defineMethod (c$, "addNewBondWithOrder", 
function (atomIndex1, atomIndex2, order) {
if (atomIndex1 < 0 || atomIndex1 >= this.ac || atomIndex2 < 0 || atomIndex2 >= this.ac) return null;
var bond =  new J.adapter.smarter.Bond (atomIndex1, atomIndex2, order);
this.addBond (bond);
return bond;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "addNewBondFromNames", 
function (atomName1, atomName2, order) {
return this.addNewBondWithOrderA (this.getAtomFromName (atomName1), this.getAtomFromName (atomName2), order);
}, "~S,~S,~N");
Clazz_defineMethod (c$, "addNewBondWithOrderA", 
function (atom1, atom2, order) {
return (atom1 == null || atom2 == null ? null : this.addNewBondWithOrder (atom1.index, atom2.index, order));
}, "J.adapter.smarter.Atom,J.adapter.smarter.Atom,~N");
Clazz_defineMethod (c$, "addBond", 
function (bond) {
if (this.trajectoryStepCount > 0) return;
if (bond.atomIndex1 < 0 || bond.atomIndex2 < 0 || bond.order < 0 || this.atoms[bond.atomIndex1].atomSetIndex != this.atoms[bond.atomIndex2].atomSetIndex) {
if (JU.Logger.debugging) {
JU.Logger.debug (">>>>>>BAD BOND:" + bond.atomIndex1 + "-" + bond.atomIndex2 + " order=" + bond.order);
}return;
}if (this.bondCount == this.bonds.length) this.bonds = JU.AU.arrayCopyObject (this.bonds, this.bondCount + 1024);
this.bonds[this.bondCount++] = bond;
this.atomSetBondCounts[this.iSet]++;
}, "J.adapter.smarter.Bond");
Clazz_defineMethod (c$, "finalizeStructures", 
function () {
if (this.structureCount == 0) return;
this.bsStructuredModels =  new JU.BS ();
var map =  new java.util.Hashtable ();
for (var i = 0; i < this.structureCount; i++) {
var s = this.structures[i];
if (s.modelStartEnd[0] == -1) {
s.modelStartEnd[0] = 0;
s.modelStartEnd[1] = this.atomSetCount - 1;
}this.bsStructuredModels.setBits (s.modelStartEnd[0], s.modelStartEnd[1] + 1);
if (s.strandCount == 0) continue;
var key = s.structureID + " " + s.modelStartEnd[0];
var v = map.get (key);
var count = (v == null ? 0 : v.intValue ()) + 1;
map.put (key, Integer.$valueOf (count));
}
for (var i = 0; i < this.structureCount; i++) {
var s = this.structures[i];
if (s.strandCount == 1) s.strandCount = map.get (s.structureID + " " + s.modelStartEnd[0]).intValue ();
}
});
Clazz_defineMethod (c$, "addStructure", 
function (structure) {
if (this.structureCount == this.structures.length) this.structures = JU.AU.arrayCopyObject (this.structures, this.structureCount + 32);
this.structures[this.structureCount++] = structure;
}, "J.adapter.smarter.Structure");
Clazz_defineMethod (c$, "addVibrationVectorWithSymmetry", 
function (iatom, vx, vy, vz, withSymmetry) {
if (!withSymmetry) {
this.addVibrationVector (iatom, vx, vy, vz);
return;
}var atomSite = this.atoms[iatom].atomSite;
var atomSetIndex = this.atoms[iatom].atomSetIndex;
for (var i = iatom; i < this.ac && this.atoms[i].atomSetIndex == atomSetIndex; i++) {
if (this.atoms[i].atomSite == atomSite) this.addVibrationVector (i, vx, vy, vz);
}
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "addVibrationVector", 
function (iatom, x, y, z) {
if (!this.allowMultiple) iatom = iatom % this.ac;
return (this.atoms[iatom].vib = JU.V3.new3 (x, y, z));
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "setCoordinatesAreFractional", 
function (tf) {
this.coordinatesAreFractional = tf;
this.setCurrentModelInfo ("coordinatesAreFractional", Boolean.$valueOf (tf));
if (tf) this.setGlobalBoolean (0);
}, "~B");
Clazz_defineMethod (c$, "setAnisoBorU", 
function (atom, data, type) {
this.haveAnisou = true;
atom.anisoBorU = data;
data[6] = type;
}, "J.adapter.smarter.Atom,~A,~N");
Clazz_defineMethod (c$, "setU", 
function (atom, i, val) {
var data = atom.anisoBorU;
if (data == null) this.setAnisoBorU (atom, data =  Clazz_newFloatArray (8, 0), 8);
data[i] = val;
}, "J.adapter.smarter.Atom,~N,~N");
Clazz_defineMethod (c$, "getXSymmetry", 
function () {
if (this.xtalSymmetry == null) this.xtalSymmetry = (J.api.Interface.getOption ("adapter.smarter.XtalSymmetry", this.reader.vwr, "file")).set (this.reader);
return this.xtalSymmetry;
});
Clazz_defineMethod (c$, "getSymmetry", 
function () {
return this.getXSymmetry ().getSymmetry ();
});
Clazz_defineMethod (c$, "setSymmetry", 
function (symmetry) {
return (symmetry == null ? null : this.getXSymmetry ().setSymmetry (symmetry));
}, "J.api.SymmetryInterface");
Clazz_defineMethod (c$, "setTensors", 
function () {
if (this.haveAnisou) this.getXSymmetry ().setTensors ();
});
Clazz_defineMethod (c$, "setInfo", 
function (key, value) {
if (value == null) this.atomSetInfo.remove (key);
 else this.atomSetInfo.put (key, value);
}, "~S,~O");
Clazz_defineMethod (c$, "setAtomSetCollectionPartialCharges", 
function (auxKey) {
if (!this.atomSetInfo.containsKey (auxKey)) return false;
var atomData = this.atomSetInfo.get (auxKey);
for (var i = atomData.size (); --i >= 0; ) this.atoms[i].partialCharge = atomData.get (i).floatValue ();

JU.Logger.info ("Setting partial charges type " + auxKey);
return true;
}, "~S");
Clazz_defineMethod (c$, "mapPartialCharge", 
function (atomName, charge) {
this.getAtomFromName (atomName).partialCharge = charge;
}, "~S,~N");
c$.fixPeriodic = Clazz_defineMethod (c$, "fixPeriodic", 
 function (pt, pt0) {
pt.x = J.adapter.smarter.AtomSetCollection.fixPoint (pt.x, pt0.x);
pt.y = J.adapter.smarter.AtomSetCollection.fixPoint (pt.y, pt0.y);
pt.z = J.adapter.smarter.AtomSetCollection.fixPoint (pt.z, pt0.z);
return pt;
}, "JU.P3,JU.P3");
c$.fixPoint = Clazz_defineMethod (c$, "fixPoint", 
 function (x, x0) {
while (x - x0 > 0.9) {
x -= 1;
}
while (x - x0 < -0.9) {
x += 1;
}
return x;
}, "~N,~N");
Clazz_defineMethod (c$, "finalizeTrajectoryAs", 
function (trajectorySteps, vibrationSteps) {
this.trajectorySteps = trajectorySteps;
this.vibrationSteps = vibrationSteps;
this.trajectoryStepCount = trajectorySteps.size ();
this.finalizeTrajectory ();
}, "JU.Lst,JU.Lst");
Clazz_defineMethod (c$, "finalizeTrajectory", 
 function () {
if (this.trajectoryStepCount == 0) return;
var trajectory = this.trajectorySteps.get (0);
var vibrations = (this.vibrationSteps == null ? null : this.vibrationSteps.get (0));
var n = (this.bsAtoms == null ? this.ac : this.bsAtoms.cardinality ());
if (this.vibrationSteps != null && vibrations != null && vibrations.length < n || trajectory.length < n) {
this.errorMessage = "File cannot be loaded as a trajectory";
return;
}var v =  new JU.V3 ();
for (var i = 0, ii = 0; i < this.ac; i++) {
if (this.bsAtoms != null && !this.bsAtoms.get (i)) continue;
if (this.vibrationSteps != null) this.atoms[i].vib = (vibrations == null ? v : vibrations[ii]);
if (trajectory[ii] != null) this.atoms[i].setT (trajectory[ii]);
ii++;
}
this.setInfo ("trajectorySteps", this.trajectorySteps);
if (this.vibrationSteps != null) this.setInfo ("vibrationSteps", this.vibrationSteps);
});
Clazz_defineMethod (c$, "newAtomSet", 
function () {
this.newAtomSetClear (true);
});
Clazz_defineMethod (c$, "newAtomSetClear", 
function (doClearMap) {
if (!this.allowMultiple && this.iSet >= 0) this.discardPreviousAtoms ();
this.bondIndex0 = this.bondCount;
if (this.isTrajectory) {
this.discardPreviousAtoms ();
}this.iSet = this.atomSetCount++;
if (this.atomSetCount > this.atomSetNumbers.length) {
this.atomSetAtomIndexes = JU.AU.doubleLengthI (this.atomSetAtomIndexes);
this.atomSetAtomCounts = JU.AU.doubleLengthI (this.atomSetAtomCounts);
this.atomSetBondCounts = JU.AU.doubleLengthI (this.atomSetBondCounts);
this.atomSetAuxiliaryInfo = JU.AU.doubleLength (this.atomSetAuxiliaryInfo);
}this.atomSetAtomIndexes[this.iSet] = this.ac;
if (this.atomSetCount + this.trajectoryStepCount > this.atomSetNumbers.length) {
this.atomSetNumbers = JU.AU.doubleLengthI (this.atomSetNumbers);
}if (this.isTrajectory) {
this.atomSetNumbers[this.iSet + this.trajectoryStepCount] = this.atomSetCount + this.trajectoryStepCount;
} else {
this.atomSetNumbers[this.iSet] = this.atomSetCount;
}if (doClearMap) this.atomSymbolicMap.clear ();
this.setCurrentModelInfo ("title", this.collectionName);
}, "~B");
Clazz_defineMethod (c$, "getAtomSetAtomIndex", 
function (i) {
return this.atomSetAtomIndexes[i];
}, "~N");
Clazz_defineMethod (c$, "getAtomSetAtomCount", 
function (i) {
return this.atomSetAtomCounts[i];
}, "~N");
Clazz_defineMethod (c$, "getAtomSetBondCount", 
function (i) {
return this.atomSetBondCounts[i];
}, "~N");
Clazz_defineMethod (c$, "setAtomSetName", 
function (atomSetName) {
if (this.isTrajectory) {
this.setTrajectoryName (atomSetName);
return;
}this.setModelInfoForSet ("name", atomSetName, this.iSet);
if (!this.allowMultiple) this.setCollectionName (atomSetName);
}, "~S");
Clazz_defineMethod (c$, "setTrajectoryName", 
 function (name) {
if (this.trajectoryStepCount == 0) return;
if (this.trajectoryNames == null) {
this.trajectoryNames =  new JU.Lst ();
}for (var i = this.trajectoryNames.size (); i < this.trajectoryStepCount; i++) this.trajectoryNames.addLast (null);

this.trajectoryNames.set (this.trajectoryStepCount - 1, name);
}, "~S");
Clazz_defineMethod (c$, "setAtomSetNames", 
function (atomSetName, n, namedSets) {
for (var i = this.iSet; --n >= 0 && i >= 0; --i) if (namedSets == null || !namedSets.get (i)) this.setModelInfoForSet ("name", atomSetName, i);

}, "~S,~N,JU.BS");
Clazz_defineMethod (c$, "setCurrentAtomSetNumber", 
function (atomSetNumber) {
this.setAtomSetNumber (this.iSet + (this.isTrajectory ? this.trajectoryStepCount : 0), atomSetNumber);
}, "~N");
Clazz_defineMethod (c$, "setAtomSetNumber", 
function (index, atomSetNumber) {
this.atomSetNumbers[index] = atomSetNumber;
}, "~N,~N");
Clazz_defineMethod (c$, "setAtomSetModelProperty", 
function (key, value) {
this.setAtomSetModelPropertyForSet (key, value, this.iSet);
}, "~S,~S");
Clazz_defineMethod (c$, "setAtomSetModelPropertyForSet", 
function (key, value, atomSetIndex) {
var p = this.getAtomSetAuxiliaryInfoValue (atomSetIndex, "modelProperties");
if (p == null) this.setModelInfoForSet ("modelProperties", p =  new java.util.Properties (), atomSetIndex);
p.put (key, value);
if (key.startsWith (".")) p.put (key.substring (1), value);
}, "~S,~S,~N");
Clazz_defineMethod (c$, "setAtomProperties", 
function (key, data, atomSetIndex, isGroup) {
if (Clazz_instanceOf (data, String) && !(data).endsWith ("\n")) data = data + "\n";
if (atomSetIndex < 0) atomSetIndex = this.iSet;
var p = this.getAtomSetAuxiliaryInfoValue (atomSetIndex, "atomProperties");
if (p == null) this.setModelInfoForSet ("atomProperties", p =  new java.util.Hashtable (), atomSetIndex);
p.put (key, data);
}, "~S,~O,~N,~B");
Clazz_defineMethod (c$, "setAtomSetPartialCharges", 
function (auxKey) {
if (!this.atomSetAuxiliaryInfo[this.iSet].containsKey (auxKey)) {
return false;
}var atomData = this.getAtomSetAuxiliaryInfoValue (this.iSet, auxKey);
for (var i = atomData.size (); --i >= 0; ) {
this.atoms[i].partialCharge = atomData.get (i).floatValue ();
}
return true;
}, "~S");
Clazz_defineMethod (c$, "getAtomSetAuxiliaryInfoValue", 
function (index, key) {
return this.atomSetAuxiliaryInfo[index >= 0 ? index : this.iSet].get (key);
}, "~N,~S");
Clazz_defineMethod (c$, "setCurrentModelInfo", 
function (key, value) {
this.setModelInfoForSet (key, value, this.iSet);
}, "~S,~O");
Clazz_defineMethod (c$, "setModelInfoForSet", 
function (key, value, atomSetIndex) {
if (atomSetIndex < 0) return;
if (this.atomSetAuxiliaryInfo[atomSetIndex] == null) this.atomSetAuxiliaryInfo[atomSetIndex] =  new java.util.Hashtable ();
if (value == null) this.atomSetAuxiliaryInfo[atomSetIndex].remove (key);
 else this.atomSetAuxiliaryInfo[atomSetIndex].put (key, value);
}, "~S,~O,~N");
Clazz_defineMethod (c$, "setAtomSetPropertyForSets", 
function (key, value, n) {
for (var idx = this.iSet; --n >= 0 && idx >= 0; --idx) this.setAtomSetModelPropertyForSet (key, value, idx);

}, "~S,~S,~N");
Clazz_defineMethod (c$, "getAtomSetNumber", 
function (atomSetIndex) {
return this.atomSetNumbers[atomSetIndex >= this.atomSetCount ? 0 : atomSetIndex];
}, "~N");
Clazz_defineMethod (c$, "getAtomSetName", 
function (atomSetIndex) {
if (this.trajectoryNames != null && atomSetIndex < this.trajectoryNames.size ()) return this.trajectoryNames.get (atomSetIndex);
if (atomSetIndex >= this.atomSetCount) atomSetIndex = this.atomSetCount - 1;
return this.getAtomSetAuxiliaryInfoValue (atomSetIndex, "name");
}, "~N");
Clazz_defineMethod (c$, "getAtomSetAuxiliaryInfo", 
function (atomSetIndex) {
var i = (atomSetIndex >= this.atomSetCount ? this.atomSetCount - 1 : atomSetIndex);
return (i < 0 ? null : this.atomSetAuxiliaryInfo[i]);
}, "~N");
Clazz_defineMethod (c$, "setAtomSetEnergy", 
function (energyString, value) {
if (this.iSet < 0) return;
JU.Logger.info ("Energy for model " + (this.iSet + 1) + " = " + energyString);
this.setCurrentModelInfo ("EnergyString", energyString);
this.setCurrentModelInfo ("Energy", Float.$valueOf (value));
this.setAtomSetModelProperty ("Energy", "" + value);
}, "~S,~N");
Clazz_defineMethod (c$, "setAtomSetFrequency", 
function (pathKey, label, freq, units) {
this.setAtomSetModelProperty ("FreqValue", freq);
freq += " " + (units == null ? "cm^-1" : units);
var name = (label == null ? "" : label + " ") + freq;
this.setAtomSetName (name);
this.setAtomSetModelProperty ("Frequency", freq);
if (label != null) this.setAtomSetModelProperty ("FrequencyLabel", label);
this.setAtomSetModelProperty (".PATH", (pathKey == null ? "" : pathKey + J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR + "Frequencies") + "Frequencies");
return name;
}, "~S,~S,~S,~S");
Clazz_defineMethod (c$, "getBondList", 
function () {
var info =  new Array (this.bondCount);
for (var i = 0; i < this.bondCount; i++) {
info[i] = [this.atoms[this.bonds[i].atomIndex1].atomName, this.atoms[this.bonds[i].atomIndex2].atomName, "" + this.bonds[i].order];
}
return info;
});
Clazz_defineMethod (c$, "centralize", 
function () {
var pt =  new JU.P3 ();
for (var i = 0; i < this.atomSetCount; i++) {
var n = this.atomSetAtomCounts[i];
var atom0 = this.atomSetAtomIndexes[i];
pt.set (0, 0, 0);
for (var j = atom0 + n; --j >= atom0; ) pt.add (this.atoms[j]);

pt.scale (1 / n);
for (var j = atom0 + n; --j >= atom0; ) this.atoms[j].sub (pt);

}
});
Clazz_defineMethod (c$, "mergeTrajectories", 
function (a) {
if (!this.isTrajectory || !a.isTrajectory || this.vibrationSteps != null) return;
for (var i = 0; i < a.trajectoryStepCount; i++) this.trajectorySteps.add (this.trajectoryStepCount++, a.trajectorySteps.get (i));

this.setInfo ("trajectorySteps", this.trajectorySteps);
}, "J.adapter.smarter.AtomSetCollection");
Clazz_defineStatics (c$,
"globalBooleans", ["someModelsHaveFractionalCoordinates", "someModelsHaveSymmetry", "someModelsHaveUnitcells", "someModelsHaveCONECT", "isPDB", "someModelsHaveDomains", "someModelsHaveValidations"],
"GLOBAL_FRACTCOORD", 0,
"GLOBAL_SYMMETRY", 1,
"GLOBAL_UNITCELLS", 2,
"GLOBAL_CONECT", 3,
"GLOBAL_ISPDB", 4,
"GLOBAL_DOMAINS", 5,
"GLOBAL_VALIDATIONS", 6);
});
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["javajs.api.GenericLineReader", "JU.SB"], "J.adapter.smarter.AtomSetCollectionReader", ["java.io.BufferedReader", "java.lang.Boolean", "$.Float", "$.NullPointerException", "javajs.api.GenericBinaryDocument", "JU.BS", "$.Lst", "$.M3", "$.P3", "$.PT", "$.Quat", "$.V3", "J.adapter.smarter.Atom", "$.AtomSetCollection", "J.api.Interface", "$.JmolAdapter", "JU.BSUtil", "$.Logger", "$.Parser"], function () {
c$ = Clazz_decorateAsClass (function () {
this.isBinary = false;
this.asc = null;
this.reader = null;
this.binaryDoc = null;
this.readerName = null;
this.htParams = null;
this.trajectorySteps = null;
this.domains = null;
this.validation = null;
this.isConcatenated = false;
this.addedData = null;
this.addedDataKey = null;
this.fixJavaFloat = true;
this.line = null;
this.prevline = null;
this.next = null;
this.ptLine = 0;
this.latticeCells = null;
this.doProcessLines = false;
this.iHaveUnitCell = false;
this.iHaveSymmetryOperators = false;
this.continuing = true;
this.vwr = null;
this.doApplySymmetry = false;
this.ignoreFileSymmetryOperators = false;
this.isTrajectory = false;
this.applySymmetryToBonds = false;
this.doCheckUnitCell = false;
this.getHeader = false;
this.isSequential = false;
this.templateAtomCount = 0;
this.modelNumber = 0;
this.vibrationNumber = 0;
this.desiredVibrationNumber = -2147483648;
this.bsModels = null;
this.havePartialChargeFilter = false;
this.calculationType = "?";
this.sgName = null;
this.ignoreFileUnitCell = false;
this.ignoreFileSpaceGroupName = false;
this.notionalUnitCell = null;
this.desiredModelNumber = -2147483648;
this.symmetry = null;
this.out = null;
this.iHaveFractionalCoordinates = false;
this.doPackUnitCell = false;
this.ptSupercell = null;
this.mustFinalizeModelSet = false;
this.forcePacked = false;
this.packingError = 0.02;
this.loadNote = null;
this.doConvertToFractional = false;
this.fileCoordinatesAreFractional = false;
this.merging = false;
this.symmetryRange = 0;
this.firstLastStep = null;
this.lastModelNumber = 2147483647;
this.desiredSpaceGroupIndex = -1;
this.fileScaling = null;
this.fileOffset = null;
this.fileOffsetFractional = null;
this.unitCellOffset = null;
this.unitCellOffsetFractional = false;
this.moreUnitCellInfo = null;
this.filePath = null;
this.fileName = null;
this.stateScriptVersionInt = 2147483647;
this.baseAtomIndex = 0;
this.isFinalized = false;
this.haveModel = false;
this.previousSpaceGroup = null;
this.previousUnitCell = null;
this.nMatrixElements = 0;
this.matUnitCellOrientation = null;
this.bsFilter = null;
this.filter = null;
this.haveAtomFilter = false;
this.filterAltLoc = false;
this.filterGroup3 = false;
this.filterChain = false;
this.filterAtomName = false;
this.filterAtomType = false;
this.filterAtomTypeStr = null;
this.filterAtomNameTerminator = ";";
this.filterElement = false;
this.filterHetero = false;
this.filterEveryNth = false;
this.filterSymop = null;
this.filterN = 0;
this.nFiltered = 0;
this.doSetOrientation = false;
this.doCentralize = false;
this.addVibrations = false;
this.useAltNames = false;
this.allowPDBFilter = false;
this.doReadMolecularOrbitals = false;
this.reverseModels = false;
this.nameRequired = null;
this.doCentroidUnitCell = false;
this.centroidPacked = false;
this.strSupercell = null;
this.filter1 = null;
this.filter2 = null;
this.matRot = null;
this.ms = null;
this.vibsFractional = false;
this.previousScript = null;
this.siteScript = null;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "AtomSetCollectionReader", null, javajs.api.GenericLineReader);
Clazz_prepareFields (c$, function () {
this.next =  Clazz_newIntArray (1, 0);
this.loadNote =  new JU.SB ();
});
Clazz_defineMethod (c$, "setup", 
function (fullPath, htParams, reader) {
this.setupASCR (fullPath, htParams, reader);
}, "~S,java.util.Map,~O");
Clazz_defineMethod (c$, "setupASCR", 
function (fullPath, htParams, reader) {
if (fullPath == null) return;
this.htParams = htParams;
this.filePath = fullPath.$replace ('\\', '/');
var i = this.filePath.lastIndexOf ('/');
this.fileName = this.filePath.substring (i + 1);
if (Clazz_instanceOf (reader, java.io.BufferedReader)) this.reader = reader;
 else if (Clazz_instanceOf (reader, javajs.api.GenericBinaryDocument)) this.binaryDoc = reader;
}, "~S,java.util.Map,~O");
Clazz_defineMethod (c$, "readData", 
function () {
this.initialize ();
this.asc =  new J.adapter.smarter.AtomSetCollection (this.readerName, this, null, null);
try {
this.initializeReader ();
if (this.binaryDoc == null) {
if (this.line == null && this.continuing) this.rd ();
while (this.line != null && this.continuing) if (this.checkLine ()) this.rd ();

} else {
this.binaryDoc.setOutputChannel (this.out);
this.processBinaryDocument ();
}this.finalizeSubclassReader ();
if (!this.isFinalized) this.finalizeReaderASCR ();
} catch (e) {
JU.Logger.info ("Reader error: " + e);
if (!this.vwr.isJS) e.printStackTrace ();
this.setError (e);
}
if (this.reader != null) this.reader.close ();
if (this.binaryDoc != null) this.binaryDoc.close ();
return this.finish ();
});
Clazz_defineMethod (c$, "fixBaseIndices", 
 function () {
try {
var baseModelIndex = (this.htParams.get ("baseModelIndex")).intValue ();
this.baseAtomIndex += this.asc.ac;
baseModelIndex += this.asc.atomSetCount;
this.htParams.put ("baseAtomIndex", Integer.$valueOf (this.baseAtomIndex));
this.htParams.put ("baseModelIndex", Integer.$valueOf (baseModelIndex));
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
});
Clazz_defineMethod (c$, "readDataObject", 
function (node) {
this.initialize ();
this.asc =  new J.adapter.smarter.AtomSetCollection (this.readerName, this, null, null);
this.initializeReader ();
this.processDOM (node);
return this.finish ();
}, "~O");
Clazz_defineMethod (c$, "processDOM", 
function (DOMNode) {
}, "~O");
Clazz_defineMethod (c$, "processBinaryDocument", 
function () {
});
Clazz_defineMethod (c$, "initializeReader", 
function () {
});
Clazz_defineMethod (c$, "checkLine", 
function () {
return true;
});
Clazz_defineMethod (c$, "checkLastModel", 
function () {
if (this.isLastModel (this.modelNumber) && this.doProcessLines) return (this.continuing = this.doProcessLines = false);
this.doProcessLines = false;
return true;
});
Clazz_defineMethod (c$, "isLastModel", 
function (modelNumber) {
return (this.desiredModelNumber > 0 || modelNumber >= this.lastModelNumber);
}, "~N");
Clazz_defineMethod (c$, "appendLoadNote", 
function (info) {
if (info == null) {
this.loadNote =  new JU.SB ();
return;
}this.loadNote.append (info).append ("\n");
JU.Logger.info (info);
}, "~S");
Clazz_defineMethod (c$, "initializeTrajectoryFile", 
function () {
this.asc.addAtom ( new J.adapter.smarter.Atom ());
this.trajectorySteps = this.htParams.get ("trajectorySteps");
if (this.trajectorySteps == null) this.htParams.put ("trajectorySteps", this.trajectorySteps =  new JU.Lst ());
});
Clazz_defineMethod (c$, "finalizeSubclassReader", 
function () {
});
Clazz_defineMethod (c$, "finalizeReaderASCR", 
function () {
this.isFinalized = true;
if (this.asc.atomSetCount > 0) {
this.applySymmetryAndSetTrajectory ();
this.asc.finalizeStructures ();
if (this.doCentralize) this.asc.centralize ();
var info = this.asc.getAtomSetAuxiliaryInfo (0);
if (this.domains != null && info != null) {
this.asc.setGlobalBoolean (5);
var s = (this.domains).getMapKeys (2, true);
var pt = s.indexOf ("{ ", 2);
if (pt >= 0) s = s.substring (pt + 2);
pt = s.indexOf ("_metadata");
if (pt < 0) pt = s.indexOf ("metadata");
if (pt >= 0) s = s.substring (0, pt);
s = JU.PT.rep (JU.PT.replaceAllCharacters (s, "{}", "").trim (), "\n", "\n  ") + "\n\nUse SHOW DOMAINS for details.";
this.appendLoadNote ("\nDomains loaded:\n   " + s);
for (var i = this.asc.atomSetCount; --i >= 0; ) {
info = this.asc.getAtomSetAuxiliaryInfo (i);
info.put ("domains", this.domains);
}
}if (this.validation != null && info != null) {
for (var i = this.asc.atomSetCount; --i >= 0; ) {
info = this.asc.getAtomSetAuxiliaryInfo (i);
info.put ("validation", this.validation);
}
}}if (!this.fixJavaFloat) this.asc.setInfo ("legacyJavaFloat", Boolean.TRUE);
this.setLoadNote ();
});
Clazz_defineMethod (c$, "setLoadNote", 
function () {
var s = this.loadNote.toString ();
if (this.loadNote.length () > 0) this.asc.setInfo ("modelLoadNote", s);
return s;
});
Clazz_defineMethod (c$, "setIsPDB", 
function () {
this.asc.setGlobalBoolean (4);
if (this.htParams.get ("pdbNoHydrogens") != null) this.asc.setInfo ("pdbNoHydrogens", this.htParams.get ("pdbNoHydrogens"));
if (this.checkFilterKey ("ADDHYDROGENS")) this.asc.setInfo ("pdbAddHydrogens", Boolean.TRUE);
});
Clazz_defineMethod (c$, "setModelPDB", 
function (isPDB) {
if (isPDB) this.asc.setGlobalBoolean (4);
 else this.asc.clearGlobalBoolean (4);
this.asc.setCurrentModelInfo ("isPDB", isPDB ? Boolean.TRUE : null);
}, "~B");
Clazz_defineMethod (c$, "finish", 
 function () {
var s = this.htParams.get ("loadState");
this.asc.setInfo ("loadState", s == null ? "" : s);
s = this.htParams.get ("smilesString");
if (s != null) this.asc.setInfo ("smilesString", s);
if (!this.htParams.containsKey ("templateAtomCount")) this.htParams.put ("templateAtomCount", Integer.$valueOf (this.asc.ac));
if (this.htParams.containsKey ("bsFilter")) this.htParams.put ("filteredAtomCount", Integer.$valueOf (JU.BSUtil.cardinalityOf (this.htParams.get ("bsFilter"))));
if (!this.calculationType.equals ("?")) this.asc.setInfo ("calculationType", this.calculationType);
var name = this.asc.fileTypeName;
var fileType = name;
if (fileType.indexOf ("(") >= 0) fileType = fileType.substring (0, fileType.indexOf ("("));
for (var i = this.asc.atomSetCount; --i >= 0; ) {
this.asc.setModelInfoForSet ("fileName", this.filePath, i);
this.asc.setModelInfoForSet ("fileType", fileType, i);
}
this.asc.freeze (this.reverseModels);
if (this.asc.errorMessage != null) return this.asc.errorMessage + "\nfor file " + this.filePath + "\ntype " + name;
if ((this.asc.bsAtoms == null ? this.asc.ac : this.asc.bsAtoms.cardinality ()) == 0 && fileType.indexOf ("DataOnly") < 0 && this.asc.atomSetInfo.get ("dataOnly") == null) return "No atoms found\nfor file " + this.filePath + "\ntype " + name;
this.fixBaseIndices ();
return this.asc;
});
Clazz_defineMethod (c$, "setError", 
 function (e) {
var s;
{
if (e.getMessage)
s = e.getMessage()
else
s = e.toString();
}if (this.line == null) this.asc.errorMessage = "Error reading file at end of file \n" + s;
 else this.asc.errorMessage = "Error reading file at line " + this.ptLine + ":\n" + this.line + "\n" + s;
if (!this.vwr.isJS) e.printStackTrace ();
}, "Throwable");
Clazz_defineMethod (c$, "initialize", 
 function () {
if (this.htParams.containsKey ("baseAtomIndex")) this.baseAtomIndex = (this.htParams.get ("baseAtomIndex")).intValue ();
this.initializeSymmetry ();
this.vwr = this.htParams.remove ("vwr");
if (this.htParams.containsKey ("stateScriptVersionInt")) this.stateScriptVersionInt = (this.htParams.get ("stateScriptVersionInt")).intValue ();
var o = this.htParams.get ("packingError");
if (o != null) this.packingError = (o).floatValue ();
 else if (this.htParams.get ("legacyJavaFloat") != null) {
this.fixJavaFloat = false;
}this.merging = this.htParams.containsKey ("merging");
this.getHeader = this.htParams.containsKey ("getHeader");
this.isSequential = this.htParams.containsKey ("isSequential");
this.readerName = this.htParams.get ("readerName");
if (this.htParams.containsKey ("outputChannel")) this.out = this.htParams.get ("outputChannel");
if (this.htParams.containsKey ("vibrationNumber")) this.desiredVibrationNumber = (this.htParams.get ("vibrationNumber")).intValue ();
 else if (this.htParams.containsKey ("modelNumber")) this.desiredModelNumber = (this.htParams.get ("modelNumber")).intValue ();
this.applySymmetryToBonds = this.htParams.containsKey ("applySymmetryToBonds");
this.bsFilter = this.htParams.get ("bsFilter");
this.setFilter (null);
if (this.strSupercell != null) {
if (!this.checkFilterKey ("NOPACK")) this.forcePacked = true;
}o = this.htParams.get ("supercell");
if (Clazz_instanceOf (o, String)) this.strSupercell = o;
 else this.ptSupercell = o;
var ptFile = (this.htParams.containsKey ("ptFile") ? (this.htParams.get ("ptFile")).intValue () : -1);
this.isTrajectory = this.htParams.containsKey ("isTrajectory");
if (ptFile > 0 && this.htParams.containsKey ("firstLastSteps")) {
var val = (this.htParams.get ("firstLastSteps")).get (ptFile - 1);
if (Clazz_instanceOf (val, JU.BS)) {
this.bsModels = val;
} else {
this.firstLastStep = val;
}} else if (this.htParams.containsKey ("firstLastStep")) {
this.firstLastStep = this.htParams.get ("firstLastStep");
} else if (this.htParams.containsKey ("bsModels")) {
this.bsModels = this.htParams.get ("bsModels");
}if (this.htParams.containsKey ("templateAtomCount")) this.templateAtomCount = (this.htParams.get ("templateAtomCount")).intValue ();
if (this.bsModels != null || this.firstLastStep != null) this.desiredModelNumber = -2147483648;
if (this.bsModels == null && this.firstLastStep != null) {
if (this.firstLastStep[0] < 0) this.firstLastStep[0] = 0;
if (this.firstLastStep[2] == 0 || this.firstLastStep[1] < this.firstLastStep[0]) this.firstLastStep[1] = -1;
if (this.firstLastStep[2] < 1) this.firstLastStep[2] = 1;
this.bsModels = JU.BSUtil.newAndSetBit (this.firstLastStep[0]);
if (this.firstLastStep[1] > this.firstLastStep[0]) {
for (var i = this.firstLastStep[0]; i <= this.firstLastStep[1]; i += this.firstLastStep[2]) this.bsModels.set (i);

}}if (this.bsModels != null && (this.firstLastStep == null || this.firstLastStep[1] != -1)) this.lastModelNumber = this.bsModels.length ();
this.symmetryRange = (this.htParams.containsKey ("symmetryRange") ? (this.htParams.get ("symmetryRange")).floatValue () : 0);
this.initializeSymmetryOptions ();
if (this.htParams.containsKey ("spaceGroupIndex")) {
this.desiredSpaceGroupIndex = (this.htParams.get ("spaceGroupIndex")).intValue ();
if (this.desiredSpaceGroupIndex == -2) this.sgName = this.htParams.get ("spaceGroupName");
this.ignoreFileSpaceGroupName = (this.desiredSpaceGroupIndex == -2 || this.desiredSpaceGroupIndex >= 0);
this.ignoreFileSymmetryOperators = (this.desiredSpaceGroupIndex != -1);
}if (this.htParams.containsKey ("unitCellOffset")) {
this.fileScaling = JU.P3.new3 (1, 1, 1);
this.fileOffset = this.htParams.get ("unitCellOffset");
this.fileOffsetFractional = JU.P3.newP (this.fileOffset);
this.unitCellOffsetFractional = this.htParams.containsKey ("unitCellOffsetFractional");
}if (this.htParams.containsKey ("unitcell")) {
var fParams = this.htParams.get ("unitcell");
if (this.merging) this.setFractionalCoordinates (true);
if (fParams.length == 9) {
this.addPrimitiveLatticeVector (0, fParams, 0);
this.addPrimitiveLatticeVector (1, fParams, 3);
this.addPrimitiveLatticeVector (2, fParams, 6);
} else {
this.setUnitCell (fParams[0], fParams[1], fParams[2], fParams[3], fParams[4], fParams[5]);
}this.ignoreFileUnitCell = this.iHaveUnitCell;
if (this.merging && !this.iHaveUnitCell) this.setFractionalCoordinates (false);
}this.domains = this.htParams.get ("domains");
this.validation = this.htParams.get ("validation");
this.isConcatenated = this.htParams.containsKey ("concatenate");
});
Clazz_defineMethod (c$, "initializeSymmetryOptions", 
function () {
this.latticeCells =  Clazz_newIntArray (3, 0);
this.doApplySymmetry = false;
var pt = this.htParams.get ("lattice");
if (pt == null || pt.length () == 0) {
if (!this.forcePacked && this.strSupercell == null) return;
pt = JU.P3.new3 (1, 1, 1);
}this.latticeCells[0] = Clazz_floatToInt (pt.x);
this.latticeCells[1] = Clazz_floatToInt (pt.y);
this.latticeCells[2] = Clazz_floatToInt (pt.z);
this.doCentroidUnitCell = (this.htParams.containsKey ("centroid"));
if (this.doCentroidUnitCell && (this.latticeCells[2] == -1 || this.latticeCells[2] == 0)) this.latticeCells[2] = 1;
var isPacked = this.forcePacked || this.htParams.containsKey ("packed");
this.centroidPacked = this.doCentroidUnitCell && isPacked;
this.doPackUnitCell = !this.doCentroidUnitCell && (isPacked || this.latticeCells[2] < 0);
this.doApplySymmetry = (this.latticeCells[0] > 0 && this.latticeCells[1] > 0);
if (!this.doApplySymmetry) this.latticeCells =  Clazz_newIntArray (3, 0);
});
Clazz_defineMethod (c$, "doGetModel", 
function (modelNumber, title) {
if (title != null && this.nameRequired != null && this.nameRequired.length > 0 && title.toUpperCase ().indexOf (this.nameRequired) < 0) return false;
var isOK = (this.bsModels == null ? this.desiredModelNumber < 1 || modelNumber == this.desiredModelNumber : modelNumber > this.lastModelNumber ? false : modelNumber > 0 && this.bsModels.get (modelNumber - 1) || this.haveModel && this.firstLastStep != null && this.firstLastStep[1] < 0 && (this.firstLastStep[2] < 2 || (modelNumber - 1 - this.firstLastStep[0]) % this.firstLastStep[2] == 0));
if (isOK && this.desiredModelNumber == 0) this.asc.discardPreviousAtoms ();
this.haveModel = new Boolean (this.haveModel | isOK).valueOf ();
if (isOK) this.doProcessLines = true;
return isOK;
}, "~N,~S");
Clazz_defineMethod (c$, "initializeSymmetry", 
function () {
this.previousSpaceGroup = this.sgName;
this.previousUnitCell = this.notionalUnitCell;
this.iHaveUnitCell = this.ignoreFileUnitCell;
if (!this.ignoreFileUnitCell) {
this.notionalUnitCell =  Clazz_newFloatArray (25, 0);
for (var i = 25; --i >= 0; ) this.notionalUnitCell[i] = NaN;

this.symmetry = null;
}if (!this.ignoreFileSpaceGroupName) this.sgName = "unspecified!";
this.doCheckUnitCell = false;
});
Clazz_defineMethod (c$, "newAtomSet", 
function (name) {
if (this.asc.iSet >= 0) {
this.asc.newAtomSet ();
this.asc.setCollectionName ("<collection of " + (this.asc.iSet + 1) + " models>");
} else {
this.asc.setCollectionName (name);
}this.asc.setModelInfoForSet ("name", name, Math.max (0, this.asc.iSet));
}, "~S");
Clazz_defineMethod (c$, "cloneLastAtomSet", 
function (ac, pts) {
var lastAtomCount = this.asc.getLastAtomSetAtomCount ();
this.asc.cloneLastAtomSetFromPoints (ac, pts);
if (this.asc.haveUnitCell) {
this.iHaveUnitCell = true;
this.doCheckUnitCell = true;
this.sgName = this.previousSpaceGroup;
this.notionalUnitCell = this.previousUnitCell;
}return lastAtomCount;
}, "~N,~A");
Clazz_defineMethod (c$, "setSpaceGroupName", 
function (name) {
if (this.ignoreFileSpaceGroupName) return;
this.sgName = name.trim ();
JU.Logger.info ("Setting space group name to " + this.sgName);
}, "~S");
Clazz_defineMethod (c$, "setSymmetryOperator", 
function (xyz) {
if (this.ignoreFileSymmetryOperators) return -1;
var isym = this.asc.getXSymmetry ().addSpaceGroupOperation (xyz, true);
if (isym < 0) JU.Logger.warn ("Skippings symmetry operation " + xyz);
this.iHaveSymmetryOperators = true;
return isym;
}, "~S");
Clazz_defineMethod (c$, "initializeCartesianToFractional", 
 function () {
for (var i = 0; i < 16; i++) if (!Float.isNaN (this.notionalUnitCell[6 + i])) return;

for (var i = 0; i < 16; i++) this.notionalUnitCell[6 + i] = ((i % 5 == 0 ? 1 : 0));

this.nMatrixElements = 0;
});
Clazz_defineMethod (c$, "clearUnitCell", 
function () {
if (this.ignoreFileUnitCell) return;
for (var i = 6; i < 22; i++) this.notionalUnitCell[i] = NaN;

this.checkUnitCell (6);
});
Clazz_defineMethod (c$, "setUnitCellItem", 
function (i, x) {
if (this.ignoreFileUnitCell) return;
if (i == 0 && x == 1 || i == 3 && x == 0) return;
if (!Float.isNaN (x) && i >= 6 && Float.isNaN (this.notionalUnitCell[6])) this.initializeCartesianToFractional ();
this.notionalUnitCell[i] = x;
if (JU.Logger.debugging) {
JU.Logger.debug ("setunitcellitem " + i + " " + x);
}if (i < 6 || Float.isNaN (x)) this.iHaveUnitCell = this.checkUnitCell (6);
 else if (++this.nMatrixElements == 12) this.iHaveUnitCell = this.checkUnitCell (22);
}, "~N,~N");
Clazz_defineMethod (c$, "setUnitCell", 
function (a, b, c, alpha, beta, gamma) {
if (this.ignoreFileUnitCell) return;
this.clearUnitCell ();
this.notionalUnitCell[0] = a;
this.notionalUnitCell[1] = b;
this.notionalUnitCell[2] = c;
if (alpha != 0) this.notionalUnitCell[3] = alpha;
if (beta != 0) this.notionalUnitCell[4] = beta;
if (gamma != 0) this.notionalUnitCell[5] = gamma;
this.iHaveUnitCell = this.checkUnitCell (6);
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "addPrimitiveLatticeVector", 
function (i, xyz, i0) {
if (this.ignoreFileUnitCell) return;
if (i == 0) for (var j = 0; j < 6; j++) this.notionalUnitCell[j] = 0;

i = 6 + i * 3;
this.notionalUnitCell[i++] = xyz[i0++];
this.notionalUnitCell[i++] = xyz[i0++];
this.notionalUnitCell[i] = xyz[i0];
if (Float.isNaN (this.notionalUnitCell[0])) {
for (i = 0; i < 6; i++) this.notionalUnitCell[i] = -1;

}this.iHaveUnitCell = this.checkUnitCell (15);
}, "~N,~A,~N");
Clazz_defineMethod (c$, "checkUnitCell", 
 function (n) {
for (var i = 0; i < n; i++) if (Float.isNaN (this.notionalUnitCell[i])) return false;

if (n == 22 && this.notionalUnitCell[0] == 1) {
if (this.notionalUnitCell[1] == 1 && this.notionalUnitCell[2] == 1 && this.notionalUnitCell[6] == 1 && this.notionalUnitCell[11] == 1 && this.notionalUnitCell[16] == 1) return false;
}if (this.doApplySymmetry) {
this.getSymmetry ();
this.doConvertToFractional = !this.fileCoordinatesAreFractional;
}return true;
}, "~N");
Clazz_defineMethod (c$, "getSymmetry", 
function () {
if (!this.iHaveUnitCell) return null;
if (this.symmetry == null) {
this.getNewSymmetry ().setUnitCell (this.notionalUnitCell, false);
this.checkUnitCellOffset ();
}return this.symmetry;
});
Clazz_defineMethod (c$, "checkUnitCellOffset", 
 function () {
if (this.fileOffsetFractional == null || this.symmetry == null) return;
this.fileOffset.setT (this.fileOffsetFractional);
if (this.unitCellOffsetFractional != this.fileCoordinatesAreFractional) {
if (this.unitCellOffsetFractional) this.symmetry.toCartesian (this.fileOffset, false);
 else this.symmetry.toFractional (this.fileOffset, false);
}});
Clazz_defineMethod (c$, "getNewSymmetry", 
function () {
return this.symmetry = this.getInterface ("JS.Symmetry");
});
Clazz_defineMethod (c$, "setFractionalCoordinates", 
function (TF) {
this.iHaveFractionalCoordinates = this.fileCoordinatesAreFractional = TF;
this.checkUnitCellOffset ();
}, "~B");
Clazz_defineMethod (c$, "setFilterAtomTypeStr", 
function (s) {
this.filterAtomTypeStr = s;
this.filterAtomNameTerminator = "\0";
}, "~S");
Clazz_defineMethod (c$, "setFilter", 
function (filter0) {
if (filter0 == null) {
filter0 = this.htParams.get ("filter");
} else {
this.bsFilter = null;
}if (filter0 != null) filter0 = filter0.toUpperCase ();
this.filter = filter0;
this.doSetOrientation = !this.checkFilterKey ("NOORIENT");
this.doCentralize = (!this.checkFilterKey ("NOCENTER") && this.checkFilterKey ("CENTER"));
this.addVibrations = !this.checkFilterKey ("NOVIB");
this.doReadMolecularOrbitals = !this.checkFilterKey ("NOMO");
this.useAltNames = this.checkFilterKey ("ALTNAME");
this.reverseModels = this.checkFilterKey ("REVERSEMODELS");
if (this.filter == null) return;
if (this.checkFilterKey ("HETATM")) {
this.filterHetero = true;
this.filter = JU.PT.rep (this.filter, "HETATM", "HETATM-Y");
}if (this.checkFilterKey ("ATOM")) {
this.filterHetero = true;
this.filter = JU.PT.rep (this.filter, "ATOM", "HETATM-N");
}if (this.checkFilterKey ("CELL=")) this.strSupercell = this.filter.substring (this.filter.indexOf ("CELL=") + 5).toLowerCase ();
this.nameRequired = JU.PT.getQuotedAttribute (this.filter, "NAME");
if (this.nameRequired != null) {
if (this.nameRequired.startsWith ("'")) this.nameRequired = JU.PT.split (this.nameRequired, "'")[1];
 else if (this.nameRequired.startsWith ("\"")) this.nameRequired = JU.PT.split (this.nameRequired, "\"")[1];
filter0 = this.filter = JU.PT.rep (this.filter, this.nameRequired, "");
filter0 = this.filter = JU.PT.rep (this.filter, "NAME=", "");
}this.filterAtomName = this.checkFilterKey ("*.") || this.checkFilterKey ("!.");
this.filterElement = this.checkFilterKey ("_");
this.filterGroup3 = this.checkFilterKey ("[");
this.filterChain = this.checkFilterKey (":");
this.filterAltLoc = this.checkFilterKey ("%");
this.filterEveryNth = this.checkFilterKey ("/=");
if (this.filterEveryNth) this.filterN = this.parseIntAt (this.filter, this.filter.indexOf ("/=") + 2);
 else this.filterAtomType = this.checkFilterKey ("=");
if (this.filterN == -2147483648) this.filterEveryNth = false;
this.haveAtomFilter = this.filterAtomName || this.filterAtomType || this.filterElement || this.filterGroup3 || this.filterChain || this.filterAltLoc || this.filterHetero || this.filterEveryNth || this.checkFilterKey ("/=");
if (this.bsFilter == null) {
this.bsFilter =  new JU.BS ();
this.htParams.put ("bsFilter", this.bsFilter);
this.filter = (";" + this.filter + ";").$replace (',', ';');
var s = this.getFilter ("SYMOP=");
if (s != null) this.filterSymop = " " + s + " ";
JU.Logger.info ("filtering with " + this.filter);
if (this.haveAtomFilter) {
var ipt;
this.filter1 = this.filter;
if ((ipt = this.filter.indexOf ("|")) >= 0) {
this.filter1 = this.filter.substring (0, ipt).trim () + ";";
this.filter2 = ";" + this.filter.substring (ipt).trim ();
}}}}, "~S");
Clazz_defineMethod (c$, "getFilter", 
function (key) {
var pt = (this.filter == null ? -1 : this.filter.indexOf (key));
return (pt < 0 ? null : this.filter.substring (pt + key.length, this.filter.indexOf (";", pt)));
}, "~S");
Clazz_defineMethod (c$, "checkFilterKey", 
function (key) {
return (this.filter != null && this.filter.indexOf (key) >= 0);
}, "~S");
Clazz_defineMethod (c$, "filterAtom", 
function (atom, iAtom) {
if (!this.haveAtomFilter) return true;
var isOK = this.checkFilter (atom, this.filter1);
if (this.filter2 != null) isOK = new Boolean (isOK | this.checkFilter (atom, this.filter2)).valueOf ();
if (isOK && this.filterEveryNth) isOK = (((this.nFiltered++) % this.filterN) == 0);
this.bsFilter.setBitTo (iAtom >= 0 ? iAtom : this.asc.ac, isOK);
return isOK;
}, "J.adapter.smarter.Atom,~N");
Clazz_defineMethod (c$, "checkFilter", 
 function (atom, f) {
return (!this.filterGroup3 || atom.group3 == null || !this.filterReject (f, "[", atom.group3.toUpperCase () + "]")) && (!this.filterAtomName || this.allowAtomName (atom.atomName, f)) && (this.filterAtomTypeStr == null || atom.atomName == null || atom.atomName.toUpperCase ().indexOf ("\0" + this.filterAtomTypeStr) >= 0) && (!this.filterElement || atom.elementSymbol == null || !this.filterReject (f, "_", atom.elementSymbol.toUpperCase () + ";")) && (!this.filterChain || atom.chainID == 0 || !this.filterReject (f, ":", "" + this.vwr.getChainIDStr (atom.chainID))) && (!this.filterAltLoc || atom.altLoc == '\0' || !this.filterReject (f, "%", "" + atom.altLoc)) && (!this.filterHetero || !this.allowPDBFilter || !this.filterReject (f, "HETATM", atom.isHetero ? "-Y" : "-N"));
}, "J.adapter.smarter.Atom,~S");
Clazz_defineMethod (c$, "rejectAtomName", 
function (name) {
return this.filterAtomName && !this.allowAtomName (name, this.filter);
}, "~S");
Clazz_defineMethod (c$, "allowAtomName", 
 function (atomName, f) {
return (atomName == null || !this.filterReject (f, ".", atomName.toUpperCase () + this.filterAtomNameTerminator));
}, "~S,~S");
Clazz_defineMethod (c$, "filterReject", 
function (f, code, atomCode) {
return (f.indexOf (code) >= 0 && (f.indexOf ("!" + code) >= 0) == (f.indexOf (code + atomCode) >= 0));
}, "~S,~S,~S");
Clazz_defineMethod (c$, "set2D", 
function () {
this.asc.setInfo ("is2D", Boolean.TRUE);
if (!this.checkFilterKey ("NOMIN")) this.asc.setInfo ("doMinimize", Boolean.TRUE);
});
Clazz_defineMethod (c$, "doGetVibration", 
function (vibrationNumber) {
return this.addVibrations && (this.desiredVibrationNumber <= 0 || vibrationNumber == this.desiredVibrationNumber);
}, "~N");
Clazz_defineMethod (c$, "setTransform", 
function (x1, y1, z1, x2, y2, z2, x3, y3, z3) {
if (this.matRot != null || !this.doSetOrientation) return;
this.matRot =  new JU.M3 ();
var v = JU.V3.new3 (x1, y1, z1);
v.normalize ();
this.matRot.setColumnV (0, v);
v.set (x2, y2, z2);
v.normalize ();
this.matRot.setColumnV (1, v);
v.set (x3, y3, z3);
v.normalize ();
this.matRot.setColumnV (2, v);
this.asc.setInfo ("defaultOrientationMatrix", JU.M3.newM3 (this.matRot));
var q = JU.Quat.newM (this.matRot);
this.asc.setInfo ("defaultOrientationQuaternion", q);
JU.Logger.info ("defaultOrientationMatrix = " + this.matRot);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "setAtomCoordXYZ", 
function (atom, x, y, z) {
atom.set (x, y, z);
this.setAtomCoord (atom);
}, "J.adapter.smarter.Atom,~N,~N,~N");
Clazz_defineMethod (c$, "setAtomCoordScaled", 
function (atom, tokens, i, f) {
if (atom == null) atom = this.asc.addNewAtom ();
this.setAtomCoordXYZ (atom, this.parseFloatStr (tokens[i]) * f, this.parseFloatStr (tokens[i + 1]) * f, this.parseFloatStr (tokens[i + 2]) * f);
return atom;
}, "J.adapter.smarter.Atom,~A,~N,~N");
Clazz_defineMethod (c$, "setAtomCoordTokens", 
function (atom, tokens, i) {
this.setAtomCoordXYZ (atom, this.parseFloatStr (tokens[i]), this.parseFloatStr (tokens[i + 1]), this.parseFloatStr (tokens[i + 2]));
}, "J.adapter.smarter.Atom,~A,~N");
Clazz_defineMethod (c$, "addAtomXYZSymName", 
function (tokens, i, sym, name) {
var atom = this.asc.addNewAtom ();
if (sym != null) atom.elementSymbol = sym;
if (name != null) atom.atomName = name;
this.setAtomCoordTokens (atom, tokens, i);
return atom;
}, "~A,~N,~S,~S");
Clazz_defineMethod (c$, "setAtomCoord", 
function (atom) {
if (this.fileScaling != null) {
atom.x = atom.x * this.fileScaling.x + this.fileOffset.x;
atom.y = atom.y * this.fileScaling.y + this.fileOffset.y;
atom.z = atom.z * this.fileScaling.z + this.fileOffset.z;
}if (this.doConvertToFractional && !this.fileCoordinatesAreFractional && this.getSymmetry () != null) {
if (!this.symmetry.haveUnitCell ()) this.symmetry.setUnitCell (this.notionalUnitCell, false);
this.symmetry.toFractional (atom, false);
this.iHaveFractionalCoordinates = true;
}if (this.fixJavaFloat && this.fileCoordinatesAreFractional) JU.PT.fixPtFloats (atom, 100000.0);
this.doCheckUnitCell = true;
}, "J.adapter.smarter.Atom");
Clazz_defineMethod (c$, "addSites", 
function (htSites) {
this.asc.setCurrentModelInfo ("pdbSites", htSites);
var sites = "";
for (var entry, $entry = htSites.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var name = entry.getKey ();
var htSite = entry.getValue ();
var ch;
for (var i = name.length; --i >= 0; ) if (!JU.PT.isLetterOrDigit (ch = name.charAt (i)) && ch != '\'') name = name.substring (0, i) + "_" + name.substring (i + 1);

var groups = htSite.get ("groups");
if (groups.length == 0) continue;
this.addSiteScript ("@site_" + name + " " + groups);
this.addSiteScript ("site_" + name + " = [\"" + JU.PT.rep (groups, ",", "\",\"") + "\"]");
sites += ",\"site_" + name + "\"";
}
if (sites.length > 0) this.addSiteScript ("site_list = [" + sites.substring (1) + "]");
}, "java.util.Map");
Clazz_defineMethod (c$, "applySymmetryAndSetTrajectory", 
function () {
this.applySymTrajASCR ();
});
Clazz_defineMethod (c$, "applySymTrajASCR", 
function () {
if (this.forcePacked) this.initializeSymmetryOptions ();
var sym = (this.iHaveUnitCell && this.doCheckUnitCell ? this.asc.getXSymmetry ().applySymmetryFromReader (this.getSymmetry ()) : null);
if (sym == null) this.asc.setTensors ();
if (this.isTrajectory) this.asc.setTrajectory ();
if (this.moreUnitCellInfo != null) {
this.asc.setCurrentModelInfo ("moreUnitCellInfo", this.moreUnitCellInfo);
this.moreUnitCellInfo = null;
}this.finalizeSubclassSymmetry (sym != null);
if (sym != null && this.ptSupercell != null) {
this.asc.getXSymmetry ().finalizeUnitCell (this.ptSupercell);
}this.initializeSymmetry ();
return sym;
});
Clazz_defineMethod (c$, "finalizeSubclassSymmetry", 
function (haveSymmetry) {
}, "~B");
Clazz_defineMethod (c$, "doPreSymmetry", 
function () {
});
Clazz_defineMethod (c$, "finalizeMOData", 
function (moData) {
this.asc.setCurrentModelInfo ("moData", moData);
if (moData == null) return;
var orbitals = moData.get ("mos");
if (orbitals != null) JU.Logger.info (orbitals.size () + " molecular orbitals read in model " + this.asc.atomSetCount);
}, "java.util.Map");
c$.getElementSymbol = Clazz_defineMethod (c$, "getElementSymbol", 
function (elementNumber) {
return J.api.JmolAdapter.getElementSymbol (elementNumber);
}, "~N");
Clazz_defineMethod (c$, "fillDataBlockFixed", 
function (data, col0, colWidth, minLineLen) {
if (colWidth == 0) {
this.fillDataBlock (data, minLineLen);
return;
}var nLines = data.length;
for (var i = 0; i < nLines; i++) {
this.discardLinesUntilNonBlank ();
var nFields = Clazz_doubleToInt ((this.line.length - col0 + 1) / colWidth);
data[i] =  new Array (nFields);
for (var j = 0, start = col0; j < nFields; j++, start += colWidth) data[i][j] = this.line.substring (start, Math.min (this.line.length, start + colWidth));

}
}, "~A,~N,~N,~N");
Clazz_defineMethod (c$, "fillDataBlock", 
function (data, minLineLen) {
var nLines = data.length;
for (var i = 0; i < nLines; i++) {
data[i] = JU.PT.getTokens (this.discardLinesUntilNonBlank ());
if (data[i].length < minLineLen) --i;
}
}, "~A,~N");
Clazz_defineMethod (c$, "fillFloatArray", 
function (s, width, data) {
var tokens =  new Array (0);
var pt = 0;
for (var i = 0; i < data.length; i++) {
while (tokens != null && pt >= tokens.length) {
if (s == null) s = this.rd ();
if (width == 0) {
tokens = JU.PT.getTokens (s);
} else {
tokens =  new Array (Clazz_doubleToInt (s.length / width));
for (var j = 0; j < tokens.length; j++) tokens[j] = s.substring (j * width, (j + 1) * width);

}s = null;
pt = 0;
}
if (tokens == null) break;
data[i] = this.parseFloatStr (tokens[pt++]);
}
return data;
}, "~S,~N,~A");
Clazz_defineMethod (c$, "fillFrequencyData", 
function (iAtom0, ac, modelAtomCount, ignore, isWide, col0, colWidth, atomIndexes, minLineLen) {
var withSymmetry = (modelAtomCount != ac);
if (atomIndexes != null) ac = atomIndexes.length;
var nLines = (isWide ? ac : ac * 3);
var nFreq = ignore.length;
var data =  new Array (nLines);
this.fillDataBlockFixed (data, col0, colWidth, minLineLen);
for (var i = 0, atomPt = 0; i < nLines; i++, atomPt++) {
var values = data[i];
var valuesY = (isWide ? null : data[++i]);
var valuesZ = (isWide ? null : data[++i]);
var dataPt = values.length - (isWide ? nFreq * 3 : nFreq) - 1;
for (var j = 0, jj = 0; jj < nFreq; jj++) {
++dataPt;
var x = values[dataPt];
if (x.charAt (0) == ')') x = x.substring (1);
var vx = this.parseFloatStr (x);
var vy = this.parseFloatStr (isWide ? values[++dataPt] : valuesY[dataPt]);
var vz = this.parseFloatStr (isWide ? values[++dataPt] : valuesZ[dataPt]);
if (ignore[jj]) continue;
var iAtom = (atomIndexes == null ? atomPt : atomIndexes[atomPt]);
if (iAtom < 0) continue;
if (JU.Logger.debugging) JU.Logger.debug ("atom " + iAtom + " vib" + j + ": " + vx + " " + vy + " " + vz);
this.asc.addVibrationVectorWithSymmetry (iAtom0 + modelAtomCount * j++ + iAtom, vx, vy, vz, withSymmetry);
}
}
}, "~N,~N,~N,~A,~B,~N,~N,~A,~N");
Clazz_defineMethod (c$, "readLines", 
function (nLines) {
for (var i = nLines; --i >= 0; ) this.rd ();

return this.line;
}, "~N");
Clazz_defineMethod (c$, "discardLinesUntilStartsWith", 
function (startsWith) {
while (this.rd () != null && !this.line.startsWith (startsWith)) {
}
return this.line;
}, "~S");
Clazz_defineMethod (c$, "discardLinesUntilContains", 
function (containsMatch) {
while (this.rd () != null && this.line.indexOf (containsMatch) < 0) {
}
return this.line;
}, "~S");
Clazz_defineMethod (c$, "discardLinesUntilContains2", 
function (s1, s2) {
while (this.rd () != null && this.line.indexOf (s1) < 0 && this.line.indexOf (s2) < 0) {
}
return this.line;
}, "~S,~S");
Clazz_defineMethod (c$, "discardLinesUntilBlank", 
function () {
while (this.rd () != null && this.line.trim ().length != 0) {
}
return this.line;
});
Clazz_defineMethod (c$, "discardLinesUntilNonBlank", 
function () {
while (this.rd () != null && this.line.trim ().length == 0) {
}
return this.line;
});
Clazz_defineMethod (c$, "checkLineForScript", 
function (line) {
this.line = line;
this.checkCurrentLineForScript ();
}, "~S");
Clazz_defineMethod (c$, "checkCurrentLineForScript", 
function () {
if (this.line.indexOf ("Jmol") >= 0) {
if (this.line.indexOf ("Jmol PDB-encoded data") >= 0) {
this.asc.setInfo ("jmolData", this.line);
if (!this.line.endsWith ("#noautobond")) this.line += "#noautobond";
}if (this.line.indexOf ("Jmol data min") >= 0) {
JU.Logger.info (this.line);
var data =  Clazz_newFloatArray (15, 0);
JU.Parser.parseStringInfestedFloatArray (this.line.substring (10).$replace ('=', ' ').$replace ('{', ' ').$replace ('}', ' '), null, data);
var minXYZ = JU.P3.new3 (data[0], data[1], data[2]);
var maxXYZ = JU.P3.new3 (data[3], data[4], data[5]);
this.fileScaling = JU.P3.new3 (data[6], data[7], data[8]);
this.fileOffset = JU.P3.new3 (data[9], data[10], data[11]);
var plotScale = JU.P3.new3 (data[12], data[13], data[14]);
if (plotScale.x <= 0) plotScale.x = 100;
if (plotScale.y <= 0) plotScale.y = 100;
if (plotScale.z <= 0) plotScale.z = 100;
if (this.fileScaling.y == 0) this.fileScaling.y = 1;
if (this.fileScaling.z == 0) this.fileScaling.z = 1;
this.setFractionalCoordinates (true);
this.latticeCells =  Clazz_newIntArray (3, 0);
this.asc.xtalSymmetry = null;
this.setUnitCell (plotScale.x * 2 / (maxXYZ.x - minXYZ.x), plotScale.y * 2 / (maxXYZ.y - minXYZ.y), plotScale.z * 2 / (maxXYZ.z == minXYZ.z ? 1 : maxXYZ.z - minXYZ.z), 90, 90, 90);
this.unitCellOffset = JU.P3.newP (plotScale);
this.unitCellOffset.scale (-1);
this.getSymmetry ();
this.symmetry.toFractional (this.unitCellOffset, false);
this.unitCellOffset.scaleAdd2 (-1.0, minXYZ, this.unitCellOffset);
this.symmetry.setOffsetPt (this.unitCellOffset);
this.asc.setInfo ("jmolDataScaling", [minXYZ, maxXYZ, plotScale]);
this.doApplySymmetry = true;
}}if (this.line.endsWith ("#noautobond")) {
this.line = this.line.substring (0, this.line.lastIndexOf ('#')).trim ();
this.asc.setNoAutoBond ();
}var pt = this.line.indexOf ("jmolscript:");
if (pt >= 0) {
var script = this.line.substring (pt + 11, this.line.length);
if (script.indexOf ("#") >= 0) {
script = script.substring (0, script.indexOf ("#"));
}this.addJmolScript (script);
this.line = this.line.substring (0, pt).trim ();
}});
Clazz_defineMethod (c$, "addJmolScript", 
function (script) {
JU.Logger.info ("#jmolScript: " + script);
if (this.previousScript == null) this.previousScript = "";
 else if (!this.previousScript.endsWith (";")) this.previousScript += ";";
this.previousScript += script;
this.asc.setInfo ("jmolscript", this.previousScript);
}, "~S");
Clazz_defineMethod (c$, "addSiteScript", 
function (script) {
if (this.siteScript == null) this.siteScript = "";
 else if (!this.siteScript.endsWith (";")) this.siteScript += ";";
this.siteScript += script;
this.asc.setInfo ("sitescript", this.siteScript);
}, "~S");
Clazz_defineMethod (c$, "rd", 
function () {
return this.RL ();
});
Clazz_defineMethod (c$, "RL", 
function () {
this.prevline = this.line;
this.line = this.reader.readLine ();
if (this.out != null && this.line != null) this.out.append (this.line).append ("\n");
this.ptLine++;
if (JU.Logger.debugging) JU.Logger.debug (this.line);
return this.line;
});
c$.getStrings = Clazz_defineMethod (c$, "getStrings", 
function (sinfo, nFields, width) {
var fields =  new Array (nFields);
for (var i = 0, pt = 0; i < nFields; i++, pt += width) fields[i] = sinfo.substring (pt, pt + width);

return fields;
}, "~S,~N,~N");
Clazz_defineMethod (c$, "getTokens", 
function () {
return JU.PT.getTokens (this.line);
});
c$.getTokensFloat = Clazz_defineMethod (c$, "getTokensFloat", 
function (s, f, n) {
if (f == null) f =  Clazz_newFloatArray (n, 0);
JU.PT.parseFloatArrayDataN (JU.PT.getTokens (s), f, n);
return f;
}, "~S,~A,~N");
Clazz_defineMethod (c$, "parseFloat", 
function () {
return JU.PT.parseFloatNext (this.line, this.next);
});
Clazz_defineMethod (c$, "parseFloatStr", 
function (s) {
this.next[0] = 0;
return JU.PT.parseFloatNext (s, this.next);
}, "~S");
Clazz_defineMethod (c$, "parseFloatRange", 
function (s, iStart, iEnd) {
this.next[0] = iStart;
return JU.PT.parseFloatRange (s, iEnd, this.next);
}, "~S,~N,~N");
Clazz_defineMethod (c$, "parseInt", 
function () {
return JU.PT.parseIntNext (this.line, this.next);
});
Clazz_defineMethod (c$, "parseIntStr", 
function (s) {
this.next[0] = 0;
return JU.PT.parseIntNext (s, this.next);
}, "~S");
Clazz_defineMethod (c$, "parseIntAt", 
function (s, iStart) {
this.next[0] = iStart;
return JU.PT.parseIntNext (s, this.next);
}, "~S,~N");
Clazz_defineMethod (c$, "parseIntRange", 
function (s, iStart, iEnd) {
this.next[0] = iStart;
return JU.PT.parseIntRange (s, iEnd, this.next);
}, "~S,~N,~N");
Clazz_defineMethod (c$, "parseToken", 
function () {
return JU.PT.parseTokenNext (this.line, this.next);
});
Clazz_defineMethod (c$, "parseTokenStr", 
function (s) {
this.next[0] = 0;
return JU.PT.parseTokenNext (s, this.next);
}, "~S");
Clazz_defineMethod (c$, "parseTokenNext", 
function (s) {
return JU.PT.parseTokenNext (s, this.next);
}, "~S");
Clazz_defineMethod (c$, "parseTokenRange", 
function (s, iStart, iEnd) {
this.next[0] = iStart;
return JU.PT.parseTokenRange (s, iEnd, this.next);
}, "~S,~N,~N");
c$.getFortranFormatLengths = Clazz_defineMethod (c$, "getFortranFormatLengths", 
function (s) {
var vdata =  new JU.Lst ();
var n = 0;
var c = 0;
var factor = 1;
var inN = false;
var inCount = true;
s += ",";
for (var i = 0; i < s.length; i++) {
var ch = s.charAt (i);
switch (ch) {
case '.':
inN = false;
continue;
case ',':
for (var j = 0; j < c; j++) vdata.addLast (Integer.$valueOf (n * factor));

inN = false;
inCount = true;
c = 0;
continue;
case 'X':
n = c;
c = 1;
factor = -1;
continue;
}
var isDigit = JU.PT.isDigit (ch);
if (isDigit) {
if (inN) n = n * 10 + ch.charCodeAt (0) - 48;
 else if (inCount) c = c * 10 + ch.charCodeAt (0) - 48;
} else if (JU.PT.isLetter (ch)) {
n = 0;
inN = true;
inCount = false;
factor = 1;
} else {
inN = false;
}}
return vdata;
}, "~S");
Clazz_defineMethod (c$, "read3Vectors", 
function (isBohr) {
var vectors =  new Array (3);
var f =  Clazz_newFloatArray (3, 0);
for (var i = 0; i < 3; i++) {
if (i > 0 || Float.isNaN (this.parseFloatStr (this.line))) {
this.rd ();
if (i == 0 && this.line != null) {
i = -1;
continue;
}}this.fillFloatArray (this.line, 0, f);
vectors[i] =  new JU.V3 ();
vectors[i].setA (f);
if (isBohr) vectors[i].scale (0.5291772);
}
return vectors;
}, "~B");
Clazz_defineMethod (c$, "setElementAndIsotope", 
function (atom, str) {
var isotope = this.parseIntStr (str);
if (isotope == -2147483648) {
atom.elementSymbol = str;
} else {
str = str.substring (("" + isotope).length);
atom.elementNumber = (str.length == 0 ? isotope : ((isotope << 7) + J.api.JmolAdapter.getElementNumber (str)));
}}, "J.adapter.smarter.Atom,~S");
Clazz_defineMethod (c$, "finalizeModelSet", 
function () {
});
Clazz_defineMethod (c$, "setChainID", 
function (atom, label) {
atom.chainID = this.vwr.getChainID (label, true);
}, "J.adapter.smarter.Atom,~S");
Clazz_overrideMethod (c$, "readNextLine", 
function () {
if (this.rd () != null && this.line.indexOf ("#jmolscript:") >= 0) this.checkCurrentLineForScript ();
return this.line;
});
Clazz_defineMethod (c$, "processDSSR", 
function (reader, htGroup1) {
var s = this.vwr.getAnnotationParser ().processDSSR (this.asc.getAtomSetAuxiliaryInfo (2147483647), reader, this.line, htGroup1);
this.appendLoadNote (s);
}, "javajs.api.GenericLineReader,java.util.Map");
Clazz_defineMethod (c$, "appendUunitCellInfo", 
function (info) {
if (this.moreUnitCellInfo == null) this.moreUnitCellInfo =  new JU.Lst ();
this.moreUnitCellInfo.addLast (info);
this.appendLoadNote (info);
}, "~S");
Clazz_defineMethod (c$, "getInterface", 
function (className) {
var o = J.api.Interface.getInterface (className, this.vwr, "file");
if (o == null) throw  new NullPointerException ("Interface");
return o;
}, "~S");
Clazz_defineMethod (c$, "forceSymmetry", 
function (andPack) {
if (andPack) this.doPackUnitCell = andPack;
if (!this.doApplySymmetry) {
this.doApplySymmetry = true;
this.latticeCells[0] = 1;
this.latticeCells[1] = 1;
this.latticeCells[2] = 1;
}}, "~B");
Clazz_defineStatics (c$,
"ANGSTROMS_PER_BOHR", 0.5291772);
});
Clazz_declarePackage ("J.adapter.smarter");
c$ = Clazz_decorateAsClass (function () {
this.atomSetIndex = 0;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "AtomSetObject");
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["J.adapter.smarter.AtomSetObject"], "J.adapter.smarter.Bond", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.atomIndex1 = 0;
this.atomIndex2 = 0;
this.order = 0;
this.radius = -1;
this.colix = -1;
this.uniqueID = -1;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "Bond", J.adapter.smarter.AtomSetObject);
Clazz_makeConstructor (c$, 
function (atomIndex1, atomIndex2, order) {
this.atomIndex1 = atomIndex1;
this.atomIndex2 = atomIndex2;
this.order = order;
}, "~N,~N,~N");
});
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["J.api.JmolAdapterBondIterator"], "J.adapter.smarter.BondIterator", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.bsAtoms = null;
this.bonds = null;
this.ibond = 0;
this.bond = null;
this.bondCount = 0;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "BondIterator", J.api.JmolAdapterBondIterator);
Clazz_makeConstructor (c$, 
function (asc) {
this.bsAtoms = asc.bsAtoms;
this.bonds = asc.bonds;
this.bondCount = asc.bondCount;
this.ibond = 0;
}, "J.adapter.smarter.AtomSetCollection");
Clazz_overrideMethod (c$, "hasNext", 
function () {
if (this.ibond == this.bondCount) return false;
while ((this.bond = this.bonds[this.ibond++]) == null || (this.bsAtoms != null && (!this.bsAtoms.get (this.bond.atomIndex1) || !this.bsAtoms.get (this.bond.atomIndex2)))) if (this.ibond == this.bondCount) return false;

return true;
});
Clazz_overrideMethod (c$, "getAtomUniqueID1", 
function () {
return Integer.$valueOf (this.bond.atomIndex1);
});
Clazz_overrideMethod (c$, "getAtomUniqueID2", 
function () {
return Integer.$valueOf (this.bond.atomIndex2);
});
Clazz_overrideMethod (c$, "getEncodedOrder", 
function () {
return this.bond.order;
});
Clazz_overrideMethod (c$, "getRadius", 
function () {
return this.bond.radius;
});
Clazz_overrideMethod (c$, "getColix", 
function () {
return this.bond.colix;
});
});
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (null, "J.adapter.smarter.Resolver", ["java.lang.Float", "java.util.StringTokenizer", "javajs.api.GenericBinaryDocument", "JU.LimitedLineReader", "$.PT", "J.adapter.smarter.AtomSetCollectionReader", "$.SmarterJmolAdapter", "J.api.Interface", "JU.Logger", "JV.JC"], function () {
c$ = Clazz_declareType (J.adapter.smarter, "Resolver");
c$.getReaderClassBase = Clazz_defineMethod (c$, "getReaderClassBase", 
function (type) {
var name = type + "Reader";
if (type.startsWith ("Xml")) return "J.adapter.readers." + "xml." + name;
var key = ";" + type + ";";
for (var i = 1; i < J.adapter.smarter.Resolver.readerSets.length; i += 2) if (J.adapter.smarter.Resolver.readerSets[i].indexOf (key) >= 0) return "J.adapter.readers." + J.adapter.smarter.Resolver.readerSets[i - 1] + name;

return "J.adapter.readers." + "???." + name;
}, "~S");
c$.getFileType = Clazz_defineMethod (c$, "getFileType", 
function (br) {
try {
return J.adapter.smarter.Resolver.determineAtomSetCollectionReader (br, false);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return null;
} else {
throw e;
}
}
}, "java.io.BufferedReader");
c$.getAtomCollectionReader = Clazz_defineMethod (c$, "getAtomCollectionReader", 
function (fullName, type, bufferedReader, htParams, ptFile) {
var rdr = null;
var readerName;
fullName = fullName.$replace ('\\', '/');
var errMsg = null;
if (type != null) {
readerName = J.adapter.smarter.Resolver.getReaderFromType (type);
if (readerName == null) readerName = J.adapter.smarter.Resolver.getReaderFromType ("Xml" + type);
if (readerName == null) errMsg = "unrecognized file format type " + type;
 else JU.Logger.info ("The Resolver assumes " + readerName);
} else {
readerName = J.adapter.smarter.Resolver.determineAtomSetCollectionReader (bufferedReader, true);
if (readerName.charAt (0) == '\n') {
type = htParams.get ("defaultType");
if (type != null) {
type = J.adapter.smarter.Resolver.getReaderFromType (type);
if (type != null) readerName = type;
}}if (readerName.charAt (0) == '\n') errMsg = "unrecognized file format for file\n" + fullName + "\n" + J.adapter.smarter.Resolver.split (readerName, 50);
 else if (readerName.equals ("spt")) errMsg = "NOTE: file recognized as a script file: " + fullName + "\n";
 else if (!fullName.equals ("ligand")) JU.Logger.info ("The Resolver thinks " + readerName);
}if (errMsg != null) {
J.adapter.smarter.SmarterJmolAdapter.close (bufferedReader);
return errMsg;
}htParams.put ("ptFile", Integer.$valueOf (ptFile));
if (ptFile <= 0) htParams.put ("readerName", readerName);
if (readerName.indexOf ("Xml") == 0) readerName = "Xml";
var className = null;
var err = null;
className = J.adapter.smarter.Resolver.getReaderClassBase (readerName);
if ((rdr = J.api.Interface.getInterface (className, htParams.get ("vwr"), "reader")) == null) {
err = JV.JC.READER_NOT_FOUND + className;
JU.Logger.error (err);
return err;
}return rdr;
}, "~S,~S,~O,java.util.Map,~N");
c$.getReaderFromType = Clazz_defineMethod (c$, "getReaderFromType", 
 function (type) {
type = ";" + type.toLowerCase () + ";";
if (";zmatrix;cfi;c;vfi;v;mnd;jag;adf;gms;g;gau;mp;nw;orc;pqs;qc;".indexOf (type) >= 0) return "Input";
var set;
var pt;
for (var i = J.adapter.smarter.Resolver.readerSets.length; --i >= 0; ) if ((pt = (set = J.adapter.smarter.Resolver.readerSets[i--]).toLowerCase ().indexOf (type)) >= 0) return set.substring (pt + 1, set.indexOf (";", pt + 2));

return null;
}, "~S");
c$.split = Clazz_defineMethod (c$, "split", 
 function (a, n) {
var s = "";
var l = a.length;
for (var i = 0, j = 0; i < l; i = j) s += a.substring (i, (j = Math.min (i + n, l))) + "\n";

return s;
}, "~S,~N");
c$.DOMResolve = Clazz_defineMethod (c$, "DOMResolve", 
function (DOMNode, htParams) {
var className = null;
var rdr;
var rdrName = J.adapter.smarter.Resolver.getXmlType (htParams.get ("nameSpaceInfo"));
if (JU.Logger.debugging) {
JU.Logger.debug ("The Resolver thinks " + rdrName);
}htParams.put ("readerName", rdrName);
className = "J.adapter.readers.xml.XmlReader";
if ((rdr = J.api.Interface.getInterface (className, htParams.get ("vwr"), "file")) != null) return rdr;
var err = "File reader was not found:" + className;
JU.Logger.error (err);
return err;
}, "~O,java.util.Map");
c$.determineAtomSetCollectionReader = Clazz_defineMethod (c$, "determineAtomSetCollectionReader", 
 function (readerOrDocument, returnLines) {
if (Clazz_instanceOf (readerOrDocument, javajs.api.GenericBinaryDocument)) {
return "PyMOL";
}var readerName;
var llr =  new JU.LimitedLineReader (readerOrDocument, 16384);
var leader = llr.getHeader (64).trim ();
if (leader.indexOf ("PNG") == 1 && leader.indexOf ("PNGJ") >= 0) return "pngj";
if (leader.indexOf ("PNG") == 1 || leader.indexOf ("JPG") == 1 || leader.indexOf ("JFIF") == 6) return "spt";
if ((readerName = J.adapter.smarter.Resolver.checkFileStart (leader)) != null) return readerName;
var lines =  new Array (16);
var nLines = 0;
for (var i = 0; i < lines.length; ++i) {
lines[i] = llr.readLineWithNewline ();
if (lines[i].length > 0) nLines++;
}
if ((readerName = J.adapter.smarter.Resolver.checkSpecial1 (nLines, lines, leader)) != null) return readerName;
if ((readerName = J.adapter.smarter.Resolver.checkLineStarts (lines)) != null) return readerName;
if ((readerName = J.adapter.smarter.Resolver.checkHeaderContains (llr.getHeader (0))) != null) return readerName;
if ((readerName = J.adapter.smarter.Resolver.checkSpecial2 (lines)) != null) return readerName;
return (returnLines ? "\n" + lines[0] + "\n" + lines[1] + "\n" + lines[2] + "\n" : null);
}, "~O,~B");
c$.checkFileStart = Clazz_defineMethod (c$, "checkFileStart", 
 function (leader) {
for (var i = 0; i < J.adapter.smarter.Resolver.fileStartsWithRecords.length; ++i) {
var recordTags = J.adapter.smarter.Resolver.fileStartsWithRecords[i];
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
if (leader.startsWith (recordTag)) return recordTags[0];
}
}
return null;
}, "~S");
c$.checkSpecial1 = Clazz_defineMethod (c$, "checkSpecial1", 
 function (nLines, lines, leader) {
if (nLines == 1 && lines[0].length > 0 && JU.PT.isDigit (lines[0].charAt (0))) return "Jme";
if (J.adapter.smarter.Resolver.checkMopacGraphf (lines)) return "MopacGraphf";
if (J.adapter.smarter.Resolver.checkOdyssey (lines)) return "Odyssey";
switch (J.adapter.smarter.Resolver.checkMol (lines)) {
case 1:
case 3:
case 2000:
case 3000:
return "Mol";
}
switch (J.adapter.smarter.Resolver.checkXyz (lines)) {
case 1:
return "Xyz";
case 2:
return "Bilbao";
}
if (J.adapter.smarter.Resolver.checkAlchemy (lines[0])) return "Alchemy";
if (J.adapter.smarter.Resolver.checkFoldingXyz (lines)) return "FoldingXyz";
if (J.adapter.smarter.Resolver.checkCube (lines)) return "Cube";
if (J.adapter.smarter.Resolver.checkWien2k (lines)) return "Wien2k";
if (J.adapter.smarter.Resolver.checkAims (lines)) return "Aims";
if (J.adapter.smarter.Resolver.checkGenNBO (lines, leader)) return "GenNBO";
return null;
}, "~N,~A,~S");
c$.checkAims = Clazz_defineMethod (c$, "checkAims", 
 function (lines) {
for (var i = 0; i < lines.length; i++) {
if (lines[i].startsWith ("mol 1")) return false;
var tokens = JU.PT.getTokens (lines[i]);
if (tokens.length == 0) continue;
if (tokens[0].startsWith ("atom") && tokens.length > 4 && Float.isNaN (JU.PT.parseFloat (tokens[4])) || tokens[0].startsWith ("multipole") && tokens.length >= 6 || tokens[0].startsWith ("lattice_vector") && tokens.length >= 4) return true;
}
return false;
}, "~A");
c$.checkAlchemy = Clazz_defineMethod (c$, "checkAlchemy", 
 function (line) {
var pt;
if ((pt = line.indexOf ("ATOMS")) >= 0 && line.indexOf ("BONDS") > pt) try {
var n = Integer.parseInt (line.substring (0, pt).trim ());
return (n > 0);
} catch (nfe) {
if (Clazz_exceptionOf (nfe, NumberFormatException)) {
} else {
throw nfe;
}
}
return false;
}, "~S");
c$.checkCube = Clazz_defineMethod (c$, "checkCube", 
 function (lines) {
try {
for (var j = 2; j <= 5; j++) {
var tokens2 =  new java.util.StringTokenizer (lines[j]);
var n = tokens2.countTokens ();
if (!(n == 4 || j == 2 && n == 5)) return false;
Integer.parseInt (tokens2.nextToken ());
for (var i = 3; --i >= 0; ) JU.PT.fVal (tokens2.nextToken ());

if (n == 5) Integer.parseInt (tokens2.nextToken ());
}
return true;
} catch (nfe) {
if (Clazz_exceptionOf (nfe, NumberFormatException)) {
} else {
throw nfe;
}
}
return false;
}, "~A");
c$.checkFoldingXyz = Clazz_defineMethod (c$, "checkFoldingXyz", 
 function (lines) {
var tokens =  new java.util.StringTokenizer (lines[0].trim (), " \t");
if (tokens.countTokens () < 2) return false;
try {
Integer.parseInt (tokens.nextToken ().trim ());
} catch (nfe) {
if (Clazz_exceptionOf (nfe, NumberFormatException)) {
return false;
} else {
throw nfe;
}
}
var secondLine = lines[1].trim ();
if (secondLine.length == 0) secondLine = lines[2].trim ();
tokens =  new java.util.StringTokenizer (secondLine, " \t");
if (tokens.countTokens () == 0) return false;
try {
Integer.parseInt (tokens.nextToken ().trim ());
} catch (nfe) {
if (Clazz_exceptionOf (nfe, NumberFormatException)) {
return false;
} else {
throw nfe;
}
}
return true;
}, "~A");
c$.checkGenNBO = Clazz_defineMethod (c$, "checkGenNBO", 
 function (lines, leader) {
return (leader.indexOf ("$GENNBO") >= 0 || lines[1].startsWith (" Basis set information needed for plotting orbitals") || lines[1].indexOf ("s in the AO basis:") >= 0 || lines[2].indexOf (" N A T U R A L   A T O M I C   O R B I T A L") >= 0);
}, "~A,~S");
c$.checkMol = Clazz_defineMethod (c$, "checkMol", 
 function (lines) {
var line4trimmed = ("X" + lines[3]).trim ().toUpperCase ();
if (line4trimmed.length < 7 || line4trimmed.indexOf (".") >= 0) return 0;
if (line4trimmed.endsWith ("V2000")) return 2000;
if (line4trimmed.endsWith ("V3000")) return 3000;
try {
var n1 = Integer.parseInt (lines[3].substring (0, 3).trim ());
var n2 = Integer.parseInt (lines[3].substring (3, 6).trim ());
return (n1 > 0 && n2 >= 0 && lines[0].indexOf ("@<TRIPOS>") != 0 && lines[1].indexOf ("@<TRIPOS>") != 0 && lines[2].indexOf ("@<TRIPOS>") != 0 ? 3 : 0);
} catch (nfe) {
if (Clazz_exceptionOf (nfe, NumberFormatException)) {
} else {
throw nfe;
}
}
return 0;
}, "~A");
c$.checkMopacGraphf = Clazz_defineMethod (c$, "checkMopacGraphf", 
 function (lines) {
return (lines[0].indexOf ("MOPAC-Graphical data") > 2);
}, "~A");
c$.checkOdyssey = Clazz_defineMethod (c$, "checkOdyssey", 
 function (lines) {
var i;
for (i = 0; i < lines.length; i++) if (!lines[i].startsWith ("C ") && lines[i].length != 0) break;

if (i >= lines.length || lines[i].charAt (0) != ' ' || (i = i + 2) + 1 >= lines.length) return false;
try {
var spin = Integer.parseInt (lines[i].substring (2).trim ());
var charge = Integer.parseInt (lines[i].substring (0, 2).trim ());
var atom1 = Integer.parseInt (lines[++i].substring (0, 2).trim ());
if (spin < 0 || spin > 5 || atom1 <= 0 || charge > 5) return false;
var atomline = J.adapter.smarter.AtomSetCollectionReader.getTokensFloat (lines[i], null, 5);
return !Float.isNaN (atomline[1]) && !Float.isNaN (atomline[2]) && !Float.isNaN (atomline[3]) && Float.isNaN (atomline[4]);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
return false;
}, "~A");
c$.checkWien2k = Clazz_defineMethod (c$, "checkWien2k", 
 function (lines) {
return (lines[2].startsWith ("MODE OF CALC=") || lines[2].startsWith ("             RELA") || lines[2].startsWith ("             NREL"));
}, "~A");
c$.checkXyz = Clazz_defineMethod (c$, "checkXyz", 
 function (lines) {
try {
Integer.parseInt (lines[0].trim ());
try {
Integer.parseInt (lines[2].trim ());
} catch (nfe) {
if (Clazz_exceptionOf (nfe, NumberFormatException)) {
return 1;
} else {
throw nfe;
}
}
return 2;
} catch (nfe) {
if (Clazz_exceptionOf (nfe, NumberFormatException)) {
if (lines[0].indexOf ("Bilbao Crys") >= 0) return 2;
} else {
throw nfe;
}
}
return 0;
}, "~A");
c$.checkLineStarts = Clazz_defineMethod (c$, "checkLineStarts", 
 function (lines) {
for (var i = 0; i < J.adapter.smarter.Resolver.lineStartsWithRecords.length; ++i) {
var recordTags = J.adapter.smarter.Resolver.lineStartsWithRecords[i];
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
for (var k = 0; k < lines.length; k++) {
if (lines[k].startsWith (recordTag)) return recordTags[0];
}
}
}
return null;
}, "~A");
c$.checkHeaderContains = Clazz_defineMethod (c$, "checkHeaderContains", 
 function (header) {
for (var i = 0; i < J.adapter.smarter.Resolver.headerContainsRecords.length; ++i) {
var recordTags = J.adapter.smarter.Resolver.headerContainsRecords[i];
for (var j = 1; j < recordTags.length; ++j) {
var recordTag = recordTags[j];
if (header.indexOf (recordTag) < 0) continue;
var type = recordTags[0];
return (!type.equals ("Xml") ? type : header.indexOf ("<!DOCTYPE HTML PUBLIC") < 0 && header.indexOf ("XHTML") < 0 && (header.indexOf ("xhtml") < 0 || header.indexOf ("<cml") >= 0) ? J.adapter.smarter.Resolver.getXmlType (header) : null);
}
}
return null;
}, "~S");
c$.getXmlType = Clazz_defineMethod (c$, "getXmlType", 
 function (header) {
if (header.indexOf ("http://www.molpro.net/") >= 0) {
return "XmlMolpro";
}if (header.indexOf ("odyssey") >= 0) {
return "XmlOdyssey";
}if (header.indexOf ("C3XML") >= 0) {
return "XmlChem3d";
}if (header.indexOf ("arguslab") >= 0) {
return "XmlArgus";
}if (header.indexOf ("jvxl") >= 0 || header.indexOf ("http://www.xml-cml.org/schema") >= 0 || header.indexOf ("cml:") >= 0) {
return "XmlCml";
}if (header.indexOf ("XSD") >= 0) {
return "XmlXsd";
}if (header.indexOf (">vasp") >= 0) {
return "XmlVasp";
}if (header.indexOf ("<GEOMETRY_INFO>") >= 0) {
return "XmlQE";
}return "XmlCml(unidentified)";
}, "~S");
c$.checkSpecial2 = Clazz_defineMethod (c$, "checkSpecial2", 
 function (lines) {
if (J.adapter.smarter.Resolver.checkGromacs (lines)) return "Gromacs";
if (J.adapter.smarter.Resolver.checkCrystal (lines)) return "Crystal";
if (J.adapter.smarter.Resolver.checkCastep (lines)) return "Castep";
if (J.adapter.smarter.Resolver.checkVasp (lines, true)) return "VaspPoscar";
if (J.adapter.smarter.Resolver.checkVasp (lines, false)) return "VaspChgcar";
return null;
}, "~A");
c$.checkCrystal = Clazz_defineMethod (c$, "checkCrystal", 
 function (lines) {
var s = lines[1].trim ();
if (s.equals ("SLAB") || s.equals ("MOLECULE") || s.equals ("CRYSTAL") || s.equals ("POLYMER") || (s = lines[3]).equals ("SLAB") || s.equals ("MOLECULE") || s.equals ("POLYMER")) return true;
for (var i = 0; i < lines.length; i++) {
if (lines[i].trim ().equals ("OPTGEOM") || lines[i].trim ().equals ("FREQCALC") || lines[i].contains ("DOVESI") || lines[i].contains ("TORINO") || lines[i].contains ("http://www.crystal.unito.it") || lines[i].contains ("Pcrystal") || lines[i].contains ("MPPcrystal") || lines[i].contains ("crystal executable")) return true;
}
return false;
}, "~A");
c$.checkGromacs = Clazz_defineMethod (c$, "checkGromacs", 
 function (lines) {
if (JU.PT.parseInt (lines[1]) == -2147483648) return false;
var len = -1;
for (var i = 2; i < 16 && len != 0; i++) if ((len = lines[i].length) != 69 && len != 45 && len != 0) return false;

return true;
}, "~A");
c$.checkCastep = Clazz_defineMethod (c$, "checkCastep", 
 function (lines) {
for (var i = 0; i < lines.length; i++) {
if (lines[i].indexOf ("Frequencies in         cm-1") == 1 || lines[i].contains ("CASTEP") || lines[i].toUpperCase ().startsWith ("%BLOCK LATTICE_ABC") || lines[i].toUpperCase ().startsWith ("%BLOCK LATTICE_CART") || lines[i].toUpperCase ().startsWith ("%BLOCK POSITIONS_FRAC") || lines[i].toUpperCase ().startsWith ("%BLOCK POSITIONS_ABS") || lines[i].contains ("<-- E")) return true;
}
return false;
}, "~A");
c$.checkVasp = Clazz_defineMethod (c$, "checkVasp", 
 function (lines, isPoscar) {
var i = (isPoscar ? (lines[5].length < 2 ? 8 : 7) : 6);
var line = lines[i].toLowerCase ();
if (isPoscar && line.contains ("selective")) line = lines[++i].toLowerCase ();
return (line.contains ("direct") || line.contains ("cartesian"));
}, "~A,~B");
Clazz_defineStatics (c$,
"classBase", "J.adapter.readers.");
c$.readerSets = c$.prototype.readerSets = ["cif.", ";Cif;MMCif;", "molxyz.", ";Mol3D;Mol;Xyz;", "more.", ";BinaryDcd;Gromacs;Jcampdx;MdCrd;MdTop;Mol2;TlsDataOnly;", "quantum.", ";Adf;Csf;Dgrid;GamessUK;GamessUS;Gaussian;GaussianFchk;GaussianWfn;Jaguar;Molden;MopacGraphf;GenNBO;NWChem;Odyssey;Psi;Qchem;Spartan;SpartanSmol;WebMO;", "pdb.", ";Pdb;Pqr;P2n;", "pymol.", ";PyMOL;", "simple.", ";Alchemy;Ampac;Cube;FoldingXyz;GhemicalMM;HyperChem;Jme;JSON;Mopac;MopacArchive;Tinker;Input;", "xtal.", ";Abinit;Aims;Bilbao;Castep;Cgd;Crystal;Dmol;Espresso;Gulp;Jana;Magres;Shelx;Siesta;VaspOutcar;VaspPoscar;VaspChgcar;Wien2k;Xcrysden;", "xml.", ";XmlArgus;XmlCml;XmlChem3d;XmlMolpro;XmlOdyssey;XmlXsd;XmlVasp;XmlQE;"];
Clazz_defineStatics (c$,
"CML_NAMESPACE_URI", "http://www.xml-cml.org/schema",
"LEADER_CHAR_MAX", 64,
"sptRecords", ["spt", "# Jmol state", "# Jmol script", "JmolManifest"],
"m3dStartRecords", ["Alchemy", "STRUCTURE  1.00     1"],
"cubeFileStartRecords", ["Cube", "JVXL", "#JVXL"],
"mol2Records", ["Mol2", "mol2", "@<TRIPOS>"],
"webmoFileStartRecords", ["WebMO", "[HEADER]"],
"moldenFileStartRecords", ["Molden", "[Molden"],
"dcdFileStartRecords", ["BinaryDcd", "T\0\0\0CORD", "\0\0\0TCORD"],
"tlsDataOnlyFileStartRecords", ["TlsDataOnly", "REFMAC\n\nTL", "REFMAC\r\n\r\n", "REFMAC\r\rTL"],
"inputFileStartRecords", ["Input", "#ZMATRIX", "%mem=", "AM1"],
"magresFileStartRecords", ["Magres", "#$magres", "# magres"],
"pymolStartRecords", ["PyMOL", "}q"],
"janaStartRecords", ["Jana", "Version Jana"],
"jsonStartRecords", ["JSON", "{\"mol\":"],
"jcampdxStartRecords", ["Jcampdx", "##TITLE"]);
c$.fileStartsWithRecords = c$.prototype.fileStartsWithRecords = [J.adapter.smarter.Resolver.sptRecords, J.adapter.smarter.Resolver.m3dStartRecords, J.adapter.smarter.Resolver.cubeFileStartRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.webmoFileStartRecords, J.adapter.smarter.Resolver.moldenFileStartRecords, J.adapter.smarter.Resolver.dcdFileStartRecords, J.adapter.smarter.Resolver.tlsDataOnlyFileStartRecords, J.adapter.smarter.Resolver.inputFileStartRecords, J.adapter.smarter.Resolver.magresFileStartRecords, J.adapter.smarter.Resolver.pymolStartRecords, J.adapter.smarter.Resolver.janaStartRecords, J.adapter.smarter.Resolver.jsonStartRecords, J.adapter.smarter.Resolver.jcampdxStartRecords];
Clazz_defineStatics (c$,
"mmcifLineStartRecords", ["MMCif", "_entry.id", "_database_PDB_", "_pdbx_", "_chem_comp.pdbx_type", "_audit_author.name"],
"cifLineStartRecords", ["Cif", "data_", "_publ"],
"pqrLineStartRecords", ["Pqr", "REMARK   1 PQR"],
"p2nLineStartRecords", ["P2n", "REMARK   1 P2N"],
"pdbLineStartRecords", ["Pdb", "HEADER", "OBSLTE", "TITLE ", "CAVEAT", "COMPND", "SOURCE", "KEYWDS", "EXPDTA", "AUTHOR", "REVDAT", "SPRSDE", "JRNL  ", "REMARK ", "DBREF ", "SEQADV", "SEQRES", "MODRES", "HELIX ", "SHEET ", "TURN  ", "CRYST1", "ORIGX1", "ORIGX2", "ORIGX3", "SCALE1", "SCALE2", "SCALE3", "ATOM  ", "HETATM", "MODEL ", "LINK  "],
"cgdLineStartRecords", ["Cgd", "EDGE ", "edge "],
"shelxLineStartRecords", ["Shelx", "TITL ", "ZERR ", "LATT ", "SYMM ", "CELL "],
"ghemicalMMLineStartRecords", ["GhemicalMM", "!Header mm1gp", "!Header gpr"],
"jaguarLineStartRecords", ["Jaguar", "  |  Jaguar version"],
"mdlLineStartRecords", ["Mol", "$MDL "],
"spartanSmolLineStartRecords", ["SpartanSmol", "INPUT="],
"csfLineStartRecords", ["Csf", "local_transform"],
"mdTopLineStartRecords", ["MdTop", "%FLAG TITLE"],
"hyperChemLineStartRecords", ["HyperChem", "mol 1"],
"vaspOutcarLineStartRecords", ["VaspOutcar", " vasp.", " INCAR:"]);
c$.lineStartsWithRecords = c$.prototype.lineStartsWithRecords = [J.adapter.smarter.Resolver.mmcifLineStartRecords, J.adapter.smarter.Resolver.cifLineStartRecords, J.adapter.smarter.Resolver.pqrLineStartRecords, J.adapter.smarter.Resolver.p2nLineStartRecords, J.adapter.smarter.Resolver.pdbLineStartRecords, J.adapter.smarter.Resolver.cgdLineStartRecords, J.adapter.smarter.Resolver.shelxLineStartRecords, J.adapter.smarter.Resolver.ghemicalMMLineStartRecords, J.adapter.smarter.Resolver.jaguarLineStartRecords, J.adapter.smarter.Resolver.mdlLineStartRecords, J.adapter.smarter.Resolver.spartanSmolLineStartRecords, J.adapter.smarter.Resolver.csfLineStartRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.mdTopLineStartRecords, J.adapter.smarter.Resolver.hyperChemLineStartRecords, J.adapter.smarter.Resolver.vaspOutcarLineStartRecords];
Clazz_defineStatics (c$,
"bilbaoContainsRecords", ["Bilbao", ">Bilbao Crystallographic Server<"],
"xmlContainsRecords", ["Xml", "<?xml", "<atom", "<molecule", "<reaction", "<cml", "<bond", ".dtd\"", "<list>", "<entry", "<identifier", "http://www.xml-cml.org/schema/cml2/core"],
"gaussianContainsRecords", ["Gaussian", "Entering Gaussian System", "Entering Link 1", "1998 Gaussian, Inc."],
"ampacContainsRecords", ["Ampac", "AMPAC Version"],
"mopacContainsRecords", ["Mopac", "MOPAC 93 (c) Fujitsu", "MOPAC FOR LINUX (PUBLIC DOMAIN VERSION)", "MOPAC:  VERSION  6", "MOPAC   7", "MOPAC2", "MOPAC (PUBLIC"],
"qchemContainsRecords", ["Qchem", "Welcome to Q-Chem", "A Quantum Leap Into The Future Of Chemistry"],
"gamessUKContainsRecords", ["GamessUK", "GAMESS-UK", "G A M E S S - U K"],
"gamessUSContainsRecords", ["GamessUS", "GAMESS", "$CONTRL"],
"spartanBinaryContainsRecords", ["SpartanSmol", "|PropertyArchive", "_spartan", "spardir", "BEGIN Directory Entry Molecule"],
"spartanContainsRecords", ["Spartan", "Spartan"],
"adfContainsRecords", ["Adf", "Amsterdam Density Functional"],
"psiContainsRecords", ["Psi", "    PSI  3", "PSI3:"],
"nwchemContainsRecords", ["NWChem", " argument  1 = "],
"uicrcifContainsRecords", ["Cif", "Crystallographic Information File"],
"dgridContainsRecords", ["Dgrid", "BASISFILE   created by DGrid"],
"crystalContainsRecords", ["Crystal", "*                                CRYSTAL", "TORINO", "DOVESI"],
"dmolContainsRecords", ["Dmol", "DMol^3"],
"gulpContainsRecords", ["Gulp", "GENERAL UTILITY LATTICE PROGRAM"],
"espressoContainsRecords", ["Espresso", "Program PWSCF", "Program PHONON"],
"siestaContainsRecords", ["Siesta", "MD.TypeOfRun", "SolutionMethod", "MeshCutoff", "WELCOME TO SIESTA"],
"xcrysDenContainsRecords", ["Xcrysden", "PRIMVEC", "CONVVEC", "PRIMCOORD", "ANIMSTEP"],
"mopacArchiveContainsRecords", ["MopacArchive", "SUMMARY OF PM"],
"abinitContainsRecords", ["Abinit", "http://www.abinit.org", "Catholique", "Louvain"],
"gaussianFchkContainsRecords", ["GaussianFchk", "Number of point charges in /Mol/"],
"inputContainsRecords", ["Input", " ATOMS cartesian", "$molecule", "&zmat", "geometry={", "$DATA", "%coords", "GEOM=PQS", "geometry units angstroms"]);
c$.headerContainsRecords = c$.prototype.headerContainsRecords = [J.adapter.smarter.Resolver.sptRecords, J.adapter.smarter.Resolver.bilbaoContainsRecords, J.adapter.smarter.Resolver.xmlContainsRecords, J.adapter.smarter.Resolver.gaussianContainsRecords, J.adapter.smarter.Resolver.ampacContainsRecords, J.adapter.smarter.Resolver.mopacContainsRecords, J.adapter.smarter.Resolver.qchemContainsRecords, J.adapter.smarter.Resolver.gamessUKContainsRecords, J.adapter.smarter.Resolver.gamessUSContainsRecords, J.adapter.smarter.Resolver.spartanBinaryContainsRecords, J.adapter.smarter.Resolver.spartanContainsRecords, J.adapter.smarter.Resolver.mol2Records, J.adapter.smarter.Resolver.adfContainsRecords, J.adapter.smarter.Resolver.psiContainsRecords, J.adapter.smarter.Resolver.nwchemContainsRecords, J.adapter.smarter.Resolver.uicrcifContainsRecords, J.adapter.smarter.Resolver.dgridContainsRecords, J.adapter.smarter.Resolver.crystalContainsRecords, J.adapter.smarter.Resolver.dmolContainsRecords, J.adapter.smarter.Resolver.gulpContainsRecords, J.adapter.smarter.Resolver.espressoContainsRecords, J.adapter.smarter.Resolver.siestaContainsRecords, J.adapter.smarter.Resolver.xcrysDenContainsRecords, J.adapter.smarter.Resolver.mopacArchiveContainsRecords, J.adapter.smarter.Resolver.abinitContainsRecords, J.adapter.smarter.Resolver.gaussianFchkContainsRecords, J.adapter.smarter.Resolver.inputContainsRecords];
});
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["J.api.JmolAdapter"], "J.adapter.smarter.SmarterJmolAdapter", ["java.io.BufferedReader", "javajs.api.GenericBinaryDocument", "JU.Rdr", "J.adapter.smarter.AtomIterator", "$.AtomSetCollection", "$.AtomSetCollectionReader", "$.BondIterator", "$.Resolver", "$.StructureIterator", "JU.Logger"], function () {
c$ = Clazz_declareType (J.adapter.smarter, "SmarterJmolAdapter", J.api.JmolAdapter);
Clazz_overrideMethod (c$, "getFileTypeName", 
function (ascOrReader) {
if (Clazz_instanceOf (ascOrReader, J.adapter.smarter.AtomSetCollection)) return (ascOrReader).fileTypeName;
if (Clazz_instanceOf (ascOrReader, java.io.BufferedReader)) return J.adapter.smarter.Resolver.getFileType (ascOrReader);
return null;
}, "~O");
Clazz_overrideMethod (c$, "getAtomSetCollectionReader", 
function (name, type, bufferedReader, htParams) {
return J.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollectionReader (name, type, bufferedReader, htParams);
}, "~S,~S,~O,java.util.Map");
c$.staticGetAtomSetCollectionReader = Clazz_defineMethod (c$, "staticGetAtomSetCollectionReader", 
function (name, type, bufferedReader, htParams) {
try {
var ret = J.adapter.smarter.Resolver.getAtomCollectionReader (name, type, bufferedReader, htParams, -1);
if (Clazz_instanceOf (ret, String)) {
try {
J.adapter.smarter.SmarterJmolAdapter.close (bufferedReader);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
} else {
(ret).setup (name, htParams, bufferedReader);
}return ret;
} catch (e) {
try {
J.adapter.smarter.SmarterJmolAdapter.close (bufferedReader);
} catch (ex) {
if (Clazz_exceptionOf (ex, Exception)) {
} else {
throw ex;
}
}
bufferedReader = null;
JU.Logger.error ("" + e);
return "" + e;
}
}, "~S,~S,~O,java.util.Map");
Clazz_defineMethod (c$, "getAtomSetCollectionFromReader", 
function (fname, reader, htParams) {
var ret = J.adapter.smarter.Resolver.getAtomCollectionReader (fname, null, reader, htParams, -1);
if (Clazz_instanceOf (ret, J.adapter.smarter.AtomSetCollectionReader)) {
(ret).setup (fname, htParams, reader);
return (ret).readData ();
}return "" + ret;
}, "~S,~O,java.util.Map");
Clazz_overrideMethod (c$, "getAtomSetCollection", 
function (ascReader) {
return J.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollection (ascReader);
}, "~O");
c$.staticGetAtomSetCollection = Clazz_defineMethod (c$, "staticGetAtomSetCollection", 
function (a) {
var br = null;
try {
br = a.reader;
var ret = a.readData ();
if (!(Clazz_instanceOf (ret, J.adapter.smarter.AtomSetCollection))) return ret;
var asc = ret;
if (asc.errorMessage != null) return asc.errorMessage;
return asc;
} catch (e) {
try {
JU.Logger.info (e.toString ());
} catch (ee) {
if (Clazz_exceptionOf (ee, Exception)) {
JU.Logger.error (e.toString ());
} else {
throw ee;
}
}
try {
br.close ();
} catch (ex) {
if (Clazz_exceptionOf (ex, Exception)) {
} else {
throw ex;
}
}
br = null;
JU.Logger.error ("" + e);
return "" + e;
}
}, "J.adapter.smarter.AtomSetCollectionReader");
Clazz_overrideMethod (c$, "getAtomSetCollectionReaders", 
function (filesReader, names, types, htParams, getReadersOnly) {
var vwr = htParams.get ("vwr");
var size = names.length;
var readers = (getReadersOnly ?  new Array (size) : null);
var reader = null;
if (htParams.containsKey ("concatenate")) {
var s = "";
for (var i = 0; i < size; i++) {
var f = vwr.getFileAsString3 (names[i], false, null);
if (i > 0 && size <= 3 && f.startsWith ("{")) {
var type = (f.contains ("/outliers/") ? "validation" : "domains");
var x = vwr.evaluateExpressionAsVariable (f);
if (x != null && x.getMap () != null) htParams.put (type, x);
continue;
}if (names[i].indexOf ("/rna3dhub/") >= 0) {
s += "\n_rna3d \n;" + f + "\n;\n";
continue;
}if (names[i].indexOf ("/dssr/") >= 0) {
s += "\n_dssr \n;" + f + "\n;\n";
continue;
}s += f;
if (!s.endsWith ("\n")) s += "\n";
}
size = 1;
reader = JU.Rdr.getBR (s);
}var atomsets = (getReadersOnly ? null :  new Array (size));
var r = null;
for (var i = 0; i < size; i++) {
try {
if (r != null) htParams.put ("vwr", vwr);
if (reader == null) reader = filesReader.getBufferedReaderOrBinaryDocument (i, false);
if (!(Clazz_instanceOf (reader, java.io.BufferedReader) || Clazz_instanceOf (reader, javajs.api.GenericBinaryDocument))) return reader;
var ret = J.adapter.smarter.Resolver.getAtomCollectionReader (names[i], (types == null ? null : types[i]), reader, htParams, i);
if (!(Clazz_instanceOf (ret, J.adapter.smarter.AtomSetCollectionReader))) return ret;
r = ret;
r.setup (null, null, null);
if (r.isBinary) {
r.setup (names[i], htParams, filesReader.getBufferedReaderOrBinaryDocument (i, true));
} else {
r.setup (names[i], htParams, reader);
}reader = null;
if (getReadersOnly) {
readers[i] = r;
} else {
ret = r.readData ();
if (!(Clazz_instanceOf (ret, J.adapter.smarter.AtomSetCollection))) return ret;
atomsets[i] = ret;
if (atomsets[i].errorMessage != null) return atomsets[i].errorMessage;
}} catch (e) {
JU.Logger.error ("" + e);
if (!vwr.isJS) e.printStackTrace ();
return "" + e;
}
}
if (getReadersOnly) return readers;
return this.getAtomSetCollectionFromSet (readers, atomsets, htParams);
}, "J.api.JmolFilesReaderInterface,~A,~A,java.util.Map,~B");
Clazz_overrideMethod (c$, "getAtomSetCollectionFromSet", 
function (readerSet, atomsets, htParams) {
var readers = readerSet;
var asc = (atomsets == null ?  new Array (readers.length) : atomsets);
if (atomsets == null) {
for (var i = 0; i < readers.length; i++) {
try {
var ret = readers[i].readData ();
if (!(Clazz_instanceOf (ret, J.adapter.smarter.AtomSetCollection))) return ret;
asc[i] = ret;
if (asc[i].errorMessage != null) return asc[i].errorMessage;
} catch (e) {
JU.Logger.error ("" + e);
return "" + e;
}
}
}var result;
if (htParams.containsKey ("trajectorySteps")) {
result = asc[0];
try {
result.finalizeTrajectoryAs (htParams.get ("trajectorySteps"), htParams.get ("vibrationSteps"));
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
if (result.errorMessage == null) result.errorMessage = "" + e;
} else {
throw e;
}
}
} else if (asc[0].isTrajectory) {
result = asc[0];
for (var i = 1; i < asc.length; i++) asc[0].mergeTrajectories (asc[i]);

} else {
result = (asc.length == 1 ? asc[0] :  new J.adapter.smarter.AtomSetCollection ("Array", null, asc, null));
}return (result.errorMessage == null ? result : result.errorMessage);
}, "~O,~O,java.util.Map");
Clazz_overrideMethod (c$, "getAtomSetCollectionFromDOM", 
function (DOMNode, htParams) {
try {
var ret = J.adapter.smarter.Resolver.DOMResolve (DOMNode, htParams);
if (!(Clazz_instanceOf (ret, J.adapter.smarter.AtomSetCollectionReader))) return ret;
var a = ret;
a.setup ("DOM node", htParams, null);
ret = a.readDataObject (DOMNode);
if (!(Clazz_instanceOf (ret, J.adapter.smarter.AtomSetCollection))) return ret;
var asc = ret;
if (asc.errorMessage != null) return asc.errorMessage;
return asc;
} catch (e) {
JU.Logger.error ("" + e);
return "" + e;
}
}, "~O,java.util.Map");
Clazz_overrideMethod (c$, "finish", 
function (asc) {
(asc).finish ();
}, "~O");
Clazz_overrideMethod (c$, "getAtomSetCollectionName", 
function (asc) {
return (asc).collectionName;
}, "~O");
Clazz_overrideMethod (c$, "getAtomSetCollectionAuxiliaryInfo", 
function (asc) {
return (asc).atomSetInfo;
}, "~O");
Clazz_overrideMethod (c$, "getAtomSetCount", 
function (asc) {
return (asc).atomSetCount;
}, "~O");
Clazz_overrideMethod (c$, "getAtomSetNumber", 
function (asc, atomSetIndex) {
return (asc).getAtomSetNumber (atomSetIndex);
}, "~O,~N");
Clazz_overrideMethod (c$, "getAtomSetName", 
function (asc, atomSetIndex) {
return (asc).getAtomSetName (atomSetIndex);
}, "~O,~N");
Clazz_overrideMethod (c$, "getAtomSetAuxiliaryInfo", 
function (asc, atomSetIndex) {
return (asc).getAtomSetAuxiliaryInfo (atomSetIndex);
}, "~O,~N");
Clazz_overrideMethod (c$, "getHydrogenAtomCount", 
function (asc) {
return (asc).getHydrogenAtomCount ();
}, "~O");
Clazz_overrideMethod (c$, "getBondList", 
function (asc) {
return (asc).getBondList ();
}, "~O");
Clazz_overrideMethod (c$, "getAtomCount", 
function (asc) {
var a = asc;
return (a.bsAtoms == null ? a.ac : a.bsAtoms.cardinality ());
}, "~O");
Clazz_overrideMethod (c$, "coordinatesAreFractional", 
function (asc) {
return (asc).coordinatesAreFractional;
}, "~O");
Clazz_overrideMethod (c$, "getAtomIterator", 
function (asc) {
return  new J.adapter.smarter.AtomIterator (asc);
}, "~O");
Clazz_overrideMethod (c$, "getBondIterator", 
function (asc) {
return  new J.adapter.smarter.BondIterator (asc);
}, "~O");
Clazz_overrideMethod (c$, "getStructureIterator", 
function (asc) {
return (asc).structureCount == 0 ? null :  new J.adapter.smarter.StructureIterator (asc);
}, "~O");
c$.close = Clazz_defineMethod (c$, "close", 
function (bufferedReader) {
if (Clazz_instanceOf (bufferedReader, java.io.BufferedReader)) (bufferedReader).close ();
 else (bufferedReader).close ();
}, "~O");
Clazz_defineStatics (c$,
"PATH_KEY", ".PATH");
c$.PATH_SEPARATOR = c$.prototype.PATH_SEPARATOR = System.getProperty ("path.separator", "/");
});
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["J.api.JmolAdapterStructureIterator"], "J.adapter.smarter.StructureIterator", ["J.api.JmolAdapter"], function () {
c$ = Clazz_decorateAsClass (function () {
this.structureCount = 0;
this.structures = null;
this.structure = null;
this.istructure = 0;
this.bsModelsDefined = null;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "StructureIterator", J.api.JmolAdapterStructureIterator);
Clazz_makeConstructor (c$, 
function (asc) {
this.structureCount = asc.structureCount;
this.structures = asc.structures;
this.istructure = 0;
this.bsModelsDefined = asc.bsStructuredModels;
}, "J.adapter.smarter.AtomSetCollection");
Clazz_overrideMethod (c$, "hasNext", 
function () {
if (this.istructure == this.structureCount) return false;
this.structure = this.structures[this.istructure++];
return true;
});
Clazz_overrideMethod (c$, "getStructureType", 
function () {
return this.structure.structureType;
});
Clazz_overrideMethod (c$, "getSubstructureType", 
function () {
return this.structure.substructureType;
});
Clazz_overrideMethod (c$, "getStructureID", 
function () {
return this.structure.structureID;
});
Clazz_overrideMethod (c$, "getSerialID", 
function () {
return this.structure.serialID;
});
Clazz_overrideMethod (c$, "getStartChainID", 
function () {
return this.structure.startChainID;
});
Clazz_overrideMethod (c$, "getStartSequenceNumber", 
function () {
return this.structure.startSequenceNumber;
});
Clazz_overrideMethod (c$, "getStartInsertionCode", 
function () {
return J.api.JmolAdapter.canonizeInsertionCode (this.structure.startInsertionCode);
});
Clazz_overrideMethod (c$, "getEndChainID", 
function () {
return this.structure.endChainID;
});
Clazz_overrideMethod (c$, "getEndSequenceNumber", 
function () {
return this.structure.endSequenceNumber;
});
Clazz_overrideMethod (c$, "getEndInsertionCode", 
function () {
return this.structure.endInsertionCode;
});
Clazz_overrideMethod (c$, "getStrandCount", 
function () {
return this.structure.strandCount;
});
Clazz_overrideMethod (c$, "getStructuredModels", 
function () {
return this.bsModelsDefined;
});
Clazz_overrideMethod (c$, "getAtomIndices", 
function () {
return this.structure.atomStartEnd;
});
Clazz_overrideMethod (c$, "getModelIndices", 
function () {
return this.structure.modelStartEnd;
});
});
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "AtomIndexIterator");
Clazz_declarePackage ("J.api");
Clazz_load (null, "J.api.Interface", ["JU.Logger"], function () {
c$ = Clazz_declareType (J.api, "Interface");
c$.getInterface = Clazz_defineMethod (c$, "getInterface", 
function (name, vwr, state) {
try {
var x = null;
{
x = Clazz._4Name (name, vwr && vwr.html5Applet, state);
}return (x == null ? null : x.newInstance ());
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error ("Interface.java Error creating instance for " + name + ": \n" + e);
return null;
} else {
throw e;
}
}
}, "~S,JV.Viewer,~S");
c$.getOption = Clazz_defineMethod (c$, "getOption", 
function (className, vwr, state) {
return J.api.Interface.getInterface ("J." + className, vwr, state);
}, "~S,JV.Viewer,~S");
c$.getUtil = Clazz_defineMethod (c$, "getUtil", 
function (name, vwr, state) {
return J.api.Interface.getInterface ("JU." + name, vwr, state);
}, "~S,JV.Viewer,~S");
c$.getSymmetry = Clazz_defineMethod (c$, "getSymmetry", 
function (vwr, state) {
return J.api.Interface.getInterface ("JS.Symmetry", vwr, state);
}, "JV.Viewer,~S");
});
Clazz_declarePackage ("J.api");
Clazz_load (null, "J.api.JmolAdapter", ["java.util.Hashtable", "JU.PT", "J.api.JmolViewer", "JU.Elements"], function () {
c$ = Clazz_declareType (J.api, "JmolAdapter");
c$.getElementSymbol = Clazz_defineMethod (c$, "getElementSymbol", 
function (elementNumber) {
return JU.Elements.elementSymbolFromNumber (elementNumber);
}, "~N");
c$.getElementNumber = Clazz_defineMethod (c$, "getElementNumber", 
function (elementSymbol) {
return JU.Elements.elementNumberFromSymbol (elementSymbol, false);
}, "~S");
c$.getNaturalIsotope = Clazz_defineMethod (c$, "getNaturalIsotope", 
function (elementNumber) {
return JU.Elements.getNaturalIsotope (elementNumber);
}, "~N");
c$.getBondingRadius = Clazz_defineMethod (c$, "getBondingRadius", 
function (atomicNumberWithIsotope, charge) {
return JU.Elements.getBondingRadius (atomicNumberWithIsotope, charge);
}, "~N,~N");
Clazz_defineMethod (c$, "getAtomSetCollectionFromReader", 
function (name, type, bufferedReader, htParams) {
if (htParams == null) htParams =  new java.util.Hashtable ();
if (!htParams.containsKey ("vwr")) htParams.put ("vwr", J.api.JmolViewer.allocateViewer (null, this));
var a = this.getAtomSetCollectionReader (name, type, bufferedReader, htParams);
if (Clazz_instanceOf (a, String)) return a;
return this.getAtomSetCollection (a);
}, "~S,~S,~O,java.util.Map");
Clazz_defineMethod (c$, "openBufferedReader", 
function (name, bufferedReader) {
return this.getAtomSetCollectionFromReader (name, null, bufferedReader, null);
}, "~S,java.io.BufferedReader");
Clazz_defineMethod (c$, "openBufferedReader", 
function (name, bufferedReader, htParams) {
return this.getAtomSetCollectionFromReader (name, null, bufferedReader, htParams);
}, "~S,java.io.BufferedReader,java.util.Map");
Clazz_defineMethod (c$, "openBufferedReader", 
function (name, type, bufferedReader) {
return this.getAtomSetCollectionFromReader (name, type, bufferedReader, null);
}, "~S,~S,java.io.BufferedReader");
c$.canonizeAlphaDigit = Clazz_defineMethod (c$, "canonizeAlphaDigit", 
 function (ch) {
return (JU.PT.isLetterOrDigit (ch) ? ch : '\0');
}, "~S");
c$.canonizeInsertionCode = Clazz_defineMethod (c$, "canonizeInsertionCode", 
function (insertionCode) {
return J.api.JmolAdapter.canonizeAlphaDigit (insertionCode);
}, "~S");
c$.canonizeAlternateLocationID = Clazz_defineMethod (c$, "canonizeAlternateLocationID", 
function (altLoc) {
return J.api.JmolAdapter.canonizeAlphaDigit (altLoc);
}, "~S");
Clazz_defineStatics (c$,
"ORDER_COVALENT_SINGLE", 1,
"ORDER_COVALENT_DOUBLE", 2,
"ORDER_COVALENT_TRIPLE", 3,
"ORDER_AROMATIC", 515,
"ORDER_AROMATIC_SINGLE", 513,
"ORDER_AROMATIC_DOUBLE", 514,
"ORDER_HBOND", 2048,
"ORDER_STEREO_NEAR", 1025,
"ORDER_STEREO_FAR", 1041,
"ORDER_PARTIAL01", 33,
"ORDER_PARTIAL12", 66,
"ORDER_PARTIAL23", 97,
"ORDER_PARTIAL32", 100,
"ORDER_UNSPECIFIED", 17,
"ORDER_PYMOL_SINGLE", 65536,
"ORDER_PYMOL_MULT", 98304,
"cellParamNames", ["_cell_length_a", "_cell_length_b", "_cell_length_c", "_cell_angle_alpha", "_cell_angle_beta", "_cell_angle_gamma"]);
});
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolAdapterAtomIterator");
Clazz_declarePackage ("J.api");
c$ = Clazz_declareType (J.api, "JmolAdapterBondIterator");
Clazz_declarePackage ("J.api");
c$ = Clazz_declareType (J.api, "JmolAdapterStructureIterator");
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolAppConsoleInterface");
Clazz_declarePackage ("J.api");
Clazz_load (["J.api.JmolSyncInterface"], "J.api.JmolAppletInterface", null, function () {
Clazz_declareInterface (J.api, "JmolAppletInterface", J.api.JmolSyncInterface);
});
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolCallbackListener");
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolAnnotationParser");
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolGraphicsInterface");
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolMeasurementClient");
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolModulationSet");
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolNavigatorInterface", Runnable);
Clazz_declarePackage ("J.api");
Clazz_load (["J.api.JmolGraphicsInterface"], "J.api.JmolRendererInterface", null, function () {
Clazz_declareInterface (J.api, "JmolRendererInterface", J.api.JmolGraphicsInterface);
});
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolRepaintManager");
Clazz_declarePackage ("J.api");
Clazz_load (["J.api.JmolCallbackListener"], "J.api.JmolStatusListener", null, function () {
Clazz_declareInterface (J.api, "JmolStatusListener", J.api.JmolCallbackListener);
});
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolSyncInterface");
Clazz_declarePackage ("J.api");
Clazz_load (null, "J.api.JmolViewer", ["java.util.Hashtable"], function () {
c$ = Clazz_decorateAsClass (function () {
this.menuStructure = null;
this.apiPlatform = null;
Clazz_instantialize (this, arguments);
}, J.api, "JmolViewer");
c$.allocateViewer = Clazz_defineMethod (c$, "allocateViewer", 
function (display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener, implementedPlatform) {
var info =  new java.util.Hashtable ();
if (display != null) info.put ("display", display);
if (modelAdapter != null) info.put ("adapter", modelAdapter);
if (statusListener != null) info.put ("statuslistener", statusListener);
if (implementedPlatform != null) info.put ("platform", implementedPlatform);
if (commandOptions != null) info.put ("options", commandOptions);
if (fullName != null) info.put ("fullname", fullName);
if (documentBase != null) info.put ("documentbase", documentBase);
if (codeBase != null) info.put ("codebase", codeBase);
return  new JV.Viewer (info);
}, "~O,J.api.JmolAdapter,~S,java.net.URL,java.net.URL,~S,J.api.JmolStatusListener,javajs.api.GenericPlatform");
c$.allocateViewer = Clazz_defineMethod (c$, "allocateViewer", 
function (container, jmolAdapter) {
return J.api.JmolViewer.allocateViewer (container, jmolAdapter, null, null, null, null, null, null);
}, "~O,J.api.JmolAdapter");
c$.allocateViewer = Clazz_defineMethod (c$, "allocateViewer", 
function (display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener) {
return J.api.JmolViewer.allocateViewer (display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener, null);
}, "~O,J.api.JmolAdapter,~S,java.net.URL,java.net.URL,~S,J.api.JmolStatusListener");
Clazz_defineMethod (c$, "setConsole", 
function (console) {
this.getProperty ("DATA_API", "getAppConsole", console);
}, "J.api.JmolAppConsoleInterface");
c$.getJmolVersion = Clazz_defineMethod (c$, "getJmolVersion", 
function () {
return JV.Viewer.getJmolVersion ();
});
Clazz_defineMethod (c$, "openFileAsync", 
function (fileName) {
this.openFileAsyncSpecial (fileName, 0);
}, "~S");
Clazz_defineMethod (c$, "renderScreenImage", 
function (g, currentSize, rectClip) {
this.apiPlatform.renderScreenImage (g, currentSize);
}, "~O,~O,~O");
Clazz_defineMethod (c$, "dispose", 
function () {
});
});
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "JmolZipUtilities");
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "Translator");
Clazz_declarePackage ("J.appletjs");
Clazz_load (["javajs.api.JSInterface", "JU.GenericApplet"], "J.appletjs.Jmol", ["java.util.Hashtable", "JU.PT", "JU.Logger", "$.Parser"], function () {
c$ = Clazz_decorateAsClass (function () {
this.htParams = null;
Clazz_instantialize (this, arguments);
}, J.appletjs, "Jmol", JU.GenericApplet, javajs.api.JSInterface);
Clazz_makeConstructor (c$, 
function (vwrOptions) {
Clazz_superConstructor (this, J.appletjs.Jmol, []);
this.htParams =  new java.util.Hashtable ();
if (vwrOptions == null) vwrOptions =  new java.util.Hashtable ();
this.vwrOptions = vwrOptions;
for (var entry, $entry = vwrOptions.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) this.htParams.put (entry.getKey ().toLowerCase (), entry.getValue ());

this.documentBase = "" + vwrOptions.get ("documentBase");
this.codeBase = "" + vwrOptions.get ("codePath");
this.isJS = true;
this.init (this);
}, "java.util.Map");
Clazz_overrideMethod (c$, "setStereoGraphics", 
function (isStereo) {
{
if (isStereo)
return vwr.apiPlatform.context;
}return null;
}, "~B");
Clazz_overrideMethod (c$, "initOptions", 
function () {
this.vwrOptions.remove ("debug");
this.vwrOptions.put ("fullName", this.fullName);
this.haveDocumentAccess = "true".equalsIgnoreCase ("" + this.getValue ("allowjavascript", "true"));
this.mayScript = true;
});
Clazz_overrideMethod (c$, "getJmolParameter", 
function (paramName) {
var o = this.htParams.get (paramName.toLowerCase ());
return (o == null ? null : "" + o);
}, "~S");
Clazz_overrideMethod (c$, "doSendJsTextStatus", 
function (message) {
System.out.println (message);
}, "~S");
Clazz_overrideMethod (c$, "doSendJsTextareaStatus", 
function (message) {
System.out.println (message);
}, "~S");
Clazz_overrideMethod (c$, "doFunctionXY", 
function (functionName, nX, nY) {
var fxy =  Clazz_newFloatArray (Math.abs (nX), Math.abs (nY), 0);
if (!this.mayScript || !this.haveDocumentAccess || nX == 0 || nY == 0) return fxy;
try {
if (nX > 0 && nY > 0) {
for (var i = 0; i < nX; i++) for (var j = 0; j < nY; j++) {
{
fxy[i][j] = eval(functionName)(this.htmlName, i, j);
}}

} else if (nY > 0) {
var data;
{
data = eval(functionName)(this.htmlName, nX, nY);
}nX = Math.abs (nX);
var fdata =  Clazz_newFloatArray (nX * nY, 0);
JU.Parser.parseStringInfestedFloatArray (data, null, fdata);
for (var i = 0, ipt = 0; i < nX; i++) {
for (var j = 0; j < nY; j++, ipt++) {
fxy[i][j] = fdata[ipt];
}
}
} else {
{
data = eval(functionName)(this.htmlName, nX, nY, fxy);
}}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error ("Exception " + e + " with nX, nY: " + nX + " " + nY);
} else {
throw e;
}
}
return fxy;
}, "~S,~N,~N");
Clazz_overrideMethod (c$, "doFunctionXYZ", 
function (functionName, nX, nY, nZ) {
var fxyz =  Clazz_newFloatArray (Math.abs (nX), Math.abs (nY), Math.abs (nZ), 0);
if (!this.mayScript || !this.haveDocumentAccess || nX == 0 || nY == 0 || nZ == 0) return fxyz;
try {
{
eval(functionName)(this.htmlName, nX, nY, nZ, fxyz);
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error ("Exception " + e + " for " + functionName + " with nX, nY, nZ: " + nX + " " + nY + " " + nZ);
} else {
throw e;
}
}
return fxyz;
}, "~S,~N,~N,~N");
Clazz_overrideMethod (c$, "doShowDocument", 
function (url) {
{
window.open(url.toString());
}}, "java.net.URL");
Clazz_overrideMethod (c$, "doSendCallback", 
function (callback, data, strInfo) {
if (callback == null || callback.length == 0) {
} else if (callback.equals ("alert")) {
{
alert(strInfo); return "";
}} else {
var tokens = JU.PT.split (callback, ".");
{
try{
var o = window[tokens[0]];
for (var i = 1; i < tokens.length; i++)
o = o[tokens[i]];
for (var i = 0; i < data.length; i++)
data[i] && data[i].booleanValue && (data[i] = data[i].booleanValue());
return o(data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7]);
} catch (e) { System.out.println(callback + " failed " + e); }
}}return "";
}, "~S,~A,~S");
Clazz_overrideMethod (c$, "doEval", 
function (strEval) {
try {
{
return "" + eval(strEval);
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error ("# error evaluating " + strEval + ":" + e.toString ());
} else {
throw e;
}
}
return "";
}, "~S");
Clazz_overrideMethod (c$, "doShowStatus", 
function (message) {
try {
System.out.println (message);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}, "~S");
Clazz_overrideMethod (c$, "cacheFileByName", 
function (fileName, isAdd) {
return this.viewer.cacheFileByName (fileName, isAdd);
}, "~S,~B");
Clazz_overrideMethod (c$, "cachePut", 
function (key, data) {
this.viewer.cachePut (key, data);
}, "~S,~O");
Clazz_overrideMethod (c$, "getGLmolView", 
function () {
return this.viewer.getGLmolView ();
});
Clazz_overrideMethod (c$, "getFullName", 
function () {
return this.fullName;
});
Clazz_overrideMethod (c$, "processMouseEvent", 
function (id, x, y, modifiers, time) {
return this.viewer.processMouseEvent (id, x, y, modifiers, time);
}, "~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "setDisplay", 
function (canvas) {
this.viewer.setDisplay (canvas);
}, "~O");
Clazz_overrideMethod (c$, "setStatusDragDropped", 
function (mode, x, y, fileName) {
return this.viewer.setStatusDragDropped (mode, x, y, fileName);
}, "~N,~N,~N,~S");
Clazz_overrideMethod (c$, "startHoverWatcher", 
function (enable) {
this.viewer.startHoverWatcher (enable);
}, "~B");
Clazz_overrideMethod (c$, "update", 
function () {
this.viewer.updateJS ();
});
Clazz_overrideMethod (c$, "openFile", 
function (fileName) {
return this.viewer.openFile (fileName);
}, "~S");
Clazz_overrideMethod (c$, "openFileAsyncSpecial", 
function (fileName, flags) {
this.viewer.openFileAsyncSpecial (fileName, flags);
}, "~S,~N");
Clazz_overrideMethod (c$, "processTwoPointGesture", 
function (touches) {
this.viewer.processTwoPointGesture (touches);
}, "~A");
Clazz_overrideMethod (c$, "setScreenDimension", 
function (width, height) {
this.viewer.setScreenDimension (width, height);
}, "~N,~N");
});
Clazz_declarePackage ("J.atomdata");
c$ = Clazz_decorateAsClass (function () {
this.programInfo = null;
this.fileName = null;
this.modelName = null;
this.modelIndex = 0;
this.bsSelected = null;
this.bsIgnored = null;
this.bsMolecules = null;
this.radiusData = null;
this.firstAtomIndex = 0;
this.firstModelIndex = 0;
this.lastModelIndex = 0;
this.hAtomRadius = 0;
this.atomIndex = null;
this.atomXyz = null;
this.atomRadius = null;
this.atomicNumber = null;
this.atomMolecule = null;
this.hAtoms = null;
this.ac = 0;
this.hydrogenAtomCount = 0;
this.adpMode = 0;
Clazz_instantialize (this, arguments);
}, J.atomdata, "AtomData");
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineStatics (c$,
"MODE_FILL_MODEL", 0,
"MODE_FILL_COORDS", 1,
"MODE_FILL_RADII", 2,
"MODE_FILL_MOLECULES", 4,
"MODE_GET_ATTACHED_HYDROGENS", 8,
"MODE_FILL_MULTIMODEL", 16);
Clazz_declarePackage ("J.atomdata");
Clazz_declareInterface (J.atomdata, "AtomDataServer");
Clazz_declarePackage ("J.atomdata");
Clazz_load (["java.lang.Enum", "J.c.VDW"], "J.atomdata.RadiusData", ["java.lang.Float", "JU.SB"], function () {
c$ = Clazz_decorateAsClass (function () {
this.info = null;
this.factorType = null;
this.vdwType = null;
this.value = NaN;
this.valueExtended = 0;
this.values = null;
Clazz_instantialize (this, arguments);
}, J.atomdata, "RadiusData");
Clazz_prepareFields (c$, function () {
this.factorType = J.atomdata.RadiusData.EnumType.ABSOLUTE;
this.vdwType = J.c.VDW.AUTO;
});
Clazz_makeConstructor (c$, 
function (values, value, factorType, vdwType) {
if (values != null) {
this.values = values;
this.value = 2147483647;
return;
}if (factorType == null) return;
this.factorType = factorType;
this.value = value;
if (vdwType != null) this.vdwType = vdwType;
}, "~A,~N,J.atomdata.RadiusData.EnumType,J.c.VDW");
Clazz_overrideMethod (c$, "toString", 
function () {
if (Float.isNaN (this.value)) return "";
var sb =  new JU.SB ();
switch (this.factorType) {
case J.atomdata.RadiusData.EnumType.ABSOLUTE:
sb.appendF (this.value);
break;
case J.atomdata.RadiusData.EnumType.OFFSET:
sb.append (this.value > 0 ? "+" : "").appendF (this.value);
break;
case J.atomdata.RadiusData.EnumType.FACTOR:
sb.appendI (Clazz_floatToInt (this.value * 100)).append ("%");
if (this.vdwType !== J.c.VDW.AUTO) sb.append (this.vdwType.getVdwLabel ());
break;
case J.atomdata.RadiusData.EnumType.SCREEN:
sb.appendI (Clazz_floatToInt (this.value));
}
return sb.toString ();
});
Clazz_pu$h(self.c$);
c$ = Clazz_declareType (J.atomdata.RadiusData, "EnumType", Enum);
Clazz_defineEnumConstant (c$, "ABSOLUTE", 0, []);
Clazz_defineEnumConstant (c$, "OFFSET", 1, []);
Clazz_defineEnumConstant (c$, "FACTOR", 2, []);
Clazz_defineEnumConstant (c$, "SCREEN", 3, []);
c$ = Clazz_p0p ();
});
Clazz_declarePackage ("J.awtjs");
c$ = Clazz_declareType (J.awtjs, "Image");
c$.grabPixels = Clazz_defineMethod (c$, "grabPixels", 
function (imageobj, width, height) {
return null;
}, "~O,~N,~N");
c$.drawImageToBuffer = Clazz_defineMethod (c$, "drawImageToBuffer", 
function (gOffscreen, imageOffscreen, imageobj, width, height, bgcolor) {
return null;
}, "~O,~O,~O,~N,~N,~N");
c$.getTextPixels = Clazz_defineMethod (c$, "getTextPixels", 
function (text, font3d, gObj, image, width, height, ascent) {
return null;
}, "~S,javajs.awt.Font,~O,~O,~N,~N,~N");
c$.newBufferedImage = Clazz_defineMethod (c$, "newBufferedImage", 
function (image, w, h) {
return null;
}, "~O,~N,~N");
c$.newBufferedImage = Clazz_defineMethod (c$, "newBufferedImage", 
function (w, h) {
return null;
}, "~N,~N");
c$.allocateRgbImage = Clazz_defineMethod (c$, "allocateRgbImage", 
function (windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent) {
return null;
}, "~N,~N,~A,~N,~B");
c$.getStaticGraphics = Clazz_defineMethod (c$, "getStaticGraphics", 
function (image, backgroundTransparent) {
return null;
}, "~O,~B");
c$.getGraphics = Clazz_defineMethod (c$, "getGraphics", 
function (image) {
return null;
}, "~O");
c$.flush = Clazz_defineMethod (c$, "flush", 
function (image) {
}, "~O");
c$.disposeGraphics = Clazz_defineMethod (c$, "disposeGraphics", 
function (graphicForText) {
}, "~O");
Clazz_declarePackage ("J.awtjs");
c$ = Clazz_declareType (J.awtjs, "JSFont");
c$.newFont = Clazz_defineMethod (c$, "newFont", 
function (fontFace, isBold, isItalic, fontSize) {
return null;
}, "~S,~B,~B,~N");
c$.getFontMetrics = Clazz_defineMethod (c$, "getFontMetrics", 
function (graphics, font) {
return null;
}, "~O,~O");
c$.getAscent = Clazz_defineMethod (c$, "getAscent", 
function (fontMetrics) {
return 0;
}, "~O");
c$.getDescent = Clazz_defineMethod (c$, "getDescent", 
function (fontMetrics) {
return 0;
}, "~O");
c$.stringWidth = Clazz_defineMethod (c$, "stringWidth", 
function (font, text) {
return 0;
}, "javajs.awt.Font,~S");
Clazz_declarePackage ("J.awtjs");
Clazz_load (["J.awtjs2d.Platform"], "J.awtjs.Platform", ["J.awtjs.Image", "$.JSFont"], function () {
c$ = Clazz_declareType (J.awtjs, "Platform", J.awtjs2d.Platform);
Clazz_overrideMethod (c$, "allocateRgbImage", 
function (windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, isImageWrite) {
return J.awtjs.Image.allocateRgbImage (windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent);
}, "~N,~N,~A,~N,~B,~B");
Clazz_overrideMethod (c$, "disposeGraphics", 
function (gOffscreen) {
J.awtjs.Image.disposeGraphics (gOffscreen);
}, "~O");
Clazz_overrideMethod (c$, "drawImage", 
function (g, img, x, y, width, height) {
}, "~O,~O,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "grabPixels", 
function (imageobj, width, height, pixels, startRow, nRows) {
return null;
}, "~O,~N,~N,~A,~N,~N");
Clazz_overrideMethod (c$, "drawImageToBuffer", 
function (gOffscreen, imageOffscreen, imageobj, width, height, bgcolor) {
return J.awtjs.Image.drawImageToBuffer (gOffscreen, imageOffscreen, imageobj, width, height, bgcolor);
}, "~O,~O,~O,~N,~N,~N");
Clazz_overrideMethod (c$, "getTextPixels", 
function (text, font3d, gObj, image, width, height, ascent) {
return J.awtjs.Image.getTextPixels (text, font3d, gObj, image, width, height, ascent);
}, "~S,javajs.awt.Font,~O,~O,~N,~N,~N");
Clazz_overrideMethod (c$, "flushImage", 
function (imagePixelBuffer) {
J.awtjs.Image.flush (imagePixelBuffer);
}, "~O");
Clazz_overrideMethod (c$, "getGraphics", 
function (image) {
return J.awtjs.Image.getGraphics (image);
}, "~O");
Clazz_overrideMethod (c$, "getStaticGraphics", 
function (image, backgroundTransparent) {
return J.awtjs.Image.getStaticGraphics (image, backgroundTransparent);
}, "~O,~B");
Clazz_overrideMethod (c$, "newBufferedImage", 
function (image, w, h) {
return J.awtjs.Image.newBufferedImage (image, w, h);
}, "~O,~N,~N");
Clazz_overrideMethod (c$, "newOffScreenImage", 
function (w, h) {
return J.awtjs.Image.newBufferedImage (w, h);
}, "~N,~N");
Clazz_overrideMethod (c$, "fontStringWidth", 
function (font, text) {
return J.awtjs.JSFont.stringWidth (font, text);
}, "javajs.awt.Font,~S");
Clazz_overrideMethod (c$, "getFontAscent", 
function (fontMetrics) {
return J.awtjs.JSFont.getAscent (fontMetrics);
}, "~O");
Clazz_overrideMethod (c$, "getFontDescent", 
function (fontMetrics) {
return J.awtjs.JSFont.getDescent (fontMetrics);
}, "~O");
Clazz_overrideMethod (c$, "getFontMetrics", 
function (font, graphics) {
return J.awtjs.JSFont.getFontMetrics (graphics, font);
}, "javajs.awt.Font,~O");
Clazz_overrideMethod (c$, "newFont", 
function (fontFace, isBold, isItalic, fontSize) {
return J.awtjs.JSFont.newFont (fontFace, isBold, isItalic, fontSize);
}, "~S,~B,~B,~N");
});
Clazz_declarePackage ("J.awtjs2d");
c$ = Clazz_declareType (J.awtjs2d, "Display");
c$.getFullScreenDimensions = Clazz_defineMethod (c$, "getFullScreenDimensions", 
function (canvas, widthHeight) {
{
widthHeight[0] = canvas.width;
widthHeight[1] = canvas.height;
}}, "~O,~A");
c$.hasFocus = Clazz_defineMethod (c$, "hasFocus", 
function (canvas) {
{
}return true;
}, "~O");
c$.requestFocusInWindow = Clazz_defineMethod (c$, "requestFocusInWindow", 
function (canvas) {
{
}}, "~O");
c$.renderScreenImage = Clazz_defineMethod (c$, "renderScreenImage", 
function (vwr, g, size) {
{
}}, "javajs.api.PlatformViewer,~O,~O");
c$.setTransparentCursor = Clazz_defineMethod (c$, "setTransparentCursor", 
function (canvas) {
{
}}, "~O");
c$.setCursor = Clazz_defineMethod (c$, "setCursor", 
function (c, canvas) {
{
}}, "~N,~O");
c$.prompt = Clazz_defineMethod (c$, "prompt", 
function (label, data, list, asButtons) {
{
var s = prompt(label, data);
if (s != null)return s;
}return "null";
}, "~S,~S,~A,~B");
c$.convertPointFromScreen = Clazz_defineMethod (c$, "convertPointFromScreen", 
function (canvas, ptTemp) {
{
}}, "~O,JU.P3");
c$.drawImage = Clazz_defineMethod (c$, "drawImage", 
function (context, canvas, x, y, width, height) {
{
var buf8 = canvas.buf8;
var buf32 = canvas.buf32;
var n = width * height;
var dw = (canvas.width - width) * 4;
for (var i = 0, j = x * 4; i < n;) {
buf8[j++] = (buf32[i] >> 16) & 0xFF;
buf8[j++] = (buf32[i] >> 8) & 0xFF;
buf8[j++] = buf32[i] & 0xFF;
buf8[j++] = 0xFF;
if (((++i)%width)==0) j += dw;
}
context.putImageData(canvas.imgdata,x,y);
}}, "~O,~O,~N,~N,~N,~N");
Clazz_declarePackage ("J.awtjs2d");
c$ = Clazz_declareType (J.awtjs2d, "Image");
c$.getWidth = Clazz_defineMethod (c$, "getWidth", 
function (canvas) {
{
return (canvas.imageWidth ? canvas.imageWidth : canvas.width);
}}, "~O");
c$.getHeight = Clazz_defineMethod (c$, "getHeight", 
function (canvas) {
{
return (canvas.imageHeight ? canvas.imageHeight : canvas.height);
}}, "~O");
c$.grabPixels = Clazz_defineMethod (c$, "grabPixels", 
function (context, width, height) {
{
if (context._buf32) return context._buf32; // non-canvas internal buffer for image writing
var data = context.getImageData(0, 0, width, height).data;
return this.toIntARGB(data);
}}, "~O,~N,~N");
c$.toIntARGB = Clazz_defineMethod (c$, "toIntARGB", 
function (imgData) {
var n = Clazz_doubleToInt (imgData.length / 4);
var iData =  Clazz_newIntArray (n, 0);
for (var i = 0, j = 0; i < n; j++) {
iData[i++] = (imgData[j++] << 16) | (imgData[j++] << 8) | imgData[j++] | 0xFF000000;
}
return iData;
}, "~A");
c$.getTextPixels = Clazz_defineMethod (c$, "getTextPixels", 
function (text, font3d, context, width, height, ascent) {
{
context.fillStyle = "#000000";
context.fillRect(0, 0, width, height);
context.fillStyle = "#FFFFFF";
context.font = font3d.font;
context.fillText(text, 0, ascent);
return this.grabPixels(context, width, height);
}}, "~S,javajs.awt.Font,~O,~N,~N,~N");
c$.allocateRgbImage = Clazz_defineMethod (c$, "allocateRgbImage", 
function (windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, canvas) {
{
if (canvas == null)
canvas = {width:windowWidth,height:windowHeight};
canvas.buf32 = pBuffer;
return canvas;
}}, "~N,~N,~A,~N,~B,~O");
c$.getStaticGraphics = Clazz_defineMethod (c$, "getStaticGraphics", 
function (canvas, backgroundTransparent) {
{
return this.getGraphics(canvas);
}}, "~O,~B");
c$.getGraphics = Clazz_defineMethod (c$, "getGraphics", 
function (canvas) {
{
return canvas.getContext("2d");
}}, "~O");
Clazz_declarePackage ("J.awtjs2d");
Clazz_load (["javajs.api.GenericFileInterface"], "J.awtjs2d.JSFile", ["JU.OC", "$.PT", "JV.Viewer"], function () {
c$ = Clazz_decorateAsClass (function () {
this.name = null;
this.fullName = null;
Clazz_instantialize (this, arguments);
}, J.awtjs2d, "JSFile", null, javajs.api.GenericFileInterface);
c$.newFile = Clazz_defineMethod (c$, "newFile", 
function (name) {
return  new J.awtjs2d.JSFile (name);
}, "~S");
Clazz_makeConstructor (c$, 
function (name) {
this.name = name.$replace ('\\', '/');
this.fullName = name;
if (!this.fullName.startsWith ("/") && JU.OC.urlTypeIndex (name) < 0) this.fullName = JV.Viewer.jsDocumentBase + "/" + this.fullName;
this.fullName = JU.PT.rep (this.fullName, "/./", "/");
name = name.substring (name.lastIndexOf ("/") + 1);
}, "~S");
Clazz_overrideMethod (c$, "getParentAsFile", 
function () {
var pt = this.fullName.lastIndexOf ("/");
return (pt < 0 ? null :  new J.awtjs2d.JSFile (this.fullName.substring (0, pt)));
});
Clazz_overrideMethod (c$, "getFullPath", 
function () {
return this.fullName;
});
Clazz_overrideMethod (c$, "getName", 
function () {
return this.name;
});
Clazz_overrideMethod (c$, "isDirectory", 
function () {
return this.fullName.endsWith ("/");
});
Clazz_overrideMethod (c$, "length", 
function () {
return 0;
});
c$.getURLContents = Clazz_defineMethod (c$, "getURLContents", 
function (url, outputBytes, post) {
try {
var conn = url.openConnection ();
if (outputBytes != null) conn.outputBytes (outputBytes);
 else if (post != null) conn.outputString (post);
return conn.getContents ();
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return e.toString ();
} else {
throw e;
}
}
}, "java.net.URL,~A,~S");
});
Clazz_declarePackage ("J.awtjs2d");
c$ = Clazz_declareType (J.awtjs2d, "JSFont");
c$.newFont = Clazz_defineMethod (c$, "newFont", 
function (fontFace, isBold, isItalic, fontSize, type) {
fontFace = (fontFace.equals ("Monospaced") ? "Courier" : fontFace.startsWith ("Sans") ? "Sans-Serif" : "Serif");
return (isBold ? "bold " : "") + (isItalic ? "italic " : "") + fontSize + type + " " + fontFace;
}, "~S,~B,~B,~N,~S");
c$.getFontMetrics = Clazz_defineMethod (c$, "getFontMetrics", 
function (font, context) {
{
if (context.font != font.font) {
context.font = font.font;
font.font = context.font;
context._fontAscent = Math.ceil(font.fontSize); //pt, not px
// the descent is actually (px - pt)
// but I know of no way of getting access to the drawn height
context._fontDescent = Math.ceil(font.fontSize * 0.25);//approx
}
}return context;
}, "javajs.awt.Font,~O");
c$.getAscent = Clazz_defineMethod (c$, "getAscent", 
function (context) {
{
return Math.ceil(context._fontAscent);
}}, "~O");
c$.getDescent = Clazz_defineMethod (c$, "getDescent", 
function (context) {
{
return Math.ceil(context._fontDescent);
}}, "~O");
c$.stringWidth = Clazz_defineMethod (c$, "stringWidth", 
function (font, context, text) {
{
context.font = font.font;
return Math.ceil(context.measureText(text).width);
}}, "javajs.awt.Font,~O,~S");
Clazz_declarePackage ("J.awtjs2d");
Clazz_load (["javajs.api.GenericMouseInterface", "javajs.awt.event.Event"], "J.awtjs2d.Mouse", ["java.lang.Character", "JU.PT", "$.V3", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.manager = null;
this.keyBuffer = "";
this.isMouseDown = false;
this.wheeling = false;
this.xWhenPressed = 0;
this.yWhenPressed = 0;
this.modifiersWhenPressed10 = 0;
Clazz_instantialize (this, arguments);
}, J.awtjs2d, "Mouse", null, javajs.api.GenericMouseInterface);
Clazz_makeConstructor (c$, 
function (privateKey, vwr, display) {
this.vwr = vwr;
this.manager = this.vwr.acm;
}, "~N,javajs.api.PlatformViewer,~O");
Clazz_overrideMethod (c$, "clear", 
function () {
});
Clazz_overrideMethod (c$, "dispose", 
function () {
});
Clazz_overrideMethod (c$, "processEvent", 
function (id, x, y, modifiers, time) {
if (id != -1) modifiers = J.awtjs2d.Mouse.applyLeftMouse (modifiers);
switch (id) {
case -1:
this.wheeled (time, x, modifiers);
break;
case 501:
this.xWhenPressed = x;
this.yWhenPressed = y;
this.modifiersWhenPressed10 = modifiers;
this.pressed (time, x, y, modifiers, false);
break;
case 506:
this.dragged (time, x, y, modifiers);
break;
case 504:
this.entry (time, x, y, false);
break;
case 505:
this.entry (time, x, y, true);
break;
case 503:
this.moved (time, x, y, modifiers);
break;
case 502:
this.released (time, x, y, modifiers);
if (x == this.xWhenPressed && y == this.yWhenPressed && modifiers == this.modifiersWhenPressed10) {
this.clicked (time, x, y, modifiers, 1);
}break;
default:
return false;
}
return true;
}, "~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "processTwoPointGesture", 
function (touches) {
if (touches[0].length < 2) return;
var t1 = touches[0];
var t2 = touches[1];
var t1first = t1[0];
var t1last = t1[t2.length - 1];
var x1first = t1first[0];
var x1last = t1last[0];
var dx1 = x1last - x1first;
var y1first = t1first[1];
var y1last = t1last[1];
var dy1 = y1last - y1first;
var v1 = JU.V3.new3 (dx1, dy1, 0);
var d1 = v1.length ();
var t2first = t2[0];
var t2last = t2[t2.length - 1];
var x2first = t2first[0];
var x2last = t2last[0];
var dx2 = x2last - x2first;
var y2first = t2first[1];
var y2last = t2last[1];
var dy2 = y2last - y2first;
var v2 = JU.V3.new3 (dx2, dy2, 0);
var d2 = v2.length ();
if (d1 < 1 || d2 < 1) return;
v1.normalize ();
v2.normalize ();
var cos12 = (v1.dot (v2));
if (cos12 > 0.8) {
var deltaX = Clazz_floatToInt (x1last - t1[t1.length - 2][0]);
var deltaY = Clazz_floatToInt (y1last - t1[t1.length - 2][1]);
this.vwr.translateXYBy (deltaX, deltaY);
} else if (cos12 < -0.8) {
v1 = JU.V3.new3 (x2first - x1first, y2first - y1first, 0);
v2 = JU.V3.new3 (x2last - x1last, y2last - y1last, 0);
var dx = v2.length () - v1.length ();
this.wheeled (System.currentTimeMillis (), dx < 0 ? -1 : 1, 32);
}}, "~A");
Clazz_defineMethod (c$, "mouseClicked", 
function (e) {
this.clicked (e.getWhen (), e.getX (), e.getY (), e.getModifiers (), e.getClickCount ());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod (c$, "mouseEntered", 
function (e) {
this.entry (e.getWhen (), e.getX (), e.getY (), false);
}, "java.awt.event.MouseEvent");
Clazz_defineMethod (c$, "mouseExited", 
function (e) {
this.entry (e.getWhen (), e.getX (), e.getY (), true);
}, "java.awt.event.MouseEvent");
Clazz_defineMethod (c$, "mousePressed", 
function (e) {
this.pressed (e.getWhen (), e.getX (), e.getY (), e.getModifiers (), e.isPopupTrigger ());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod (c$, "mouseReleased", 
function (e) {
this.released (e.getWhen (), e.getX (), e.getY (), e.getModifiers ());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod (c$, "mouseDragged", 
function (e) {
var modifiers = e.getModifiers ();
if ((modifiers & 28) == 0) modifiers |= 16;
this.dragged (e.getWhen (), e.getX (), e.getY (), modifiers);
}, "java.awt.event.MouseEvent");
Clazz_defineMethod (c$, "mouseMoved", 
function (e) {
this.moved (e.getWhen (), e.getX (), e.getY (), e.getModifiers ());
}, "java.awt.event.MouseEvent");
Clazz_defineMethod (c$, "mouseWheelMoved", 
function (e) {
e.consume ();
this.wheeled (e.getWhen (), e.getWheelRotation (), e.getModifiers ());
}, "java.awt.event.MouseWheelEvent");
Clazz_defineMethod (c$, "keyTyped", 
function (ke) {
ke.consume ();
if (!this.vwr.menuEnabled ()) return;
var ch = ke.getKeyChar ();
var modifiers = ke.getModifiers ();
if (JU.Logger.debuggingHigh) JU.Logger.debug ("MouseManager keyTyped: " + ch + " " + (0 + ch.charCodeAt (0)) + " " + modifiers);
if (modifiers != 0 && modifiers != 1) {
switch (ch) {
case String.fromCharCode (11):
case 'k':
var isON = !this.vwr.getBooleanProperty ("allowKeyStrokes");
switch (modifiers) {
case 2:
this.vwr.setBooleanProperty ("allowKeyStrokes", isON);
this.vwr.setBooleanProperty ("showKeyStrokes", true);
break;
case 10:
case 1:
this.vwr.setBooleanProperty ("allowKeyStrokes", isON);
this.vwr.setBooleanProperty ("showKeyStrokes", false);
break;
}
this.clearKeyBuffer ();
this.vwr.refresh (3, "showkey");
break;
case 22:
case 'v':
switch (modifiers) {
case 2:
break;
}
break;
case 26:
case 'z':
switch (modifiers) {
case 2:
this.vwr.undoMoveAction (4165, 1);
break;
case 3:
this.vwr.undoMoveAction (4139, 1);
break;
}
break;
case 25:
case 'y':
switch (modifiers) {
case 2:
this.vwr.undoMoveAction (4139, 1);
break;
}
break;
}
return;
}if (!this.vwr.getBooleanProperty ("allowKeyStrokes")) return;
this.addKeyBuffer (ke.getModifiers () == 1 ? Character.toUpperCase (ch) : ch);
}, "java.awt.event.KeyEvent");
Clazz_defineMethod (c$, "keyPressed", 
function (ke) {
if (this.vwr.isApplet) ke.consume ();
this.manager.keyPressed (ke.getKeyCode (), ke.getModifiers ());
}, "java.awt.event.KeyEvent");
Clazz_defineMethod (c$, "keyReleased", 
function (ke) {
ke.consume ();
this.manager.keyReleased (ke.getKeyCode ());
}, "java.awt.event.KeyEvent");
Clazz_defineMethod (c$, "clearKeyBuffer", 
 function () {
if (this.keyBuffer.length == 0) return;
this.keyBuffer = "";
if (this.vwr.getBooleanProperty ("showKeyStrokes")) this.vwr.evalStringQuietSync ("!set echo _KEYSTROKES; set echo bottom left;echo \"\"", true, true);
});
Clazz_defineMethod (c$, "addKeyBuffer", 
 function (ch) {
if (ch.charCodeAt (0) == 10) {
this.sendKeyBuffer ();
return;
}if (ch.charCodeAt (0) == 8) {
if (this.keyBuffer.length > 0) this.keyBuffer = this.keyBuffer.substring (0, this.keyBuffer.length - 1);
} else {
this.keyBuffer += ch;
}if (this.vwr.getBooleanProperty ("showKeyStrokes")) this.vwr.evalStringQuietSync ("!set echo _KEYSTROKES; set echo bottom left;echo " + JU.PT.esc ("\1" + this.keyBuffer), true, true);
}, "~S");
Clazz_defineMethod (c$, "sendKeyBuffer", 
 function () {
var kb = this.keyBuffer;
if (this.vwr.getBooleanProperty ("showKeyStrokes")) this.vwr.evalStringQuietSync ("!set echo _KEYSTROKES; set echo bottom left;echo " + JU.PT.esc (this.keyBuffer), true, true);
this.clearKeyBuffer ();
this.vwr.evalStringQuietSync (kb, false, true);
});
Clazz_defineMethod (c$, "entry", 
 function (time, x, y, isExit) {
this.wheeling = false;
this.manager.mouseEnterExit (time, x, y, isExit);
}, "~N,~N,~N,~B");
Clazz_defineMethod (c$, "clicked", 
 function (time, x, y, modifiers, clickCount) {
this.clearKeyBuffer ();
this.manager.mouseAction (2, time, x, y, 1, modifiers);
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "moved", 
 function (time, x, y, modifiers) {
this.clearKeyBuffer ();
if (this.isMouseDown) this.manager.mouseAction (1, time, x, y, 0, J.awtjs2d.Mouse.applyLeftMouse (modifiers));
 else this.manager.mouseAction (0, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "wheeled", 
 function (time, rotation, modifiers) {
this.clearKeyBuffer ();
this.wheeling = true;
this.manager.mouseAction (3, time, 0, rotation, 0, modifiers & -29 | 32);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "pressed", 
 function (time, x, y, modifiers, isPopupTrigger) {
this.clearKeyBuffer ();
this.isMouseDown = true;
this.wheeling = false;
this.manager.mouseAction (4, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "released", 
 function (time, x, y, modifiers) {
this.isMouseDown = false;
this.wheeling = false;
this.manager.mouseAction (5, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "dragged", 
 function (time, x, y, modifiers) {
if (this.wheeling) return;
if ((modifiers & 20) == 20) modifiers = modifiers & -5 | 2;
this.manager.mouseAction (1, time, x, y, 0, modifiers);
}, "~N,~N,~N,~N");
c$.applyLeftMouse = Clazz_defineMethod (c$, "applyLeftMouse", 
 function (modifiers) {
return ((modifiers & 28) == 0) ? (modifiers | 16) : modifiers;
}, "~N");
});
Clazz_declarePackage ("J.awtjs2d");
Clazz_load (["javajs.api.GenericPlatform"], "J.awtjs2d.Platform", ["java.net.URL", "JU.AjaxURLStreamHandlerFactory", "$.Rdr", "$.SB", "J.api.Interface", "J.awtjs2d.Display", "$.Image", "$.JSFile", "$.JSFont", "$.Mouse"], function () {
c$ = Clazz_decorateAsClass (function () {
this.canvas = null;
this.vwr = null;
this.context = null;
Clazz_instantialize (this, arguments);
}, J.awtjs2d, "Platform", null, javajs.api.GenericPlatform);
Clazz_overrideMethod (c$, "setViewer", 
function (vwr, canvas) {
{
this.vwr = vwr;
this.canvas = canvas;
if (canvas != null) {
this.context = canvas.getContext("2d");
canvas.imgdata = this.context.getImageData(0, 0, canvas.width, canvas.height);
canvas.buf8 = canvas.imgdata.data;
}
}try {
java.net.URL.setURLStreamHandlerFactory ( new JU.AjaxURLStreamHandlerFactory ());
} catch (e) {
}
}, "javajs.api.PlatformViewer,~O");
Clazz_overrideMethod (c$, "isSingleThreaded", 
function () {
return true;
});
Clazz_overrideMethod (c$, "getJsObjectInfo", 
function (jsObject, method, args) {
{
if (method == "localName")return jsObject[0]["nodeName"];
return (args == null ? jsObject[0][method] : jsObject[0][method](args[0]));
}}, "~A,~S,~A");
Clazz_overrideMethod (c$, "isHeadless", 
function () {
return false;
});
Clazz_overrideMethod (c$, "getMouseManager", 
function (privateKey, display) {
return  new J.awtjs2d.Mouse (privateKey, this.vwr, display);
}, "~N,~O");
Clazz_overrideMethod (c$, "convertPointFromScreen", 
function (canvas, ptTemp) {
J.awtjs2d.Display.convertPointFromScreen (canvas, ptTemp);
}, "~O,JU.P3");
Clazz_overrideMethod (c$, "getFullScreenDimensions", 
function (canvas, widthHeight) {
J.awtjs2d.Display.getFullScreenDimensions (canvas, widthHeight);
}, "~O,~A");
Clazz_overrideMethod (c$, "getMenuPopup", 
function (menuStructure, type) {
var c = (type == 'j' ? "awtjs2d.JmolJSPopup" : "awtjs2d.JSModelKitPopup");
var jmolpopup = J.api.Interface.getOption (c, this.vwr, "popup");
try {
if (jmolpopup != null) jmolpopup.jpiInitialize (this.vwr, menuStructure);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
c = "Exception creating " + c + ":" + e;
System.out.println (c);
return null;
} else {
throw e;
}
}
return jmolpopup;
}, "~S,~S");
Clazz_overrideMethod (c$, "hasFocus", 
function (canvas) {
return J.awtjs2d.Display.hasFocus (canvas);
}, "~O");
Clazz_overrideMethod (c$, "prompt", 
function (label, data, list, asButtons) {
return J.awtjs2d.Display.prompt (label, data, list, asButtons);
}, "~S,~S,~A,~B");
Clazz_overrideMethod (c$, "renderScreenImage", 
function (context, size) {
J.awtjs2d.Display.renderScreenImage (this.vwr, context, size);
}, "~O,~O");
Clazz_overrideMethod (c$, "drawImage", 
function (context, canvas, x, y, width, height) {
J.awtjs2d.Display.drawImage (context, canvas, x, y, width, height);
}, "~O,~O,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "requestFocusInWindow", 
function (canvas) {
J.awtjs2d.Display.requestFocusInWindow (canvas);
}, "~O");
Clazz_overrideMethod (c$, "repaint", 
function (canvas) {
{
if (typeof Jmol != "undefined" && Jmol._repaint)
Jmol._repaint(this.vwr.html5Applet,true);
}}, "~O");
Clazz_overrideMethod (c$, "setTransparentCursor", 
function (canvas) {
J.awtjs2d.Display.setTransparentCursor (canvas);
}, "~O");
Clazz_overrideMethod (c$, "setCursor", 
function (c, canvas) {
J.awtjs2d.Display.setCursor (c, canvas);
}, "~N,~O");
Clazz_overrideMethod (c$, "allocateRgbImage", 
function (windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, isImageWrite) {
return J.awtjs2d.Image.allocateRgbImage (windowWidth, windowHeight, pBuffer, windowSize, backgroundTransparent, (isImageWrite ? null : this.canvas));
}, "~N,~N,~A,~N,~B,~B");
Clazz_overrideMethod (c$, "notifyEndOfRendering", 
function () {
});
Clazz_overrideMethod (c$, "createImage", 
function (data) {
return null;
}, "~O");
Clazz_overrideMethod (c$, "disposeGraphics", 
function (gOffscreen) {
}, "~O");
Clazz_overrideMethod (c$, "grabPixels", 
function (canvas, width, height, pixels, startRow, nRows) {
{
if (canvas.image && (width != canvas.width || height != canvas.height))
Jmol._setCanvasImage(canvas, width, height);
if (canvas.buf32) return canvas.buf32;
}var buf = J.awtjs2d.Image.grabPixels (J.awtjs2d.Image.getGraphics (canvas), width, height);
{
canvas.buf32 = buf;
}return buf;
}, "~O,~N,~N,~A,~N,~N");
Clazz_overrideMethod (c$, "drawImageToBuffer", 
function (gOffscreen, imageOffscreen, canvas, width, height, bgcolor) {
return this.grabPixels (canvas, width, height, null, 0, 0);
}, "~O,~O,~O,~N,~N,~N");
Clazz_overrideMethod (c$, "getTextPixels", 
function (text, font3d, context, image, width, height, ascent) {
return J.awtjs2d.Image.getTextPixels (text, font3d, context, width, height, ascent);
}, "~S,javajs.awt.Font,~O,~O,~N,~N,~N");
Clazz_overrideMethod (c$, "flushImage", 
function (imagePixelBuffer) {
}, "~O");
Clazz_overrideMethod (c$, "getGraphics", 
function (canvas) {
return (canvas == null ? this.context : J.awtjs2d.Image.getGraphics (canvas));
}, "~O");
Clazz_overrideMethod (c$, "getImageHeight", 
function (canvas) {
return (canvas == null ? -1 : J.awtjs2d.Image.getHeight (canvas));
}, "~O");
Clazz_overrideMethod (c$, "getImageWidth", 
function (canvas) {
return (canvas == null ? -1 : J.awtjs2d.Image.getWidth (canvas));
}, "~O");
Clazz_overrideMethod (c$, "getStaticGraphics", 
function (image, backgroundTransparent) {
return J.awtjs2d.Image.getStaticGraphics (image, backgroundTransparent);
}, "~O,~B");
Clazz_overrideMethod (c$, "newBufferedImage", 
function (image, w, h) {
{
if (typeof Jmol != "undefined" && Jmol._getHiddenCanvas)
return Jmol._getHiddenCanvas(this.vwr.html5Applet, "stereoImage", w, h);
}return null;
}, "~O,~N,~N");
Clazz_overrideMethod (c$, "newOffScreenImage", 
function (w, h) {
{
if (typeof Jmol != "undefined" && Jmol._getHiddenCanvas)
return Jmol._getHiddenCanvas(this.vwr.html5Applet, "textImage", w, h);
}return null;
}, "~N,~N");
Clazz_overrideMethod (c$, "waitForDisplay", 
function (echoNameAndPath, zipBytes) {
{
if (typeof Jmol == "undefined" || !Jmol._getHiddenCanvas) return false;
var vwr = this.vwr;
var sc = vwr.getEvalContextAndHoldQueue(vwr.eval);
var echoName = echoNameAndPath[0];
return Jmol._loadImage(this, echoNameAndPath, zipBytes,
function(canvas, pathOrError) { vwr.loadImageData(canvas, pathOrError, echoName, sc) }
);
}}, "~O,~O");
Clazz_overrideMethod (c$, "fontStringWidth", 
function (font, text) {
return J.awtjs2d.JSFont.stringWidth (font, this.context, text);
}, "javajs.awt.Font,~S");
Clazz_overrideMethod (c$, "getFontAscent", 
function (context) {
return J.awtjs2d.JSFont.getAscent (context);
}, "~O");
Clazz_overrideMethod (c$, "getFontDescent", 
function (context) {
return J.awtjs2d.JSFont.getDescent (context);
}, "~O");
Clazz_overrideMethod (c$, "getFontMetrics", 
function (font, context) {
return J.awtjs2d.JSFont.getFontMetrics (font, context);
}, "javajs.awt.Font,~O");
Clazz_overrideMethod (c$, "newFont", 
function (fontFace, isBold, isItalic, fontSize) {
return J.awtjs2d.JSFont.newFont (fontFace, isBold, isItalic, fontSize, "px");
}, "~S,~B,~B,~N");
Clazz_overrideMethod (c$, "getDateFormat", 
function (isoType) {
{
if (isoType == null) {
} else if (isoType.indexOf("8824") >= 0) {
var d = new Date();
var x = d.toString().split(" ");
var MM = "0" + d.getMonth(); MM = MM.substring(MM.length - 2);
var dd = "0" + d.getDate(); dd = dd.substring(dd.length - 2);
return x[3] + MM + dd + x[4].replace(/\:/g,"") + x[5].substring(3,6) + "'" + x[5].substring(6,8) + "'"
} else if (isoType.indexOf("8601") >= 0){
var d = new Date();
var x = d.toString().split(" ");
var MM = "0" + d.getMonth(); MM = MM.substring(MM.length - 2);
var dd = "0" + d.getDate(); dd = dd.substring(dd.length - 2);
return x[3] + MM + dd + x[4].replace(/\:/g,"") + x[5].substring(3,6) + "'" + x[5].substring(6,8) + "'"
}
return ("" + (new Date())).split(" (")[0];
}}, "~S");
Clazz_overrideMethod (c$, "newFile", 
function (name) {
return  new J.awtjs2d.JSFile (name);
}, "~S");
Clazz_overrideMethod (c$, "getBufferedFileInputStream", 
function (name) {
return null;
}, "~S");
Clazz_overrideMethod (c$, "getURLContents", 
function (url, outputBytes, post, asString) {
return J.awtjs2d.Platform.getURLContentsStatic (url, outputBytes, post, asString);
}, "java.net.URL,~A,~S,~B");
c$.getURLContentsStatic = Clazz_defineMethod (c$, "getURLContentsStatic", 
function (url, outputBytes, post, asString) {
var ret = J.awtjs2d.JSFile.getURLContents (url, outputBytes, post);
try {
return (!asString ? ret : Clazz_instanceOf (ret, String) ? ret : Clazz_instanceOf (ret, JU.SB) ? (ret).toString () : Clazz_instanceOf (ret, Array) ?  String.instantialize (ret) :  String.instantialize (JU.Rdr.getStreamAsBytes (ret, null)));
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return "" + e;
} else {
throw e;
}
}
}, "java.net.URL,~A,~S,~B");
Clazz_overrideMethod (c$, "getLocalUrl", 
function (fileName) {
return null;
}, "~S");
});
Clazz_declarePackage ("J.bspt");
Clazz_load (null, "J.bspt.Bspf", ["JU.AU", "J.bspt.Bspt", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.dimMax = 0;
this.bspts = null;
this.isValid = false;
this.bsptsValid = null;
this.cubeIterators = null;
Clazz_instantialize (this, arguments);
}, J.bspt, "Bspf");
Clazz_defineMethod (c$, "validateModel", 
function (i, isValid) {
this.bsptsValid[i] = isValid;
}, "~N,~B");
Clazz_defineMethod (c$, "isInitializedIndex", 
function (bsptIndex) {
return this.bspts.length > bsptIndex && this.bspts[bsptIndex] != null && this.bsptsValid[bsptIndex];
}, "~N");
Clazz_makeConstructor (c$, 
function (dimMax) {
this.dimMax = dimMax;
this.bspts =  new Array (1);
this.bsptsValid =  Clazz_newBooleanArray (1, false);
this.cubeIterators =  new Array (0);
}, "~N");
Clazz_defineMethod (c$, "addTuple", 
function (bsptIndex, tuple) {
if (bsptIndex >= this.bspts.length) {
this.bspts = JU.AU.arrayCopyObject (this.bspts, bsptIndex + 1);
this.bsptsValid = JU.AU.arrayCopyBool (this.bsptsValid, bsptIndex + 1);
}var bspt = this.bspts[bsptIndex];
if (bspt == null) {
bspt = this.bspts[bsptIndex] =  new J.bspt.Bspt (this.dimMax, bsptIndex);
}bspt.addTuple (tuple);
}, "~N,JU.P3");
Clazz_defineMethod (c$, "stats", 
function () {
for (var i = 0; i < this.bspts.length; ++i) if (this.bspts[i] != null) this.bspts[i].stats ();

});
Clazz_defineMethod (c$, "dump", 
function () {
for (var i = 0; i < this.bspts.length; ++i) {
JU.Logger.info (">>>>\nDumping bspt #" + i + "\n>>>>");
this.bspts[i].dump ();
}
JU.Logger.info ("<<<<");
});
Clazz_defineMethod (c$, "getCubeIterator", 
function (bsptIndex) {
if (bsptIndex < 0) return this.getNewCubeIterator (-1 - bsptIndex);
if (bsptIndex >= this.cubeIterators.length) this.cubeIterators = JU.AU.arrayCopyObject (this.cubeIterators, bsptIndex + 1);
if (this.cubeIterators[bsptIndex] == null && this.bspts[bsptIndex] != null) this.cubeIterators[bsptIndex] = this.getNewCubeIterator (bsptIndex);
this.cubeIterators[bsptIndex].set (this.bspts[bsptIndex]);
return this.cubeIterators[bsptIndex];
}, "~N");
Clazz_defineMethod (c$, "getNewCubeIterator", 
function (bsptIndex) {
return this.bspts[bsptIndex].allocateCubeIterator ();
}, "~N");
Clazz_defineMethod (c$, "initialize", 
function (modelIndex, atoms, modelAtomBitSet) {
if (this.bspts[modelIndex] != null) this.bspts[modelIndex].reset ();
for (var i = modelAtomBitSet.nextSetBit (0); i >= 0; i = modelAtomBitSet.nextSetBit (i + 1)) this.addTuple (modelIndex, atoms[i]);

this.bsptsValid[modelIndex] = true;
}, "~N,~A,JU.BS");
});
Clazz_declarePackage ("J.bspt");
Clazz_load (null, "J.bspt.Bspt", ["JU.SB", "J.bspt.CubeIterator", "$.Leaf", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.treeDepth = 0;
this.dimMax = 0;
this.index = 0;
this.eleRoot = null;
Clazz_instantialize (this, arguments);
}, J.bspt, "Bspt");
Clazz_makeConstructor (c$, 
function (dimMax, index) {
this.dimMax = dimMax;
this.index = index;
this.reset ();
}, "~N,~N");
Clazz_defineMethod (c$, "reset", 
function () {
this.eleRoot =  new J.bspt.Leaf (this, null, 0);
this.treeDepth = 1;
});
Clazz_defineMethod (c$, "addTuple", 
function (tuple) {
this.eleRoot = this.eleRoot.addTuple (0, tuple);
}, "JU.P3");
Clazz_defineMethod (c$, "stats", 
function () {
});
Clazz_defineMethod (c$, "dump", 
function () {
var sb =  new JU.SB ();
this.eleRoot.dump (0, sb);
JU.Logger.info (sb.toString ());
});
Clazz_defineMethod (c$, "allocateCubeIterator", 
function () {
return  new J.bspt.CubeIterator (this);
});
Clazz_defineStatics (c$,
"leafCountMax", 2,
"MAX_TREE_DEPTH", 100);
});
Clazz_declarePackage ("J.bspt");
Clazz_load (null, "J.bspt.CubeIterator", ["J.bspt.Node"], function () {
c$ = Clazz_decorateAsClass (function () {
this.bspt = null;
this.stack = null;
this.sp = 0;
this.leafIndex = 0;
this.leaf = null;
this.radius = 0;
this.cx = 0;
this.cy = 0;
this.cz = 0;
this.dx = 0;
this.dy = 0;
this.dz = 0;
this.tHemisphere = false;
Clazz_instantialize (this, arguments);
}, J.bspt, "CubeIterator");
Clazz_makeConstructor (c$, 
function (bspt) {
this.set (bspt);
}, "J.bspt.Bspt");
Clazz_defineMethod (c$, "set", 
function (bspt) {
this.bspt = bspt;
this.stack =  new Array (bspt.treeDepth);
}, "J.bspt.Bspt");
Clazz_defineMethod (c$, "initialize", 
function (center, radius, hemisphereOnly) {
this.radius = radius;
this.tHemisphere = false;
this.cx = center.x;
this.cy = center.y;
this.cz = center.z;
this.leaf = null;
this.stack[0] = this.bspt.eleRoot;
this.sp = 1;
this.findLeftLeaf ();
this.tHemisphere = hemisphereOnly;
}, "JU.T3,~N,~B");
Clazz_defineMethod (c$, "release", 
function () {
this.set (this.bspt);
});
Clazz_defineMethod (c$, "hasMoreElements", 
function () {
while (this.leaf != null) {
for (; this.leafIndex < this.leaf.count; ++this.leafIndex) if (this.isWithinRadius (this.leaf.tuples[this.leafIndex])) return true;

this.findLeftLeaf ();
}
return false;
});
Clazz_defineMethod (c$, "nextElement", 
function () {
return this.leaf.tuples[this.leafIndex++];
});
Clazz_defineMethod (c$, "foundDistance2", 
function () {
return this.dx * this.dx + this.dy * this.dy + this.dz * this.dz;
});
Clazz_defineMethod (c$, "findLeftLeaf", 
 function () {
this.leaf = null;
if (this.sp == 0) return;
var ele = this.stack[--this.sp];
while (Clazz_instanceOf (ele, J.bspt.Node)) {
var node = ele;
var minValue;
switch (node.dim) {
case 0:
minValue = this.cx;
break;
case 1:
minValue = this.cy;
break;
case 2:
default:
minValue = this.cz;
break;
}
var maxValue = minValue + this.radius;
if (!this.tHemisphere || node.dim != 0) minValue -= this.radius;
if (minValue <= node.maxLeft && maxValue >= node.minLeft) {
if (maxValue >= node.minRight && minValue <= node.maxRight) {
this.stack[this.sp++] = node.eleRight;
}ele = node.eleLeft;
} else if (maxValue >= node.minRight && minValue <= node.maxRight) {
ele = node.eleRight;
} else {
if (this.sp == 0) return;
ele = this.stack[--this.sp];
}}
this.leaf = ele;
this.leafIndex = 0;
});
Clazz_defineMethod (c$, "isWithinRadius", 
 function (t) {
this.dx = t.x - this.cx;
return ((!this.tHemisphere || this.dx >= 0) && (this.dx = Math.abs (this.dx)) <= this.radius && (this.dy = Math.abs (t.y - this.cy)) <= this.radius && (this.dz = Math.abs (t.z - this.cz)) <= this.radius);
}, "JU.T3");
});
Clazz_declarePackage ("J.bspt");
c$ = Clazz_decorateAsClass (function () {
this.bspt = null;
this.count = 0;
Clazz_instantialize (this, arguments);
}, J.bspt, "Element");
Clazz_declarePackage ("J.bspt");
Clazz_load (["J.bspt.Element"], "J.bspt.Leaf", ["J.bspt.Node", "JU.Escape"], function () {
c$ = Clazz_decorateAsClass (function () {
this.tuples = null;
Clazz_instantialize (this, arguments);
}, J.bspt, "Leaf", J.bspt.Element);
Clazz_makeConstructor (c$, 
function (bspt, leaf, countToKeep) {
this.bspt = bspt;
this.count = 0;
this.tuples =  new Array (2);
if (leaf == null) return;
for (var i = countToKeep; i < 2; ++i) {
this.tuples[this.count++] = leaf.tuples[i];
leaf.tuples[i] = null;
}
leaf.count = countToKeep;
}, "J.bspt.Bspt,J.bspt.Leaf,~N");
Clazz_defineMethod (c$, "sort", 
function (dim) {
for (var i = this.count; --i > 0; ) {
var champion = this.tuples[i];
var championValue = J.bspt.Node.getDimensionValue (champion, dim);
for (var j = i; --j >= 0; ) {
var challenger = this.tuples[j];
var challengerValue = J.bspt.Node.getDimensionValue (challenger, dim);
if (challengerValue > championValue) {
this.tuples[i] = challenger;
this.tuples[j] = champion;
champion = challenger;
championValue = challengerValue;
}}
}
}, "~N");
Clazz_overrideMethod (c$, "addTuple", 
function (level, tuple) {
if (this.count < 2) {
this.tuples[this.count++] = tuple;
return this;
}var node =  new J.bspt.Node (this.bspt, level, this);
return node.addTuple (level, tuple);
}, "~N,JU.P3");
Clazz_overrideMethod (c$, "dump", 
function (level, sb) {
for (var i = 0; i < this.count; ++i) {
var t = this.tuples[i];
for (var j = 0; j < level; ++j) sb.append (".");

sb.append (JU.Escape.eP (t)).append ("Leaf ").appendI (i).append (": ").append ((t).getInfo ());
}
}, "~N,JU.SB");
Clazz_overrideMethod (c$, "toString", 
function () {
return "leaf:" + this.count + "\n";
});
});
Clazz_declarePackage ("J.bspt");
Clazz_load (["J.bspt.Element"], "J.bspt.Node", ["java.lang.NullPointerException", "J.bspt.Leaf"], function () {
c$ = Clazz_decorateAsClass (function () {
this.dim = 0;
this.minLeft = 0;
this.maxLeft = 0;
this.eleLeft = null;
this.minRight = 0;
this.maxRight = 0;
this.eleRight = null;
Clazz_instantialize (this, arguments);
}, J.bspt, "Node", J.bspt.Element);
Clazz_makeConstructor (c$, 
function (bspt, level, leafLeft) {
this.bspt = bspt;
if (level == bspt.treeDepth) {
bspt.treeDepth = level + 1;
}if (leafLeft.count != 2) throw  new NullPointerException ();
this.dim = level % bspt.dimMax;
leafLeft.sort (this.dim);
var leafRight =  new J.bspt.Leaf (bspt, leafLeft, 1);
this.minLeft = J.bspt.Node.getDimensionValue (leafLeft.tuples[0], this.dim);
this.maxLeft = J.bspt.Node.getDimensionValue (leafLeft.tuples[leafLeft.count - 1], this.dim);
this.minRight = J.bspt.Node.getDimensionValue (leafRight.tuples[0], this.dim);
this.maxRight = J.bspt.Node.getDimensionValue (leafRight.tuples[leafRight.count - 1], this.dim);
this.eleLeft = leafLeft;
this.eleRight = leafRight;
this.count = 2;
}, "J.bspt.Bspt,~N,J.bspt.Leaf");
Clazz_defineMethod (c$, "addTuple", 
function (level, tuple) {
var dimValue = J.bspt.Node.getDimensionValue (tuple, this.dim);
++this.count;
var addLeft;
if (dimValue < this.maxLeft) {
addLeft = true;
} else if (dimValue > this.minRight) {
addLeft = false;
} else if (dimValue == this.maxLeft) {
if (dimValue == this.minRight) {
if (this.eleLeft.count < this.eleRight.count) addLeft = true;
 else addLeft = false;
} else {
addLeft = true;
}} else if (dimValue == this.minRight) {
addLeft = false;
} else {
if (this.eleLeft.count < this.eleRight.count) addLeft = true;
 else addLeft = false;
}if (addLeft) {
if (dimValue < this.minLeft) this.minLeft = dimValue;
 else if (dimValue > this.maxLeft) this.maxLeft = dimValue;
this.eleLeft = this.eleLeft.addTuple (level + 1, tuple);
} else {
if (dimValue < this.minRight) this.minRight = dimValue;
 else if (dimValue > this.maxRight) this.maxRight = dimValue;
this.eleRight = this.eleRight.addTuple (level + 1, tuple);
}return this;
}, "~N,JU.P3");
Clazz_defineMethod (c$, "dump", 
function (level, sb) {
sb.append ("\nnode LEFT" + level);
this.eleLeft.dump (level + 1, sb);
for (var i = 0; i < level; ++i) sb.append ("->");

sb.append (" RIGHT" + level);
this.eleRight.dump (level + 1, sb);
}, "~N,JU.SB");
Clazz_defineMethod (c$, "toString", 
function () {
return this.eleLeft.toString () + this.dim + ":" + "\n" + this.eleRight.toString ();
});
c$.getDimensionValue = Clazz_defineMethod (c$, "getDimensionValue", 
function (pt, dim) {
switch (dim) {
case 0:
return pt.x;
case 1:
return pt.y;
default:
return pt.z;
}
}, "JU.P3,~N");
});
Clazz_declarePackage ("J.c");
Clazz_load (["java.lang.Enum"], "J.c.CBK", ["JU.SB"], function () {
c$ = Clazz_declareType (J.c, "CBK", Enum);
c$.getCallback = Clazz_defineMethod (c$, "getCallback", 
function (name) {
name = name.toUpperCase ();
name = name.substring (0, Math.max (name.indexOf ("CALLBACK"), 0));
for (var item, $item = 0, $$item = J.c.CBK.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.name ().equalsIgnoreCase (name)) return item;

return null;
}, "~S");
c$.getNameList = Clazz_defineMethod (c$, "getNameList", 
function () {
if (J.c.CBK.nameList == null) {
var names =  new JU.SB ();
for (var item, $item = 0, $$item = J.c.CBK.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) names.append (item.name ().toLowerCase ()).append ("Callback;");

J.c.CBK.nameList = names.toString ();
}return J.c.CBK.nameList;
});
c$.nameList = null;
Clazz_defineEnumConstant (c$, "ANIMFRAME", 0, []);
Clazz_defineEnumConstant (c$, "APPLETREADY", 1, []);
Clazz_defineEnumConstant (c$, "ATOMMOVED", 2, []);
Clazz_defineEnumConstant (c$, "CLICK", 3, []);
Clazz_defineEnumConstant (c$, "DRAGDROP", 4, []);
Clazz_defineEnumConstant (c$, "ECHO", 5, []);
Clazz_defineEnumConstant (c$, "ERROR", 6, []);
Clazz_defineEnumConstant (c$, "EVAL", 7, []);
Clazz_defineEnumConstant (c$, "HOVER", 8, []);
Clazz_defineEnumConstant (c$, "LOADSTRUCT", 9, []);
Clazz_defineEnumConstant (c$, "MEASURE", 10, []);
Clazz_defineEnumConstant (c$, "MESSAGE", 11, []);
Clazz_defineEnumConstant (c$, "MINIMIZATION", 12, []);
Clazz_defineEnumConstant (c$, "PICK", 13, []);
Clazz_defineEnumConstant (c$, "RESIZE", 14, []);
Clazz_defineEnumConstant (c$, "SCRIPT", 15, []);
Clazz_defineEnumConstant (c$, "SYNC", 16, []);
Clazz_defineEnumConstant (c$, "STRUCTUREMODIFIED", 17, []);
});
Clazz_declarePackage ("J.c");
Clazz_load (["java.lang.Enum"], "J.c.FIL", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.code = 0;
Clazz_instantialize (this, arguments);
}, J.c, "FIL", Enum);
Clazz_defineMethod (c$, "getCode", 
function () {
return this.code;
});
Clazz_makeConstructor (c$, 
 function (code) {
this.code = code;
}, "~N");
Clazz_defineEnumConstant (c$, "DELETED", 0, [5]);
Clazz_defineEnumConstant (c$, "CREATED", 1, [3]);
Clazz_defineEnumConstant (c$, "CREATING_MODELSET", 2, [2]);
Clazz_defineEnumConstant (c$, "ZAPPED", 3, [0]);
Clazz_defineEnumConstant (c$, "NOT_LOADED", 4, [-1]);
});
Clazz_declarePackage ("J.c");
Clazz_load (["java.lang.Enum"], "J.c.PAL", ["java.lang.Byte"], function () {
c$ = Clazz_decorateAsClass (function () {
this.$$name = null;
this.id = 0;
Clazz_instantialize (this, arguments);
}, J.c, "PAL", Enum);
Clazz_makeConstructor (c$, 
 function (name, id) {
this.$$name = name;
this.id = id;
}, "~S,~N");
c$.pidOf = Clazz_defineMethod (c$, "pidOf", 
function (value) {
return (Clazz_instanceOf (value, J.c.PAL) ? (value).id : Clazz_instanceOf (value, Byte) ? (value).byteValue () : J.c.PAL.UNKNOWN.id);
}, "~O");
c$.isPaletteVariable = Clazz_defineMethod (c$, "isPaletteVariable", 
function (pid) {
return ((pid & 64) != 0);
}, "~N");
c$.getPalette = Clazz_defineMethod (c$, "getPalette", 
function (paletteName) {
if (paletteName.indexOf ('_') < 0) for (var item, $item = 0, $$item = J.c.PAL.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (paletteName.equalsIgnoreCase (item.$$name)) return item;

return (paletteName.indexOf ("property_") == 0 ? J.c.PAL.PROPERTY : J.c.PAL.UNKNOWN);
}, "~S");
c$.getPaletteID = Clazz_defineMethod (c$, "getPaletteID", 
function (paletteName) {
if (paletteName.indexOf ('_') < 0) for (var item, $item = 0, $$item = J.c.PAL.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (paletteName.equalsIgnoreCase (item.$$name)) return item.id;

return (paletteName.indexOf ("property_") == 0 ? J.c.PAL.PROPERTY.id : J.c.PAL.UNKNOWN.id);
}, "~S");
c$.getPaletteName = Clazz_defineMethod (c$, "getPaletteName", 
function (pid) {
for (var item, $item = 0, $$item = J.c.PAL.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.id == pid) return item.$$name;

return null;
}, "~N");
c$.PALETTE_VOLATILE = 0x40;
c$.PALETTE_NONE = 0;
c$.PALETTE_CPK = 1;
c$.PALETTE_PARTIAL_CHARGE = 2;
c$.PALETTE_FORMAL_CHARGE = 3;
c$.PALETTE_TEMP = 68;
c$.PALETTE_FIXEDTEMP = 5;
c$.PALETTE_SURFACE = 70;
c$.PALETTE_STRUCTURE = 7;
c$.PALETTE_AMINO = 8;
c$.PALETTE_SHAPELY = 9;
c$.PALETTE_CHAIN = 10;
c$.PALETTE_GROUP = 75;
c$.PALETTE_MONOMER = 76;
c$.PALETTE_MOLECULE = 77;
c$.PALETTE_ALTLOC = 14;
c$.PALETTE_INSERTION = 15;
c$.PALETTE_JMOL = 16;
c$.PALETTE_RASMOL = 17;
c$.PALETTE_TYPE = 18;
c$.PALETTE_ENERGY = 19;
c$.PALETTE_PROPERTY = 84;
c$.PALETTE_VARIABLE = 85;
c$.PALETTE_STRAIGHTNESS = 86;
c$.PALETTE_POLYMER = 87;
c$.argbsCpkRasmol = [16716947, 33554431, 50315467, 62005794, 83951360, 113821896, 126849023, 149946368, 165324064, 184549631, 203590434, 226525328, 249210144, 268412160, 285198386, 285277952, 343965840, 377520272, 411074704, 427851920, 452961536, 480586282, 497363498, 514140714, 598026794, 796950672, 899686640, 956278016, 1339729184];
c$.argbsCpk = [0xFFFF1493, 0xFFFFFFFF, 0xFFD9FFFF, 0xFFCC80FF, 0xFFC2FF00, 0xFFFFB5B5, 0xFF909090, 0xFF3050F8, 0xFFFF0D0D, 0xFF90E050, 0xFFB3E3F5, 0xFFAB5CF2, 0xFF8AFF00, 0xFFBFA6A6, 0xFFF0C8A0, 0xFFFF8000, 0xFFFFFF30, 0xFF1FF01F, 0xFF80D1E3, 0xFF8F40D4, 0xFF3DFF00, 0xFFE6E6E6, 0xFFBFC2C7, 0xFFA6A6AB, 0xFF8A99C7, 0xFF9C7AC7, 0xFFE06633, 0xFFF090A0, 0xFF50D050, 0xFFC88033, 0xFF7D80B0, 0xFFC28F8F, 0xFF668F8F, 0xFFBD80E3, 0xFFFFA100, 0xFFA62929, 0xFF5CB8D1, 0xFF702EB0, 0xFF00FF00, 0xFF94FFFF, 0xFF94E0E0, 0xFF73C2C9, 0xFF54B5B5, 0xFF3B9E9E, 0xFF248F8F, 0xFF0A7D8C, 0xFF006985, 0xFFC0C0C0, 0xFFFFD98F, 0xFFA67573, 0xFF668080, 0xFF9E63B5, 0xFFD47A00, 0xFF940094, 0xFF429EB0, 0xFF57178F, 0xFF00C900, 0xFF70D4FF, 0xFFFFFFC7, 0xFFD9FFC7, 0xFFC7FFC7, 0xFFA3FFC7, 0xFF8FFFC7, 0xFF61FFC7, 0xFF45FFC7, 0xFF30FFC7, 0xFF1FFFC7, 0xFF00FF9C, 0xFF00E675, 0xFF00D452, 0xFF00BF38, 0xFF00AB24, 0xFF4DC2FF, 0xFF4DA6FF, 0xFF2194D6, 0xFF267DAB, 0xFF266696, 0xFF175487, 0xFFD0D0E0, 0xFFFFD123, 0xFFB8B8D0, 0xFFA6544D, 0xFF575961, 0xFF9E4FB5, 0xFFAB5C00, 0xFF754F45, 0xFF428296, 0xFF420066, 0xFF007D00, 0xFF70ABFA, 0xFF00BAFF, 0xFF00A1FF, 0xFF008FFF, 0xFF0080FF, 0xFF006BFF, 0xFF545CF2, 0xFF785CE3, 0xFF8A4FE3, 0xFFA136D4, 0xFFB31FD4, 0xFFB31FBA, 0xFFB30DA6, 0xFFBD0D87, 0xFFC70066, 0xFFCC0059, 0xFFD1004F, 0xFFD90045, 0xFFE00038, 0xFFE6002E, 0xFFEB0026];
Clazz_defineEnumConstant (c$, "UNKNOWN", 0, [null, 0xFF]);
Clazz_defineEnumConstant (c$, "NONE", 1, ["none", 0]);
Clazz_defineEnumConstant (c$, "CPK", 2, ["cpk", 1]);
Clazz_defineEnumConstant (c$, "PARTIAL_CHARGE", 3, ["partialcharge", 2]);
Clazz_defineEnumConstant (c$, "FORMAL_CHARGE", 4, ["formalcharge", 3]);
Clazz_defineEnumConstant (c$, "TEMP", 5, ["temperature", 68]);
Clazz_defineEnumConstant (c$, "FIXEDTEMP", 6, ["fixedtemperature", 5]);
Clazz_defineEnumConstant (c$, "SURFACE", 7, ["surfacedistance", 70]);
Clazz_defineEnumConstant (c$, "STRUCTURE", 8, ["structure", 7]);
Clazz_defineEnumConstant (c$, "AMINO", 9, ["amino", 8]);
Clazz_defineEnumConstant (c$, "SHAPELY", 10, ["shapely", 9]);
Clazz_defineEnumConstant (c$, "CHAIN", 11, ["chain", 10]);
Clazz_defineEnumConstant (c$, "GROUP", 12, ["group", 75]);
Clazz_defineEnumConstant (c$, "MONOMER", 13, ["monomer", 76]);
Clazz_defineEnumConstant (c$, "MOLECULE", 14, ["molecule", 77]);
Clazz_defineEnumConstant (c$, "ALTLOC", 15, ["altloc", 14]);
Clazz_defineEnumConstant (c$, "INSERTION", 16, ["insertion", 15]);
Clazz_defineEnumConstant (c$, "JMOL", 17, ["jmol", 16]);
Clazz_defineEnumConstant (c$, "RASMOL", 18, ["rasmol", 17]);
Clazz_defineEnumConstant (c$, "TYPE", 19, ["type", 18]);
Clazz_defineEnumConstant (c$, "ENERGY", 20, ["energy", 19]);
Clazz_defineEnumConstant (c$, "PROPERTY", 21, ["property", 84]);
Clazz_defineEnumConstant (c$, "VARIABLE", 22, ["variable", 85]);
Clazz_defineEnumConstant (c$, "STRAIGHTNESS", 23, ["straightness", 86]);
Clazz_defineEnumConstant (c$, "POLYMER", 24, ["polymer", 87]);
});
Clazz_declarePackage ("J.c");
Clazz_load (["java.lang.Enum"], "J.c.STER", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.$$name = null;
this.$isBiColor = false;
Clazz_instantialize (this, arguments);
}, J.c, "STER", Enum);
Clazz_makeConstructor (c$, 
 function (name, isBiColor) {
this.$$name = name;
this.$isBiColor = isBiColor;
}, "~S,~B");
Clazz_defineMethod (c$, "getName", 
function () {
return this.$$name;
});
Clazz_defineMethod (c$, "isBiColor", 
function () {
return this.$isBiColor;
});
c$.getStereoMode = Clazz_defineMethod (c$, "getStereoMode", 
function (id) {
for (var item, $item = 0, $$item = J.c.STER.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.$$name.equalsIgnoreCase (id)) return item;

return null;
}, "~S");
Clazz_defineEnumConstant (c$, "NONE", 0, ["OFF", false]);
Clazz_defineEnumConstant (c$, "DOUBLE", 1, ["", false]);
Clazz_defineEnumConstant (c$, "REDCYAN", 2, ["REDCYAN", true]);
Clazz_defineEnumConstant (c$, "REDBLUE", 3, ["REDBLUE", true]);
Clazz_defineEnumConstant (c$, "REDGREEN", 4, ["REDGREEN", true]);
Clazz_defineEnumConstant (c$, "CUSTOM", 5, ["", true]);
});
Clazz_declarePackage ("J.c");
Clazz_load (["java.lang.Enum"], "J.c.STR", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.id = 0;
this.color = 0;
Clazz_instantialize (this, arguments);
}, J.c, "STR", Enum);
Clazz_makeConstructor (c$, 
 function (id, color) {
this.id = id;
this.color = color;
}, "~N,~N");
Clazz_defineMethod (c$, "getId", 
function () {
return this.id;
});
Clazz_defineMethod (c$, "getColor", 
function () {
return this.color;
});
c$.getProteinStructureType = Clazz_defineMethod (c$, "getProteinStructureType", 
function (name) {
for (var item, $item = 0, $$item = J.c.STR.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (name.equalsIgnoreCase (item.name ())) return (item.isProtein () ? item : J.c.STR.NOT);

return J.c.STR.NOT;
}, "~S");
Clazz_defineMethod (c$, "getBioStructureTypeName", 
function (isGeneric) {
return (this.id < 0 ? "" : isGeneric && this.isProtein () ? "protein" : this.name ());
}, "~B");
Clazz_defineMethod (c$, "isProtein", 
 function () {
return this.id >= 0 && this.id <= 3 || this.id >= 7;
});
Clazz_defineEnumConstant (c$, "NOT", 0, [-1, 0xFF808080]);
Clazz_defineEnumConstant (c$, "NONE", 1, [0, 0xFFFFFFFF]);
Clazz_defineEnumConstant (c$, "TURN", 2, [1, 0xFF6080FF]);
Clazz_defineEnumConstant (c$, "SHEET", 3, [2, 0xFFFFC800]);
Clazz_defineEnumConstant (c$, "HELIX", 4, [3, 0xFFFF0080]);
Clazz_defineEnumConstant (c$, "DNA", 5, [4, 0xFFAE00FE]);
Clazz_defineEnumConstant (c$, "RNA", 6, [5, 0xFFFD0162]);
Clazz_defineEnumConstant (c$, "CARBOHYDRATE", 7, [6, 0xFFA6A6FA]);
Clazz_defineEnumConstant (c$, "HELIX310", 8, [7, 0xFFA00080]);
Clazz_defineEnumConstant (c$, "HELIXALPHA", 9, [8, 0xFFFF0080]);
Clazz_defineEnumConstant (c$, "HELIXPI", 10, [9, 0xFF600080]);
Clazz_defineEnumConstant (c$, "ANNOTATION", 11, [-2, 0]);
});
Clazz_declarePackage ("J.c");
Clazz_load (["java.lang.Enum"], "J.c.VDW", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.pt = 0;
this.type = null;
this.type2 = null;
Clazz_instantialize (this, arguments);
}, J.c, "VDW", Enum);
Clazz_makeConstructor (c$, 
 function (pt, type, type2) {
this.pt = pt;
this.type = type;
this.type2 = type2;
}, "~N,~S,~S");
Clazz_defineMethod (c$, "getVdwLabel", 
function () {
return (this.type == null ? this.type2 : this.type);
});
c$.getVdwType = Clazz_defineMethod (c$, "getVdwType", 
function (label) {
if (label != null) for (var item, $item = 0, $$item = J.c.VDW.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (label.equalsIgnoreCase (item.type)) return item;

return null;
}, "~S");
c$.getVdwType2 = Clazz_defineMethod (c$, "getVdwType2", 
function (label) {
if (label != null) for (var item, $item = 0, $$item = J.c.VDW.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (label.equalsIgnoreCase (item.type2)) return item;

return null;
}, "~S");
Clazz_defineEnumConstant (c$, "JMOL", 0, [0, "Jmol", null]);
Clazz_defineEnumConstant (c$, "BABEL", 1, [1, "Babel", null]);
Clazz_defineEnumConstant (c$, "RASMOL", 2, [2, "RasMol", null]);
Clazz_defineEnumConstant (c$, "BABEL21", 3, [3, "Babel21", null]);
Clazz_defineEnumConstant (c$, "AUTO_JMOL", 4, [0, null, "Jmol"]);
Clazz_defineEnumConstant (c$, "AUTO_BABEL", 5, [1, null, "Babel"]);
Clazz_defineEnumConstant (c$, "AUTO_RASMOL", 6, [2, null, "RasMol"]);
Clazz_defineEnumConstant (c$, "AUTO", 7, [0, "Auto", null]);
Clazz_defineEnumConstant (c$, "USER", 8, [-1, "User", null]);
Clazz_defineEnumConstant (c$, "ADPMAX", 9, [-1, null, "adpmax"]);
Clazz_defineEnumConstant (c$, "ADPMIN", 10, [-1, null, "adpmin"]);
Clazz_defineEnumConstant (c$, "HYDRO", 11, [-1, null, "hydrophobic"]);
Clazz_defineEnumConstant (c$, "BONDING", 12, [-1, null, "bondingradius"]);
Clazz_defineEnumConstant (c$, "TEMP", 13, [-1, null, "temperature"]);
Clazz_defineEnumConstant (c$, "NOJMOL", 14, [-1, null, null]);
Clazz_defineEnumConstant (c$, "NADA", 15, [-1, null, null]);
});
Clazz_declarePackage ("J.g3d");
Clazz_load (null, "J.g3d.CylinderRenderer", ["JU.AU"], function () {
c$ = Clazz_decorateAsClass (function () {
this.g3d = null;
this.line3d = null;
this.shader = null;
this.colixA = 0;
this.colixB = 0;
this.shadesA = null;
this.shadesB = null;
this.xA = 0;
this.yA = 0;
this.zA = 0;
this.dxB = 0;
this.dyB = 0;
this.dzB = 0;
this.xAf = 0;
this.yAf = 0;
this.zAf = 0;
this.dxBf = 0;
this.dyBf = 0;
this.dzBf = 0;
this.tEvenDiameter = false;
this.diameter = 0;
this.endcaps = 0;
this.tEndcapOpen = false;
this.xEndcap = 0;
this.yEndcap = 0;
this.zEndcap = 0;
this.argbEndcap = 0;
this.colixEndcap = 0;
this.endcapShadeIndex = 0;
this.radius = 0;
this.radius2 = 0;
this.cosTheta = 0;
this.cosPhi = 0;
this.sinPhi = 0;
this.clipped = false;
this.drawBackside = false;
this.rasterCount = 0;
this.xyztRaster = null;
this.xyzfRaster = null;
this.xTip = 0;
this.yTip = 0;
this.zTip = 0;
Clazz_instantialize (this, arguments);
}, J.g3d, "CylinderRenderer");
Clazz_prepareFields (c$, function () {
this.xyztRaster = [ Clazz_newFloatArray (32, 0),  Clazz_newFloatArray (32, 0),  Clazz_newFloatArray (32, 0),  Clazz_newFloatArray (32, 0)];
this.xyzfRaster = [ Clazz_newIntArray (32, 0),  Clazz_newIntArray (32, 0),  Clazz_newIntArray (32, 0),  Clazz_newIntArray (32, 0)];
});
Clazz_makeConstructor (c$, 
function (g3d) {
this.g3d = g3d;
this.line3d = g3d.line3d;
this.shader = g3d.shader;
}, "J.g3d.Graphics3D");
Clazz_defineMethod (c$, "render", 
function (colixA, colixB, endcaps, diameter, xa, ya, za, xb, yb, zb) {
var r = Clazz_doubleToInt (diameter / 2) + 1;
var g = this.g3d;
var codeMinA = g.clipCode3 (xa - r, ya - r, za - r);
var codeMaxA = g.clipCode3 (xa + r, ya + r, za + r);
var codeMinB = g.clipCode3 (xb - r, yb - r, zb - r);
var codeMaxB = g.clipCode3 (xb + r, yb + r, zb + r);
this.clipped = ((codeMinA | codeMaxA | codeMinB | codeMaxB) != 0);
if ((codeMinA & codeMaxB & codeMaxA & codeMinB) != 0) return;
this.dxB = xb - xa;
this.dyB = yb - ya;
this.dzB = zb - za;
if (diameter <= 1) {
this.line3d.plotLineDelta (g.getColorArgbOrGray (colixA), g.getColorArgbOrGray (colixB), xa, ya, za, this.dxB, this.dyB, this.dzB, this.clipped);
return;
}this.drawBackside = (this.clipped || endcaps == 2 || endcaps == 0);
this.diameter = diameter;
this.xA = xa;
this.yA = ya;
this.zA = za;
this.endcaps = endcaps;
this.shadesA = g.getShades (this.colixA = colixA);
this.shadesB = g.getShades (this.colixB = colixB);
this.calcArgbEndcap (true, false);
this.calcCosSin (this.dxB, this.dyB, this.dzB);
this.calcPoints (3, false);
this.interpolate (0, 1, this.xyzfRaster, this.xyztRaster);
this.interpolate (1, 2, this.xyzfRaster, this.xyztRaster);
var xyzf = this.xyzfRaster;
if (endcaps == 2 || endcaps == 4) this.renderFlatEndcap (true, false, xyzf);
g.setZMargin (5);
var width = g.width;
var zbuf = g.zbuf;
var xr = xyzf[0];
var yr = xyzf[1];
var zr = xyzf[2];
var fr = xyzf[3];
var p = g.pixel;
for (var i = this.rasterCount; --i >= 0; ) {
var fpz = fr[i] >> (8);
var fpzBack = fpz >> 1;
var x = xr[i];
var y = yr[i];
var z = zr[i];
if (this.tEndcapOpen && this.argbEndcap != 0) {
if (this.clipped) {
g.plotPixelClippedArgb (this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelClippedArgb (this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
} else {
g.plotPixelUnclipped (this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelUnclipped (this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
}}this.line3d.plotLineDeltaA (this.shadesA, this.shadesB, fpz, this.xA + x, this.yA + y, this.zA - z, this.dxB, this.dyB, this.dzB, this.clipped);
if (this.drawBackside) {
this.line3d.plotLineDelta (this.shadesA[fpzBack], this.shadesB[fpzBack], this.xA - x, this.yA - y, this.zA + z, this.dxB, this.dyB, this.dzB, this.clipped);
}}
g.setZMargin (0);
if (endcaps == 3) this.renderSphericalEndcaps ();
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "renderBits", 
function (colixA, colixB, endcaps, diameter, xa, ya, za, xb, yb, zb) {
var r = Clazz_doubleToInt (diameter / 2) + 1;
var ixA = Math.round (xa);
var iyA = Math.round (ya);
var izA = Math.round (za);
var ixB = Math.round (xb);
var iyB = Math.round (yb);
var izB = Math.round (zb);
var g = this.g3d;
var codeMinA = g.clipCode3 (ixA - r, iyA - r, izA - r);
var codeMaxA = g.clipCode3 (ixA + r, iyA + r, izA + r);
var codeMinB = g.clipCode3 (ixB - r, iyB - r, izB - r);
var codeMaxB = g.clipCode3 (ixB + r, iyB + r, izB + r);
this.clipped = ((codeMinA | codeMaxA | codeMinB | codeMaxB) != 0);
if ((codeMinA & codeMaxB & codeMaxA & codeMinB) != 0) return;
this.dxBf = xb - xa;
this.dyBf = yb - ya;
this.dzBf = zb - za;
if (diameter == 0 || diameter == 1) {
this.line3d.plotLineDelta (g.getColorArgbOrGray (colixA), g.getColorArgbOrGray (colixB), Clazz_floatToInt (xa), Clazz_floatToInt (ya), Clazz_floatToInt (za), Clazz_floatToInt (this.dxBf), Clazz_floatToInt (this.dyBf), Clazz_floatToInt (this.dzBf), this.clipped);
return;
}if (diameter > 0) {
this.diameter = diameter;
this.xAf = xa;
this.yAf = ya;
this.zAf = za;
}this.drawBackside = (this.clipped || endcaps == 2 || endcaps == 0);
this.xA = Clazz_floatToInt (this.xAf);
this.yA = Clazz_floatToInt (this.yAf);
this.zA = Clazz_floatToInt (this.zAf);
this.dxB = Clazz_floatToInt (this.dxBf);
this.dyB = Clazz_floatToInt (this.dyBf);
this.dzB = Clazz_floatToInt (this.dzBf);
this.shadesA = g.getShades (this.colixA = colixA);
this.shadesB = g.getShades (this.colixB = colixB);
this.endcaps = endcaps;
this.calcArgbEndcap (true, true);
var xyzf = this.xyzfRaster;
if (diameter > 0) this.generateBaseEllipsePrecisely (false);
if (endcaps == 2) this.renderFlatEndcap (true, true, xyzf);
this.line3d.setLineBits (this.dxBf, this.dyBf);
g.setZMargin (5);
var p = g.pixel;
var width = g.width;
var zbuf = g.zbuf;
var xr = xyzf[0];
var yr = xyzf[1];
var zr = xyzf[2];
var fr = xyzf[3];
for (var i = this.rasterCount; --i >= 0; ) {
var fpz = fr[i] >> (8);
var fpzBack = fpz >> 1;
var x = xr[i];
var y = yr[i];
var z = zr[i];
if (this.tEndcapOpen && this.argbEndcap != 0) {
if (this.clipped) {
g.plotPixelClippedArgb (this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelClippedArgb (this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
} else {
g.plotPixelUnclipped (this.argbEndcap, this.xEndcap + x, this.yEndcap + y, this.zEndcap - z - 1, width, zbuf, p);
g.plotPixelUnclipped (this.argbEndcap, this.xEndcap - x, this.yEndcap - y, this.zEndcap + z - 1, width, zbuf, p);
}}this.line3d.plotLineDeltaBits (this.shadesA, this.shadesB, fpz, this.xA + x, this.yA + y, this.zA - z, this.dxB, this.dyB, this.dzB, this.clipped);
if (this.drawBackside) {
this.line3d.plotLineDelta (this.shadesA[fpzBack], this.shadesB[fpzBack], this.xA - x, this.yA - y, this.zA + z, this.dxB, this.dyB, this.dzB, this.clipped);
}}
g.setZMargin (0);
if (endcaps == 3) this.renderSphericalEndcaps ();
this.xAf += this.dxBf;
this.yAf += this.dyBf;
this.zAf += this.dzBf;
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "renderCone", 
function (colix, endcap, diameter, xa, ya, za, xtip, ytip, ztip, doFill, isBarb) {
this.dxBf = (xtip) - (this.xAf = xa);
this.dyBf = (ytip) - (this.yAf = ya);
this.dzBf = (ztip) - (this.zAf = za);
this.xA = Clazz_doubleToInt (Math.floor (this.xAf));
this.yA = Clazz_doubleToInt (Math.floor (this.yAf));
this.zA = Clazz_doubleToInt (Math.floor (this.zAf));
this.dxB = Clazz_doubleToInt (Math.floor (this.dxBf));
this.dyB = Clazz_doubleToInt (Math.floor (this.dyBf));
this.dzB = Clazz_doubleToInt (Math.floor (this.dzBf));
this.xTip = xtip;
this.yTip = ytip;
this.zTip = ztip;
this.colixA = colix;
this.shadesA = this.g3d.getShades (colix);
var shadeIndexTip = this.shader.getShadeIndex (this.dxB, this.dyB, -this.dzB);
var g3d = this.g3d;
var p = g3d.pixel;
var width = g3d.width;
var zbuf = g3d.zbuf;
g3d.plotPixelClippedArgb (this.shadesA[shadeIndexTip], Clazz_floatToInt (xtip), Clazz_floatToInt (ytip), Clazz_floatToInt (ztip), width, zbuf, p);
this.diameter = diameter;
if (diameter <= 1) {
if (diameter == 1) this.line3d.plotLineDelta (this.colixA, this.colixA, this.xA, this.yA, this.zA, this.dxB, this.dyB, this.dzB, this.clipped);
return;
}this.endcaps = endcap;
this.calcArgbEndcap (false, true);
this.generateBaseEllipsePrecisely (isBarb);
if (!isBarb && this.endcaps == 2) this.renderFlatEndcap (false, true, this.xyzfRaster);
g3d.setZMargin (5);
var xr = this.xyztRaster[0];
var yr = this.xyztRaster[1];
var zr = this.xyztRaster[2];
var fr = this.xyzfRaster[3];
var sA = this.shadesA;
var doOpen = (this.tEndcapOpen && this.argbEndcap != 0);
for (var i = this.rasterCount; --i >= 0; ) {
var x = xr[i];
var y = yr[i];
var z = zr[i];
var fpz = fr[i] >> (8);
var xUp = this.xAf + x;
var yUp = this.yAf + y;
var zUp = this.zAf - z;
var xDn = this.xAf - x;
var yDn = this.yAf - y;
var zDn = this.zAf + z;
var argb = sA[0];
if (doOpen) {
g3d.plotPixelClippedArgb (this.argbEndcap, Clazz_floatToInt (xUp), Clazz_floatToInt (yUp), Clazz_floatToInt (zUp), width, zbuf, p);
g3d.plotPixelClippedArgb (this.argbEndcap, Clazz_floatToInt (xDn), Clazz_floatToInt (yDn), Clazz_floatToInt (zDn), width, zbuf, p);
}if (argb != 0) {
this.line3d.plotLineDeltaA (sA, sA, fpz, Clazz_floatToInt (xUp), Clazz_floatToInt (yUp), Clazz_floatToInt (zUp), Clazz_doubleToInt (Math.ceil (this.xTip - xUp)), Clazz_doubleToInt (Math.ceil (this.yTip - yUp)), Clazz_doubleToInt (Math.ceil (this.zTip - zUp)), true);
if (doFill) {
this.line3d.plotLineDeltaA (sA, sA, fpz, Clazz_floatToInt (xUp), Clazz_floatToInt (yUp) + 1, Clazz_floatToInt (zUp), Clazz_doubleToInt (Math.ceil (this.xTip - xUp)), Clazz_doubleToInt (Math.ceil (this.yTip - yUp)) + 1, Clazz_doubleToInt (Math.ceil (this.zTip - zUp)), true);
this.line3d.plotLineDeltaA (sA, sA, fpz, Clazz_floatToInt (xUp) + 1, Clazz_floatToInt (yUp), Clazz_floatToInt (zUp), Clazz_doubleToInt (Math.ceil (this.xTip - xUp)) + 1, Clazz_doubleToInt (Math.ceil (this.yTip - yUp)), Clazz_doubleToInt (Math.ceil (this.zTip - zUp)), true);
}if (!isBarb && !(this.endcaps != 2 && this.dzB > 0)) {
this.line3d.plotLineDelta (argb, argb, Clazz_floatToInt (xDn), Clazz_floatToInt (yDn), Clazz_floatToInt (zDn), Clazz_doubleToInt (Math.ceil (this.xTip - xDn)), Clazz_doubleToInt (Math.ceil (this.yTip - yDn)), Clazz_doubleToInt (Math.ceil (this.zTip - zDn)), true);
}}}
g3d.setZMargin (0);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~B,~B");
Clazz_defineMethod (c$, "generateBaseEllipsePrecisely", 
 function (isBarb) {
this.calcCosSin (this.dxBf, this.dyBf, this.dzBf);
this.calcPoints (isBarb ? 2 : 3, true);
this.interpolatePrecisely (0, 1, this.xyzfRaster, this.xyztRaster);
if (!isBarb) this.interpolatePrecisely (1, 2, this.xyzfRaster, this.xyztRaster);
for (var i = 3; --i >= 0; ) for (var j = this.rasterCount; --j >= 0; ) this.xyzfRaster[i][j] = Clazz_doubleToInt (Math.floor (this.xyztRaster[i][j]));


}, "~B");
Clazz_defineMethod (c$, "calcPoints", 
 function (count, isPrecise) {
this.calcRotatedPoint (0, 0, isPrecise, this.xyzfRaster, this.xyztRaster);
this.calcRotatedPoint (0.5, 1, isPrecise, this.xyzfRaster, this.xyztRaster);
if ((this.rasterCount = count) == 3) this.calcRotatedPoint (1, 2, isPrecise, this.xyzfRaster, this.xyztRaster);
}, "~N,~B");
Clazz_defineMethod (c$, "calcCosSin", 
 function (dx, dy, dz) {
var mag2d2 = dx * dx + dy * dy;
if (mag2d2 == 0) {
this.cosTheta = 1;
this.cosPhi = 1;
this.sinPhi = 0;
} else {
var mag2d = Math.sqrt (mag2d2);
var mag3d = Math.sqrt (mag2d2 + dz * dz);
this.cosTheta = dz / mag3d;
this.cosPhi = dx / mag2d;
this.sinPhi = dy / mag2d;
}}, "~N,~N,~N");
Clazz_defineMethod (c$, "calcRotatedPoint", 
 function (t, i, isPrecision, xyzf, xyzt) {
xyzt[3][i] = t;
var tPI = t * 3.141592653589793;
var xT = Math.sin (tPI) * this.cosTheta;
var yT = Math.cos (tPI);
var xR = this.radius * (xT * this.cosPhi - yT * this.sinPhi);
var yR = this.radius * (xT * this.sinPhi + yT * this.cosPhi);
var z2 = this.radius2 - (xR * xR + yR * yR);
var zR = (z2 > 0 ? Math.sqrt (z2) : 0);
if (isPrecision) {
xyzt[0][i] = xR;
xyzt[1][i] = yR;
xyzt[2][i] = zR;
} else if (this.tEvenDiameter) {
xyzf[0][i] = Clazz_doubleToInt (xR - 0.5);
xyzf[1][i] = Clazz_doubleToInt (yR - 0.5);
xyzf[2][i] = Clazz_doubleToInt (zR + 0.5);
} else {
xyzf[0][i] = Clazz_doubleToInt (xR);
xyzf[1][i] = Clazz_doubleToInt (yR);
xyzf[2][i] = Clazz_doubleToInt (zR + 0.5);
}xyzf[3][i] = this.shader.getShadeFp8 (xR, yR, zR);
}, "~N,~N,~B,~A,~A");
Clazz_defineMethod (c$, "allocRaster", 
 function (isPrecision, xyzf, xyzt) {
if (this.rasterCount >= xyzf[0].length) while (this.rasterCount >= xyzf[0].length) {
for (var i = 4; --i >= 0; ) xyzf[i] = JU.AU.doubleLengthI (xyzf[i]);

xyzt[3] = JU.AU.doubleLengthF (xyzt[3]);
}
if (isPrecision) while (this.rasterCount >= xyzt[0].length) {
for (var i = 3; --i >= 0; ) xyzt[i] = JU.AU.doubleLengthF (xyzt[i]);

}
return this.rasterCount++;
}, "~B,~A,~A");
Clazz_defineMethod (c$, "interpolate", 
 function (iLower, iUpper, xyzf, xyzt) {
var x = xyzf[0];
var y = xyzf[1];
var dx = x[iUpper] - x[iLower];
if (dx < 0) dx = -dx;
var dy = y[iUpper] - y[iLower];
if (dy < 0) dy = -dy;
if ((dx + dy) <= 1) return;
var iMid = this.allocRaster (false, xyzf, xyzt);
x = xyzf[0];
y = xyzf[1];
var f = xyzf[3];
var tLower = xyzt[3][iLower];
var tUpper = xyzt[3][iUpper];
for (var j = 4; --j >= 0; ) {
var tMid = (tLower + tUpper) / 2;
this.calcRotatedPoint (tMid, iMid, false, xyzf, xyzt);
if ((x[iMid] == x[iLower]) && (y[iMid] == y[iLower])) {
f[iLower] = (f[iLower] + f[iMid]) >>> 1;
tLower = tMid;
} else if ((x[iMid] == x[iUpper]) && (y[iMid] == y[iUpper])) {
f[iUpper] = (f[iUpper] + f[iMid]) >>> 1;
tUpper = tMid;
} else {
this.interpolate (iLower, iMid, xyzf, xyzt);
this.interpolate (iMid, iUpper, xyzf, xyzt);
return;
}}
x[iMid] = x[iLower];
y[iMid] = y[iUpper];
}, "~N,~N,~A,~A");
Clazz_defineMethod (c$, "interpolatePrecisely", 
 function (iLower, iUpper, xyzf, xyzt) {
var x = xyzt[0];
var y = xyzt[1];
var dx = Clazz_doubleToInt (Math.floor (x[iUpper])) - Clazz_doubleToInt (Math.floor (x[iLower]));
if (dx < 0) dx = -dx;
var dy = Clazz_doubleToInt (Math.floor (y[iUpper])) - Clazz_doubleToInt (Math.floor (y[iLower]));
if (dy < 0) dy = -dy;
if ((dx + dy) <= 1) return;
var t = xyzt[3];
var tLower = t[iLower];
var tUpper = t[iUpper];
var iMid = this.allocRaster (true, xyzf, xyzt);
x = xyzt[0];
y = xyzt[1];
t = xyzt[3];
var f = xyzf[3];
for (var j = 4; --j >= 0; ) {
var tMid = (tLower + tUpper) / 2;
this.calcRotatedPoint (tMid, iMid, true, xyzf, xyzt);
if ((Clazz_doubleToInt (Math.floor (x[iMid])) == Clazz_doubleToInt (Math.floor (x[iLower]))) && (Clazz_doubleToInt (Math.floor (y[iMid])) == Clazz_doubleToInt (Math.floor (y[iLower])))) {
f[iLower] = (f[iLower] + f[iMid]) >>> 1;
tLower = tMid;
} else if ((Clazz_doubleToInt (Math.floor (x[iMid])) == Clazz_doubleToInt (Math.floor (x[iUpper]))) && (Clazz_doubleToInt (Math.floor (y[iMid])) == Clazz_doubleToInt (Math.floor (y[iUpper])))) {
f[iUpper] = (f[iUpper] + f[iMid]) >>> 1;
tUpper = tMid;
} else {
this.interpolatePrecisely (iLower, iMid, xyzf, xyzt);
this.interpolatePrecisely (iMid, iUpper, xyzf, xyzt);
return;
}}
x[iMid] = x[iLower];
y[iMid] = y[iUpper];
}, "~N,~N,~A,~A");
Clazz_defineMethod (c$, "renderFlatEndcap", 
 function (tCylinder, isPrecise, xyzf) {
var xT;
var yT;
var zT;
if (isPrecise) {
if (this.dzBf == 0 || !this.g3d.setC (this.colixEndcap)) return;
var xTf = this.xAf;
var yTf = this.yAf;
var zTf = this.zAf;
if (tCylinder && this.dzBf < 0) {
xTf += this.dxBf;
yTf += this.dyBf;
zTf += this.dzBf;
}xT = Clazz_floatToInt (xTf);
yT = Clazz_floatToInt (yTf);
zT = Clazz_floatToInt (zTf);
} else {
if (this.dzB == 0 || !this.g3d.setC (this.colixEndcap)) return;
xT = this.xA;
yT = this.yA;
zT = this.zA;
if (tCylinder && this.dzB < 0) {
if (this.endcaps == 4) return;
xT += this.dxB;
yT += this.dyB;
zT += this.dzB;
}}var yMin = xyzf[1][0];
var yMax = xyzf[1][0];
var zXMin = 0;
var zXMax = 0;
var xr = xyzf[0];
var yr = xyzf[1];
var zr = xyzf[2];
for (var i = this.rasterCount; --i > 0; ) {
var y = yr[i];
if (y < yMin) yMin = y;
 else if (y > yMax) yMax = y;
 else {
y = -y;
if (y < yMin) yMin = y;
 else if (y > yMax) yMax = y;
}}
for (var y = yMin; y <= yMax; ++y) {
var xMin = 2147483647;
var xMax = -2147483648;
for (var i = this.rasterCount; --i >= 0; ) {
if (yr[i] == y) {
var x = xr[i];
if (x < xMin) {
xMin = x;
zXMin = zr[i];
}if (x > xMax) {
xMax = x;
zXMax = zr[i];
}}if (yr[i] == -y) {
var x = -xr[i];
if (x < xMin) {
xMin = x;
zXMin = -zr[i];
}if (x > xMax) {
xMax = x;
zXMax = -zr[i];
}}}
var count = xMax - xMin + 1;
this.g3d.setColorNoisy (this.endcapShadeIndex);
this.g3d.plotPixelsClippedRaster (count, xT + xMin, yT + y, zT - zXMin - 1, zT - zXMax - 1, null, null);
}
}, "~B,~B,~A");
Clazz_defineMethod (c$, "renderSphericalEndcaps", 
 function () {
if (this.colixA != 0 && this.g3d.setC (this.colixA)) this.g3d.fillSphereXYZ (this.diameter, this.xA, this.yA, this.zA + 1);
if (this.colixB != 0 && this.g3d.setC (this.colixB)) this.g3d.fillSphereXYZ (this.diameter, this.xA + this.dxB, this.yA + this.dyB, this.zA + this.dzB + 1);
});
Clazz_defineMethod (c$, "calcArgbEndcap", 
 function (tCylinder, isFloat) {
this.tEvenDiameter = ((this.diameter & 1) == 0);
this.radius = this.diameter / 2.0;
this.radius2 = this.radius * this.radius;
this.tEndcapOpen = false;
var dzf = (isFloat ? this.dzBf : this.dzB);
if (this.endcaps == 3 || dzf == 0) return;
this.xEndcap = this.xA;
this.yEndcap = this.yA;
this.zEndcap = this.zA;
var shadesEndcap;
var dxf = (isFloat ? this.dxBf : this.dxB);
var dyf = (isFloat ? this.dyBf : this.dyB);
if (dzf >= 0 || !tCylinder) {
this.endcapShadeIndex = this.shader.getShadeIndex (-dxf, -dyf, dzf);
this.colixEndcap = this.colixA;
shadesEndcap = this.shadesA;
} else {
this.endcapShadeIndex = this.shader.getShadeIndex (dxf, dyf, -dzf);
this.colixEndcap = this.colixB;
shadesEndcap = this.shadesB;
this.xEndcap += this.dxB;
this.yEndcap += this.dyB;
this.zEndcap += this.dzB;
}if (this.endcapShadeIndex > 56) this.endcapShadeIndex = 56;
this.argbEndcap = shadesEndcap[this.endcapShadeIndex];
this.tEndcapOpen = (this.endcaps == 1);
}, "~B,~B");
});
Clazz_declarePackage ("J.g3d");
Clazz_declareInterface (J.g3d, "G3DRenderer");
Clazz_declarePackage ("J.g3d");
Clazz_load (["J.api.JmolRendererInterface", "JU.GData", "JU.V3"], "J.g3d.Graphics3D", ["java.lang.NullPointerException", "java.util.Arrays", "javajs.awt.Font", "JU.AU", "J.api.Interface", "J.c.STER", "J.g3d.CylinderRenderer", "$.ImageRenderer", "$.LineRenderer", "$.Pixelator", "$.PixelatorShaded", "$.Platform3D", "$.SphereRenderer", "$.TextRenderer", "$.TextSorter", "$.TextString", "JU.C", "$.Normix"], function () {
c$ = Clazz_decorateAsClass (function () {
this.platform = null;
this.line3d = null;
this.sphere3d = null;
this.cylinder3d = null;
this.triangle3d = null;
this.circle3d = null;
this.hermite3d = null;
this.isFullSceneAntialiasingEnabled = false;
this.antialias2 = false;
this.strings = null;
this.stringCount = 0;
this.anaglyphChannelBytes = null;
this.twoPass = false;
this.$haveTranslucentObjects = false;
this.pbuf = null;
this.pbufT = null;
this.zbuf = null;
this.zbufT = null;
this.translucencyMask = 0;
this.renderLow = false;
this.shadesCurrent = null;
this.anaglyphLength = 0;
this.pixel = null;
this.zMargin = 0;
this.aobuf = null;
this.currentShadeIndex = 0;
this.lastRawColor = 0;
this.translucencyLog = 0;
this.saveAmbient = 0;
this.saveDiffuse = 0;
this.vectorAB = null;
this.vectorAC = null;
this.vectorNormal = null;
this.shadeIndexes = null;
this.shadeIndexes2Sided = null;
this.pass2Flag01 = 0;
Clazz_instantialize (this, arguments);
}, J.g3d, "Graphics3D", JU.GData, J.api.JmolRendererInterface);
Clazz_prepareFields (c$, function () {
this.vectorAB =  new JU.V3 ();
this.vectorAC =  new JU.V3 ();
this.vectorNormal =  new JU.V3 ();
this.shadeIndexes =  Clazz_newByteArray (JU.GData.normixCount, 0);
this.shadeIndexes2Sided =  Clazz_newByteArray (JU.GData.normixCount, 0);
});
Clazz_overrideMethod (c$, "clear", 
function () {
this.stringCount = 0;
this.strings = null;
J.g3d.TextRenderer.clearFontCache ();
});
Clazz_overrideMethod (c$, "destroy", 
function () {
this.releaseBuffers ();
this.platform = null;
this.graphicsForMetrics = null;
});
Clazz_defineMethod (c$, "setZMargin", 
function (dz) {
this.zMargin = dz;
}, "~N");
Clazz_makeConstructor (c$, 
function () {
Clazz_superConstructor (this, J.g3d.Graphics3D, []);
for (var i = JU.GData.normixCount; --i >= 0; ) this.transformedVectors[i] =  new JU.V3 ();

});
Clazz_overrideMethod (c$, "initialize", 
function (vwr, apiPlatform) {
this.vwr = vwr;
this.apiPlatform = apiPlatform;
this.platform =  new J.g3d.Platform3D (apiPlatform);
this.graphicsForMetrics = this.platform.getGraphicsForMetrics ();
this.line3d =  new J.g3d.LineRenderer (this);
this.sphere3d =  new J.g3d.SphereRenderer (this);
this.cylinder3d =  new J.g3d.CylinderRenderer (this);
}, "JV.Viewer,javajs.api.GenericPlatform");
Clazz_overrideMethod (c$, "addRenderer", 
function (tok) {
switch (tok) {
case 1073741880:
if (this.circle3d == null) this.circle3d = this.getRenderer ("Circle");
break;
case 553648147:
if (this.hermite3d == null) this.hermite3d = this.getRenderer ("Hermite");
case 1073742182:
if (this.triangle3d == null) this.triangle3d = this.getRenderer ("Triangle");
break;
}
}, "~N");
Clazz_defineMethod (c$, "getRenderer", 
 function (type) {
var r = (J.api.Interface.getOption ("g3d." + type + "Renderer", this.vwr, "render"));
if (r == null) throw  new NullPointerException ("Interface");
r.set (this, this);
return r;
}, "~S");
Clazz_overrideMethod (c$, "setWindowParameters", 
function (width, height, antialias) {
this.setWinParams (width, height, antialias);
if (this.currentlyRendering) this.endRendering ();
}, "~N,~N,~B");
Clazz_overrideMethod (c$, "checkTranslucent", 
function (isAlphaTranslucent) {
if (isAlphaTranslucent) this.$haveTranslucentObjects = true;
return (!this.twoPass || this.twoPass && (this.isPass2 == isAlphaTranslucent));
}, "~B");
Clazz_overrideMethod (c$, "beginRendering", 
function (rotationMatrix, translucentMode, isImageWrite, renderLow) {
if (this.currentlyRendering) this.endRendering ();
this.renderLow = renderLow;
if (this.windowWidth != this.newWindowWidth || this.windowHeight != this.newWindowHeight || this.newAntialiasing != this.isFullSceneAntialiasingEnabled) {
this.windowWidth = this.newWindowWidth;
this.windowHeight = this.newWindowHeight;
this.isFullSceneAntialiasingEnabled = this.newAntialiasing;
this.releaseBuffers ();
}this.setRotationMatrix (rotationMatrix);
this.antialiasEnabled = this.antialiasThisFrame = this.newAntialiasing;
this.currentlyRendering = true;
if (this.strings != null) for (var i = Math.min (this.strings.length, this.stringCount); --i >= 0; ) this.strings[i] = null;

this.stringCount = 0;
this.twoPass = true;
this.isPass2 = false;
this.pass2Flag01 = 0;
this.colixCurrent = 0;
this.$haveTranslucentObjects = false;
this.translucentCoverOnly = !translucentMode;
if (this.pbuf == null) {
this.platform.allocateBuffers (this.windowWidth, this.windowHeight, this.antialiasThisFrame, isImageWrite);
this.pbuf = this.platform.pBuffer;
this.zbuf = this.platform.zBuffer;
this.aobuf = null;
}this.setWidthHeight (this.antialiasThisFrame);
this.platform.clearBuffer ();
if (this.backgroundImage != null) this.plotImage (-2147483648, 0, -2147483648, this.backgroundImage, null, 0, 0, 0);
this.textY = 0;
}, "JU.M3,~B,~B,~B");
Clazz_overrideMethod (c$, "setBackgroundTransparent", 
function (TF) {
if (this.platform != null) this.platform.setBackgroundTransparent (TF);
}, "~B");
Clazz_defineMethod (c$, "releaseBuffers", 
 function () {
this.pbuf = null;
this.zbuf = null;
this.pbufT = null;
this.zbufT = null;
this.aobuf = null;
this.platform.releaseBuffers ();
this.line3d.clearLineCache ();
});
Clazz_overrideMethod (c$, "setPass2", 
function (antialiasTranslucent) {
if (!this.$haveTranslucentObjects || !this.currentlyRendering) return false;
this.isPass2 = true;
this.pass2Flag01 = 1;
this.colixCurrent = 0;
if (this.pbufT == null || this.antialias2 != antialiasTranslucent) {
this.platform.allocateTBuffers (antialiasTranslucent);
this.pbufT = this.platform.pBufferT;
this.zbufT = this.platform.zBufferT;
}this.antialias2 = antialiasTranslucent;
if (this.antialiasThisFrame && !this.antialias2) this.downsampleFullSceneAntialiasing (true);
this.platform.clearTBuffer ();
return true;
}, "~B");
Clazz_overrideMethod (c$, "endRendering", 
function () {
if (!this.currentlyRendering) return;
if (this.pbuf != null) {
if (this.isPass2 && this.pbufT != null) for (var offset = this.pbufT.length; --offset >= 0; ) J.g3d.Graphics3D.mergeBufferPixel (this.pbuf, offset, this.pbufT[offset], this.bgcolor);

if (this.antialiasThisFrame) this.downsampleFullSceneAntialiasing (false);
}this.platform.setBackgroundColor (this.bgcolor);
this.platform.notifyEndOfRendering ();
this.currentlyRendering = false;
});
c$.mergeBufferPixel = Clazz_defineMethod (c$, "mergeBufferPixel", 
function (pbuf, offset, argbB, bgcolor) {
if (argbB == 0) return;
var argbA = pbuf[offset];
if (argbA == argbB) return;
if (argbA == 0) argbA = bgcolor;
var rbA = (argbA & 0x00FF00FF);
var gA = (argbA & 0x0000FF00);
var rbB = (argbB & 0x00FF00FF);
var gB = (argbB & 0x0000FF00);
var logAlpha = (argbB >> 24) & 0xF;
switch (logAlpha) {
case 0:
rbA = rbB;
gA = gB;
break;
case 1:
rbA = (((rbB << 2) + (rbB << 1) + rbB + rbA) >> 3) & 0x00FF00FF;
gA = (((gB << 2) + +(gB << 1) + gB + gA) >> 3) & 0x0000FF00;
break;
case 2:
rbA = (((rbB << 1) + rbB + rbA) >> 2) & 0x00FF00FF;
gA = (((gB << 1) + gB + gA) >> 2) & 0x0000FF00;
break;
case 3:
rbA = (((rbB << 2) + rbB + (rbA << 1) + rbA) >> 3) & 0x00FF00FF;
gA = (((gB << 2) + gB + (gA << 1) + gA) >> 3) & 0x0000FF00;
break;
case 4:
rbA = ((rbA + rbB) >> 1) & 0x00FF00FF;
gA = ((gA + gB) >> 1) & 0x0000FF00;
break;
case 5:
rbA = (((rbB << 1) + rbB + (rbA << 2) + rbA) >> 3) & 0x00FF00FF;
gA = (((gB << 1) + gB + (gA << 2) + gA) >> 3) & 0x0000FF00;
break;
case 6:
rbA = (((rbA << 1) + rbA + rbB) >> 2) & 0x00FF00FF;
gA = (((gA << 1) + gA + gB) >> 2) & 0x0000FF00;
break;
case 7:
rbA = (((rbA << 2) + (rbA << 1) + rbA + rbB) >> 3) & 0x00FF00FF;
gA = (((gA << 2) + (gA << 1) + gA + gB) >> 3) & 0x0000FF00;
break;
}
pbuf[offset] = 0xFF000000 | rbA | gA;
}, "~A,~N,~N,~N");
Clazz_overrideMethod (c$, "getScreenImage", 
function (isImageWrite) {
{
var obj = this.platform.bufferedImage; if (isImageWrite) {
this.releaseBuffers(); } return obj;
}}, "~B");
Clazz_overrideMethod (c$, "applyAnaglygh", 
function (stereoMode, stereoColors) {
switch (stereoMode) {
case J.c.STER.REDCYAN:
this.applyCyanAnaglyph ();
break;
case J.c.STER.CUSTOM:
this.applyCustomAnaglyph (stereoColors);
break;
case J.c.STER.REDBLUE:
this.applyBlueAnaglyph ();
break;
case J.c.STER.REDGREEN:
this.applyGreenAnaglyph ();
break;
case J.c.STER.DOUBLE:
break;
case J.c.STER.NONE:
break;
}
}, "J.c.STER,~A");
Clazz_overrideMethod (c$, "snapshotAnaglyphChannelBytes", 
function () {
if (this.currentlyRendering) throw  new NullPointerException ();
this.anaglyphLength = this.windowWidth * this.windowHeight;
if (this.anaglyphChannelBytes == null || this.anaglyphChannelBytes.length != this.anaglyphLength) this.anaglyphChannelBytes =  Clazz_newByteArray (this.anaglyphLength, 0);
for (var i = this.anaglyphLength; --i >= 0; ) this.anaglyphChannelBytes[i] = this.pbuf[i];

});
Clazz_defineMethod (c$, "applyCustomAnaglyph", 
function (stereoColors) {
var color1 = stereoColors[0];
var color2 = stereoColors[1] & 0x00FFFFFF;
for (var i = this.anaglyphLength; --i >= 0; ) {
var a = this.anaglyphChannelBytes[i] & 0x000000FF;
a = (a | ((a | (a << 8)) << 8)) & color2;
this.pbuf[i] = (this.pbuf[i] & color1) | a;
}
}, "~A");
Clazz_defineMethod (c$, "applyGreenAnaglyph", 
function () {
for (var i = this.anaglyphLength; --i >= 0; ) {
var green = (this.anaglyphChannelBytes[i] & 0x000000FF) << 8;
this.pbuf[i] = (this.pbuf[i] & 0xFFFF0000) | green;
}
});
Clazz_defineMethod (c$, "applyBlueAnaglyph", 
function () {
for (var i = this.anaglyphLength; --i >= 0; ) {
var blue = this.anaglyphChannelBytes[i] & 0x000000FF;
this.pbuf[i] = (this.pbuf[i] & 0xFFFF0000) | blue;
}
});
Clazz_defineMethod (c$, "applyCyanAnaglyph", 
function () {
for (var i = this.anaglyphLength; --i >= 0; ) {
var blue = this.anaglyphChannelBytes[i] & 0x000000FF;
var cyan = (blue << 8) | blue;
this.pbuf[i] = this.pbuf[i] & 0xFFFF0000 | cyan;
}
});
Clazz_overrideMethod (c$, "releaseScreenImage", 
function () {
this.platform.clearScreenBufferThreaded ();
});
Clazz_overrideMethod (c$, "haveTranslucentObjects", 
function () {
return this.$haveTranslucentObjects;
});
Clazz_defineMethod (c$, "setTempZSlab", 
function (zSlab) {
this.zSlab = zSlab;
}, "~N");
Clazz_overrideMethod (c$, "setZShade", 
function (zShade, zSlab, zDepth, zShadePower) {
if (zShade) {
this.setZShade2 (zSlab, zDepth, zShadePower);
this.pixel =  new J.g3d.PixelatorShaded (this);
} else {
this.pixel =  new J.g3d.Pixelator (this);
}}, "~B,~N,~N,~N");
Clazz_defineMethod (c$, "downsampleFullSceneAntialiasing", 
 function (downsampleZBuffer) {
var bgcheck = this.bgcolor;
if (downsampleZBuffer) bgcheck += ((bgcheck & 0xFF) == 0xFF ? -1 : 1);
J.g3d.Graphics3D.downsample2d (this.pbuf, this.windowWidth, this.windowHeight, bgcheck);
if (downsampleZBuffer) {
J.g3d.Graphics3D.downsample2dZ (this.pbuf, this.zbuf, this.windowWidth, this.windowHeight, bgcheck);
this.antialiasThisFrame = false;
this.setWidthHeight (false);
}}, "~B");
c$.downsample2d = Clazz_defineMethod (c$, "downsample2d", 
function (pbuf, width, height, bgcheck) {
var width4 = width << 1;
if (bgcheck != 0) {
bgcheck &= 0xFFFFFF;
for (var i = pbuf.length; --i >= 0; ) if (pbuf[i] == 0) pbuf[i] = bgcheck;

}var bg0 = ((bgcheck >> 2) & 0x3F3F3F3F) << 2;
bg0 += (bg0 & 0xC0C0C0C0) >> 6;
var offset1 = 0;
var offset4 = 0;
for (var i = height; --i >= 0; offset4 += width4) for (var j = width; --j >= 0; ++offset1) {
var argb = ((pbuf[offset4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4++ + width4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4] >> 2) & 0x3F3F3F3F) + ((pbuf[offset4++ + width4] >> 2) & 0x3F3F3F3F);
argb += (argb & 0xC0C0C0C0) >> 6;
if (argb == bg0) argb = bgcheck;
{
pbuf[offset1] = argb & 0x00FFFFFF | 0xFF000000;
}}

}, "~A,~N,~N,~N");
c$.downsample2dZ = Clazz_defineMethod (c$, "downsample2dZ", 
 function (pbuf, zbuf, width, height, bgcheck) {
var width4 = width << 1;
var offset1 = 0;
var offset4 = 0;
for (var i = height; --i >= 0; offset4 += width4) for (var j = width; --j >= 0; ++offset1, ++offset4) {
var z = Math.min (zbuf[offset4], zbuf[offset4 + width4]);
z = Math.min (z, zbuf[++offset4]);
z = Math.min (z, zbuf[offset4 + width4]);
if (z != 2147483647) z >>= 1;
zbuf[offset1] = (pbuf[offset1] == bgcheck ? 2147483647 : z);
}

}, "~A,~A,~N,~N,~N");
Clazz_defineMethod (c$, "hasContent", 
function () {
return this.platform.hasContent ();
});
Clazz_overrideMethod (c$, "setC", 
function (colix) {
var isLast = JU.C.isColixLastAvailable (colix);
if (!isLast && colix == this.colixCurrent && this.currentShadeIndex == -1) return true;
var mask = colix & 30720;
if (mask == 16384) return false;
if (this.renderLow) mask = 0;
var isTranslucent = (mask != 0);
if (!this.checkTranslucent (isTranslucent)) return false;
if (this.isPass2) {
this.translucencyMask = (mask << 13) | 0xFFFFFF;
this.translucencyLog = mask >> 11;
} else {
this.translucencyLog = 0;
}this.colixCurrent = colix;
if (isLast) {
if (this.argbCurrent != this.lastRawColor) {
if (this.argbCurrent == 0) this.argbCurrent = 0xFFFFFFFF;
this.lastRawColor = this.argbCurrent;
this.shader.setLastColix (this.argbCurrent, this.inGreyscaleMode);
}}this.shadesCurrent = this.getShades (colix);
this.currentShadeIndex = -1;
this.setColor (this.getColorArgbOrGray (colix));
return true;
}, "~N");
Clazz_overrideMethod (c$, "drawFilledCircle", 
function (colixRing, colixFill, diameter, x, y, z) {
if (this.isClippedZ (z)) return;
var r = Clazz_doubleToInt ((diameter + 1) / 2);
var isClipped = x < r || x + r >= this.width || y < r || y + r >= this.height;
if (isClipped && this.isClippedXY (diameter, x, y)) return;
if (colixRing != 0 && this.setC (colixRing)) {
if (isClipped) {
if (!this.isClippedXY (diameter, x, y)) (this.circle3d).plotCircleCenteredClipped (x, y, z, diameter);
} else {
(this.circle3d).plotCircleCenteredUnclipped (x, y, z, diameter);
}}if (colixFill != 0 && this.setC (colixFill)) {
if (isClipped) (this.circle3d).plotFilledCircleCenteredClipped (x, y, z, diameter);
 else (this.circle3d).plotFilledCircleCenteredUnclipped (x, y, z, diameter);
}}, "~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "volumeRender4", 
function (diameter, x, y, z) {
if (diameter == 1) {
this.plotPixelClippedArgb (this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel);
return;
}if (this.isClippedZ (z)) return;
var r = Clazz_doubleToInt ((diameter + 1) / 2);
var isClipped = x < r || x + r >= this.width || y < r || y + r >= this.height;
if (isClipped && this.isClippedXY (diameter, x, y)) return;
if (isClipped) (this.circle3d).plotFilledCircleCenteredClipped (x, y, z, diameter);
 else (this.circle3d).plotFilledCircleCenteredUnclipped (x, y, z, diameter);
}, "~N,~N,~N,~N");
Clazz_overrideMethod (c$, "fillSphereXYZ", 
function (diameter, x, y, z) {
switch (diameter) {
case 1:
this.plotPixelClippedArgb (this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel);
return;
case 0:
return;
}
if (diameter <= (this.antialiasThisFrame ? 2000 : 1000)) this.sphere3d.render (this.shadesCurrent, diameter, x, y, z, null, null, null, -1, null);
}, "~N,~N,~N,~N");
Clazz_overrideMethod (c$, "volumeRender", 
function (TF) {
if (TF) {
this.saveAmbient = this.getAmbientPercent ();
this.saveDiffuse = this.getDiffusePercent ();
this.setAmbientPercent (100);
this.setDiffusePercent (0);
this.addRenderer (1073741880);
} else {
this.setAmbientPercent (this.saveAmbient);
this.setDiffusePercent (this.saveDiffuse);
}}, "~B");
Clazz_overrideMethod (c$, "fillSphereI", 
function (diameter, center) {
this.fillSphereXYZ (diameter, center.x, center.y, center.z);
}, "~N,JU.P3i");
Clazz_overrideMethod (c$, "fillSphere", 
function (diameter, center) {
this.fillSphereXYZ (diameter, Math.round (center.x), Math.round (center.y), Math.round (center.z));
}, "~N,JU.P3");
Clazz_overrideMethod (c$, "fillEllipsoid", 
function (center, points, x, y, z, diameter, mToEllipsoidal, coef, mDeriv, selectedOctant, octantPoints) {
switch (diameter) {
case 1:
this.plotPixelClippedArgb (this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel);
return;
case 0:
return;
}
if (diameter <= (this.antialiasThisFrame ? 2000 : 1000)) this.sphere3d.render (this.shadesCurrent, diameter, x, y, z, mToEllipsoidal, coef, mDeriv, selectedOctant, octantPoints);
}, "JU.P3,~A,~N,~N,~N,~N,JU.M3,~A,JU.M4,~N,~A");
Clazz_overrideMethod (c$, "drawRect", 
function (x, y, z, zSlab, rWidth, rHeight) {
if (zSlab != 0 && this.isClippedZ (zSlab)) return;
var w = rWidth - 1;
var h = rHeight - 1;
var xRight = x + w;
var yBottom = y + h;
if (y >= 0 && y < this.height) this.drawHLine (x, y, z, w);
if (yBottom >= 0 && yBottom < this.height) this.drawHLine (x, yBottom, z, w);
if (x >= 0 && x < this.width) this.drawVLine (x, y, z, h);
if (xRight >= 0 && xRight < this.width) this.drawVLine (xRight, y, z, h);
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "drawHLine", 
 function (x, y, z, w) {
if (w < 0) {
x += w;
w = -w;
}if (x < 0) {
w += x;
x = 0;
}if (x + w >= this.width) w = this.width - 1 - x;
var p = this.pixel;
var c = this.argbCurrent;
var offset = x + this.width * y;
for (var i = 0; i <= w; i++) {
if (z < this.zbuf[offset]) p.addPixel (offset, z, c);
offset++;
}
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "drawVLine", 
 function (x, y, z, h) {
if (h < 0) {
y += h;
h = -h;
}if (y < 0) {
h += y;
y = 0;
}if (y + h >= this.height) {
h = this.height - 1 - y;
}var offset = x + this.width * y;
var p = this.pixel;
var c = this.argbCurrent;
for (var i = 0; i <= h; i++) {
if (z < this.zbuf[offset]) p.addPixel (offset, z, c);
offset += this.width;
}
}, "~N,~N,~N,~N");
Clazz_overrideMethod (c$, "fillRect", 
function (x, y, z, zSlab, widthFill, heightFill) {
if (this.isClippedZ (zSlab)) return;
var w = this.width;
if (x < 0) {
widthFill += x;
if (widthFill <= 0) return;
x = 0;
}if (x + widthFill > w) {
widthFill = w - x;
if (widthFill <= 0) return;
}if (y < 0) {
heightFill += y;
if (heightFill <= 0) return;
y = 0;
}if (y + heightFill > this.height) heightFill = this.height - y;
var c = this.argbCurrent;
var zb = this.zbuf;
var p = this.pixel;
while (--heightFill >= 0) this.plotPixelsUnclippedCount (c, widthFill, x, y++, z, w, zb, p);

}, "~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "drawString", 
function (str, font3d, xBaseline, yBaseline, z, zSlab, bgColix) {
this.currentShadeIndex = 0;
if (str == null) return;
if (this.isClippedZ (zSlab)) return;
this.drawStringNoSlab (str, font3d, xBaseline, yBaseline, z, bgColix);
}, "~S,javajs.awt.Font,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "drawStringNoSlab", 
function (str, font3d, xBaseline, yBaseline, z, bgColix) {
if (str == null) return;
if (this.strings == null) this.strings =  new Array (10);
if (this.stringCount == this.strings.length) this.strings = JU.AU.doubleLength (this.strings);
var t =  new J.g3d.TextString ();
t.setText (str, font3d == null ? this.currentFont : (this.currentFont = font3d), this.argbCurrent, JU.C.isColixTranslucent (bgColix) ? (this.getColorArgbOrGray (bgColix) & 0xFFFFFF) | ((bgColix & 30720) << 13) : 0, xBaseline, yBaseline, z);
this.strings[this.stringCount++] = t;
}, "~S,javajs.awt.Font,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "renderAllStrings", 
function (jmolRenderer) {
if (this.strings == null) return;
if (this.stringCount >= 2) {
if (J.g3d.Graphics3D.sort == null) J.g3d.Graphics3D.sort =  new J.g3d.TextSorter ();
java.util.Arrays.sort (this.strings, J.g3d.Graphics3D.sort);
}for (var i = 0; i < this.stringCount; i++) {
var ts = this.strings[i];
this.plotText (ts.x, ts.y, ts.z, ts.argb, ts.bgargb, ts.text, ts.font, jmolRenderer);
}
this.strings = null;
this.stringCount = 0;
}, "~O");
Clazz_overrideMethod (c$, "plotText", 
function (x, y, z, argb, bgargb, text, font3d, jmolRenderer) {
J.g3d.TextRenderer.plot (x, y, z, argb, bgargb, text, font3d, this, jmolRenderer, this.antialiasThisFrame);
}, "~N,~N,~N,~N,~N,~S,javajs.awt.Font,J.api.JmolRendererInterface");
Clazz_overrideMethod (c$, "drawImage", 
function (objImage, x, y, z, zSlab, bgcolix, width, height) {
if (objImage == null || width == 0 || height == 0 || this.isClippedZ (zSlab)) return;
this.plotImage (x, y, z, objImage, null, bgcolix, width, height);
}, "~O,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "plotImage", 
function (x, y, z, image, jmolRenderer, bgcolix, width, height) {
this.setC (bgcolix);
if (!this.isPass2) this.translucencyMask = -1;
if (bgcolix == 0) this.argbCurrent = 0;
J.g3d.ImageRenderer.plotImage (x, y, z, image, this, jmolRenderer, this.antialiasThisFrame, this.argbCurrent, width, height);
}, "~N,~N,~N,~O,J.api.JmolRendererInterface,~N,~N,~N");
Clazz_overrideMethod (c$, "setFontFid", 
function (fid) {
this.currentFont = javajs.awt.Font.getFont3D (fid);
}, "~N");
Clazz_overrideMethod (c$, "setFont", 
function (font3d) {
this.currentFont = font3d;
}, "javajs.awt.Font");
Clazz_overrideMethod (c$, "drawPixel", 
function (x, y, z) {
this.plotPixelClippedArgb (this.argbCurrent, x, y, z, this.width, this.zbuf, this.pixel);
}, "~N,~N,~N");
Clazz_overrideMethod (c$, "drawPoints", 
function (count, coordinates, scale) {
if (scale > 1) {
var s2 = scale * scale * 0.8;
for (var i = -scale; i < scale; i++) {
for (var j = -scale; j < scale; j++) {
if (i * i + j * j > s2) continue;
this.plotPoints (count, coordinates, i, j);
this.plotPoints (count, coordinates, i, j);
}
}
} else {
this.plotPoints (count, coordinates, 0, 0);
}}, "~N,~A,~N");
Clazz_overrideMethod (c$, "drawDashedLine", 
function (run, rise, pointA, pointB) {
this.line3d.plotDashedLine (this.argbCurrent, run, rise, pointA.x, pointA.y, pointA.z, pointB.x, pointB.y, pointB.z, true);
}, "~N,~N,JU.P3i,JU.P3i");
Clazz_overrideMethod (c$, "drawDottedLine", 
function (pointA, pointB) {
this.line3d.plotDashedLine (this.argbCurrent, 2, 1, pointA.x, pointA.y, pointA.z, pointB.x, pointB.y, pointB.z, true);
}, "JU.P3i,JU.P3i");
Clazz_overrideMethod (c$, "drawLineXYZ", 
function (x1, y1, z1, x2, y2, z2) {
this.line3d.plotLine (this.argbCurrent, this.argbCurrent, x1, y1, z1, x2, y2, z2, true);
}, "~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "drawLine", 
function (colixA, colixB, x1, y1, z1, x2, y2, z2) {
if (!this.setC (colixA)) colixA = 0;
var argbA = this.argbCurrent;
if (!this.setC (colixB)) colixB = 0;
if (colixA != 0 || colixB != 0) this.line3d.plotLine (argbA, this.argbCurrent, x1, y1, z1, x2, y2, z2, true);
}, "~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "drawLineAB", 
function (pointA, pointB) {
this.line3d.plotLine (this.argbCurrent, this.argbCurrent, pointA.x, pointA.y, pointA.z, pointB.x, pointB.y, pointB.z, true);
}, "JU.P3i,JU.P3i");
Clazz_overrideMethod (c$, "fillCylinderXYZ", 
function (colixA, colixB, endcaps, diameter, xA, yA, zA, xB, yB, zB) {
if (diameter > this.ht3) return;
if (!this.setC (colixA)) colixA = 0;
if (!this.setC (colixB)) colixB = 0;
if (colixA != 0 || colixB != 0) this.cylinder3d.render (colixA, colixB, endcaps, diameter, xA, yA, zA, xB, yB, zB);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "fillCylinderScreen", 
function (endcaps, diameter, xA, yA, zA, xB, yB, zB) {
if (diameter <= this.ht3) this.cylinder3d.render (this.colixCurrent, this.colixCurrent, endcaps, diameter, xA, yA, zA, xB, yB, zB);
}, "~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "fillCylinderScreen3I", 
function (endcaps, diameter, screenA, screenB, pt0f, pt1f, radius) {
if (diameter <= this.ht3) this.cylinder3d.render (this.colixCurrent, this.colixCurrent, endcaps, diameter, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z);
}, "~N,~N,JU.P3i,JU.P3i,JU.P3,JU.P3,~N");
Clazz_overrideMethod (c$, "fillCylinder", 
function (endcaps, diameter, screenA, screenB) {
if (diameter <= this.ht3) this.cylinder3d.render (this.colixCurrent, this.colixCurrent, endcaps, diameter, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z);
}, "~N,~N,JU.P3i,JU.P3i");
Clazz_overrideMethod (c$, "fillCylinderBits", 
function (endcaps, diameter, screenA, screenB) {
if (diameter <= this.ht3) this.cylinder3d.renderBits (this.colixCurrent, this.colixCurrent, endcaps, diameter, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z);
}, "~N,~N,JU.P3,JU.P3");
Clazz_overrideMethod (c$, "fillConeScreen", 
function (endcap, screenDiameter, screenBase, screenTip, isBarb) {
if (screenDiameter <= this.ht3) this.cylinder3d.renderCone (this.colixCurrent, endcap, screenDiameter, screenBase.x, screenBase.y, screenBase.z, screenTip.x, screenTip.y, screenTip.z, false, isBarb);
}, "~N,~N,JU.P3i,JU.P3i,~B");
Clazz_overrideMethod (c$, "fillConeSceen3f", 
function (endcap, screenDiameter, screenBase, screenTip) {
if (screenDiameter <= this.ht3) this.cylinder3d.renderCone (this.colixCurrent, endcap, screenDiameter, screenBase.x, screenBase.y, screenBase.z, screenTip.x, screenTip.y, screenTip.z, true, false);
}, "~N,~N,JU.P3,JU.P3");
Clazz_overrideMethod (c$, "drawHermite4", 
function (tension, s0, s1, s2, s3) {
(this.hermite3d).renderHermiteRope (false, tension, 0, 0, 0, s0, s1, s2, s3);
}, "~N,JU.P3i,JU.P3i,JU.P3i,JU.P3i");
Clazz_overrideMethod (c$, "drawHermite7", 
function (fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, colixBack) {
if (colixBack == 0) {
(this.hermite3d).renderHermiteRibbon (fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, 0);
return;
}(this.hermite3d).renderHermiteRibbon (fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, 1);
var colix = this.colixCurrent;
this.setC (colixBack);
(this.hermite3d).renderHermiteRibbon (fill, border, tension, s0, s1, s2, s3, s4, s5, s6, s7, aspectRatio, -1);
this.setC (colix);
}, "~B,~B,~N,JU.P3i,JU.P3i,JU.P3i,JU.P3i,JU.P3i,JU.P3i,JU.P3i,JU.P3i,~N,~N");
Clazz_overrideMethod (c$, "fillHermite", 
function (tension, diameterBeg, diameterMid, diameterEnd, s0, s1, s2, s3) {
(this.hermite3d).renderHermiteRope (true, tension, diameterBeg, diameterMid, diameterEnd, s0, s1, s2, s3);
}, "~N,~N,~N,~N,JU.P3i,JU.P3i,JU.P3i,JU.P3i");
Clazz_overrideMethod (c$, "drawTriangle3C", 
function (screenA, colixA, screenB, colixB, screenC, colixC, check) {
if ((check & 1) == 1) this.drawLine (colixA, colixB, screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z);
if ((check & 2) == 2) this.drawLine (colixB, colixC, screenB.x, screenB.y, screenB.z, screenC.x, screenC.y, screenC.z);
if ((check & 4) == 4) this.drawLine (colixA, colixC, screenA.x, screenA.y, screenA.z, screenC.x, screenC.y, screenC.z);
}, "JU.P3i,~N,JU.P3i,~N,JU.P3i,~N,~N");
Clazz_overrideMethod (c$, "fillTriangleTwoSided", 
function (normix, xScreenA, yScreenA, zScreenA, xScreenB, yScreenB, zScreenB, xScreenC, yScreenC, zScreenC) {
this.setColorNoisy (this.getShadeIndex (normix));
(this.triangle3d).fillTriangleXYZ (xScreenA, yScreenA, zScreenA, xScreenB, yScreenB, zScreenB, xScreenC, yScreenC, zScreenC, false);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "fillTriangle3f", 
function (screenA, screenB, screenC, setNoisy) {
var i = this.getShadeIndexP3 (screenA, screenB, screenC);
if (setNoisy) this.setColorNoisy (i);
 else this.setColor (this.shadesCurrent[i]);
(this.triangle3d).fillTriangleP3f (screenA, screenB, screenC, false);
}, "JU.P3,JU.P3,JU.P3,~B");
Clazz_overrideMethod (c$, "fillTriangle3i", 
function (screenA, screenB, screenC, ptA, ptB, ptC, doShade) {
if (doShade) {
var v = this.vectorAB;
v.set (screenB.x - screenA.x, screenB.y - screenA.y, screenB.z - screenA.z);
var shadeIndex;
if (screenC == null) {
shadeIndex = this.shader.getShadeIndex (-v.x, -v.y, v.z);
} else {
this.vectorAC.set (screenC.x - screenA.x, screenC.y - screenA.y, screenC.z - screenA.z);
v.cross (v, this.vectorAC);
shadeIndex = v.z >= 0 ? this.shader.getShadeIndex (-v.x, -v.y, v.z) : this.shader.getShadeIndex (v.x, v.y, -v.z);
}if (shadeIndex > 56) shadeIndex = 56;
this.setColorNoisy (shadeIndex);
}(this.triangle3d).fillTriangleP3i (screenA, screenB, screenC, false);
}, "JU.P3i,JU.P3i,JU.P3i,JU.T3,JU.T3,JU.T3,~B");
Clazz_overrideMethod (c$, "fillTriangle3CN", 
function (screenA, colixA, normixA, screenB, colixB, normixB, screenC, colixC, normixC) {
var useGouraud;
if (!this.isPass2 && normixA == normixB && normixA == normixC && colixA == colixB && colixA == colixC) {
var shadeIndex = this.getShadeIndex (normixA);
if (colixA != this.colixCurrent || this.currentShadeIndex != shadeIndex) {
this.currentShadeIndex = -1;
this.setC (colixA);
this.setColorNoisy (shadeIndex);
}useGouraud = false;
} else {
this.setTriangleTranslucency (colixA, colixB, colixC);
(this.triangle3d).setGouraud (this.getShades (colixA)[this.getShadeIndex (normixA)], this.getShades (colixB)[this.getShadeIndex (normixB)], this.getShades (colixC)[this.getShadeIndex (normixC)]);
useGouraud = true;
}(this.triangle3d).fillTriangleP3i (screenA, screenB, screenC, useGouraud);
}, "JU.P3i,~N,~N,JU.P3i,~N,~N,JU.P3i,~N,~N");
Clazz_defineMethod (c$, "getShadeIndex", 
function (normix) {
return (normix == -10000 || normix == 9999 ? J.g3d.Graphics3D.nullShadeIndex : normix < 0 ? this.shadeIndexes2Sided[~normix] : this.shadeIndexes[normix]);
}, "~N");
Clazz_defineMethod (c$, "setTriangleTranslucency", 
 function (colixA, colixB, colixC) {
if (this.isPass2) {
var maskA = colixA & 30720;
var maskB = colixB & 30720;
var maskC = colixC & 30720;
maskA &= -16385;
maskB &= -16385;
maskC &= -16385;
var mask = JU.GData.roundInt (Clazz_doubleToInt ((maskA + maskB + maskC) / 3)) & 30720;
this.translucencyMask = (mask << 13) | 0xFFFFFF;
}}, "~N,~N,~N");
Clazz_overrideMethod (c$, "drawQuadrilateral", 
function (colix, screenA, screenB, screenC, screenD) {
this.setC (colix);
this.drawLineAB (screenA, screenB);
this.drawLineAB (screenB, screenC);
this.drawLineAB (screenC, screenD);
this.drawLineAB (screenD, screenA);
}, "~N,JU.P3i,JU.P3i,JU.P3i,JU.P3i");
Clazz_overrideMethod (c$, "fillQuadrilateral", 
function (screenA, screenB, screenC, screenD) {
this.setColorNoisy (this.getShadeIndexP3 (screenA, screenB, screenC));
(this.triangle3d).fillTriangleP3f (screenA, screenB, screenC, false);
(this.triangle3d).fillTriangleP3f (screenA, screenC, screenD, false);
}, "JU.P3,JU.P3,JU.P3,JU.P3");
Clazz_overrideMethod (c$, "drawSurface", 
function (meshSurface, colix) {
}, "JU.MeshSurface,~N");
Clazz_overrideMethod (c$, "plotPixelClippedP3i", 
function (screen) {
this.plotPixelClippedArgb (this.argbCurrent, screen.x, screen.y, screen.z, this.width, this.zbuf, this.pixel);
}, "JU.P3i");
Clazz_defineMethod (c$, "plotPixelClippedArgb", 
function (argb, x, y, z, width, zbuf, p) {
if (this.isClipped3 (x, y, z)) return;
var offset = y * width + x;
if (z < zbuf[offset]) p.addPixel (offset, z, argb);
}, "~N,~N,~N,~N,~N,~A,J.g3d.Pixelator");
Clazz_defineMethod (c$, "plotPixelUnclipped", 
function (argb, x, y, z, width, zbuf, p) {
var offset = y * width + x;
if (z < zbuf[offset]) p.addPixel (offset, z, argb);
}, "~N,~N,~N,~N,~N,~A,J.g3d.Pixelator");
Clazz_overrideMethod (c$, "plotImagePixel", 
function (argb, x, y, z, shade, bgargb, width, height, zbuf, p, transpLog) {
if (x < 0 || x >= width || y < 0 || y >= height) return;
var offset = y * width + x;
if (z < zbuf[offset]) {
if (shade == 8) (p).addPixel (offset, z, argb);
 else {
shade += transpLog;
if (shade <= 7) this.shadeTextPixel (offset, z, argb, bgargb, shade, zbuf);
}}}, "~N,~N,~N,~N,~N,~N,~N,~N,~A,~O,~N");
Clazz_defineMethod (c$, "plotPixelsClipped", 
function (argb, count, x, y, z, width, height, zbuf, p) {
if (y < 0 || y >= height || x >= width) return;
if (x < 0) {
count += x;
x = 0;
}if (count + x > width) count = width - x;
if (count <= 0) return;
var offsetPbuf = y * width + x;
var offsetMax = offsetPbuf + count;
while (offsetPbuf < offsetMax) {
if (z < zbuf[offsetPbuf]) p.addPixel (offsetPbuf, z, argb);
offsetPbuf++;
}
}, "~N,~N,~N,~N,~N,~N,~N,~A,J.g3d.Pixelator");
Clazz_defineMethod (c$, "plotPixelsClippedRaster", 
function (count, x, y, zAtLeft, zPastRight, rgb16Left, rgb16Right) {
var depth;
var slab;
if (count <= 0 || y < 0 || y >= this.height || x >= this.width || (zAtLeft < (slab = this.slab) && zPastRight < slab) || (zAtLeft > (depth = this.depth) && zPastRight > depth)) return;
var zb = this.zbuf;
var seed = (x << 16) + (y << 1) ^ 0x33333333;
var zScaled = (zAtLeft << 10) + (512);
var dz = zPastRight - zAtLeft;
var roundFactor = Clazz_doubleToInt (count / 2);
var zIncrementScaled = JU.GData.roundInt (Clazz_doubleToInt (((dz << 10) + (dz >= 0 ? roundFactor : -roundFactor)) / count));
if (x < 0) {
x = -x;
zScaled += zIncrementScaled * x;
count -= x;
if (count <= 0) return;
x = 0;
}if (count + x > this.width) count = this.width - x;
var offsetPbuf = y * this.width + x;
var p = this.pixel;
if (rgb16Left == null) {
var adn = this.argbNoisyDn;
var aup = this.argbNoisyUp;
var ac = this.argbCurrent;
while (--count >= 0) {
var z = zScaled >> 10;
if (z >= slab && z <= depth && z < zb[offsetPbuf]) {
seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF;
var bits = (seed >> 16) & 0x07;
p.addPixel (offsetPbuf, z, bits == 0 ? adn : (bits == 1 ? aup : ac));
}++offsetPbuf;
zScaled += zIncrementScaled;
}
} else {
var rScaled = rgb16Left.r << 8;
var rIncrement = Clazz_doubleToInt (((rgb16Right.r - rgb16Left.r) << 8) / count);
var gScaled = rgb16Left.g;
var gIncrement = Clazz_doubleToInt ((rgb16Right.g - gScaled) / count);
var bScaled = rgb16Left.b;
var bIncrement = Clazz_doubleToInt ((rgb16Right.b - bScaled) / count);
while (--count >= 0) {
var z = zScaled >> 10;
if (z >= slab && z <= depth && z < zb[offsetPbuf]) p.addPixel (offsetPbuf, z, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF));
++offsetPbuf;
zScaled += zIncrementScaled;
rScaled += rIncrement;
gScaled += gIncrement;
bScaled += bIncrement;
}
}}, "~N,~N,~N,~N,~N,JU.Rgb16,JU.Rgb16");
Clazz_defineMethod (c$, "plotPixelsUnclippedRaster", 
function (count, x, y, zAtLeft, zPastRight, rgb16Left, rgb16Right) {
if (count <= 0) return;
var seed = ((x << 16) + (y << 1) ^ 0x33333333) & 0x7FFFFFFF;
var zScaled = (zAtLeft << 10) + (512);
var dz = zPastRight - zAtLeft;
var roundFactor = Clazz_doubleToInt (count / 2);
var zIncrementScaled = JU.GData.roundInt (Clazz_doubleToInt (((dz << 10) + (dz >= 0 ? roundFactor : -roundFactor)) / count));
var offsetPbuf = y * this.width + x;
var zb = this.zbuf;
var p = this.pixel;
if (rgb16Left == null) {
var adn = this.argbNoisyDn;
var aup = this.argbNoisyUp;
var ac = this.argbCurrent;
while (--count >= 0) {
var z = zScaled >> 10;
if (z < zb[offsetPbuf]) {
seed = ((seed << 16) + (seed << 1) + seed) & 0x7FFFFFFF;
var bits = (seed >> 16) & 0x07;
p.addPixel (offsetPbuf, z, bits == 0 ? adn : (bits == 1 ? aup : ac));
}++offsetPbuf;
zScaled += zIncrementScaled;
}
} else {
var rScaled = rgb16Left.r << 8;
var rIncrement = JU.GData.roundInt (Clazz_doubleToInt (((rgb16Right.r - rgb16Left.r) << 8) / count));
var gScaled = rgb16Left.g;
var gIncrement = JU.GData.roundInt (Clazz_doubleToInt ((rgb16Right.g - gScaled) / count));
var bScaled = rgb16Left.b;
var bIncrement = JU.GData.roundInt (Clazz_doubleToInt ((rgb16Right.b - bScaled) / count));
while (--count >= 0) {
var z = zScaled >> 10;
if (z < zb[offsetPbuf]) p.addPixel (offsetPbuf, z, 0xFF000000 | (rScaled & 0xFF0000) | (gScaled & 0xFF00) | ((bScaled >> 8) & 0xFF));
++offsetPbuf;
zScaled += zIncrementScaled;
rScaled += rIncrement;
gScaled += gIncrement;
bScaled += bIncrement;
}
}}, "~N,~N,~N,~N,~N,JU.Rgb16,JU.Rgb16");
Clazz_defineMethod (c$, "plotPixelsUnclippedCount", 
function (c, count, x, y, z, width, zbuf, p) {
var offsetPbuf = y * width + x;
while (--count >= 0) {
if (z < zbuf[offsetPbuf]) p.addPixel (offsetPbuf, z, c);
++offsetPbuf;
}
}, "~N,~N,~N,~N,~N,~N,~A,J.g3d.Pixelator");
Clazz_defineMethod (c$, "plotPoints", 
 function (count, coordinates, xOffset, yOffset) {
var p = this.pixel;
var c = this.argbCurrent;
var zb = this.zbuf;
var w = this.width;
var antialias = this.antialiasThisFrame;
for (var i = count * 3; i > 0; ) {
var z = coordinates[--i];
var y = coordinates[--i] + yOffset;
var x = coordinates[--i] + xOffset;
if (this.isClipped3 (x, y, z)) continue;
var offset = y * w + x++;
if (z < zb[offset]) p.addPixel (offset, z, c);
if (antialias) {
offset = y * w + x;
if (!this.isClipped3 (x, y, z) && z < zb[offset]) p.addPixel (offset, z, c);
offset = (++y) * w + x;
if (!this.isClipped3 (x, y, z) && z < zb[offset]) p.addPixel (offset, z, c);
offset = y * w + (--x);
if (!this.isClipped3 (x, y, z) && z < zb[offset]) p.addPixel (offset, z, c);
}}
}, "~N,~A,~N,~N");
Clazz_defineMethod (c$, "setColorNoisy", 
function (shadeIndex) {
this.currentShadeIndex = shadeIndex;
this.argbCurrent = this.shadesCurrent[shadeIndex];
this.argbNoisyUp = this.shadesCurrent[shadeIndex < 63 ? shadeIndex + 1 : 63];
this.argbNoisyDn = this.shadesCurrent[shadeIndex > 0 ? shadeIndex - 1 : 0];
}, "~N");
Clazz_defineMethod (c$, "getShadeIndexP3", 
 function (screenA, screenB, screenC) {
this.vectorAB.sub2 (screenB, screenA);
this.vectorAC.sub2 (screenC, screenA);
var v = this.vectorNormal;
v.cross (this.vectorAB, this.vectorAC);
var i = (v.z >= 0 ? this.shader.getShadeIndex (-v.x, -v.y, v.z) : this.shader.getShadeIndex (v.x, v.y, -v.z));
return i;
}, "JU.P3,JU.P3,JU.P3");
Clazz_overrideMethod (c$, "renderBackground", 
function (jmolRenderer) {
if (this.backgroundImage != null) this.plotImage (-2147483648, 0, -2147483648, this.backgroundImage, jmolRenderer, 0, 0, 0);
}, "J.api.JmolRendererInterface");
Clazz_overrideMethod (c$, "drawAtom", 
function (atom) {
this.fillSphereXYZ (atom.sD, atom.sX, atom.sY, atom.sZ);
}, "JM.Atom");
Clazz_overrideMethod (c$, "getExportType", 
function () {
return 0;
});
Clazz_overrideMethod (c$, "getExportName", 
function () {
return null;
});
Clazz_defineMethod (c$, "canDoTriangles", 
function () {
return true;
});
Clazz_defineMethod (c$, "isCartesianExport", 
function () {
return false;
});
Clazz_overrideMethod (c$, "initializeExporter", 
function (vwr, privateKey, g3d, params) {
return null;
}, "JV.Viewer,~N,JU.GData,java.util.Map");
Clazz_overrideMethod (c$, "finalizeOutput", 
function () {
return null;
});
Clazz_overrideMethod (c$, "drawBond", 
function (atomA, atomB, colixA, colixB, endcaps, mad, bondOrder) {
}, "JU.P3,JU.P3,~N,~N,~N,~N,~N");
Clazz_overrideMethod (c$, "drawEllipse", 
function (ptAtom, ptX, ptY, fillArc, wireframeOnly) {
return false;
}, "JU.P3,JU.P3,JU.P3,~B,~B");
Clazz_defineMethod (c$, "getPrivateKey", 
function () {
return 0;
});
Clazz_overrideMethod (c$, "clearFontCache", 
function () {
J.g3d.TextRenderer.clearFontCache ();
});
Clazz_defineMethod (c$, "setRotationMatrix", 
function (rotationMatrix) {
var vertexVectors = JU.Normix.getVertexVectors ();
for (var i = JU.GData.normixCount; --i >= 0; ) {
var tv = this.transformedVectors[i];
rotationMatrix.rotate2 (vertexVectors[i], tv);
this.shadeIndexes[i] = this.shader.getShadeB (tv.x, -tv.y, tv.z);
this.shadeIndexes2Sided[i] = (tv.z >= 0 ? this.shadeIndexes[i] : this.shader.getShadeB (-tv.x, tv.y, -tv.z));
}
}, "JU.M3");
Clazz_overrideMethod (c$, "renderCrossHairs", 
function (minMax, screenWidth, screenHeight, navOffset, navDepth) {
var antialiased = this.isAntialiased ();
this.setC (navDepth < 0 ? 10 : navDepth > 100 ? 11 : 23);
var x = Math.max (Math.min (this.width, Math.round (navOffset.x)), 0);
var y = Math.max (Math.min (this.height, Math.round (navOffset.y)), 0);
var z = Math.round (navOffset.z) + 1;
var off = (antialiased ? 8 : 4);
var h = (antialiased ? 20 : 10);
var w = (antialiased ? 2 : 1);
this.drawRect (x - off, y, z, 0, h, w);
this.drawRect (x, y - off, z, 0, w, h);
this.drawRect (x - off, y - off, z, 0, h, h);
off = h;
h = h >> 1;
this.setC (minMax[1] < navOffset.x ? 21 : 11);
this.drawRect (x - off, y, z, 0, h, w);
this.setC (minMax[0] > navOffset.x ? 21 : 11);
this.drawRect (x + h, y, z, 0, h, w);
this.setC (minMax[3] < navOffset.y ? 21 : 11);
this.drawRect (x, y - off, z, 0, w, h);
this.setC (minMax[2] > navOffset.y ? 21 : 11);
this.drawRect (x, y + h, z, 0, w, h);
}, "~A,~N,~N,JU.P3,~N");
Clazz_overrideMethod (c$, "initializeOutput", 
function (vwr, privateKey, params) {
return false;
}, "JV.Viewer,~N,java.util.Map");
Clazz_defineMethod (c$, "shadeTextPixel", 
function (offset, z, argb, bgargb, shade, zbuf) {
if (bgargb != 0) J.g3d.Graphics3D.mergeBufferPixel (this.pbuf, offset, bgargb, this.bgcolor);
J.g3d.Graphics3D.mergeBufferPixel (this.pbuf, offset, (argb & 0xFFFFFF) | shade << 24, this.bgcolor);
zbuf[offset] = z;
}, "~N,~N,~N,~N,~N,~A");
Clazz_defineStatics (c$,
"sort", null,
"nullShadeIndex", 50);
});
Clazz_declarePackage ("J.g3d");
c$ = Clazz_declareType (J.g3d, "ImageRenderer");
c$.plotImage = Clazz_defineMethod (c$, "plotImage", 
function (x, y, z, image, g3d, jmolRenderer, antialias, argbBackground, textWidth, textHeight) {
var isBackground = (x == -2147483648);
var bgcolor = (isBackground ? g3d.bgcolor : argbBackground);
if (isBackground) {
x = 0;
z = 2147483646;
textWidth = g3d.width;
textHeight = g3d.height;
}if (x + textWidth <= 0 || x >= g3d.width || y + textHeight <= 0 || y >= g3d.height) return;
var g;
{
g = null;
}var buffer = g3d.apiPlatform.drawImageToBuffer (g, g3d.platform.offscreenImage, image, textWidth, textHeight, isBackground ? bgcolor : 0);
if (buffer == null) return;
var zbuf = g3d.zbuf;
var width = g3d.width;
var p = g3d.pixel;
var height = g3d.height;
var tlog = g3d.translucencyLog;
if (jmolRenderer != null || (x < 0 || x + textWidth > width || y < 0 || y + textHeight > height)) {
if (jmolRenderer == null) jmolRenderer = g3d;
for (var i = 0, offset = 0; i < textHeight; i++) for (var j = 0; j < textWidth; j++) jmolRenderer.plotImagePixel (buffer[offset++], x + j, y + i, z, 8, bgcolor, width, height, zbuf, p, tlog);


} else {
for (var i = 0, offset = 0, pbufOffset = y * width + x; i < textHeight; i++, pbufOffset += (width - textWidth)) {
for (var j = 0; j < textWidth; j++, pbufOffset++) if (z < zbuf[pbufOffset]) p.addPixel (pbufOffset, z, buffer[offset++]);

}
}}, "~N,~N,~N,~O,J.g3d.Graphics3D,J.api.JmolRendererInterface,~B,~N,~N,~N");
Clazz_declarePackage ("J.g3d");
Clazz_load (["java.util.Hashtable"], "J.g3d.LineRenderer", ["java.lang.Float", "JU.BS"], function () {
c$ = Clazz_decorateAsClass (function () {
this.g3d = null;
this.shader = null;
this.lineBits = null;
this.slope = 0;
this.lineTypeX = false;
this.nBits = 0;
this.lineCache = null;
this.slopeKey = null;
this.x1t = 0;
this.y1t = 0;
this.z1t = 0;
this.x2t = 0;
this.y2t = 0;
this.z2t = 0;
this.cc1 = 0;
this.cc2 = 0;
Clazz_instantialize (this, arguments);
}, J.g3d, "LineRenderer");
Clazz_prepareFields (c$, function () {
this.lineCache =  new java.util.Hashtable ();
});
Clazz_makeConstructor (c$, 
function (g3d) {
this.g3d = g3d;
this.shader = g3d.shader;
}, "J.g3d.Graphics3D");
Clazz_defineMethod (c$, "setLineBits", 
function (dx, dy) {
this.slope = (dx != 0 ? dy / dx : dy >= 0 ? 3.4028235E38 : -3.4028235E38);
this.lineTypeX = (this.slope <= 1 && this.slope >= -1);
this.nBits = (this.lineTypeX ? this.g3d.width : this.g3d.height);
this.slopeKey = Float.$valueOf (this.slope);
if (this.lineCache.containsKey (this.slopeKey)) {
this.lineBits = this.lineCache.get (this.slopeKey);
return;
}this.lineBits = JU.BS.newN (this.nBits);
dy = Math.abs (dy);
dx = Math.abs (dx);
if (dy > dx) {
var t = dx;
dx = dy;
dy = t;
}var twoDError = 0;
var twoDx = dx + dx;
var twoDy = dy + dy;
for (var i = 0; i < this.nBits; i++) {
twoDError += twoDy;
if (twoDError > dx) {
this.lineBits.set (i);
twoDError -= twoDx;
}}
this.lineCache.put (this.slopeKey, this.lineBits);
}, "~N,~N");
Clazz_defineMethod (c$, "clearLineCache", 
function () {
this.lineCache.clear ();
});
Clazz_defineMethod (c$, "plotLine", 
function (argbA, argbB, xA, yA, zA, xB, yB, zB, clipped) {
this.x1t = xA;
this.x2t = xB;
this.y1t = yA;
this.y2t = yB;
this.z1t = zA;
this.z2t = zB;
if (clipped) switch (this.getTrimmedLine ()) {
case 0:
clipped = false;
break;
case 2:
return;
}
this.plotLineClipped (argbA, argbB, xA, yA, zA, xB - xA, yB - yA, zB - zA, clipped, 0, 0);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "plotLineDelta", 
function (argbA, argbB, xA, yA, zA, dxBA, dyBA, dzBA, clipped) {
this.x1t = xA;
this.x2t = xA + dxBA;
this.y1t = yA;
this.y2t = yA + dyBA;
this.z1t = zA;
this.z2t = zA + dzBA;
if (clipped) switch (this.getTrimmedLine ()) {
case 2:
return;
case 0:
clipped = false;
break;
}
this.plotLineClipped (argbA, argbB, xA, yA, zA, dxBA, dyBA, dzBA, clipped, 0, 0);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "plotLineDeltaA", 
function (shades1, shades2, shadeIndex, xA, yA, zA, dxBA, dyBA, dzBA, clipped) {
this.x1t = xA;
this.x2t = xA + dxBA;
this.y1t = yA;
this.y2t = yA + dyBA;
this.z1t = zA;
this.z2t = zA + dzBA;
if (clipped) switch (this.getTrimmedLine ()) {
case 2:
return;
case 0:
clipped = false;
}
this.plotLineClippedA (shades1, shades2, shadeIndex, xA, yA, zA, dxBA, dyBA, dzBA, clipped, 0, 0);
}, "~A,~A,~N,~N,~N,~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "plotLineDeltaBits", 
function (shades1, shades2, shadeIndex, xA, yA, zA, dxBA, dyBA, dzBA, clipped) {
this.x1t = xA;
this.x2t = xA + dxBA;
this.y1t = yA;
this.y2t = yA + dyBA;
this.z1t = zA;
this.z2t = zA + dzBA;
if (clipped && this.getTrimmedLine () == 2) return;
this.plotLineClippedBits (shades1, shades2, shadeIndex, xA, yA, zA, dxBA, dyBA, dzBA, 0, 0);
}, "~A,~A,~N,~N,~N,~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "plotDashedLine", 
function (argb, run, rise, xA, yA, zA, xB, yB, zB, clipped) {
this.x1t = xA;
this.x2t = xB;
this.y1t = yA;
this.y2t = yB;
this.z1t = zA;
this.z2t = zB;
if (clipped) switch (this.getTrimmedLine ()) {
case 2:
return;
case 0:
clipped = false;
break;
}
this.plotLineClipped (argb, argb, xA, yA, zA, xB - xA, yB - yA, zB - zA, clipped, run, rise);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "getTrimmedLine", 
 function () {
this.cc1 = this.g3d.clipCode3 (this.x1t, this.y1t, this.z1t);
this.cc2 = this.g3d.clipCode3 (this.x2t, this.y2t, this.z2t);
if ((this.cc1 | this.cc2) == 0) return 0;
var xLast = this.g3d.xLast;
var yLast = this.g3d.yLast;
var slab = this.g3d.slab;
var depth = this.g3d.depth;
do {
if ((this.cc1 & this.cc2) != 0) return 2;
var dx = this.x2t - this.x1t;
var dy = this.y2t - this.y1t;
var dz = this.z2t - this.z1t;
if (this.cc1 != 0) {
if ((this.cc1 & 8) != 0) {
this.y1t += Clazz_floatToInt ((-this.x1t * dy) / dx);
this.z1t += Clazz_floatToInt ((-this.x1t * dz) / dx);
this.x1t = 0;
} else if ((this.cc1 & 4) != 0) {
this.y1t += Clazz_floatToInt (((xLast - this.x1t) * dy) / dx);
this.z1t += Clazz_floatToInt (((xLast - this.x1t) * dz) / dx);
this.x1t = xLast;
} else if ((this.cc1 & 2) != 0) {
this.x1t += Clazz_floatToInt ((-this.y1t * dx) / dy);
this.z1t += Clazz_floatToInt ((-this.y1t * dz) / dy);
this.y1t = 0;
} else if ((this.cc1 & 1) != 0) {
this.x1t += Clazz_floatToInt (((yLast - this.y1t) * dx) / dy);
this.z1t += Clazz_floatToInt (((yLast - this.y1t) * dz) / dy);
this.y1t = yLast;
} else if ((this.cc1 & 32) != 0) {
this.x1t += Clazz_floatToInt (((slab - this.z1t) * dx) / dz);
this.y1t += Clazz_floatToInt (((slab - this.z1t) * dy) / dz);
this.z1t = slab;
} else {
this.x1t += Clazz_floatToInt (((depth - this.z1t) * dx) / dz);
this.y1t += Clazz_floatToInt (((depth - this.z1t) * dy) / dz);
this.z1t = depth;
}this.cc1 = this.g3d.clipCode3 (this.x1t, this.y1t, this.z1t);
} else {
if ((this.cc2 & 8) != 0) {
this.y2t += Clazz_floatToInt ((-this.x2t * dy) / dx);
this.z2t += Clazz_floatToInt ((-this.x2t * dz) / dx);
this.x2t = 0;
} else if ((this.cc2 & 4) != 0) {
this.y2t += Clazz_floatToInt (((xLast - this.x2t) * dy) / dx);
this.z2t += Clazz_floatToInt (((xLast - this.x2t) * dz) / dx);
this.x2t = xLast;
} else if ((this.cc2 & 2) != 0) {
this.x2t += Clazz_floatToInt ((-this.y2t * dx) / dy);
this.z2t += Clazz_floatToInt ((-this.y2t * dz) / dy);
this.y2t = 0;
} else if ((this.cc2 & 1) != 0) {
this.x2t += Clazz_floatToInt (((yLast - this.y2t) * dx) / dy);
this.z2t += Clazz_floatToInt (((yLast - this.y2t) * dz) / dy);
this.y2t = yLast;
} else if ((this.cc2 & 32) != 0) {
this.x2t += Clazz_floatToInt (((slab - this.z2t) * dx) / dz);
this.y2t += Clazz_floatToInt (((slab - this.z2t) * dy) / dz);
this.z2t = slab;
} else {
this.x2t += Clazz_floatToInt (((depth - this.z2t) * dx) / dz);
this.y2t += Clazz_floatToInt (((depth - this.z2t) * dy) / dz);
this.z2t = depth;
}this.cc2 = this.g3d.clipCode3 (this.x2t, this.y2t, this.z2t);
}} while ((this.cc1 | this.cc2) != 0);
return 1;
});
Clazz_defineMethod (c$, "plotLineClipped", 
 function (argb1, argb2, x, y, z, dx, dy, dz, clipped, run, rise) {
var zbuf = this.g3d.zbuf;
var width = this.g3d.width;
var runIndex = 0;
if (run == 0) {
rise = 2147483647;
run = 1;
}var offset = y * width + x;
var offsetMax = this.g3d.bufferSize;
var argb = argb1;
var p = this.g3d.pixel;
if (argb != 0 && !clipped && offset >= 0 && offset < offsetMax && z < zbuf[offset]) {
p.addPixel (offset, z, argb);
}if (dx == 0 && dy == 0) {
return;
}var xIncrement = 1;
var yOffsetIncrement = width;
var x2 = x + dx;
var y2 = y + dy;
if (dx < 0) {
dx = -dx;
xIncrement = -1;
}if (dy < 0) {
dy = -dy;
yOffsetIncrement = -width;
}var twoDx = dx + dx;
var twoDy = dy + dy;
var zCurrentScaled = z << 10;
if (dy <= dx) {
var roundingFactor = dx - 1;
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt (((dz << 10) + roundingFactor) / dx);
var twoDxAccumulatedYError = 0;
var n1 = Math.abs (x2 - this.x2t) - 1;
var n2 = Math.abs (x2 - this.x1t) - 1;
for (var n = dx - 1, nMid = Clazz_doubleToInt (n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argb2;
if (argb == 0) return;
}offset += xIncrement;
zCurrentScaled += zIncrementScaled;
twoDxAccumulatedYError += twoDy;
if (twoDxAccumulatedYError > dx) {
offset += yOffsetIncrement;
twoDxAccumulatedYError -= twoDx;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = zCurrentScaled >> 10;
if (zCurrent < zbuf[offset]) p.addPixel (offset, zCurrent, argb);
}runIndex = (runIndex + 1) % run;
}
} else {
var roundingFactor = dy - 1;
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt (((dz << 10) + roundingFactor) / dy);
var twoDyAccumulatedXError = 0;
var n1 = Math.abs (y2 - this.y2t) - 1;
var n2 = Math.abs (y2 - this.y1t) - 1;
for (var n = dy - 1, nMid = Clazz_doubleToInt (n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argb2;
if (argb == 0) return;
}offset += yOffsetIncrement;
zCurrentScaled += zIncrementScaled;
twoDyAccumulatedXError += twoDx;
if (twoDyAccumulatedXError > dy) {
offset += xIncrement;
twoDyAccumulatedXError -= twoDy;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = zCurrentScaled >> 10;
if (zCurrent < zbuf[offset]) p.addPixel (offset, zCurrent, argb);
}runIndex = (runIndex + 1) % run;
}
}}, "~N,~N,~N,~N,~N,~N,~N,~N,~B,~N,~N");
Clazz_defineMethod (c$, "plotLineClippedA", 
 function (shades1, shades2, shadeIndex, x, y, z, dx, dy, dz, clipped, run, rise) {
var zbuf = this.g3d.zbuf;
var width = this.g3d.width;
var runIndex = 0;
if (run == 0) {
rise = 2147483647;
run = 1;
}var offset = y * width + x;
var offsetMax = this.g3d.bufferSize;
var shadeIndexUp = (shadeIndex < 63 ? shadeIndex + 1 : shadeIndex);
var shadeIndexDn = (shadeIndex > 0 ? shadeIndex - 1 : shadeIndex);
var argb1 = shades1[shadeIndex];
var argb1Up = shades1[shadeIndexUp];
var argb1Dn = shades1[shadeIndexDn];
var argb2 = shades2[shadeIndex];
var argb2Up = shades2[shadeIndexUp];
var argb2Dn = shades2[shadeIndexDn];
var argb = argb1;
var p = this.g3d.pixel;
if (argb != 0 && !clipped && offset >= 0 && offset < offsetMax && z < zbuf[offset]) p.addPixel (offset, z, argb);
if (dx == 0 && dy == 0) {
return;
}var xIncrement = 1;
var yOffsetIncrement = width;
var x2 = x + dx;
var y2 = y + dy;
if (dx < 0) {
dx = -dx;
xIncrement = -1;
}if (dy < 0) {
dy = -dy;
yOffsetIncrement = -width;
}var twoDx = dx + dx;
var twoDy = dy + dy;
var zCurrentScaled = z << 10;
var argbUp = argb1Up;
var argbDn = argb1Dn;
if (dy <= dx) {
var roundingFactor = dx - 1;
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt (((dz << 10) + roundingFactor) / dx);
var twoDxAccumulatedYError = 0;
var n1 = Math.abs (x2 - this.x2t) - 1;
var n2 = Math.abs (x2 - this.x1t) - 1;
for (var n = dx - 1, nMid = Clazz_doubleToInt (n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argb2;
if (argb == 0) return;
argbUp = argb2Up;
argbDn = argb2Dn;
}offset += xIncrement;
zCurrentScaled += zIncrementScaled;
twoDxAccumulatedYError += twoDy;
if (twoDxAccumulatedYError > dx) {
offset += yOffsetIncrement;
twoDxAccumulatedYError -= twoDx;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = zCurrentScaled >> 10;
if (zCurrent < zbuf[offset]) {
var rand8 = this.shader.nextRandom8Bit ();
p.addPixel (offset, zCurrent, rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb));
}}runIndex = (runIndex + 1) % run;
}
} else {
var roundingFactor = dy - 1;
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt (((dz << 10) + roundingFactor) / dy);
var twoDyAccumulatedXError = 0;
var n1 = Math.abs (y2 - this.y2t) - 1;
var n2 = Math.abs (y2 - this.y1t) - 1;
for (var n = dy - 1, nMid = Clazz_doubleToInt (n / 2); --n >= n1; ) {
if (n == nMid) {
argb = argb2;
if (argb == 0) return;
argbUp = argb2Up;
argbDn = argb2Dn;
}offset += yOffsetIncrement;
zCurrentScaled += zIncrementScaled;
twoDyAccumulatedXError += twoDx;
if (twoDyAccumulatedXError > dy) {
offset += xIncrement;
twoDyAccumulatedXError -= twoDy;
}if (argb != 0 && n < n2 && offset >= 0 && offset < offsetMax && runIndex < rise) {
var zCurrent = zCurrentScaled >> 10;
if (zCurrent < zbuf[offset]) {
var rand8 = this.g3d.shader.nextRandom8Bit ();
p.addPixel (offset, zCurrent, rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb));
}}runIndex = (runIndex + 1) % run;
}
}}, "~A,~A,~N,~N,~N,~N,~N,~N,~N,~B,~N,~N");
Clazz_defineMethod (c$, "plotLineClippedBits", 
 function (shades1, shades2, shadeIndex, x, y, z, dx, dy, dz, run, rise) {
var zbuf = this.g3d.zbuf;
var width = this.g3d.width;
var runIndex = 0;
if (run == 0) {
rise = 2147483647;
run = 1;
}var shadeIndexUp = (shadeIndex < 63 ? shadeIndex + 1 : shadeIndex);
var shadeIndexDn = (shadeIndex > 0 ? shadeIndex - 1 : shadeIndex);
var argb1 = shades1[shadeIndex];
var argb1Up = shades1[shadeIndexUp];
var argb1Dn = shades1[shadeIndexDn];
var argb2 = shades2[shadeIndex];
var argb2Up = shades2[shadeIndexUp];
var argb2Dn = shades2[shadeIndexDn];
var offset = y * width + x;
var offsetMax = this.g3d.bufferSize;
var i0;
var iMid;
var i1;
var i2;
var iIncrement;
var xIncrement;
var yIncrement;
var zIncrement;
if (this.lineTypeX) {
i0 = x;
i1 = this.x1t;
i2 = this.x2t;
iMid = x + Clazz_doubleToInt (dx / 2);
iIncrement = (dx >= 0 ? 1 : -1);
xIncrement = iIncrement;
yIncrement = (dy >= 0 ? width : -width);
zIncrement = dz / Math.abs (dx);
} else {
i0 = y;
i1 = this.y1t;
i2 = this.y2t;
iMid = y + Clazz_doubleToInt (dy / 2);
iIncrement = (dy >= 0 ? 1 : -1);
xIncrement = (dy >= 0 ? width : -width);
yIncrement = (dx >= 0 ? 1 : -1);
zIncrement = dz / Math.abs (dy);
}var zFloat = z;
var argb = argb1;
var argbUp = argb1Up;
var argbDn = argb1Dn;
var isInWindow = false;
var p = this.g3d.pixel;
for (var i = i0, iBits = i0; ; i += iIncrement, iBits += iIncrement) {
if (i == i1) isInWindow = true;
if (i == iMid) {
argb = argb2;
if (argb == 0) return;
argbUp = argb2Up;
argbDn = argb2Dn;
}if (argb != 0 && isInWindow && offset >= 0 && offset < offsetMax && runIndex < rise) {
if (zFloat < zbuf[offset]) {
var rand8 = this.shader.nextRandom8Bit ();
p.addPixel (offset, Clazz_floatToInt (zFloat), rand8 < 85 ? argbDn : (rand8 > 170 ? argbUp : argb));
}}if (i == i2) break;
runIndex = (runIndex + 1) % run;
offset += xIncrement;
while (iBits < 0) iBits += this.nBits;

if (this.lineBits.get (iBits % this.nBits)) offset += yIncrement;
zFloat += zIncrement;
}
}, "~A,~A,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineStatics (c$,
"VISIBILITY_UNCLIPPED", 0,
"VISIBILITY_CLIPPED", 1,
"VISIBILITY_OFFSCREEN", 2);
});
Clazz_declarePackage ("J.g3d");
Clazz_load (null, "J.g3d.Pixelator", ["J.g3d.Graphics3D"], function () {
c$ = Clazz_decorateAsClass (function () {
this.g = null;
Clazz_instantialize (this, arguments);
}, J.g3d, "Pixelator");
Clazz_makeConstructor (c$, 
function (graphics3d) {
this.g = graphics3d;
}, "J.g3d.Graphics3D");
Clazz_defineMethod (c$, "clearPixel", 
function (offset, z) {
if (!this.g.isPass2 && this.g.zbuf[offset] > z) this.g.zbuf[offset] = 2147483647;
}, "~N,~N");
Clazz_defineMethod (c$, "addPixel", 
function (offset, z, p) {
this.addPixel1 (offset, z, p);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "addPixel1", 
function (offset, z, p) {
if (!this.g.isPass2) {
this.g.zbuf[offset] = z;
this.g.pbuf[offset] = p;
return;
}var zT = this.g.zbufT[offset];
if (z < zT) {
var argb = this.g.pbufT[offset];
if (!this.g.translucentCoverOnly && argb != 0 && zT - z > this.g.zMargin) J.g3d.Graphics3D.mergeBufferPixel (this.g.pbuf, offset, argb, this.g.bgcolor);
this.g.zbufT[offset] = z;
this.g.pbufT[offset] = p & this.g.translucencyMask;
} else if (z == zT) {
} else if (!this.g.translucentCoverOnly && z - zT > this.g.zMargin) {
J.g3d.Graphics3D.mergeBufferPixel (this.g.pbuf, offset, p & this.g.translucencyMask, this.g.bgcolor);
}}, "~N,~N,~N");
});
Clazz_declarePackage ("J.g3d");
Clazz_load (["J.g3d.Pixelator"], "J.g3d.PixelatorShaded", null, function () {
c$ = Clazz_declareType (J.g3d, "PixelatorShaded", J.g3d.Pixelator);
Clazz_overrideMethod (c$, "addPixel", 
function (offset, z, p) {
if (z > this.g.zDepth) return;
if (z <= this.g.zDepth && z >= this.g.zSlab) {
var pR = p & 0xFF;
var pG = (p & 0xFF00) >> 8;
var pB = (p & 0xFF0000) >> 16;
var pA = (p & 0xFF000000);
var f = (this.g.zDepth - z) / (this.g.zDepth - this.g.zSlab);
if (this.g.zShadePower > 1) {
for (var i = 0; i < this.g.zShadePower; i++) f *= f;

}pR = this.g.zShadeR + Clazz_floatToInt (f * (pR - this.g.zShadeR));
pG = this.g.zShadeG + Clazz_floatToInt (f * (pG - this.g.zShadeG));
pB = this.g.zShadeB + Clazz_floatToInt (f * (pB - this.g.zShadeB));
p = (pB << 16) | (pG << 8) | pR | pA;
}this.addPixel1 (offset, z, p);
}, "~N,~N,~N");
});
Clazz_declarePackage ("J.g3d");
c$ = Clazz_decorateAsClass (function () {
this.windowWidth = 0;
this.windowHeight = 0;
this.windowSize = 0;
this.bufferWidth = 0;
this.bufferHeight = 0;
this.bufferSize = 0;
this.bufferSizeT = 0;
this.bufferedImage = null;
this.pBuffer = null;
this.pBufferT = null;
this.zBuffer = null;
this.zBufferT = null;
this.widthOffscreen = 0;
this.heightOffscreen = 0;
this.offscreenImage = null;
this.graphicsForTextOrImage = null;
this.apiPlatform = null;
Clazz_instantialize (this, arguments);
}, J.g3d, "Platform3D");
Clazz_makeConstructor (c$, 
function (apiPlatform) {
this.apiPlatform = apiPlatform;
}, "javajs.api.GenericPlatform");
Clazz_defineMethod (c$, "getGraphicsForMetrics", 
function () {
return this.apiPlatform.getGraphics (this.allocateOffscreenImage (1, 1));
});
Clazz_defineMethod (c$, "allocateTBuffers", 
function (antialiasTranslucent) {
this.bufferSizeT = (antialiasTranslucent ? this.bufferSize : this.windowSize);
this.zBufferT =  Clazz_newIntArray (this.bufferSizeT, 0);
this.pBufferT =  Clazz_newIntArray (this.bufferSizeT, 0);
}, "~B");
Clazz_defineMethod (c$, "allocateBuffers", 
function (width, height, antialias, isImageWrite) {
this.windowWidth = width;
this.windowHeight = height;
this.windowSize = width * height;
if (antialias) {
width *= 2;
height *= 2;
}this.bufferWidth = width;
this.bufferHeight = height;
this.bufferSize = this.bufferWidth * this.bufferHeight;
this.zBuffer =  Clazz_newIntArray (this.bufferSize, 0);
this.pBuffer =  Clazz_newIntArray (this.bufferSize, 0);
this.bufferedImage = this.apiPlatform.allocateRgbImage (this.windowWidth, this.windowHeight, this.pBuffer, this.windowSize, J.g3d.Platform3D.backgroundTransparent, isImageWrite);
}, "~N,~N,~B,~B");
Clazz_defineMethod (c$, "releaseBuffers", 
function () {
this.windowWidth = this.windowHeight = this.bufferWidth = this.bufferHeight = this.bufferSize = -1;
if (this.bufferedImage != null) {
this.apiPlatform.flushImage (this.bufferedImage);
this.bufferedImage = null;
}this.pBuffer = null;
this.zBuffer = null;
this.pBufferT = null;
this.zBufferT = null;
});
Clazz_defineMethod (c$, "hasContent", 
function () {
for (var i = this.bufferSize; --i >= 0; ) if (this.zBuffer[i] != 2147483647) return true;

return false;
});
Clazz_defineMethod (c$, "clearScreenBuffer", 
function () {
for (var i = this.bufferSize; --i >= 0; ) {
this.zBuffer[i] = 2147483647;
this.pBuffer[i] = 0;
}
});
Clazz_defineMethod (c$, "setBackgroundColor", 
function (bgColor) {
if (this.pBuffer == null) return;
for (var i = this.bufferSize; --i >= 0; ) if (this.pBuffer[i] == 0) this.pBuffer[i] = bgColor;

}, "~N");
Clazz_defineMethod (c$, "clearTBuffer", 
function () {
for (var i = this.bufferSizeT; --i >= 0; ) {
this.zBufferT[i] = 2147483647;
this.pBufferT[i] = 0;
}
});
Clazz_defineMethod (c$, "clearBuffer", 
function () {
this.clearScreenBuffer ();
});
Clazz_defineMethod (c$, "clearScreenBufferThreaded", 
function () {
});
Clazz_defineMethod (c$, "notifyEndOfRendering", 
function () {
this.apiPlatform.notifyEndOfRendering ();
});
Clazz_defineMethod (c$, "getGraphicsForTextOrImage", 
function (width, height) {
if (width > this.widthOffscreen || height > this.heightOffscreen) {
if (this.offscreenImage != null) {
this.apiPlatform.disposeGraphics (this.graphicsForTextOrImage);
this.apiPlatform.flushImage (this.offscreenImage);
}if (width > this.widthOffscreen) this.widthOffscreen = width;
if (height > this.heightOffscreen) this.heightOffscreen = height;
this.offscreenImage = this.allocateOffscreenImage (this.widthOffscreen, this.heightOffscreen);
this.graphicsForTextOrImage = this.apiPlatform.getStaticGraphics (this.offscreenImage, J.g3d.Platform3D.backgroundTransparent);
}return this.graphicsForTextOrImage;
}, "~N,~N");
Clazz_defineMethod (c$, "allocateOffscreenImage", 
 function (width, height) {
return this.apiPlatform.newOffScreenImage (width, height);
}, "~N,~N");
Clazz_defineMethod (c$, "setBackgroundTransparent", 
function (tf) {
J.g3d.Platform3D.backgroundTransparent = tf;
}, "~B");
Clazz_defineStatics (c$,
"backgroundTransparent", false);
Clazz_declarePackage ("J.g3d");
Clazz_load (["JU.P3"], "J.g3d.SphereRenderer", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.g3d = null;
this.shader = null;
this.minX = 0;
this.maxX = 0;
this.minY = 0;
this.maxY = 0;
this.minZ = 0;
this.maxZ = 0;
this.x = 0;
this.y = 0;
this.z = 0;
this.diameter = 0;
this.shades = null;
this.zroot = null;
this.mat = null;
this.coef = null;
this.mDeriv = null;
this.selectedOctant = 0;
this.planeShade = 0;
this.zbuf = null;
this.width = 0;
this.height = 0;
this.depth = 0;
this.slab = 0;
this.offsetPbufBeginLine = 0;
this.ptTemp = null;
this.planeShades = null;
this.dxyz = null;
Clazz_instantialize (this, arguments);
}, J.g3d, "SphereRenderer");
Clazz_prepareFields (c$, function () {
this.zroot =  Clazz_newDoubleArray (2, 0);
this.ptTemp =  new JU.P3 ();
this.planeShades =  Clazz_newIntArray (3, 0);
this.dxyz =  Clazz_newFloatArray (3, 3, 0);
});
Clazz_makeConstructor (c$, 
function (g3d) {
this.g3d = g3d;
this.shader = g3d.shader;
}, "J.g3d.Graphics3D");
Clazz_defineMethod (c$, "render", 
function (shades, diameter, x, y, z, mat, coef, mDeriv, selectedOctant, octantPoints) {
if (z == 1) return;
if (diameter > 49) diameter &= -2;
if (this.g3d.isClippedXY (diameter, x, y)) return;
this.slab = this.g3d.slab;
this.depth = this.g3d.depth;
var radius = (diameter + 1) >> 1;
if ((this.maxZ = z + radius) < this.slab || (this.minZ = z - radius) > this.depth) return;
this.minX = x - radius;
this.maxX = x + radius;
this.minY = y - radius;
this.maxY = y + radius;
this.shader.nOut = this.shader.nIn = 0;
this.zbuf = this.g3d.zbuf;
this.height = this.g3d.height;
this.width = this.g3d.width;
this.offsetPbufBeginLine = this.width * y + x;
this.x = x;
this.y = y;
this.z = z;
this.diameter = diameter;
this.shades = shades;
var sh = this.shader;
this.mat = mat;
if (mat != null) {
this.coef = coef;
this.mDeriv = mDeriv;
this.selectedOctant = selectedOctant;
if (sh.ellipsoidShades == null) sh.createEllipsoidShades ();
if (octantPoints != null) {
this.planeShade = -1;
for (var i = 0; i < 3; i++) {
var dx = this.dxyz[i][0] = octantPoints[i].x - x;
var dy = this.dxyz[i][1] = octantPoints[i].y - y;
var dz = this.dxyz[i][2] = octantPoints[i].z - z;
this.planeShades[i] = sh.getShadeIndex (dx, dy, -dz);
if (dx == 0 && dy == 0) {
this.planeShade = this.planeShades[i];
break;
}}
}}if (mat != null || diameter > 128) {
this.renderQuadrant (-1, -1);
this.renderQuadrant (-1, 1);
this.renderQuadrant (1, -1);
this.renderQuadrant (1, 1);
if (mat != null) {
this.mat = null;
this.coef = null;
this.mDeriv = null;
}} else {
var ss = sh.sphereShapeCache[diameter - 1];
if (ss == null) {
var countSE = 0;
var d = (diameter & 1) != 0;
var radiusF = diameter / 2.0;
var radiusF2 = radiusF * radiusF;
radius = Clazz_doubleToInt ((diameter + 1) / 2);
var ys = d ? 0 : 0.5;
for (var i = 0; i < radius; ++i, ++ys) {
var y2 = ys * ys;
var xs = d ? 0 : 0.5;
for (var j = 0; j < radius; ++j, ++xs) {
var x2 = xs * xs;
var z2 = radiusF2 - y2 - x2;
if (z2 >= 0) ++countSE;
}
}
ss =  Clazz_newIntArray (countSE, 0);
var offset = 0;
ys = d ? 0 : 0.5;
for (var i = 0; i < radius; ++i, ++ys) {
var y2 = ys * ys;
var xs = d ? 0 : 0.5;
for (var j = 0; j < radius; ++j, ++xs) {
var x2 = xs * xs;
var z2 = radiusF2 - y2 - x2;
if (z2 >= 0) {
var zs = Math.sqrt (z2);
var height = Clazz_floatToInt (zs);
var shadeIndexSE = sh.getShadeN (xs, ys, zs, radiusF);
var shadeIndexSW = sh.getShadeN (-xs, ys, zs, radiusF);
var shadeIndexNE = sh.getShadeN (xs, -ys, zs, radiusF);
var shadeIndexNW = sh.getShadeN (-xs, -ys, zs, radiusF);
var packed = (height | (shadeIndexSE << 7) | (shadeIndexSW << 13) | (shadeIndexNE << 19) | (shadeIndexNW << 25));
ss[offset++] = packed;
}}
ss[offset - 1] |= 0x80000000;
}
sh.sphereShapeCache[diameter - 1] = ss;
}if (this.minX < 0 || this.maxX >= this.width || this.minY < 0 || this.maxY >= this.height || this.minZ < this.slab || z > this.depth) this.renderSphereClipped (ss, x, y, z, diameter);
 else this.renderSphereUnclipped (ss, z, diameter);
}this.shades = null;
this.zbuf = null;
}, "~A,~N,~N,~N,~N,JU.M3,~A,JU.M4,~N,~A");
Clazz_defineMethod (c$, "renderSphereUnclipped", 
 function (sphereShape, z, diameter) {
var offsetSphere = 0;
var evenSizeCorrection = 1 - (diameter & 1);
var offsetSouthCenter = this.offsetPbufBeginLine;
var offsetNorthCenter = offsetSouthCenter - evenSizeCorrection * this.width;
var nLines = Clazz_doubleToInt ((diameter + 1) / 2);
var shades = this.shades;
var zbuf = this.zbuf;
var width = this.width;
var p = this.g3d.pixel;
do {
var offsetSE = offsetSouthCenter;
var offsetSW = offsetSouthCenter - evenSizeCorrection;
var offsetNE = offsetNorthCenter;
var offsetNW = offsetNorthCenter - evenSizeCorrection;
var packed;
do {
packed = sphereShape[offsetSphere++];
var zPixel = z - (packed & 0x7F);
if (zPixel < zbuf[offsetSE]) p.addPixel (offsetSE, zPixel, shades[((packed >> 7) & 0x3F)]);
if (zPixel < zbuf[offsetSW]) p.addPixel (offsetSW, zPixel, shades[((packed >> 13) & 0x3F)]);
if (zPixel < zbuf[offsetNE]) p.addPixel (offsetNE, zPixel, shades[((packed >> 19) & 0x3F)]);
if (zPixel < zbuf[offsetNW]) p.addPixel (offsetNW, zPixel, shades[((packed >> 25) & 0x3F)]);
++offsetSE;
--offsetSW;
++offsetNE;
--offsetNW;
} while (packed >= 0);
offsetSouthCenter += width;
offsetNorthCenter -= width;
} while (--nLines > 0);
}, "~A,~N,~N");
Clazz_defineMethod (c$, "renderSphereClipped", 
 function (sphereShape, x, y, z, diameter) {
var w = this.width;
var h = this.height;
var offsetSphere = 0;
var evenSizeCorrection = 1 - (diameter & 1);
var offsetSouthCenter = this.offsetPbufBeginLine;
var offsetNorthCenter = offsetSouthCenter - evenSizeCorrection * w;
var nLines = Clazz_doubleToInt ((diameter + 1) / 2);
var ySouth = y;
var yNorth = y - evenSizeCorrection;
var randu = (x << 16) + (y << 1) ^ 0x33333333;
var sh = this.shades;
var zb = this.zbuf;
var p = this.g3d.pixel;
var sl = this.slab;
var de = this.depth;
do {
var tSouthVisible = ySouth >= 0 && ySouth < h;
var tNorthVisible = yNorth >= 0 && yNorth < h;
var offsetSE = offsetSouthCenter;
var offsetSW = offsetSouthCenter - evenSizeCorrection;
var offsetNE = offsetNorthCenter;
var offsetNW = offsetNorthCenter - evenSizeCorrection;
var packed;
var xEast = x;
var xWest = x - evenSizeCorrection;
do {
var tWestVisible = xWest >= 0 && xWest < w;
var tEastVisible = xEast >= 0 && xEast < w;
packed = sphereShape[offsetSphere++];
var isCore;
var zOffset = packed & 0x7F;
var zPixel;
if (z < sl) {
zPixel = z + zOffset;
isCore = (zPixel >= sl);
} else {
zPixel = z - zOffset;
isCore = (zPixel < sl);
}if (isCore) zPixel = sl;
if (zPixel >= sl && zPixel <= de) {
if (tSouthVisible) {
if (tEastVisible && zPixel < zb[offsetSE]) {
var i = (isCore ? 44 + ((randu >> 7) & 0x07) : (packed >> 7) & 0x3F);
p.addPixel (offsetSE, zPixel, sh[i]);
}if (tWestVisible && zPixel < zb[offsetSW]) {
var i = (isCore ? 44 + ((randu >> 13) & 0x07) : (packed >> 13) & 0x3F);
p.addPixel (offsetSW, zPixel, sh[i]);
}}if (tNorthVisible) {
if (tEastVisible && zPixel < zb[offsetNE]) {
var i = (isCore ? 44 + ((randu >> 19) & 0x07) : (packed >> 19) & 0x3F);
p.addPixel (offsetNE, zPixel, sh[i]);
}if (tWestVisible && zPixel < zb[offsetNW]) {
var i = (isCore ? 44 + ((randu >> 25) & 0x07) : (packed >> 25) & 0x3F);
p.addPixel (offsetNW, zPixel, sh[i]);
}}}++offsetSE;
--offsetSW;
++offsetNE;
--offsetNW;
++xEast;
--xWest;
if (isCore) randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF;
} while (packed >= 0);
offsetSouthCenter += w;
offsetNorthCenter -= w;
++ySouth;
--yNorth;
} while (--nLines > 0);
}, "~A,~N,~N,~N,~N");
Clazz_defineMethod (c$, "renderQuadrant", 
 function (xSign, ySign) {
var radius = Clazz_doubleToInt (this.diameter / 2);
var t = this.x + radius * xSign;
var xStatus = (this.x < 0 ? -1 : this.x < this.width ? 0 : 1) + (t < 0 ? -2 : t < this.width ? 0 : 2);
if (xStatus == -3 || xStatus == 3) return;
t = this.y + radius * ySign;
var yStatus = (this.y < 0 ? -1 : this.y < this.height ? 0 : 1) + (t < 0 ? -2 : t < this.height ? 0 : 2);
if (yStatus == -3 || yStatus == 3) return;
var unclipped = (this.mat == null && xStatus == 0 && yStatus == 0 && this.z - radius >= this.slab && this.z <= this.depth);
if (unclipped) this.renderQuadrantUnclipped (radius, xSign, ySign);
 else this.renderQuadrantClipped (radius, xSign, ySign);
}, "~N,~N");
Clazz_defineMethod (c$, "renderQuadrantUnclipped", 
 function (radius, xSign, ySign) {
var r2 = radius * radius;
var dDivisor = radius * 2 + 1;
var lineIncrement = (ySign < 0 ? -this.width : this.width);
var ptLine = this.offsetPbufBeginLine;
var zb = this.zbuf;
var p = this.g3d.pixel;
var indexes = this.shader.sphereShadeIndexes;
var s = this.shades;
for (var i = 0, i2 = 0; i2 <= r2; i2 += i + (++i), ptLine += lineIncrement) {
var offset = ptLine;
var s2 = r2 - i2;
var z0 = this.z - radius;
var y8 = Clazz_doubleToInt (((i * ySign + radius) << 8) / dDivisor);
for (var j = 0, j2 = 0; j2 <= s2; j2 += j + (++j), offset += xSign) {
if (zb[offset] <= z0) continue;
var k = Clazz_doubleToInt (Math.sqrt (s2 - j2));
z0 = this.z - k;
if (zb[offset] <= z0) continue;
var x8 = Clazz_doubleToInt (((j * xSign + radius) << 8) / dDivisor);
p.addPixel (offset, z0, s[indexes[((y8 << 8) + x8)]]);
}
}
}, "~N,~N,~N");
Clazz_defineMethod (c$, "renderQuadrantClipped", 
 function (radius, xSign, ySign) {
var isEllipsoid = (this.mat != null);
var checkOctant = (this.selectedOctant >= 0);
var r2 = radius * radius;
var dDivisor = radius * 2 + 1;
var lineIncrement = (ySign < 0 ? -this.width : this.width);
var ptLine = this.offsetPbufBeginLine;
var randu = (this.x << 16) + (this.y << 1) ^ 0x33333333;
var yC = this.y;
var y8 = 0;
var iShade = 0;
var p = this.g3d.pixel;
var z1 = 0;
var h = this.height;
var w = this.width;
var x0 = this.x;
var zb = this.zbuf;
var xyz = this.dxyz;
var y0 = this.y;
var z0 = this.z;
var sl = this.slab;
var de = this.depth;
var pt = this.ptTemp;
var c = this.coef;
var rt = this.zroot;
var oct = this.selectedOctant;
var s = this.shader;
var ss = this.shades;
var pl = this.planeShades;
var indexes = s.sphereShadeIndexes;
var ps = this.planeShade;
var m = this.mat;
for (var i = 0, i2 = 0; i2 <= r2; i2 += i + (++i), ptLine += lineIncrement, yC += ySign) {
if (yC < 0) {
if (ySign < 0) return;
continue;
}if (yC >= h) {
if (ySign > 0) return;
continue;
}var s2 = r2 - (isEllipsoid ? 0 : i2);
var xC = x0;
if (!isEllipsoid) {
y8 = Clazz_doubleToInt (((i * ySign + radius) << 8) / dDivisor);
}randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF;
var iRoot = -1;
var mode = 1;
var offset = ptLine;
for (var j = 0, j2 = 0; j2 <= s2; j2 += j + (++j), offset += xSign, xC += xSign) {
if (xC < 0) {
if (xSign < 0) break;
continue;
}if (xC >= w) {
if (xSign > 0) break;
continue;
}var zPixel;
if (isEllipsoid) {
var b_2a = (c[4] * xC + c[5] * yC + c[8]) / c[2] / 2;
var c_a = (c[0] * xC * xC + c[1] * yC * yC + c[3] * xC * yC + c[6] * xC + c[7] * yC - 1) / c[2];
var f = b_2a * b_2a - c_a;
if (f < 0) {
if (iRoot >= 0) {
break;
}continue;
}f = Math.sqrt (f);
rt[0] = (-b_2a - f);
rt[1] = (-b_2a + f);
iRoot = (z0 < sl ? 1 : 0);
if ((zPixel = Clazz_doubleToInt (rt[iRoot])) == 0) zPixel = z0;
mode = 2;
z1 = zPixel;
if (checkOctant) {
pt.set (xC - x0, yC - y0, zPixel - z0);
m.rotate (pt);
var thisOctant = 0;
if (pt.x < 0) thisOctant |= 1;
if (pt.y < 0) thisOctant |= 2;
if (pt.z < 0) thisOctant |= 4;
if (thisOctant == oct) {
if (ps >= 0) {
iShade = ps;
} else {
var iMin = 3;
var dz;
var zMin = 3.4028235E38;
for (var ii = 0; ii < 3; ii++) {
if ((dz = xyz[ii][2]) == 0) continue;
var ptz = z0 + (-xyz[ii][0] * (xC - this.x) - xyz[ii][1] * (yC - y0)) / dz;
if (ptz < zMin) {
zMin = ptz;
iMin = ii;
}}
if (iMin == 3) {
iMin = 0;
zMin = z0;
}rt[0] = zMin;
iShade = pl[iMin];
}zPixel = Clazz_doubleToInt (rt[0]);
mode = 3;
}var isCore = (z0 < sl ? zPixel >= sl : zPixel < sl);
if (isCore) {
z1 = zPixel = sl;
mode = 0;
}}if (zPixel < sl || zPixel > de || zb[offset] <= z1) continue;
} else {
var zOffset = Clazz_doubleToInt (Math.sqrt (s2 - j2));
zPixel = z0 + (z0 < sl ? zOffset : -zOffset);
var isCore = (z0 < sl ? zPixel >= sl : zPixel < sl);
if (isCore) {
zPixel = sl;
mode = 0;
}if (zPixel < sl || zPixel > de || zb[offset] <= zPixel) continue;
}switch (mode) {
case 0:
iShade = (44 + ((randu >> 8) & 0x07));
randu = ((randu << 16) + (randu << 1) + randu) & 0x7FFFFFFF;
mode = 1;
break;
case 2:
iShade = s.getEllipsoidShade (xC, yC, rt[iRoot], radius, this.mDeriv);
break;
case 3:
p.clearPixel (offset, z1);
break;
default:
var x8 = Clazz_doubleToInt (((j * xSign + radius) << 8) / dDivisor);
iShade = indexes[(y8 << 8) + x8];
break;
}
p.addPixel (offset, zPixel, ss[iShade]);
}
randu = ((randu + xC + yC) | 1) & 0x7FFFFFFF;
}
}, "~N,~N,~N");
Clazz_defineStatics (c$,
"maxOddSizeSphere", 49,
"maxSphereDiameter", 1000,
"maxSphereDiameter2", 2000,
"SHADE_SLAB_CLIPPED", 47);
});
Clazz_declarePackage ("J.g3d");
Clazz_load (["java.util.Hashtable"], "J.g3d.TextRenderer", ["JU.CU"], function () {
c$ = Clazz_decorateAsClass (function () {
this.height = 0;
this.ascent = 0;
this.width = 0;
this.mapWidth = 0;
this.size = 0;
this.tmap = null;
this.isInvalid = false;
Clazz_instantialize (this, arguments);
}, J.g3d, "TextRenderer");
c$.clearFontCache = Clazz_defineMethod (c$, "clearFontCache", 
function () {
if (J.g3d.TextRenderer.working) return;
J.g3d.TextRenderer.htFont3d.clear ();
J.g3d.TextRenderer.htFont3dAntialias.clear ();
});
c$.plot = Clazz_defineMethod (c$, "plot", 
function (x, y, z, argb, bgargb, text, font3d, g3d, jr, antialias) {
if (text.length == 0) return 0;
if (text.indexOf ("<su") >= 0 || text.indexOf ("<color") >= 0) return J.g3d.TextRenderer.plotByCharacter (x, y, z, argb, bgargb, text, font3d, g3d, jr, antialias);
var offset = font3d.getAscent ();
y -= offset;
var text3d = J.g3d.TextRenderer.getPlotText3D (x, y, g3d, text, font3d, antialias);
if (text3d.isInvalid) return text3d.width;
if (antialias && (argb & 0xC0C0C0) == 0) {
argb = argb | 0x040404;
}var textHeight = text3d.height;
var textWidth = text3d.width;
var tmap = text3d.tmap;
var g = g3d;
var width = g.width;
var height = g.height;
var zbuf = g.zbuf;
var p = g.pixel;
var tLog = g.translucencyLog;
if (jr != null || (x < 0 || x + text3d.width > width || y < 0 || y + text3d.height > height) && (jr = g3d) != null) {
for (var off = 0, i = 0; i < textHeight; i++) {
for (var j = 0; j < textWidth; j++) {
var shade = tmap[off++];
if (shade != 0) jr.plotImagePixel (argb, x + j, y + i, z, shade, bgargb, width, height, zbuf, p, tLog);
}
}
} else {
var pbufOffset = y * width + x;
for (var i = 0, off = 0; i < textHeight; i++) {
for (var j = 0; j < textWidth; j++) {
var shade = tmap[off++];
if (shade != 0 && z < zbuf[pbufOffset]) {
if (shade == 8) {
p.addPixel (pbufOffset, z, argb);
} else {
shade += tLog;
if (shade <= 7) g3d.shadeTextPixel (pbufOffset, z, argb, bgargb, shade, zbuf);
}}pbufOffset++;
}
pbufOffset += (width - textWidth);
}
}return text3d.width;
}, "~N,~N,~N,~N,~N,~S,javajs.awt.Font,J.g3d.Graphics3D,J.api.JmolRendererInterface,~B");
c$.plotByCharacter = Clazz_defineMethod (c$, "plotByCharacter", 
 function (x, y, z, argb, bgargb, text, font3d, g3d, jmolRenderer, antialias) {
var w = 0;
var len = text.length;
var suboffset = Math.round (font3d.getHeight () * 0.25);
var supoffset = -Math.round (font3d.getHeight () * 0.3);
var argb0 = 0;
for (var i = 0; i < len; i++) {
if (text.charAt (i) == '<') {
if (i + 5 < len && text.substring (i, i + 6).equals ("<color")) {
argb0 = argb;
var pt = text.indexOf (">", i);
if (pt < 0) continue;
argb = JU.CU.getArgbFromString (text.substring (i + 7, pt).trim ());
i = pt;
continue;
}if (i + 7 < len && text.substring (i, i + 8).equals ("</color>")) {
i += 7;
argb = argb0;
continue;
}if (i + 4 < len && text.substring (i, i + 5).equals ("<sub>")) {
i += 4;
y += suboffset;
continue;
}if (i + 4 < len && text.substring (i, i + 5).equals ("<sup>")) {
i += 4;
y += supoffset;
continue;
}if (i + 5 < len && text.substring (i, i + 6).equals ("</sub>")) {
i += 5;
y -= suboffset;
continue;
}if (i + 5 < len && text.substring (i, i + 6).equals ("</sup>")) {
i += 5;
y -= supoffset;
continue;
}}var width = J.g3d.TextRenderer.plot (x + w, y, z, argb, bgargb, text.substring (i, i + 1), font3d, g3d, jmolRenderer, antialias);
w += width;
}
return w;
}, "~N,~N,~N,~N,~N,~S,javajs.awt.Font,J.g3d.Graphics3D,J.api.JmolRendererInterface,~B");
Clazz_makeConstructor (c$, 
 function (text, font3d) {
this.ascent = font3d.getAscent ();
this.height = font3d.getHeight ();
this.width = font3d.stringWidth (text);
if (this.width == 0) return;
this.mapWidth = this.width;
this.size = this.mapWidth * this.height;
}, "~S,javajs.awt.Font");
c$.getPlotText3D = Clazz_defineMethod (c$, "getPlotText3D", 
 function (x, y, g3d, text, font3d, antialias) {
J.g3d.TextRenderer.working = true;
var ht = (antialias ? J.g3d.TextRenderer.htFont3dAntialias : J.g3d.TextRenderer.htFont3d);
var htForThisFont = ht.get (font3d);
var text3d = null;
var newFont = false;
var newText = false;
if (htForThisFont != null) {
text3d = htForThisFont.get (text);
} else {
htForThisFont =  new java.util.Hashtable ();
newFont = true;
}if (text3d == null) {
text3d =  new J.g3d.TextRenderer (text, font3d);
newText = true;
}text3d.isInvalid = (text3d.width == 0 || x + text3d.width <= 0 || x >= g3d.width || y + text3d.height <= 0 || y >= g3d.height);
if (text3d.isInvalid) return text3d;
if (newFont) ht.put (font3d, htForThisFont);
if (newText) {
text3d.setTranslucency (text, font3d, g3d);
htForThisFont.put (text, text3d);
}J.g3d.TextRenderer.working = false;
return text3d;
}, "~N,~N,J.g3d.Graphics3D,~S,javajs.awt.Font,~B");
Clazz_defineMethod (c$, "setTranslucency", 
 function (text, font3d, g3d) {
var pixels = g3d.apiPlatform.getTextPixels (text, font3d, g3d.platform.getGraphicsForTextOrImage (this.mapWidth, this.height), g3d.platform.offscreenImage, this.mapWidth, this.height, this.ascent);
if (pixels == null) return;
this.tmap =  Clazz_newByteArray (this.size, 0);
for (var i = pixels.length; --i >= 0; ) {
var p = pixels[i] & 0xFF;
if (p != 0) {
this.tmap[i] = J.g3d.TextRenderer.translucency[p >> 5];
}}
}, "~S,javajs.awt.Font,J.g3d.Graphics3D");
Clazz_defineStatics (c$,
"translucency", [7, 6, 5, 4, 3, 2, 1, 8],
"working", false);
c$.htFont3d = c$.prototype.htFont3d =  new java.util.Hashtable ();
c$.htFont3dAntialias = c$.prototype.htFont3dAntialias =  new java.util.Hashtable ();
});
Clazz_declarePackage ("J.g3d");
c$ = Clazz_declareType (J.g3d, "TextSorter", null, java.util.Comparator);
Clazz_overrideMethod (c$, "compare", 
function (a, b) {
return (a == null || b == null ? 0 : a.z > b.z ? -1 : a.z < b.z ? 1 : 0);
}, "J.g3d.TextString,J.g3d.TextString");
Clazz_declarePackage ("J.g3d");
Clazz_load (["JU.P3i"], "J.g3d.TextString", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.text = null;
this.font = null;
this.argb = 0;
this.bgargb = 0;
Clazz_instantialize (this, arguments);
}, J.g3d, "TextString", JU.P3i);
Clazz_defineMethod (c$, "setText", 
function (text, font, argb, bgargb, x, y, z) {
this.text = text;
this.font = font;
this.argb = argb;
this.bgargb = bgargb;
this.x = x;
this.y = y;
this.z = z;
}, "~S,javajs.awt.Font,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "toString", 
function () {
return Clazz_superCall (this, J.g3d.TextString, "toString", []) + " " + this.text;
});
});
Clazz_declarePackage ("J.g3d");
Clazz_load (["J.g3d.G3DRenderer", "JU.Rgb16"], "J.g3d.TriangleRenderer", ["JU.GData"], function () {
c$ = Clazz_decorateAsClass (function () {
this.g3d = null;
this.ax = null;
this.ay = null;
this.az = null;
this.axW = null;
this.azW = null;
this.axE = null;
this.azE = null;
this.rgb16sW = null;
this.rgb16sE = null;
this.rgb16sGouraud = null;
this.rgb16t1 = null;
this.rgb16t2 = null;
Clazz_instantialize (this, arguments);
}, J.g3d, "TriangleRenderer", null, J.g3d.G3DRenderer);
Clazz_prepareFields (c$, function () {
this.ax =  Clazz_newIntArray (3, 0);
this.ay =  Clazz_newIntArray (3, 0);
this.az =  Clazz_newIntArray (3, 0);
this.axW =  Clazz_newIntArray (64, 0);
this.azW =  Clazz_newIntArray (64, 0);
this.axE =  Clazz_newIntArray (64, 0);
this.azE =  Clazz_newIntArray (64, 0);
this.rgb16t1 =  new JU.Rgb16 ();
this.rgb16t2 =  new JU.Rgb16 ();
});
Clazz_makeConstructor (c$, 
function () {
});
Clazz_overrideMethod (c$, "set", 
function (g3d, gdata) {
try {
this.rgb16sW =  new Array (64);
this.rgb16sE =  new Array (64);
for (var i = 64; --i >= 0; ) {
this.rgb16sW[i] =  new JU.Rgb16 ();
this.rgb16sE[i] =  new JU.Rgb16 ();
}
this.g3d = g3d;
this.rgb16sGouraud =  new Array (3);
for (var i = 3; --i >= 0; ) this.rgb16sGouraud[i] =  new JU.Rgb16 ();

} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
return this;
}, "J.api.JmolRendererInterface,JU.GData");
Clazz_defineMethod (c$, "reallocRgb16s", 
function (rgb16s, n) {
var t =  new Array (n);
System.arraycopy (rgb16s, 0, t, 0, rgb16s.length);
for (var i = rgb16s.length; i < n; ++i) t[i] =  new JU.Rgb16 ();

return t;
}, "~A,~N");
Clazz_defineMethod (c$, "setGouraud", 
function (rgbA, rgbB, rgbC) {
this.rgb16sGouraud[0].setInt (rgbA);
this.rgb16sGouraud[1].setInt (rgbB);
this.rgb16sGouraud[2].setInt (rgbC);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "fillTriangleXYZ", 
function (xScreenA, yScreenA, zScreenA, xScreenB, yScreenB, zScreenB, xScreenC, yScreenC, zScreenC, useGouraud) {
this.ax[0] = xScreenA;
this.ax[1] = xScreenB;
this.ax[2] = xScreenC;
this.ay[0] = yScreenA;
this.ay[1] = yScreenB;
this.ay[2] = yScreenC;
this.az[0] = zScreenA;
this.az[1] = zScreenB;
this.az[2] = zScreenC;
this.fillTriangleB (useGouraud);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "fillTriangleP3i", 
function (screenA, screenB, screenC, useGouraud) {
this.ax[0] = screenA.x;
this.ax[1] = screenB.x;
this.ax[2] = screenC.x;
this.ay[0] = screenA.y;
this.ay[1] = screenB.y;
this.ay[2] = screenC.y;
this.az[0] = screenA.z;
this.az[1] = screenB.z;
this.az[2] = screenC.z;
this.fillTriangleB (useGouraud);
}, "JU.P3i,JU.P3i,JU.P3i,~B");
Clazz_defineMethod (c$, "fillTriangleP3f", 
function (screenA, screenB, screenC, useGouraud) {
this.ax[0] = Math.round (screenA.x);
this.ax[1] = Math.round (screenB.x);
this.ax[2] = Math.round (screenC.x);
this.ay[0] = Math.round (screenA.y);
this.ay[1] = Math.round (screenB.y);
this.ay[2] = Math.round (screenC.y);
this.az[0] = Math.round (screenA.z);
this.az[1] = Math.round (screenB.z);
this.az[2] = Math.round (screenC.z);
this.fillTriangleB (useGouraud);
}, "JU.P3,JU.P3,JU.P3,~B");
Clazz_defineMethod (c$, "fillTriangleB", 
 function (useGouraud) {
if (this.az[0] <= 1 || this.az[1] <= 1 || this.az[2] <= 1) return;
var cc0 = this.g3d.clipCode3 (this.ax[0], this.ay[0], this.az[0]);
var cc1 = this.g3d.clipCode3 (this.ax[1], this.ay[1], this.az[1]);
var cc2 = this.g3d.clipCode3 (this.ax[2], this.ay[2], this.az[2]);
var isClipped = (cc0 | cc1 | cc2) != 0;
if (isClipped) {
if ((cc0 & cc1 & cc2) != 0) {
return;
}}var iMinY = 0;
if (this.ay[1] < this.ay[iMinY]) iMinY = 1;
if (this.ay[2] < this.ay[iMinY]) iMinY = 2;
var iMidY = (iMinY + 1) % 3;
var iMaxY = (iMinY + 2) % 3;
if (this.ay[iMidY] > this.ay[iMaxY]) {
var t = iMidY;
iMidY = iMaxY;
iMaxY = t;
}var yMin = this.ay[iMinY];
var yMid = this.ay[iMidY];
var yMax = this.ay[iMaxY];
var nLines = yMax - yMin + 1;
if (nLines > this.g3d.height * 3) return;
if (nLines > this.axW.length) {
var n = (nLines + 31) & -32;
this.axW =  Clazz_newIntArray (n, 0);
this.azW =  Clazz_newIntArray (n, 0);
this.axE =  Clazz_newIntArray (n, 0);
this.azE =  Clazz_newIntArray (n, 0);
this.rgb16sW = this.reallocRgb16s (this.rgb16sW, n);
this.rgb16sE = this.reallocRgb16s (this.rgb16sE, n);
}var gouraudW;
var gouraudE;
if (useGouraud) {
gouraudW = this.rgb16sW;
gouraudE = this.rgb16sE;
} else {
gouraudW = gouraudE = null;
}var dyMidMin = yMid - yMin;
if (dyMidMin == 0) {
if (this.ax[iMidY] < this.ax[iMinY]) {
var t = iMidY;
iMidY = iMinY;
iMinY = t;
}this.generateRaster (nLines, iMinY, iMaxY, this.axW, this.azW, 0, gouraudW);
this.generateRaster (nLines, iMidY, iMaxY, this.axE, this.azE, 0, gouraudE);
} else if (yMid == yMax) {
if (this.ax[iMaxY] < this.ax[iMidY]) {
var t = iMidY;
iMidY = iMaxY;
iMaxY = t;
}this.generateRaster (nLines, iMinY, iMidY, this.axW, this.azW, 0, gouraudW);
this.generateRaster (nLines, iMinY, iMaxY, this.axE, this.azE, 0, gouraudE);
} else {
var dxMaxMin = this.ax[iMaxY] - this.ax[iMinY];
var roundFactor;
roundFactor = JU.GData.roundInt (Clazz_doubleToInt (nLines / 2));
if (dxMaxMin < 0) roundFactor = -roundFactor;
var axSplit = this.ax[iMinY] + Clazz_doubleToInt ((dxMaxMin * dyMidMin + roundFactor) / nLines);
if (axSplit < this.ax[iMidY]) {
this.generateRaster (nLines, iMinY, iMaxY, this.axW, this.azW, 0, gouraudW);
this.generateRaster (dyMidMin + 1, iMinY, iMidY, this.axE, this.azE, 0, gouraudE);
this.generateRaster (nLines - dyMidMin, iMidY, iMaxY, this.axE, this.azE, dyMidMin, gouraudE);
} else {
this.generateRaster (dyMidMin + 1, iMinY, iMidY, this.axW, this.azW, 0, gouraudW);
this.generateRaster (nLines - dyMidMin, iMidY, iMaxY, this.axW, this.azW, dyMidMin, gouraudW);
this.generateRaster (nLines, iMinY, iMaxY, this.axE, this.azE, 0, gouraudE);
}}this.g3d.setZMargin (5);
var pass2Row = this.g3d.pass2Flag01;
var pass2Off = 1 - pass2Row;
var xW;
var i = 0;
if (yMin < 0) {
nLines += yMin;
i -= yMin;
yMin = 0;
}if (yMin + nLines > this.g3d.height) nLines = this.g3d.height - yMin;
if (useGouraud) {
if (isClipped) {
for (; --nLines >= pass2Row; ++yMin, ++i) {
var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off;
if (pixelCount > 0) this.g3d.plotPixelsClippedRaster (pixelCount, xW, yMin, this.azW[i], this.azE[i], this.rgb16sW[i], this.rgb16sE[i]);
}
} else {
for (; --nLines >= pass2Row; ++yMin, ++i) {
var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off;
if (pass2Row == 1 && pixelCount < 0) {
pixelCount = 1;
xW--;
}if (pixelCount > 0) this.g3d.plotPixelsUnclippedRaster (pixelCount, xW, yMin, this.azW[i], this.azE[i], this.rgb16sW[i], this.rgb16sE[i]);
}
}} else {
if (isClipped) {
for (; --nLines >= pass2Row; ++yMin, ++i) {
var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off;
if (pixelCount > 0) this.g3d.plotPixelsClippedRaster (pixelCount, xW, yMin, this.azW[i], this.azE[i], null, null);
}
} else {
for (; --nLines >= pass2Row; ++yMin, ++i) {
var pixelCount = this.axE[i] - (xW = this.axW[i]) + pass2Off;
if (pass2Row == 1 && pixelCount < 0) {
pixelCount = 1;
xW--;
}if (pixelCount > 0) this.g3d.plotPixelsUnclippedRaster (pixelCount, xW, yMin, this.azW[i], this.azE[i], null, null);
}
}}this.g3d.setZMargin (0);
}, "~B");
Clazz_defineMethod (c$, "generateRaster", 
 function (dy, iN, iS, axRaster, azRaster, iRaster, gouraud) {
var xN = this.ax[iN];
var zN = this.az[iN];
var xS = this.ax[iS];
var zS = this.az[iS];
var dx = xS - xN;
var dz = zS - zN;
var xCurrent = xN;
var xIncrement;
var width;
var errorTerm;
if (dx >= 0) {
xIncrement = 1;
width = dx;
errorTerm = 0;
} else {
xIncrement = -1;
width = -dx;
errorTerm = 1 - dy;
}var zCurrentScaled = (zN << 10) + (512);
var roundingFactor = JU.GData.roundInt (Clazz_doubleToInt (dy / 2));
if (dz < 0) roundingFactor = -roundingFactor;
var zIncrementScaled = Clazz_doubleToInt (((dz << 10) + roundingFactor) / dy);
var xMajorIncrement;
var xMajorError;
if (width <= dy) {
xMajorIncrement = 0;
xMajorError = width;
} else {
xMajorIncrement = JU.GData.roundInt (Clazz_doubleToInt (dx / dy));
xMajorError = width % dy;
}for (var y = 0, i = iRaster; y < dy; zCurrentScaled += zIncrementScaled, ++i, ++y) {
axRaster[i] = xCurrent;
azRaster[i] = zCurrentScaled >> 10;
xCurrent += xMajorIncrement;
errorTerm += xMajorError;
if (errorTerm > 0) {
xCurrent += xIncrement;
errorTerm -= dy;
}}
if (gouraud != null) {
var rgb16Base = this.rgb16t1;
rgb16Base.setRgb (this.rgb16sGouraud[iN]);
var rgb16Increment = this.rgb16t2;
rgb16Increment.diffDiv (this.rgb16sGouraud[iS], rgb16Base, dy);
for (var i = iRaster, iMax = iRaster + dy; i < iMax; ++i) gouraud[i].setAndIncrement (rgb16Base, rgb16Increment);

}}, "~N,~N,~N,~A,~A,~N,~A");
Clazz_defineStatics (c$,
"DEFAULT", 64);
});
Clazz_declarePackage ("J.i18n");
Clazz_load (["J.api.Translator", "java.text.MessageFormat", "java.util.Hashtable", "JU.PT", "J.i18n.Language", "$.Resource"], "J.i18n.GT", ["JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.resources = null;
this.resourceCount = 0;
this.doTranslate = true;
this.language = null;
Clazz_instantialize (this, arguments);
}, J.i18n, "GT", null, J.api.Translator);
Clazz_makeConstructor (c$, 
function () {
});
Clazz_overrideMethod (c$, "translate", 
function (s) {
return J.i18n.GT._ (s);
}, "~S");
Clazz_makeConstructor (c$, 
function (vwr, langCode) {
{
}this.resources = null;
this.resourceCount = 0;
J.i18n.GT.$getTextWrapper = this;
if (langCode != null && langCode.length == 0) langCode = "none";
if (langCode != null) this.language = langCode;
if ("none".equals (this.language)) this.language = null;
if (this.language == null) this.language = J.i18n.Resource.getLanguage ();
if (this.language == null) this.language = "en";
var la = this.language;
var la_co = null;
var la_co_va = null;
var i = this.language.indexOf ("_");
if (i >= 0) {
la = la.substring (0, i);
la_co = this.language;
if ((i = la_co.indexOf ("_", ++i)) >= 0) {
la_co = la_co.substring (0, i);
la_co_va = this.language;
}}if ((this.language = this.getSupported (la_co_va)) == null && (this.language = this.getSupported (la_co)) == null && (this.language = this.getSupported (la)) == null) {
this.language = "en";
System.out.println (this.language + " not supported -- using en");
return;
}la_co_va = null;
la_co = null;
switch (this.language.length) {
default:
la_co_va = this.language;
la_co = this.language.substring (0, 5);
la = this.language.substring (0, 2);
break;
case 5:
la_co = this.language;
la = this.language.substring (0, 2);
break;
case 2:
la = this.language;
break;
}
la_co = this.getSupported (la_co);
la = this.getSupported (la);
if (la === la_co || "en_US".equals (la)) la = null;
if (la_co === la_co_va) la_co = null;
if ("en_US".equals (la_co)) return;
if (J.i18n.GT.allowDebug && JU.Logger.debugging) JU.Logger.debug ("Instantiating gettext wrapper for " + this.language + " using files for language:" + la + " country:" + la_co + " variant:" + la_co_va);
if (!J.i18n.GT.$ignoreApplicationBundle) this.addBundles (vwr, "Jmol", la_co_va, la_co, la);
this.addBundles (vwr, "JmolApplet", la_co_va, la_co, la);
}, "JV.Viewer,~S");
c$.getLanguageList = Clazz_defineMethod (c$, "getLanguageList", 
function (gt) {
if (J.i18n.GT.languageList == null) {
if (gt == null) gt = J.i18n.GT.getTextWrapper ();
gt.createLanguageList ();
}return J.i18n.GT.languageList;
}, "J.i18n.GT");
c$.getLanguage = Clazz_defineMethod (c$, "getLanguage", 
function () {
return J.i18n.GT.getTextWrapper ().language;
});
c$.ignoreApplicationBundle = Clazz_defineMethod (c$, "ignoreApplicationBundle", 
function () {
J.i18n.GT.$ignoreApplicationBundle = true;
});
c$.setDoTranslate = Clazz_defineMethod (c$, "setDoTranslate", 
function (TF) {
var b = J.i18n.GT.getDoTranslate ();
J.i18n.GT.getTextWrapper ().doTranslate = TF;
return b;
}, "~B");
c$.getDoTranslate = Clazz_defineMethod (c$, "getDoTranslate", 
function () {
return J.i18n.GT.getTextWrapper ().doTranslate;
});
c$._ = Clazz_defineMethod (c$, "_", 
function (string) {
return J.i18n.GT.getTextWrapper ().getString (string);
}, "~S");
c$.o = Clazz_defineMethod (c$, "o", 
function (s, o) {
if (Clazz_instanceOf (o, Array)) {
if ((o).length != 1) return java.text.MessageFormat.format (s, o);
o = (o)[0];
}return JU.PT.rep (s, "{0}", o.toString ());
}, "~S,~O");
c$.i = Clazz_defineMethod (c$, "i", 
function (s, n) {
return JU.PT.rep (s, "{0}", "" + n);
}, "~S,~N");
c$.escapeHTML = Clazz_defineMethod (c$, "escapeHTML", 
function (msg) {
var ch;
for (var i = msg.length; --i >= 0; ) if ((ch = msg.charAt (i)).charCodeAt (0) > 0x7F) {
msg = msg.substring (0, i) + "&#" + ((ch).charCodeAt (0)) + ";" + msg.substring (i + 1);
}
return msg;
}, "~S");
c$.getTextWrapper = Clazz_defineMethod (c$, "getTextWrapper", 
 function () {
return (J.i18n.GT.$getTextWrapper == null ? J.i18n.GT.$getTextWrapper =  new J.i18n.GT (null, null) : J.i18n.GT.$getTextWrapper);
});
Clazz_defineMethod (c$, "createLanguageList", 
 function () {
var wasTranslating = this.doTranslate;
this.doTranslate = false;
J.i18n.GT.languageList = J.i18n.Language.getLanguageList ();
this.doTranslate = wasTranslating;
});
Clazz_defineMethod (c$, "getSupported", 
 function (code) {
if (code == null) return null;
var s = J.i18n.GT.htLanguages.get (code);
if (s != null) return (s.length == 0 ? null : s);
s = J.i18n.Language.getSupported (J.i18n.GT.getLanguageList (this), code);
J.i18n.GT.htLanguages.put (code, (s == null ? "" : s));
return s;
}, "~S");
Clazz_defineMethod (c$, "addBundles", 
 function (vwr, type, la_co_va, la_co, la) {
try {
var className = "J.translation." + type + ".";
if (la_co_va != null) this.addBundle (vwr, className, la_co_va);
if (la_co != null) this.addBundle (vwr, className, la_co);
if (la != null) this.addBundle (vwr, className, la);
} catch (exception) {
if (Clazz_exceptionOf (exception, Exception)) {
if (J.i18n.GT.allowDebug) JU.Logger.errorEx ("Some exception occurred!", exception);
this.resources = null;
this.resourceCount = 0;
} else {
throw exception;
}
}
}, "JV.Viewer,~S,~S,~S,~S");
Clazz_defineMethod (c$, "addBundle", 
 function (vwr, className, name) {
var resource = J.i18n.Resource.getResource (vwr, className, name);
if (resource != null) {
if (this.resources == null) {
this.resources =  new Array (8);
this.resourceCount = 0;
}this.resources[this.resourceCount] = resource;
this.resourceCount++;
if (J.i18n.GT.allowDebug) JU.Logger.debug ("GT adding " + className);
}}, "JV.Viewer,~S,~S");
Clazz_defineMethod (c$, "getString", 
 function (s) {
var trans = null;
if (this.doTranslate) {
for (var bundle = this.resourceCount; --bundle >= 0; ) {
trans = this.resources[bundle].getString (s);
if (trans != null) {
s = trans;
break;
}}
if (this.resourceCount > 0 && trans == null && J.i18n.GT.allowDebug && JU.Logger.debugging) JU.Logger.debug ("No trans, using default: " + s);
}if (trans == null) {
if (s.startsWith ("[")) s = s.substring (s.indexOf ("]") + 1);
 else if (s.endsWith ("]")) s = s.substring (0, s.indexOf ("["));
}return s;
}, "~S");
Clazz_defineStatics (c$,
"$ignoreApplicationBundle", false,
"$getTextWrapper", null,
"languageList", null,
"allowDebug", false,
"vwr", null);
c$.htLanguages = c$.prototype.htLanguages =  new java.util.Hashtable ();
});
Clazz_declarePackage ("J.i18n");
Clazz_load (null, "J.i18n.Language", ["J.i18n.GT"], function () {
c$ = Clazz_decorateAsClass (function () {
this.code = null;
this.language = null;
this.nativeLanguage = null;
this.display = false;
Clazz_instantialize (this, arguments);
}, J.i18n, "Language");
c$.getLanguageList = Clazz_defineMethod (c$, "getLanguageList", 
function () {
return [ new J.i18n.Language ("ar", J.i18n.GT._ ("Arabic"), "العربية", false),  new J.i18n.Language ("ast", J.i18n.GT._ ("Asturian"), "Asturian", false),  new J.i18n.Language ("az", J.i18n.GT._ ("Azerbaijani"), "azərbaycan dili", false),  new J.i18n.Language ("bs", J.i18n.GT._ ("Bosnian"), "bosanski jezik", false),  new J.i18n.Language ("ca", J.i18n.GT._ ("Catalan"), "Català", true),  new J.i18n.Language ("cs", J.i18n.GT._ ("Czech"), "Čeština", true),  new J.i18n.Language ("da", J.i18n.GT._ ("Danish"), "Dansk", true),  new J.i18n.Language ("de", J.i18n.GT._ ("German"), "Deutsch", true),  new J.i18n.Language ("el", J.i18n.GT._ ("Greek"), "Ελληνικά", false),  new J.i18n.Language ("en_AU", J.i18n.GT._ ("Australian English"), "Australian English", false),  new J.i18n.Language ("en_GB", J.i18n.GT._ ("British English"), "British English", true),  new J.i18n.Language ("en_US", J.i18n.GT._ ("American English"), "American English", true),  new J.i18n.Language ("es", J.i18n.GT._ ("Spanish"), "Español", true),  new J.i18n.Language ("et", J.i18n.GT._ ("Estonian"), "Eesti", false),  new J.i18n.Language ("eu", J.i18n.GT._ ("Basque"), "Euskara", true),  new J.i18n.Language ("fi", J.i18n.GT._ ("Finnish"), "Suomi", true),  new J.i18n.Language ("fo", J.i18n.GT._ ("Faroese"), "Føroyskt", false),  new J.i18n.Language ("fr", J.i18n.GT._ ("French"), "Français", true),  new J.i18n.Language ("fy", J.i18n.GT._ ("Frisian"), "Frysk", false),  new J.i18n.Language ("gl", J.i18n.GT._ ("Galician"), "Galego", false),  new J.i18n.Language ("hr", J.i18n.GT._ ("Croatian"), "Hrvatski", false),  new J.i18n.Language ("hu", J.i18n.GT._ ("Hungarian"), "Magyar", true),  new J.i18n.Language ("hy", J.i18n.GT._ ("Armenian"), "Հայերեն", false),  new J.i18n.Language ("id", J.i18n.GT._ ("Indonesian"), "Indonesia", true),  new J.i18n.Language ("it", J.i18n.GT._ ("Italian"), "Italiano", true),  new J.i18n.Language ("ja", J.i18n.GT._ ("Japanese"), "日本語", true),  new J.i18n.Language ("jv", J.i18n.GT._ ("Javanese"), "Basa Jawa", false),  new J.i18n.Language ("ko", J.i18n.GT._ ("Korean"), "한국어", true),  new J.i18n.Language ("ms", J.i18n.GT._ ("Malay"), "Bahasa Melayu", true),  new J.i18n.Language ("nb", J.i18n.GT._ ("Norwegian Bokmal"), "Norsk Bokmål", false),  new J.i18n.Language ("nl", J.i18n.GT._ ("Dutch"), "Nederlands", true),  new J.i18n.Language ("oc", J.i18n.GT._ ("Occitan"), "Occitan", false),  new J.i18n.Language ("pl", J.i18n.GT._ ("Polish"), "Polski", false),  new J.i18n.Language ("pt", J.i18n.GT._ ("Portuguese"), "Português", false),  new J.i18n.Language ("pt_BR", J.i18n.GT._ ("Brazilian Portuguese"), "Português brasileiro", true),  new J.i18n.Language ("ru", J.i18n.GT._ ("Russian"), "Русский", false),  new J.i18n.Language ("sl", J.i18n.GT._ ("Slovenian"), "Slovenščina", false),  new J.i18n.Language ("sr", J.i18n.GT._ ("Serbian"), "српски језик", false),  new J.i18n.Language ("sv", J.i18n.GT._ ("Swedish"), "Svenska", true),  new J.i18n.Language ("ta", J.i18n.GT._ ("Tamil"), "தமிழ்", false),  new J.i18n.Language ("te", J.i18n.GT._ ("Telugu"), "తెలుగు", false),  new J.i18n.Language ("tr", J.i18n.GT._ ("Turkish"), "Türkçe", true),  new J.i18n.Language ("ug", J.i18n.GT._ ("Uyghur"), "Uyƣurqə", false),  new J.i18n.Language ("uk", J.i18n.GT._ ("Ukrainian"), "Українська", true),  new J.i18n.Language ("uz", J.i18n.GT._ ("Uzbek"), "O'zbek", false),  new J.i18n.Language ("zh_CN", J.i18n.GT._ ("Simplified Chinese"), "简体中文", true),  new J.i18n.Language ("zh_TW", J.i18n.GT._ ("Traditional Chinese"), "繁體中文", true)];
});
Clazz_makeConstructor (c$, 
 function (code, language, nativeLanguage, display) {
this.code = code;
this.language = language;
this.nativeLanguage = nativeLanguage;
this.display = display;
}, "~S,~S,~S,~B");
c$.getSupported = Clazz_defineMethod (c$, "getSupported", 
function (list, code) {
for (var i = list.length; --i >= 0; ) if (list[i].code.equalsIgnoreCase (code)) return list[i].code;

for (var i = list.length; --i >= 0; ) if (list[i].code.startsWith (code)) return list[i].code;

return null;
}, "~A,~S");
});
Clazz_declarePackage ("J.i18n");
Clazz_load (null, "J.i18n.Resource", ["java.util.Hashtable", "JU.PT", "J.api.Interface", "JU.Logger", "JV.Viewer"], function () {
c$ = Clazz_decorateAsClass (function () {
this.resource = null;
this.resourceMap = null;
Clazz_instantialize (this, arguments);
}, J.i18n, "Resource");
Clazz_makeConstructor (c$, 
 function (resource, className) {
if (className == null) this.resourceMap = resource;
 else this.resource = resource;
}, "~O,~S");
c$.getResource = Clazz_defineMethod (c$, "getResource", 
function (vwr, className, name) {
var poData = null;
if (vwr != null && vwr.isApplet) {
var fname = JV.Viewer.appletIdiomaBase + "/" + name + ".po";
JU.Logger.info ("Loading language resource " + fname);
poData = vwr.getFileAsString3 (fname, false, "gt");
return J.i18n.Resource.getResourceFromPO (poData);
}className += name + ".Messages_" + name;
var o = J.api.Interface.getInterface (className, vwr, "gt");
return (o == null ? null :  new J.i18n.Resource (o, className));
}, "JV.Viewer,~S,~S");
Clazz_defineMethod (c$, "getString", 
function (string) {
try {
return (this.resource == null ? this.resourceMap.get (string) : this.resource.getString (string));
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return null;
} else {
throw e;
}
}
}, "~S");
c$.getLanguage = Clazz_defineMethod (c$, "getLanguage", 
function () {
var language = null;
{
language = Jmol.featureDetection.getDefaultLanguage().replace(/-/g,'_');
}return language;
});
c$.getResourceFromPO = Clazz_defineMethod (c$, "getResourceFromPO", 
function (data) {
if (data == null || data.length == 0) return null;
var map =  new java.util.Hashtable ();
try {
var lines = JU.PT.split (data, "\n");
var mode = 0;
var msgstr = "";
var msgid = "";
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
if (line.length <= 2) {
if (mode == 2 && msgstr.length != 0 && msgid.length != 0) map.put (msgid, msgstr);
mode = 0;
} else if (line.indexOf ("msgid") == 0) {
mode = 1;
msgid = J.i18n.Resource.fix (line);
} else if (line.indexOf ("msgstr") == 0) {
mode = 2;
msgstr = J.i18n.Resource.fix (line);
} else if (mode == 1) {
msgid += J.i18n.Resource.fix (line);
} else if (mode == 2) {
msgstr += J.i18n.Resource.fix (line);
}}
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
JU.Logger.info (map.size () + " translations loaded");
return (map.size () == 0 ? null :  new J.i18n.Resource (map, null));
}, "~S");
c$.fix = Clazz_defineMethod (c$, "fix", 
function (line) {
if (line.indexOf ("\\\"") >= 0) line = JU.PT.rep (line, "\\\"", "\"");
return JU.PT.rep (line.substring (line.indexOf ("\"") + 1, line.lastIndexOf ("\"")), "\\n", "\n");
}, "~S");
});
Clazz_declarePackage ("J.io");
Clazz_load (null, "J.io.FileReader", ["java.io.BufferedInputStream", "$.BufferedReader", "$.Reader", "javajs.api.GenericBinaryDocument", "$.ZInputStream", "JU.PT", "J.api.Interface", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.fm = null;
this.vwr = null;
this.fileNameIn = null;
this.fullPathNameIn = null;
this.nameAsGivenIn = null;
this.fileTypeIn = null;
this.atomSetCollection = null;
this.reader = null;
this.htParams = null;
this.isAppend = false;
this.bytes = null;
Clazz_instantialize (this, arguments);
}, J.io, "FileReader");
Clazz_makeConstructor (c$, 
function (fileManager, vwr, fileName, fullPathName, nameAsGiven, type, reader, htParams, isAppend) {
this.fm = fileManager;
this.vwr = vwr;
this.fileNameIn = fileName;
this.fullPathNameIn = fullPathName;
this.nameAsGivenIn = nameAsGiven;
this.fileTypeIn = type;
this.reader = (Clazz_instanceOf (reader, java.io.BufferedReader) ? reader : Clazz_instanceOf (reader, java.io.Reader) ?  new java.io.BufferedReader (reader) : null);
this.bytes = (JU.PT.isAB (reader) ? reader : null);
this.htParams = htParams;
this.isAppend = isAppend;
}, "JV.FileManager,JV.Viewer,~S,~S,~S,~S,~O,java.util.Map,~B");
Clazz_defineMethod (c$, "run", 
function () {
if (!this.isAppend && this.vwr.displayLoadErrors) this.vwr.zap (false, true, false);
var errorMessage = null;
var t = null;
if (this.reader == null) {
t = this.fm.getUnzippedReaderOrStreamFromName (this.fullPathNameIn, this.bytes, true, false, false, true, this.htParams);
if (t == null || Clazz_instanceOf (t, String)) {
errorMessage = (t == null ? "error opening:" + this.nameAsGivenIn : t);
if (!errorMessage.startsWith ("NOTE:")) JU.Logger.error ("file ERROR: " + this.fullPathNameIn + "\n" + errorMessage);
this.atomSetCollection = errorMessage;
return;
}if (Clazz_instanceOf (t, java.io.BufferedReader)) {
this.reader = t;
} else if (Clazz_instanceOf (t, javajs.api.ZInputStream)) {
var name = this.fullPathNameIn;
var subFileList = null;
name = name.$replace ('\\', '/');
if (name.indexOf ("|") >= 0 && !name.endsWith (".zip")) {
subFileList = JU.PT.split (name, "|");
name = subFileList[0];
}if (subFileList != null) this.htParams.put ("subFileList", subFileList);
var zis = t;
var zipDirectory = this.fm.getZipDirectory (name, true, true);
this.atomSetCollection = t = this.fm.jmb.getAtomSetCollectionOrBufferedReaderFromZip (this.vwr.getModelAdapter (), zis, name, zipDirectory, this.htParams, false);
try {
zis.close ();
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}}if (Clazz_instanceOf (t, java.io.BufferedInputStream)) {
var bd = J.api.Interface.getInterface ("JU.BinaryDocument", this.vwr, "file");
bd.setStream (this.vwr.getJzt (), t, true);
this.reader = bd;
}if (this.reader != null) {
this.atomSetCollection = this.vwr.getModelAdapter ().getAtomSetCollectionReader (this.fullPathNameIn, this.fileTypeIn, this.reader, this.htParams);
if (!(Clazz_instanceOf (this.atomSetCollection, String))) this.atomSetCollection = this.vwr.getModelAdapter ().getAtomSetCollection (this.atomSetCollection);
try {
if (Clazz_instanceOf (this.reader, java.io.BufferedReader)) (this.reader).close ();
 else if (Clazz_instanceOf (this.reader, javajs.api.GenericBinaryDocument)) (this.reader).close ();
} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
} else {
throw e;
}
}
}if (Clazz_instanceOf (this.atomSetCollection, String)) return;
if (!this.isAppend && !this.vwr.displayLoadErrors) this.vwr.zap (false, true, false);
this.fm.setFileInfo ([this.fullPathNameIn, this.fileNameIn, this.nameAsGivenIn]);
});
Clazz_defineMethod (c$, "getAtomSetCollection", 
function () {
return this.atomSetCollection;
});
});
Clazz_declarePackage ("J.io");
Clazz_load (null, "J.io.JmolBinary", ["java.io.BufferedInputStream", "java.util.Hashtable", "JU.PT", "$.Rdr", "J.api.Interface", "JU.Logger", "JV.FileManager", "$.JmolAsyncException"], function () {
c$ = Clazz_decorateAsClass (function () {
this.fm = null;
this.pngjCache = null;
this.spardirCache = null;
this.jzu = null;
Clazz_instantialize (this, arguments);
}, J.io, "JmolBinary");
Clazz_makeConstructor (c$, 
function (fm) {
this.fm = fm;
}, "JV.FileManager");
Clazz_defineMethod (c$, "determineSurfaceTypeIs", 
function (is) {
var br;
try {
br = JU.Rdr.getBufferedReader ( new java.io.BufferedInputStream (is), "ISO-8859-1");
} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
return null;
} else {
throw e;
}
}
return this.determineSurfaceFileType (br);
}, "java.io.InputStream");
c$.getEmbeddedScript = Clazz_defineMethod (c$, "getEmbeddedScript", 
function (script) {
if (script == null) return script;
var pt = script.indexOf ("**** Jmol Embedded Script ****");
if (pt < 0) return script;
var pt1 = script.lastIndexOf ("/*", pt);
var pt2 = script.indexOf ((script.charAt (pt1 + 2) == '*' ? "*" : "") + "*/", pt);
if (pt1 >= 0 && pt2 >= pt) script = script.substring (pt + "**** Jmol Embedded Script ****".length, pt2) + "\n";
while ((pt1 = script.indexOf (" #Jmol...\u0000")) >= 0) script = script.substring (0, pt1) + script.substring (pt1 + " #Jmol...\u0000".length + 4);

if (JU.Logger.debugging) JU.Logger.debug (script);
return script;
}, "~S");
Clazz_defineMethod (c$, "getJzu", 
 function () {
return (this.jzu == null ? this.jzu = J.api.Interface.getOption ("io.JmolUtil", this.fm.vwr, "file") : this.jzu);
});
Clazz_defineMethod (c$, "getCachedPngjBytes", 
function (pathName) {
return (pathName.indexOf (".png") < 0 ? null : this.getJzu ().getCachedPngjBytes (this, pathName));
}, "~S");
Clazz_defineMethod (c$, "clearAndCachePngjFile", 
function (data) {
this.pngjCache =  new java.util.Hashtable ();
return (data == null || data[0] == null ? false : this.getJzu ().cachePngjFile (this, data));
}, "~A");
Clazz_defineMethod (c$, "spardirPut", 
function (name, bytes) {
if (this.spardirCache == null) this.spardirCache =  new java.util.Hashtable ();
this.spardirCache.put (name, bytes);
}, "~S,~A");
Clazz_defineMethod (c$, "clearPngjCache", 
function (fileName) {
if (this.pngjCache == null || fileName != null && !this.pngjCache.containsKey (fileName)) return;
this.pngjCache = null;
JU.Logger.info ("PNGJ cache cleared");
}, "~S");
Clazz_defineMethod (c$, "recachePngjBytes", 
function (fileName, bytes) {
if (this.pngjCache == null || !this.pngjCache.containsKey (fileName)) return;
this.pngjCache.put (fileName, bytes);
JU.Logger.info ("PNGJ recaching " + fileName + " (" + bytes.length + ")");
}, "~S,~A");
Clazz_defineMethod (c$, "getAtomSetCollectionOrBufferedReaderFromZip", 
function (adapter, is, fileName, zipDirectory, htParams, asBufferedReader) {
return this.getJzu ().getAtomSetCollectionOrBufferedReaderFromZip (this.fm.vwr, adapter, is, fileName, zipDirectory, htParams, 1, asBufferedReader);
}, "J.api.JmolAdapter,java.io.InputStream,~S,~A,java.util.Map,~B");
Clazz_defineMethod (c$, "spartanFileList", 
function (name, zipDirectory) {
return this.getJzu ().spartanFileList (this.fm.vwr.getJzt (), name, zipDirectory);
}, "~S,~S");
Clazz_defineMethod (c$, "determineSurfaceFileType", 
function (br) {
return this.getJzu ().determineSurfaceFileType (br);
}, "java.io.BufferedReader");
Clazz_defineMethod (c$, "getImage", 
function (vwr, fullPathNameOrBytes, echoName) {
return this.getJzu ().getImage (vwr, fullPathNameOrBytes, echoName);
}, "JV.Viewer,~O,~S");
c$.getFileReferences = Clazz_defineMethod (c$, "getFileReferences", 
function (script, fileList) {
for (var ipt = 0; ipt < JV.FileManager.scriptFilePrefixes.length; ipt++) {
var tag = JV.FileManager.scriptFilePrefixes[ipt];
var i = -1;
while ((i = script.indexOf (tag, i + 1)) >= 0) {
var s = JU.PT.getQuotedStringAt (script, i);
if (s.indexOf ("::") >= 0) s = JU.PT.split (s, "::")[1];
fileList.addLast (s);
}
}
}, "~S,JU.Lst");
c$.getManifestScriptPath = Clazz_defineMethod (c$, "getManifestScriptPath", 
function (manifest) {
if (manifest.indexOf ("$SCRIPT_PATH$") >= 0) return "";
var ch = (manifest.indexOf ('\n') >= 0 ? "\n" : "\r");
if (manifest.indexOf (".spt") >= 0) {
var s = JU.PT.split (manifest, ch);
for (var i = s.length; --i >= 0; ) if (s[i].indexOf (".spt") >= 0) return "|" + JU.PT.trim (s[i], "\r\n \t");

}return null;
}, "~S");
c$.getBufferedReaderForResource = Clazz_defineMethod (c$, "getBufferedReaderForResource", 
function (vwr, resourceClass, classPath, resourceName) {
var url;
{
}resourceName = (url == null ? vwr.vwrOptions.get ("codePath") + classPath + resourceName : url.getFile ());
if (vwr.async) {
var bytes = vwr.fm.cacheGet (resourceName, false);
if (bytes == null) throw  new JV.JmolAsyncException (resourceName);
return JU.Rdr.getBufferedReader (JU.Rdr.getBIS (bytes), null);
}return vwr.fm.getBufferedReaderOrErrorMessageFromName (resourceName, [null, null], false, true);
}, "JV.Viewer,~O,~S,~S");
Clazz_defineStatics (c$,
"JPEG_CONTINUE_STRING", " #Jmol...\0",
"PMESH_BINARY_MAGIC_NUMBER", "PM\1\0");
});
Clazz_declarePackage ("J.render");
Clazz_load (["J.render.ShapeRenderer"], "J.render.BallsRenderer", ["J.shape.Shape"], function () {
c$ = Clazz_declareType (J.render, "BallsRenderer", J.render.ShapeRenderer);
Clazz_overrideMethod (c$, "render", 
function () {
var needTranslucent = false;
if (this.isExport || this.vwr.checkMotionRendering (1141899265)) {
var atoms = this.ms.at;
var colixes = (this.shape).colixes;
var bsOK = this.vwr.shm.bsRenderableAtoms;
for (var i = bsOK.nextSetBit (0); i >= 0; i = bsOK.nextSetBit (i + 1)) {
var atom = atoms[i];
if (atom.sD > 0 && (atom.shapeVisibilityFlags & this.myVisibilityFlag) != 0) {
if (this.g3d.setC (colixes == null ? atom.colixAtom : J.shape.Shape.getColix (colixes, i, atom))) {
this.g3d.drawAtom (atom);
} else {
needTranslucent = true;
}}}
}return needTranslucent;
});
});
Clazz_declarePackage ("J.render");
Clazz_load (["J.render.ShapeRenderer", "JU.P3", "$.P3i", "$.V3"], "J.render.FontLineShapeRenderer", ["java.lang.Float", "JU.PT"], function () {
c$ = Clazz_decorateAsClass (function () {
this.imageFontScaling = 0;
this.atomA = null;
this.atomB = null;
this.font3d = null;
this.pt0i = null;
this.pt1i = null;
this.pt2i = null;
this.s1 = null;
this.s2 = null;
this.pointT = null;
this.pointT2 = null;
this.pointT3 = null;
this.vectorT = null;
this.vectorT2 = null;
this.vectorT3 = null;
this.tickInfo = null;
this.draw000 = true;
this.width = 0;
this.endcap = 3;
this.colixA = 0;
this.colixB = 0;
this.dotsOrDashes = false;
this.dashDots = null;
this.asLineOnly = false;
Clazz_instantialize (this, arguments);
}, J.render, "FontLineShapeRenderer", J.render.ShapeRenderer);
Clazz_prepareFields (c$, function () {
this.pt0i =  new JU.P3i ();
this.pt1i =  new JU.P3i ();
this.pt2i =  new JU.P3i ();
this.s1 =  new JU.P3i ();
this.s2 =  new JU.P3i ();
this.pointT =  new JU.P3 ();
this.pointT2 =  new JU.P3 ();
this.pointT3 =  new JU.P3 ();
this.vectorT =  new JU.V3 ();
this.vectorT2 =  new JU.V3 ();
this.vectorT3 =  new JU.V3 ();
});
Clazz_defineMethod (c$, "getDiameter", 
function (z, madOrPixels) {
var diameter;
var isMad = (madOrPixels > 20);
switch (this.exportType) {
case 1:
diameter = (isMad ? madOrPixels : Clazz_doubleToInt (Math.floor (this.vwr.tm.unscaleToScreen (z, madOrPixels * 2) * 1000)));
break;
default:
if (isMad) {
diameter = Clazz_floatToInt (this.vwr.tm.scaleToScreen (z, madOrPixels));
} else {
if (this.g3d.isAntialiased ()) madOrPixels += madOrPixels;
diameter = madOrPixels;
}}
return diameter;
}, "~N,~N");
Clazz_defineMethod (c$, "renderLine", 
function (p0, p1, diameter, pt0, pt1, drawTicks) {
pt0.set (Clazz_doubleToInt (Math.floor (p0.x)), Clazz_doubleToInt (Math.floor (p0.y)), Clazz_doubleToInt (Math.floor (p0.z)));
pt1.set (Clazz_doubleToInt (Math.floor (p1.x)), Clazz_doubleToInt (Math.floor (p1.y)), Clazz_doubleToInt (Math.floor (p1.z)));
if (diameter < 0) this.g3d.drawDottedLine (pt0, pt1);
 else this.g3d.fillCylinder (this.endcap, diameter, pt0, pt1);
if (!drawTicks || this.tickInfo == null) return;
this.atomA.sX = pt0.x;
this.atomA.sY = pt0.y;
this.atomA.sZ = pt0.z;
this.atomB.sX = pt1.x;
this.atomB.sY = pt1.y;
this.atomB.sZ = pt1.z;
this.drawTicks (this.atomA, this.atomB, diameter, true);
}, "JU.P3,JU.P3,~N,JU.P3i,JU.P3i,~B");
Clazz_defineMethod (c$, "drawTicks", 
function (pt1, pt2, diameter, withLabels) {
if (Float.isNaN (this.tickInfo.first)) this.tickInfo.first = 0;
this.drawTicks2 (pt1, pt2, this.tickInfo.ticks.x, 8, diameter, (!withLabels ? null : this.tickInfo.tickLabelFormats == null ? ["%0.2f"] : this.tickInfo.tickLabelFormats));
this.drawTicks2 (pt1, pt2, this.tickInfo.ticks.y, 4, diameter, null);
this.drawTicks2 (pt1, pt2, this.tickInfo.ticks.z, 2, diameter, null);
}, "JU.Point3fi,JU.Point3fi,~N,~B");
Clazz_defineMethod (c$, "drawTicks2", 
 function (ptA, ptB, dx, length, diameter, formats) {
if (dx == 0) return;
if (this.g3d.isAntialiased ()) length *= 2;
this.vectorT2.set (ptB.sX, ptB.sY, 0);
this.vectorT.set (ptA.sX, ptA.sY, 0);
this.vectorT2.sub (this.vectorT);
if (this.vectorT2.length () < 50) return;
var signFactor = this.tickInfo.signFactor;
this.vectorT.sub2 (ptB, ptA);
var d0 = this.vectorT.length ();
if (this.tickInfo.scale != null) {
if (Float.isNaN (this.tickInfo.scale.x)) {
var a = this.vwr.getUnitCellInfo (0);
if (!Float.isNaN (a)) this.vectorT.set (this.vectorT.x / a, this.vectorT.y / this.vwr.getUnitCellInfo (1), this.vectorT.z / this.vwr.getUnitCellInfo (2));
} else {
this.vectorT.set (this.vectorT.x * this.tickInfo.scale.x, this.vectorT.y * this.tickInfo.scale.y, this.vectorT.z * this.tickInfo.scale.z);
}}var d = this.vectorT.length () + 0.0001 * dx;
if (d < dx) return;
var f = dx / d * d0 / d;
this.vectorT.scale (f);
var dz = (ptB.sZ - ptA.sZ) / (d / dx);
d += this.tickInfo.first;
var p = (Clazz_doubleToInt (Math.floor (this.tickInfo.first / dx))) * dx - this.tickInfo.first;
this.pointT.scaleAdd2 (p / dx, this.vectorT, ptA);
p += this.tickInfo.first;
var z = ptA.sZ;
if (diameter < 0) diameter = 1;
this.vectorT2.set (-this.vectorT2.y, this.vectorT2.x, 0);
this.vectorT2.scale (length / this.vectorT2.length ());
var ptRef = this.tickInfo.reference;
if (ptRef == null) {
this.pointT3.setT (this.vwr.getBoundBoxCenter ());
if (this.vwr.g.axesMode == 603979810) {
this.pointT3.add3 (1, 1, 1);
}} else {
this.pointT3.setT (ptRef);
}this.tm.transformPtScr (this.pointT3, this.pt2i);
var horizontal = (Math.abs (this.vectorT2.x / this.vectorT2.y) < 0.2);
var centerX = horizontal;
var centerY = !horizontal;
var rightJustify = !centerX && (this.vectorT2.x < 0);
var drawLabel = (formats != null && formats.length > 0);
var x;
var y;
var val =  new Array (1);
var i = (this.draw000 ? 0 : -1);
while (p < d) {
if (p >= this.tickInfo.first) {
this.pointT2.setT (this.pointT);
this.tm.transformPt3f (this.pointT2, this.pointT2);
this.drawLine (Clazz_doubleToInt (Math.floor (this.pointT2.x)), Clazz_doubleToInt (Math.floor (this.pointT2.y)), Clazz_floatToInt (z), (x = Clazz_doubleToInt (Math.floor (this.pointT2.x + this.vectorT2.x))), (y = Clazz_doubleToInt (Math.floor (this.pointT2.y + this.vectorT2.y))), Clazz_floatToInt (z), diameter);
if (drawLabel && (this.draw000 || p != 0)) {
val[0] = Float.$valueOf ((p == 0 ? 0 : p * signFactor));
var s = JU.PT.sprintf (formats[i % formats.length], "f", val);
this.drawString (x, y, Clazz_floatToInt (z), 4, rightJustify, centerX, centerY, Clazz_doubleToInt (Math.floor (this.pointT2.y)), s);
}}this.pointT.add (this.vectorT);
p += dx;
z += dz;
i++;
}
}, "JU.Point3fi,JU.Point3fi,~N,~N,~N,~A");
Clazz_defineMethod (c$, "drawLine", 
function (x1, y1, z1, x2, y2, z2, diameter) {
return this.drawLine2 (x1, y1, z1, x2, y2, z2, diameter);
}, "~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "drawLine2", 
function (x1, y1, z1, x2, y2, z2, diameter) {
this.pt0i.set (x1, y1, z1);
this.pt1i.set (x2, y2, z2);
if (this.dotsOrDashes) {
if (this.dashDots != null) this.drawDashed (x1, y1, z1, x2, y2, z2, this.dashDots);
} else {
if (diameter < 0) {
this.g3d.drawDashedLine (4, 2, this.pt0i, this.pt1i);
return 1;
}this.g3d.fillCylinder (2, diameter, this.pt0i, this.pt1i);
}return Clazz_doubleToInt ((diameter + 1) / 2);
}, "~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "drawString", 
function (x, y, z, radius, rightJustify, centerX, centerY, yRef, sVal) {
if (sVal == null) return;
var width = this.font3d.stringWidth (sVal);
var height = this.font3d.getAscent ();
var xT = x;
if (rightJustify) xT -= Clazz_doubleToInt (radius / 2) + 2 + width;
 else if (centerX) xT -= Clazz_doubleToInt (radius / 2) + 2 + Clazz_doubleToInt (width / 2);
 else xT += Clazz_doubleToInt (radius / 2) + 2;
var yT = y;
if (centerY) yT += Clazz_doubleToInt (height / 2);
 else if (yRef == 0 || yRef < y) yT += height;
 else yT -= Clazz_doubleToInt (radius / 2);
var zT = z - radius - 2;
if (zT < 1) zT = 1;
this.g3d.drawString (sVal, this.font3d, xT, yT, zT, zT, 0);
}, "~N,~N,~N,~N,~B,~B,~B,~N,~S");
Clazz_defineMethod (c$, "drawDashed", 
function (xA, yA, zA, xB, yB, zB, array) {
if (array == null || this.width < 0) return;
var f = array[0];
var dx = xB - xA;
var dy = yB - yA;
var dz = zB - zA;
var n = 0;
var isNdots = (array === J.render.FontLineShapeRenderer.ndots);
var isDots = (isNdots || array === J.render.FontLineShapeRenderer.sixdots);
if (isDots) {
var d2 = (dx * dx + dy * dy) / (this.width * this.width);
if (isNdots) {
f = (Math.sqrt (d2) / 1.5);
n = Clazz_floatToInt (f) + 3;
} else if (d2 < 8) {
array = J.render.FontLineShapeRenderer.twodots;
} else if (d2 < 32) {
array = J.render.FontLineShapeRenderer.fourdots;
}}var ptS = array[1];
var ptE = array[2];
var colixS = this.colixA;
var colixE = (ptE == 0 ? this.colixB : this.colixA);
if (n == 0) n = array.length;
for (var i = 0, pt = 3; pt < n; pt++) {
i = (isNdots ? i + 1 : array[pt]);
var xS = Clazz_doubleToInt (Math.floor (xA + dx * i / f));
var yS = Clazz_doubleToInt (Math.floor (yA + dy * i / f));
var zS = Clazz_doubleToInt (Math.floor (zA + dz * i / f));
if (isDots) {
this.s1.set (xS, yS, zS);
if (pt == ptS) this.g3d.setC (this.colixA);
 else if (pt == ptE) this.g3d.setC (this.colixB);
this.g3d.fillSphereI (this.width, this.s1);
continue;
}if (pt == ptS) colixS = this.colixB;
i = array[++pt];
if (pt == ptE) colixE = this.colixB;
var xE = Clazz_doubleToInt (Math.floor (xA + dx * i / f));
var yE = Clazz_doubleToInt (Math.floor (yA + dy * i / f));
var zE = Clazz_doubleToInt (Math.floor (zA + dz * i / f));
this.fillCylinder (colixS, colixE, 2, this.width, xS, yS, zS, xE, yE, zE);
}
}, "~N,~N,~N,~N,~N,~N,~A");
Clazz_defineMethod (c$, "fillCylinder", 
function (colixA, colixB, endcaps, diameter, xA, yA, zA, xB, yB, zB) {
if (this.asLineOnly) this.g3d.drawLine (colixA, colixB, xA, yA, zA, xB, yB, zB);
 else this.g3d.fillCylinderXYZ (colixA, colixB, endcaps, (!this.isExport || this.mad == 1 ? diameter : this.mad), xA, yA, zA, xB, yB, zB);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineStatics (c$,
"dashes", [12, 0, 0, 2, 5, 7, 10],
"hDashes", [10, 7, 6, 1, 3, 4, 6, 7, 9],
"ndots", [0, 3, 1000],
"sixdots", [12, 3, 6, 1, 3, 5, 7, 9, 11],
"fourdots", [13, 3, 5, 2, 5, 8, 11],
"twodots", [12, 3, 4, 3, 9]);
});
Clazz_declarePackage ("J.render");
Clazz_load (["J.render.ShapeRenderer"], "J.render.FrankRenderer", ["JU.C"], function () {
c$ = Clazz_declareType (J.render, "FrankRenderer", J.render.ShapeRenderer);
Clazz_overrideMethod (c$, "render", 
function () {
var frank = this.shape;
var allowKeys = this.vwr.getBooleanProperty ("allowKeyStrokes");
var modelKitMode = this.vwr.getBoolean (603979883);
this.colix = (modelKitMode ? 20 : this.vwr.isSignedApplet ? (allowKeys || this.vwr.isJS && !this.vwr.isWebGL ? 5 : 10) : allowKeys ? 7 : 12);
if (this.isExport || !this.vwr.getShowFrank ()) return false;
if (!this.g3d.setC (JU.C.getColixTranslucent3 (this.colix, this.g3d.haveTranslucentObjects (), 0.5))) return true;
var imageFontScaling = this.vwr.getImageFontScaling ();
frank.getFont (imageFontScaling);
var dx = Clazz_floatToInt (frank.frankWidth + 4 * imageFontScaling);
var dy = frank.frankDescent;
this.g3d.drawStringNoSlab (frank.frankString, frank.font3d, this.vwr.gdata.width - dx, this.vwr.gdata.height - dy, 0, 0);
if (modelKitMode) {
this.g3d.fillRect (0, 0, 0, 0, dy * 2, Clazz_doubleToInt (dx * 3 / 2));
}return false;
});
});
Clazz_declarePackage ("J.render");
Clazz_load (["J.api.JmolRepaintManager", "JU.BS"], "J.render.RepaintManager", ["java.lang.NullPointerException", "J.api.Interface", "JU.Logger", "JV.JC"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.shapeManager = null;
this.renderers = null;
this.bsTranslucent = null;
this.holdRepaint = 0;
this.repaintPending = false;
Clazz_instantialize (this, arguments);
}, J.render, "RepaintManager", null, J.api.JmolRepaintManager);
Clazz_prepareFields (c$, function () {
this.bsTranslucent = JU.BS.newN (37);
});
Clazz_makeConstructor (c$, 
function () {
});
Clazz_overrideMethod (c$, "set", 
function (vwr, shapeManager) {
this.vwr = vwr;
this.shapeManager = shapeManager;
}, "JV.Viewer,JV.ShapeManager");
Clazz_overrideMethod (c$, "isRepaintPending", 
function () {
return this.repaintPending;
});
Clazz_overrideMethod (c$, "pushHoldRepaint", 
function (why) {
++this.holdRepaint;
}, "~S");
Clazz_overrideMethod (c$, "popHoldRepaint", 
function (andRepaint, why) {
--this.holdRepaint;
if (this.holdRepaint <= 0) {
this.holdRepaint = 0;
if (andRepaint) {
this.repaintPending = true;
this.repaintNow (why);
}}}, "~B,~S");
Clazz_overrideMethod (c$, "requestRepaintAndWait", 
function (why) {
{
if (typeof Jmol != "undefined" && Jmol._repaint)
Jmol._repaint(this.vwr.html5Applet, false);
this.repaintDone();
}}, "~S");
Clazz_overrideMethod (c$, "repaintIfReady", 
function (why) {
if (this.repaintPending) return false;
this.repaintPending = true;
if (this.holdRepaint == 0) this.repaintNow (why);
return true;
}, "~S");
Clazz_defineMethod (c$, "repaintNow", 
 function (why) {
if (!this.vwr.haveDisplay) return;
this.vwr.apiPlatform.repaint (this.vwr.display);
}, "~S");
Clazz_overrideMethod (c$, "repaintDone", 
function () {
this.repaintPending = false;
{
}});
Clazz_overrideMethod (c$, "clear", 
function (iShape) {
if (this.renderers == null) return;
if (iShape >= 0) this.renderers[iShape] = null;
 else for (var i = 0; i < 37; ++i) this.renderers[i] = null;

}, "~N");
Clazz_defineMethod (c$, "getRenderer", 
 function (shapeID) {
if (this.renderers[shapeID] != null) return this.renderers[shapeID];
var className = JV.JC.getShapeClassName (shapeID, true) + "Renderer";
var renderer;
if ((renderer = J.api.Interface.getInterface (className, this.vwr, "render")) == null) return null;
renderer.setViewerG3dShapeID (this.vwr, shapeID);
return this.renderers[shapeID] = renderer;
}, "~N");
Clazz_overrideMethod (c$, "render", 
function (gdata, modelSet, isFirstPass, navMinMax) {
var g3d = gdata;
if (this.renderers == null) this.renderers =  new Array (37);
this.getAllRenderers ();
try {
var logTime = this.vwr.getBoolean (603979934);
g3d.renderBackground (null);
if (isFirstPass) {
this.bsTranslucent.clearAll ();
if (navMinMax != null) g3d.renderCrossHairs (navMinMax, this.vwr.getScreenWidth (), this.vwr.getScreenHeight (), this.vwr.tm.getNavigationOffset (), this.vwr.tm.navigationDepthPercent);
var band = this.vwr.getRubberBandSelection ();
if (band != null && g3d.setC (this.vwr.cm.colixRubberband)) g3d.drawRect (band.x, band.y, 0, 0, band.width, band.height);
}var msg = null;
for (var i = 0; i < 37 && gdata.currentlyRendering; ++i) {
var shape = this.shapeManager.getShape (i);
if (shape == null) continue;
if (logTime) {
msg = "rendering " + JV.JC.getShapeClassName (i, false);
JU.Logger.startTimer (msg);
}if ((isFirstPass || this.bsTranslucent.get (i)) && this.getRenderer (i).renderShape (g3d, modelSet, shape)) this.bsTranslucent.set (i);
if (logTime) JU.Logger.checkTimer (msg, false);
}
g3d.renderAllStrings (null);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
if (!this.vwr.isJS) e.printStackTrace ();
if (this.vwr.async && "Interface".equals (e.getMessage ())) throw  new NullPointerException ();
JU.Logger.error ("rendering error? " + e);
} else {
throw e;
}
}
}, "JU.GData,JM.ModelSet,~B,~A");
Clazz_defineMethod (c$, "getAllRenderers", 
 function () {
var isOK = true;
for (var i = 0; i < 37; ++i) {
if (this.shapeManager.getShape (i) == null || this.getRenderer (i) != null) continue;
isOK = this.repaintPending = !this.vwr.async;
}
if (!isOK) throw  new NullPointerException ();
});
Clazz_overrideMethod (c$, "renderExport", 
function (gdata, modelSet, params) {
var isOK;
this.vwr.finalizeTransformParameters ();
this.shapeManager.finalizeAtoms (null, null);
var exporter3D = this.vwr.initializeExporter (params);
isOK = (exporter3D != null);
if (!isOK) {
JU.Logger.error ("Cannot export " + params.get ("type"));
return null;
}if (this.renderers == null) this.renderers =  new Array (37);
this.getAllRenderers ();
var msg = null;
try {
var logTime = this.vwr.getBoolean (603979934);
exporter3D.renderBackground (exporter3D);
for (var i = 0; i < 37; ++i) {
var shape = this.shapeManager.getShape (i);
if (shape == null) continue;
if (logTime) {
msg = "rendering " + JV.JC.getShapeClassName (i, false);
JU.Logger.startTimer (msg);
}this.getRenderer (i).renderShape (exporter3D, modelSet, shape);
if (logTime) JU.Logger.checkTimer (msg, false);
}
exporter3D.renderAllStrings (exporter3D);
msg = exporter3D.finalizeOutput ();
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
if (!this.vwr.isJS) e.printStackTrace ();
JU.Logger.error ("rendering error? " + e);
} else {
throw e;
}
}
return msg;
}, "JU.GData,JM.ModelSet,java.util.Map");
});
Clazz_declarePackage ("J.render");
Clazz_load (null, "J.render.ShapeRenderer", ["JV.JC"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.tm = null;
this.g3d = null;
this.ms = null;
this.shape = null;
this.myVisibilityFlag = 0;
this.shapeID = 0;
this.colix = 0;
this.mad = 0;
this.madBeg = 0;
this.madMid = 0;
this.madEnd = 0;
this.exportType = 0;
this.isExport = false;
Clazz_instantialize (this, arguments);
}, J.render, "ShapeRenderer");
Clazz_defineMethod (c$, "initRenderer", 
function () {
});
Clazz_defineMethod (c$, "setViewerG3dShapeID", 
function (vwr, shapeID) {
this.vwr = vwr;
this.tm = vwr.tm;
this.shapeID = shapeID;
this.myVisibilityFlag = JV.JC.getShapeVisibilityFlag (shapeID);
this.initRenderer ();
}, "JV.Viewer,~N");
Clazz_defineMethod (c$, "renderShape", 
function (g3d, modelSet, shape) {
this.g3d = g3d;
this.ms = modelSet;
this.shape = shape;
this.exportType = g3d.getExportType ();
this.isExport = (this.exportType != 0);
var needsTranslucent = this.render ();
this.exportType = 0;
this.isExport = false;
return needsTranslucent;
}, "J.api.JmolRendererInterface,JM.ModelSet,J.shape.Shape");
Clazz_defineMethod (c$, "isVisibleForMe", 
function (a) {
return a.isVisible (this.myVisibilityFlag | 9);
}, "JM.Atom");
});
Clazz_declarePackage ("J.render");
Clazz_load (["J.render.FontLineShapeRenderer", "JU.BS", "$.P3", "$.V3"], "J.render.SticksRenderer", ["java.lang.Float", "J.c.PAL", "JM.Bond", "JU.C", "$.Edge"], function () {
c$ = Clazz_decorateAsClass (function () {
this.showMultipleBonds = false;
this.multipleBondSpacing = 0;
this.multipleBondRadiusFactor = 0;
this.modeMultipleBond = 0;
this.isCartesianExport = false;
this.endcaps = 0;
this.ssbondsBackbone = false;
this.hbondsBackbone = false;
this.bondsBackbone = false;
this.hbondsSolid = false;
this.a = null;
this.b = null;
this.bond = null;
this.xA = 0;
this.yA = 0;
this.zA = 0;
this.xB = 0;
this.yB = 0;
this.zB = 0;
this.dx = 0;
this.dy = 0;
this.mag2d = 0;
this.bondOrder = 0;
this.wireframeOnly = false;
this.isAntialiased = false;
this.slabbing = false;
this.slabByAtom = false;
this.x = null;
this.y = null;
this.z = null;
this.p1 = null;
this.p2 = null;
this.bsForPass2 = null;
this.isPass2 = false;
this.xAxis1 = 0;
this.yAxis1 = 0;
this.xAxis2 = 0;
this.yAxis2 = 0;
this.dxStep = 0;
this.dyStep = 0;
Clazz_instantialize (this, arguments);
}, J.render, "SticksRenderer", J.render.FontLineShapeRenderer);
Clazz_prepareFields (c$, function () {
this.x =  new JU.V3 ();
this.y =  new JU.V3 ();
this.z =  new JU.V3 ();
this.p1 =  new JU.P3 ();
this.p2 =  new JU.P3 ();
this.bsForPass2 = JU.BS.newN (64);
});
Clazz_overrideMethod (c$, "render", 
function () {
var bonds = this.ms.bo;
if (bonds == null) return false;
this.isPass2 = this.vwr.gdata.isPass2;
if (!this.isPass2) this.bsForPass2.clearAll ();
this.slabbing = this.tm.slabEnabled;
this.slabByAtom = this.vwr.getBoolean (603979939);
this.endcaps = 3;
this.dashDots = (this.vwr.getBoolean (603979889) ? J.render.FontLineShapeRenderer.sixdots : J.render.FontLineShapeRenderer.dashes);
this.isCartesianExport = (this.exportType == 1);
this.getMultipleBondSettings (false);
this.wireframeOnly = !this.vwr.checkMotionRendering (1678770178);
this.ssbondsBackbone = this.vwr.getBoolean (603979952);
this.hbondsBackbone = this.vwr.getBoolean (603979852);
this.bondsBackbone =  new Boolean (this.hbondsBackbone | this.ssbondsBackbone).valueOf ();
this.hbondsSolid = this.vwr.getBoolean (603979854);
this.isAntialiased = this.g3d.isAntialiased ();
var needTranslucent = false;
if (!this.isExport && this.isPass2) for (var i = this.bsForPass2.nextSetBit (0); i >= 0; i = this.bsForPass2.nextSetBit (i + 1)) {
this.bond = bonds[i];
this.renderBond ();
}
 else for (var i = this.ms.bondCount; --i >= 0; ) {
this.bond = bonds[i];
if ((this.bond.shapeVisibilityFlags & this.myVisibilityFlag) != 0 && this.renderBond ()) {
needTranslucent = true;
this.bsForPass2.set (i);
}}
return needTranslucent;
});
Clazz_defineMethod (c$, "getMultipleBondSettings", 
 function (isPymol) {
this.multipleBondSpacing = (isPymol ? 0.15 : this.vwr.getFloat (570425370));
this.multipleBondRadiusFactor = (isPymol ? 0.4 : this.vwr.getFloat (570425369));
if (this.multipleBondSpacing == 0 && this.isCartesianExport) this.multipleBondSpacing = 0.2;
this.modeMultipleBond = this.vwr.g.modeMultipleBond;
this.showMultipleBonds = (this.multipleBondSpacing != 0 && this.modeMultipleBond != 0 && this.vwr.getBoolean (603979928));
}, "~B");
Clazz_defineMethod (c$, "renderBond", 
 function () {
var atomA0;
var atomB0;
this.a = atomA0 = this.bond.atom1;
this.b = atomB0 = this.bond.atom2;
var order = this.bond.order & -131073;
if (this.bondsBackbone) {
if (this.ssbondsBackbone && (order & 256) != 0) {
this.a = this.a.group.getLeadAtomOr (this.a);
this.b = this.b.group.getLeadAtomOr (this.b);
} else if (this.hbondsBackbone && JM.Bond.isOrderH (order)) {
this.a = this.a.group.getLeadAtomOr (this.a);
this.b = this.b.group.getLeadAtomOr (this.b);
}}if (!this.isPass2 && (!this.a.isVisible (9) || !this.b.isVisible (9) || !this.g3d.isInDisplayRange (this.a.sX, this.a.sY) || !this.g3d.isInDisplayRange (this.b.sX, this.b.sY))) return false;
if (this.slabbing) {
if (this.vwr.gdata.isClippedZ (this.a.sZ) && this.vwr.gdata.isClippedZ (this.b.sZ) || this.slabByAtom && (this.vwr.gdata.isClippedZ (this.a.sZ) || this.vwr.gdata.isClippedZ (this.b.sZ))) return false;
}this.zA = this.a.sZ;
this.zB = this.b.sZ;
if (this.zA == 1 || this.zB == 1) return false;
this.colixA = atomA0.colixAtom;
this.colixB = atomB0.colixAtom;
if (((this.colix = this.bond.colix) & -30721) == 2) {
this.colix = (this.colix & 30720);
this.colixA = JU.C.getColixInherited ((this.colix | this.vwr.cm.getColixAtomPalette (atomA0, J.c.PAL.CPK.id)), this.colixA);
this.colixB = JU.C.getColixInherited ((this.colix | this.vwr.cm.getColixAtomPalette (atomB0, J.c.PAL.CPK.id)), this.colixB);
} else {
this.colixA = JU.C.getColixInherited (this.colix, this.colixA);
this.colixB = JU.C.getColixInherited (this.colix, this.colixB);
}var needTranslucent = false;
if (!this.isExport && !this.isPass2) {
var doA = !JU.C.isColixTranslucent (this.colixA);
var doB = !JU.C.isColixTranslucent (this.colixB);
if (!doA || !doB) {
if (!doA && !doB && !needTranslucent) {
this.g3d.setC (!doA ? this.colixA : this.colixB);
return true;
}needTranslucent = true;
}}this.bondOrder = order & -131073;
if ((this.bondOrder & 224) == 0) {
if ((this.bondOrder & 256) != 0) this.bondOrder &= -257;
if ((this.bondOrder & 1023) != 0) {
if (!this.showMultipleBonds || (this.modeMultipleBond == 2 && this.mad > 500) || (this.bondOrder & 98304) == 65536) {
this.bondOrder = 1;
}}}var mask = 0;
switch (this.bondOrder) {
case 1:
case 2:
case 3:
case 4:
break;
case 17:
case 513:
this.bondOrder = 1;
mask = (order == 513 ? 0 : 1);
break;
case 515:
case 514:
this.bondOrder = 2;
mask = (order == 515 ? this.getAromaticDottedBondMask () : 0);
break;
default:
if ((this.bondOrder & 224) != 0) {
this.bondOrder = JU.Edge.getPartialBondOrder (order);
mask = JU.Edge.getPartialBondDotted (order);
} else if (JM.Bond.isOrderH (this.bondOrder)) {
this.bondOrder = 1;
if (!this.hbondsSolid) mask = -1;
} else if (this.bondOrder == 32768) {
this.bondOrder = 1;
} else if ((this.bondOrder & 98304) == 98304) {
this.getMultipleBondSettings (true);
this.bondOrder &= 3;
mask = -2;
}}
this.xA = this.a.sX;
this.yA = this.a.sY;
this.xB = this.b.sX;
this.yB = this.b.sY;
this.mad = this.bond.mad;
if (this.multipleBondRadiusFactor > 0 && this.bondOrder > 1) this.mad *= this.multipleBondRadiusFactor;
this.dx = this.xB - this.xA;
this.dy = this.yB - this.yA;
this.width = Clazz_floatToInt (this.vwr.tm.scaleToScreen (Clazz_doubleToInt ((this.zA + this.zB) / 2), this.mad));
if (this.wireframeOnly && this.width > 0) this.width = 1;
if (!this.isCartesianExport) {
this.asLineOnly = (this.width <= 1);
if (this.asLineOnly && (this.isAntialiased)) {
this.width = 3;
this.asLineOnly = false;
}}switch (mask) {
case -2:
this.drawBond (0);
this.getMultipleBondSettings (false);
break;
case -1:
this.drawDashed (this.xA, this.yA, this.zA, this.xB, this.yB, this.zB, J.render.FontLineShapeRenderer.hDashes);
break;
default:
this.drawBond (mask);
break;
}
return needTranslucent;
});
Clazz_defineMethod (c$, "drawBond", 
 function (dottedMask) {
if (this.isCartesianExport && this.bondOrder == 1) {
this.g3d.drawBond (this.a, this.b, this.colixA, this.colixB, this.endcaps, this.mad, -1);
return;
}var isEndOn = (this.dx == 0 && this.dy == 0);
if (isEndOn && this.asLineOnly) return;
var doFixedSpacing = (this.bondOrder > 1 && this.multipleBondSpacing > 0);
var isPiBonded = doFixedSpacing && (this.vwr.getHybridizationAndAxes (this.a.i, this.z, this.x, "pz") != null || this.vwr.getHybridizationAndAxes (this.b.i, this.z, this.x, "pz") != null) && !Float.isNaN (this.x.x);
if (isEndOn && !doFixedSpacing) {
var space = Clazz_doubleToInt (this.width / 8) + 3;
var step = this.width + space;
var y = this.yA - Clazz_doubleToInt ((this.bondOrder - 1) * step / 2);
do {
this.fillCylinder (this.colixA, this.colixA, this.endcaps, this.width, this.xA, y, this.zA, this.xA, y, this.zA);
y += step;
} while (--this.bondOrder > 0);
return;
}var isDashed = (dottedMask & 1) != 0;
if (this.bondOrder == 1) {
if (isDashed) this.drawDashed (this.xA, this.yA, this.zA, this.xB, this.yB, this.zB, this.dashDots);
 else this.fillCylinder (this.colixA, this.colixB, this.endcaps, this.width, this.xA, this.yA, this.zA, this.xB, this.yB, this.zB);
return;
}if (doFixedSpacing) {
if (!isPiBonded) this.z.setT (JU.P3.getUnlikely ());
this.x.sub2 (this.b, this.a);
this.y.cross (this.x, this.z);
this.y.normalize ();
if (Float.isNaN (this.y.x)) {
this.z.setT (JU.P3.getUnlikely ());
this.y.cross (this.x, this.z);
this.y.cross (this.y, this.x);
this.y.normalize ();
}this.y.scale (this.multipleBondSpacing);
this.x.setT (this.y);
this.x.scale ((this.bondOrder - 1) / 2);
this.p1.sub2 (this.a, this.x);
this.p2.sub2 (this.b, this.x);
while (true) {
if (this.isCartesianExport && !isDashed) {
this.g3d.drawBond (this.p1, this.p2, this.colixA, this.colixB, this.endcaps, this.mad, -2);
} else {
this.tm.transformPtScr (this.p1, this.s1);
this.tm.transformPtScr (this.p2, this.s2);
if (isDashed) this.drawDashed (this.s1.x, this.s1.y, this.s1.z, this.s2.x, this.s2.y, this.s2.z, this.dashDots);
 else this.fillCylinder (this.colixA, this.colixB, this.endcaps, this.width, this.s1.x, this.s1.y, this.s1.z, this.s2.x, this.s2.y, this.s2.z);
dottedMask >>= 1;
isDashed = (dottedMask & 1) != 0;
}if (--this.bondOrder <= 0) break;
this.p1.add (this.y);
this.p2.add (this.y);
this.stepAxisCoordinates ();
}
return;
}var dxB = this.dx * this.dx;
var dyB = this.dy * this.dy;
this.mag2d = Math.round (Math.sqrt (dxB + dyB));
this.resetAxisCoordinates ();
while (true) {
if ((dottedMask & 1) != 0) this.drawDashed (this.xAxis1, this.yAxis1, this.zA, this.xAxis2, this.yAxis2, this.zB, this.dashDots);
 else this.fillCylinder (this.colixA, this.colixB, this.endcaps, this.width, this.xAxis1, this.yAxis1, this.zA, this.xAxis2, this.yAxis2, this.zB);
dottedMask >>= 1;
if (--this.bondOrder <= 0) break;
this.stepAxisCoordinates ();
}
}, "~N");
Clazz_defineMethod (c$, "resetAxisCoordinates", 
 function () {
var space = this.mag2d >> 3;
if (this.multipleBondSpacing != -1 && this.multipleBondSpacing < 0) space *= -this.multipleBondSpacing;
var step = this.width + space;
this.dxStep = Clazz_doubleToInt (step * this.dy / this.mag2d);
this.dyStep = Clazz_doubleToInt (step * -this.dx / this.mag2d);
this.xAxis1 = this.xA;
this.yAxis1 = this.yA;
this.xAxis2 = this.xB;
this.yAxis2 = this.yB;
var f = (this.bondOrder - 1);
this.xAxis1 -= Clazz_doubleToInt (this.dxStep * f / 2);
this.yAxis1 -= Clazz_doubleToInt (this.dyStep * f / 2);
this.xAxis2 -= Clazz_doubleToInt (this.dxStep * f / 2);
this.yAxis2 -= Clazz_doubleToInt (this.dyStep * f / 2);
});
Clazz_defineMethod (c$, "stepAxisCoordinates", 
 function () {
this.xAxis1 += this.dxStep;
this.yAxis1 += this.dyStep;
this.xAxis2 += this.dxStep;
this.yAxis2 += this.dyStep;
});
Clazz_defineMethod (c$, "getAromaticDottedBondMask", 
 function () {
var atomC = this.b.findAromaticNeighbor (this.a.i);
if (atomC == null) return 1;
var dxAC = atomC.sX - this.xA;
var dyAC = atomC.sY - this.yA;
return ((this.dx * dyAC - this.dy * dxAC) < 0 ? 2 : 1);
});
});
Clazz_declarePackage ("JS");
Clazz_load (["JS.T"], "JS.ContextToken", ["java.util.Hashtable", "JS.SV"], function () {
c$ = Clazz_decorateAsClass (function () {
this.contextVariables = null;
this.name0 = null;
Clazz_instantialize (this, arguments);
}, JS, "ContextToken", JS.T);
c$.newContext = Clazz_defineMethod (c$, "newContext", 
function (isOpen) {
var ct = (isOpen ? JS.ContextToken.newCmd (1276384259, "{") : JS.ContextToken.newCmd (1276383249, "}"));
ct.intValue = 0;
return ct;
}, "~B");
c$.newCmd = Clazz_defineMethod (c$, "newCmd", 
function (tok, value) {
var ct =  new JS.ContextToken ();
ct.tok = tok;
ct.value = value;
return ct;
}, "~N,~O");
Clazz_defineMethod (c$, "addName", 
function (name) {
if (this.contextVariables == null) this.contextVariables =  new java.util.Hashtable ();
this.contextVariables.put (name, JS.SV.newS ("").setName (name));
}, "~S");
});
Clazz_declarePackage ("JS");
Clazz_load (null, "JS.ScriptContext", ["java.util.Hashtable", "JS.SV"], function () {
c$ = Clazz_decorateAsClass (function () {
this.aatoken = null;
this.allowJSThreads = false;
this.chk = false;
this.contextPath = " >> ";
this.vars = null;
this.displayLoadErrorsSave = false;
this.errorMessage = null;
this.errorMessageUntranslated = null;
this.errorType = null;
this.executionPaused = false;
this.executionStepping = false;
this.functionName = null;
this.iCommandError = -1;
this.id = 0;
this.isComplete = true;
this.isFunction = false;
this.isJSThread = false;
this.isStateScript = false;
this.isTryCatch = false;
this.iToken = 0;
this.lineEnd = 2147483647;
this.lineIndices = null;
this.lineNumbers = null;
this.mustResumeEval = false;
this.outputBuffer = null;
this.parallelProcessor = null;
this.parentContext = null;
this.pc = 0;
this.pc0 = 0;
this.pcEnd = 2147483647;
this.script = null;
this.scriptExtensions = null;
this.scriptFileName = null;
this.scriptLevel = 0;
this.statement = null;
this.htFileCache = null;
this.statementLength = 0;
this.token = null;
this.tryPt = 0;
this.theToken = null;
this.theTok = 0;
Clazz_instantialize (this, arguments);
}, JS, "ScriptContext");
Clazz_makeConstructor (c$, 
function () {
this.id = ++JS.ScriptContext.contextCount;
});
Clazz_defineMethod (c$, "setMustResume", 
function () {
var sc = this;
while (sc != null) {
sc.mustResumeEval = true;
sc.pc = sc.pc0;
sc = sc.parentContext;
}
});
Clazz_defineMethod (c$, "getVariable", 
function ($var) {
var context = this;
while (context != null && !context.isFunction) {
if (context.vars != null && context.vars.containsKey ($var)) return context.vars.get ($var);
context = context.parentContext;
}
return null;
}, "~S");
Clazz_defineMethod (c$, "getFullMap", 
function () {
var ht =  new java.util.Hashtable ();
var context = this;
if (this.contextPath != null) ht.put ("_path", JS.SV.newS (this.contextPath));
while (context != null && !context.isFunction) {
if (context.vars != null) for (var key, $key = context.vars.keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) if (!ht.containsKey (key)) {
var val = context.vars.get (key);
if (val.tok != 2 || val.intValue != 2147483647) ht.put (key, val);
}
context = context.parentContext;
}
return ht;
});
Clazz_defineStatics (c$,
"contextCount", 0);
});
Clazz_declarePackage ("JS");
Clazz_load (["java.lang.Exception"], "JS.ScriptException", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.eval = null;
this.message = null;
this.untranslated = null;
this.isError = false;
Clazz_instantialize (this, arguments);
}, JS, "ScriptException", Exception);
Clazz_makeConstructor (c$, 
function (se, msg, untranslated, isError) {
this.eval = se;
this.message = msg;
this.isError = isError;
if (!isError) return;
this.eval.setException (this, msg, untranslated);
}, "JS.ScriptError,~S,~S,~B");
Clazz_defineMethod (c$, "getErrorMessageUntranslated", 
function () {
return this.untranslated;
});
Clazz_overrideMethod (c$, "toString", 
function () {
return this.message;
});
});
Clazz_declarePackage ("JS");
Clazz_load (["javajs.api.JSONEncodable", "JS.T", "JU.P3"], "JS.SV", ["java.lang.Boolean", "$.Float", "java.util.Arrays", "$.Collections", "$.Hashtable", "$.Map", "JU.AU", "$.BArray", "$.BS", "$.Base64", "$.Lst", "$.M3", "$.M34", "$.M4", "$.Measure", "$.P4", "$.PT", "$.Quat", "$.SB", "$.T3", "$.V3", "JM.BondSet", "JS.ScriptContext", "JU.BSUtil", "$.Escape"], function () {
c$ = Clazz_decorateAsClass (function () {
this.index = 2147483647;
this.flags = 2;
this.myName = null;
if (!Clazz_isClassDefined ("JS.SV.Sort")) {
JS.SV.$SV$Sort$ ();
}
Clazz_instantialize (this, arguments);
}, JS, "SV", JS.T, javajs.api.JSONEncodable);
c$.newV = Clazz_defineMethod (c$, "newV", 
function (tok, value) {
var sv =  new JS.SV ();
sv.tok = tok;
sv.value = value;
return sv;
}, "~N,~O");
c$.newI = Clazz_defineMethod (c$, "newI", 
function (i) {
var sv =  new JS.SV ();
sv.tok = 2;
sv.intValue = i;
return sv;
}, "~N");
c$.newS = Clazz_defineMethod (c$, "newS", 
function (s) {
return JS.SV.newV (4, s);
}, "~S");
c$.newT = Clazz_defineMethod (c$, "newT", 
function (x) {
return JS.SV.newSV (x.tok, x.intValue, x.value);
}, "JS.T");
c$.newSV = Clazz_defineMethod (c$, "newSV", 
function (tok, intValue, value) {
var sv = JS.SV.newV (tok, value);
sv.intValue = intValue;
return sv;
}, "~N,~N,~O");
Clazz_defineMethod (c$, "setv", 
function (v) {
this.index = v.index;
this.intValue = v.intValue;
this.tok = v.tok;
this.value = v.value;
return this;
}, "JS.SV");
c$.sizeOf = Clazz_defineMethod (c$, "sizeOf", 
function (x) {
switch (x == null ? 0 : x.tok) {
case 10:
return JU.BSUtil.cardinalityOf (JS.SV.bsSelectToken (x));
case 1048589:
case 1048588:
return -1;
case 2:
return -2;
case 3:
return -4;
case 8:
return -8;
case 9:
return -16;
case 11:
return -32;
case 12:
return -64;
case 15:
return (x.value).data.length;
case 4:
return (x.value).length;
case 7:
return x.intValue == 2147483647 ? (x).getList ().size () : JS.SV.sizeOf (JS.SV.selectItemTok (x, -2147483648));
case 6:
return (x.value).size ();
case 14:
return (x.value).getFullMap ().size ();
default:
return 0;
}
}, "JS.T");
c$.isVariableType = Clazz_defineMethod (c$, "isVariableType", 
function (x) {
return (Clazz_instanceOf (x, JS.SV) || Clazz_instanceOf (x, Boolean) || Clazz_instanceOf (x, Integer) || Clazz_instanceOf (x, Float) || Clazz_instanceOf (x, String) || Clazz_instanceOf (x, JU.T3) || Clazz_instanceOf (x, JU.BS) || Clazz_instanceOf (x, JU.P4) || Clazz_instanceOf (x, JU.Quat) || Clazz_instanceOf (x, JU.M34) || Clazz_instanceOf (x, java.util.Map) || Clazz_instanceOf (x, JU.Lst) || Clazz_instanceOf (x, JU.BArray) || Clazz_instanceOf (x, JS.ScriptContext) || JS.SV.isArray (x));
}, "~O");
c$.isArray = Clazz_defineMethod (c$, "isArray", 
 function (x) {
{
return Clazz_instanceOf(x, Array);
}}, "~O");
c$.getVariable = Clazz_defineMethod (c$, "getVariable", 
function (x) {
if (x == null) return JS.SV.newS ("");
if (Clazz_instanceOf (x, JS.SV)) return x;
if (Clazz_instanceOf (x, Boolean)) return JS.SV.getBoolean ((x).booleanValue ());
if (Clazz_instanceOf (x, Integer)) return JS.SV.newI ((x).intValue ());
if (Clazz_instanceOf (x, Float)) return JS.SV.newV (3, x);
if (Clazz_instanceOf (x, String)) {
x = JS.SV.unescapePointOrBitsetAsVariable (x);
if (Clazz_instanceOf (x, JS.SV)) return x;
return JS.SV.newV (4, x);
}if (Clazz_instanceOf (x, JU.P3)) return JS.SV.newV (8, x);
if (Clazz_instanceOf (x, JU.V3)) return JS.SV.newV (8, JU.P3.newP (x));
if (Clazz_instanceOf (x, JU.BS)) return JS.SV.newV (10, x);
if (Clazz_instanceOf (x, JU.P4)) return JS.SV.newV (9, x);
if (Clazz_instanceOf (x, JU.Quat)) return JS.SV.newV (9, (x).toPoint4f ());
if (Clazz_instanceOf (x, JU.M34)) return JS.SV.newV (Clazz_instanceOf (x, JU.M4) ? 12 : 11, x);
if (Clazz_instanceOf (x, java.util.Map)) return JS.SV.getVariableMap (x);
if (Clazz_instanceOf (x, JU.Lst)) return JS.SV.getVariableList (x);
if (Clazz_instanceOf (x, JU.BArray)) return JS.SV.newV (15, x);
if (Clazz_instanceOf (x, JS.ScriptContext)) return JS.SV.newV (14, x);
if (JU.Escape.isAV (x)) return JS.SV.getVariableAV (x);
if (JU.PT.isAI (x)) return JS.SV.getVariableAI (x);
if (JU.PT.isAB (x)) return JS.SV.getVariableAB (x);
if (JU.PT.isAF (x)) return JS.SV.getVariableAF (x);
if (JU.PT.isAD (x)) return JS.SV.getVariableAD (x);
if (JU.PT.isAS (x)) return JS.SV.getVariableAS (x);
if (JU.PT.isAP (x)) return JS.SV.getVariableAP (x);
if (JU.PT.isAII (x)) return JS.SV.getVariableAII (x);
if (JU.PT.isAFF (x)) return JS.SV.getVariableAFF (x);
if (JU.PT.isASS (x)) return JS.SV.getVariableASS (x);
if (JU.PT.isADD (x)) return JS.SV.getVariableADD (x);
if (JU.PT.isAFloat (x)) return JS.SV.newV (13, x);
return JS.SV.newS (x.toString ());
}, "~O");
c$.getVariableMap = Clazz_defineMethod (c$, "getVariableMap", 
function (x) {
var ht = x;
var o = null;
for (var oo, $oo = ht.values ().iterator (); $oo.hasNext () && ((oo = $oo.next ()) || true);) {
o = oo;
break;
}
if (!(Clazz_instanceOf (o, JS.SV))) {
var x2 =  new java.util.Hashtable ();
for (var entry, $entry = ht.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) x2.put (entry.getKey (), JS.SV.getVariable (entry.getValue ()));

x = x2;
}return JS.SV.newV (6, x);
}, "java.util.Map");
c$.getVariableList = Clazz_defineMethod (c$, "getVariableList", 
function (v) {
var len = v.size ();
if (len > 0 && Clazz_instanceOf (v.get (0), JS.SV)) return JS.SV.newV (7, v);
var objects =  new JU.Lst ();
for (var i = 0; i < len; i++) objects.addLast (JS.SV.getVariable (v.get (i)));

return JS.SV.newV (7, objects);
}, "JU.Lst");
c$.getVariableAV = Clazz_defineMethod (c$, "getVariableAV", 
function (v) {
var objects =  new JU.Lst ();
for (var i = 0; i < v.length; i++) objects.addLast (v[i]);

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableAD = Clazz_defineMethod (c$, "getVariableAD", 
function (f) {
var objects =  new JU.Lst ();
for (var i = 0; i < f.length; i++) objects.addLast (JS.SV.newV (3, Float.$valueOf (f[i])));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableAS = Clazz_defineMethod (c$, "getVariableAS", 
function (s) {
var objects =  new JU.Lst ();
for (var i = 0; i < s.length; i++) objects.addLast (JS.SV.newV (4, s[i]));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableAP = Clazz_defineMethod (c$, "getVariableAP", 
function (p) {
var objects =  new JU.Lst ();
for (var i = 0; i < p.length; i++) objects.addLast (JS.SV.newV (8, p[i]));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableAFF = Clazz_defineMethod (c$, "getVariableAFF", 
function (fx) {
var objects =  new JU.Lst ();
for (var i = 0; i < fx.length; i++) objects.addLast (JS.SV.getVariableAF (fx[i]));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableADD = Clazz_defineMethod (c$, "getVariableADD", 
function (fx) {
var objects =  new JU.Lst ();
for (var i = 0; i < fx.length; i++) objects.addLast (JS.SV.getVariableAD (fx[i]));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableASS = Clazz_defineMethod (c$, "getVariableASS", 
function (fx) {
var objects =  new JU.Lst ();
for (var i = 0; i < fx.length; i++) objects.addLast (JS.SV.getVariableAS (fx[i]));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableAII = Clazz_defineMethod (c$, "getVariableAII", 
function (ix) {
var objects =  new JU.Lst ();
for (var i = 0; i < ix.length; i++) objects.addLast (JS.SV.getVariableAI (ix[i]));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableAF = Clazz_defineMethod (c$, "getVariableAF", 
function (f) {
var objects =  new JU.Lst ();
for (var i = 0; i < f.length; i++) objects.addLast (JS.SV.newV (3, Float.$valueOf (f[i])));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableAI = Clazz_defineMethod (c$, "getVariableAI", 
function (ix) {
var objects =  new JU.Lst ();
for (var i = 0; i < ix.length; i++) objects.addLast (JS.SV.newI (ix[i]));

return JS.SV.newV (7, objects);
}, "~A");
c$.getVariableAB = Clazz_defineMethod (c$, "getVariableAB", 
function (ix) {
var objects =  new JU.Lst ();
for (var i = 0; i < ix.length; i++) objects.addLast (JS.SV.newI (ix[i]));

return JS.SV.newV (7, objects);
}, "~A");
Clazz_defineMethod (c$, "setName", 
function (name) {
this.myName = name;
this.flags |= 1;
return this;
}, "~S");
Clazz_defineMethod (c$, "isModified", 
function () {
return JS.T.tokAttr (this.flags, 2);
});
Clazz_defineMethod (c$, "setModified", 
function (tf) {
if (tf) this.flags |= 2;
 else this.flags &= -3;
}, "~B");
Clazz_defineMethod (c$, "canIncrement", 
function () {
return true;
});
Clazz_defineMethod (c$, "increment", 
function (n) {
if (!this.canIncrement ()) return false;
switch (this.tok) {
case 2:
this.intValue += n;
break;
case 3:
this.value = Float.$valueOf ((this.value).floatValue () + n);
break;
default:
return false;
}
return true;
}, "~N");
Clazz_defineMethod (c$, "asBoolean", 
function () {
return JS.SV.bValue (this);
});
Clazz_defineMethod (c$, "asInt", 
function () {
return JS.SV.iValue (this);
});
Clazz_defineMethod (c$, "asFloat", 
function () {
return JS.SV.fValue (this);
});
Clazz_defineMethod (c$, "asString", 
function () {
return JS.SV.sValue (this);
});
c$.oValue = Clazz_defineMethod (c$, "oValue", 
function (x) {
switch (x == null ? 0 : x.tok) {
case 1048589:
return Boolean.TRUE;
case 0:
case 1048588:
return Boolean.FALSE;
case 2:
return Integer.$valueOf (x.intValue);
case 10:
case 135266306:
return JS.SV.selectItemVar (x).value;
default:
return x.value;
}
}, "JS.SV");
c$.nValue = Clazz_defineMethod (c$, "nValue", 
function (x) {
var iValue;
switch (x == null ? 0 : x.tok) {
case 3:
return x.value;
case 2:
iValue = x.intValue;
break;
case 4:
if ((x.value).indexOf (".") >= 0) return Float.$valueOf (JS.SV.toFloat (x.value));
iValue = Clazz_floatToInt (JS.SV.toFloat (x.value));
break;
case 8:
return Float.$valueOf ((x.value).length ());
default:
iValue = 0;
}
return Integer.$valueOf (iValue);
}, "JS.T");
c$.bValue = Clazz_defineMethod (c$, "bValue", 
function (x) {
switch (x == null ? 0 : x.tok) {
case 1048589:
case 6:
case 14:
return true;
case 1048588:
return false;
case 2:
return x.intValue != 0;
case 3:
case 4:
case 7:
return JS.SV.fValue (x) != 0;
case 10:
case 15:
return JS.SV.iValue (x) != 0;
case 8:
case 9:
case 11:
case 12:
return Math.abs (JS.SV.fValue (x)) > 0.0001;
default:
return false;
}
}, "JS.T");
c$.iValue = Clazz_defineMethod (c$, "iValue", 
function (x) {
switch (x == null ? 0 : x.tok) {
case 1048589:
return 1;
case 1048588:
return 0;
case 2:
return x.intValue;
case 3:
case 7:
case 4:
case 8:
case 9:
case 11:
case 12:
return Clazz_floatToInt (JS.SV.fValue (x));
case 10:
return JU.BSUtil.cardinalityOf (JS.SV.bsSelectToken (x));
case 15:
return (x.value).data.length;
default:
return 0;
}
}, "JS.T");
c$.fValue = Clazz_defineMethod (c$, "fValue", 
function (x) {
switch (x == null ? 0 : x.tok) {
case 1048589:
return 1;
case 1048588:
return 0;
case 2:
return x.intValue;
case 3:
return (x.value).floatValue ();
case 7:
var i = x.intValue;
if (i == 2147483647) return (x).getList ().size ();
case 4:
return JS.SV.toFloat (JS.SV.sValue (x));
case 10:
case 15:
return JS.SV.iValue (x);
case 8:
return (x.value).length ();
case 9:
return JU.Measure.distanceToPlane (x.value, JS.SV.pt0);
case 11:
var pt =  new JU.P3 ();
(x.value).rotate (pt);
return pt.length ();
case 12:
var pt1 =  new JU.P3 ();
(x.value).rotTrans (pt1);
return pt1.length ();
default:
return 0;
}
}, "JS.T");
c$.sValue = Clazz_defineMethod (c$, "sValue", 
function (x) {
if (x == null) return "";
var i;
var sb;
switch (x.tok) {
case 1048589:
return "true";
case 1048588:
return "false";
case 2:
return "" + x.intValue;
case 10:
var bs = JS.SV.bsSelectToken (x);
return (Clazz_instanceOf (x.value, JM.BondSet) ? JU.Escape.eBond (bs) : JU.Escape.eBS (bs));
case 7:
var sv = (x).getList ();
i = x.intValue;
if (i <= 0) i = sv.size () - i;
if (i != 2147483647) return (i < 1 || i > sv.size () ? "" : JS.SV.sValue (sv.get (i - 1)));
case 6:
case 14:
if (Clazz_instanceOf (x.value, String)) return x.value;
sb =  new JU.SB ();
JS.SV.sValueArray (sb, x, "", "", false, true, true, 2147483647, false);
return JU.PT.rep (sb.toString (), "\n\0", " ");
case 4:
var s = x.value;
i = x.intValue;
if (i <= 0) i = s.length - i;
if (i == 2147483647) return s;
if (i < 1 || i > s.length) return "";
return "" + s.charAt (i - 1);
case 8:
return JU.Escape.eP (x.value);
case 9:
return JU.Escape.eP4 (x.value);
case 11:
case 12:
return JU.Escape.e (x.value);
default:
return x.value.toString ();
}
}, "JS.T");
c$.sValueArray = Clazz_defineMethod (c$, "sValueArray", 
 function (sb, vx, path, tabs, isEscaped, isRaw, addValues, maxLevels, skipEmpty) {
switch (vx.tok) {
case 6:
case 14:
case 7:
var thiskey = ";" + vx.hashCode () + ";";
if (path.indexOf (thiskey) >= 0) {
sb.append (isEscaped ? "{}" : vx.myName == null ? "\0\"<circular reference>\"" : "<" + vx.myName + ">");
break;
}path += thiskey;
if (vx.tok == 7) {
if (!addValues) return;
if (!isRaw) sb.append (isEscaped ? "[ " : tabs + "[\n");
var sx = vx.getList ();
for (var i = 0; i < sx.size (); i++) {
if (isEscaped && i > 0) sb.append (",");
var sv = sx.get (i);
JS.SV.sValueArray (sb, sv, path, tabs + "  ", isEscaped, tabs.length == 0 && !isEscaped && JS.SV.isRawType (sv.tok), addValues, maxLevels, skipEmpty);
if (!isEscaped) sb.append ("\n");
}
if (!isRaw) sb.append (isEscaped ? " ]" : tabs + "]");
} else if (--maxLevels >= 0) {
var ht = (vx.tok == 14 ? (vx.value).getFullMap () : vx.getMap ());
JS.SV.addKeys (sb, path, ht, tabs, isEscaped, addValues, maxLevels, skipEmpty);
}break;
default:
if (!addValues) return;
if (!isRaw && !isEscaped) sb.append (tabs);
sb.append (isEscaped ? vx.escape () : JS.SV.sValue (vx));
}
}, "JU.SB,JS.SV,~S,~S,~B,~B,~B,~N,~B");
c$.addKeys = Clazz_defineMethod (c$, "addKeys", 
 function (sb, path, ht, tabs, isEscaped, addValues, maxLevels, skipEmpty) {
if (maxLevels < 0) return;
var keyset = ht.keySet ();
var keys = ht.keySet ().toArray ( new Array (keyset.size ()));
java.util.Arrays.sort (keys);
if (isEscaped) {
sb.append ("{ ");
var sep = "";
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var val = ht.get (key);
if (skipEmpty && val.tok == 7 && val.getList ().size () == 0 || val.tok == 6 && val.getMap ().isEmpty ()) continue;
if (addValues) sb.append (sep).append (JU.PT.esc (key)).append (":");
 else sb.appendC (' ').append (key);
JS.SV.sValueArray (sb, val, path, tabs + "  ", true, false, addValues, maxLevels, skipEmpty);
sep = ",";
}
sb.append (" }");
if (!addValues) sb.append ("\n");
return;
}sb.append (tabs).append ("{\n");
tabs += "  ";
for (var i = 0; i < keys.length; i++) {
sb.append (tabs);
var key = keys[i];
sb.append (key).append ("  :");
var sb2 =  new JU.SB ();
var v = ht.get (key);
isEscaped = JS.SV.isRawType (v.tok);
JS.SV.sValueArray (sb2, v, path, tabs, isEscaped, false, addValues, maxLevels, skipEmpty);
var value = sb2.toString ();
if (isEscaped && addValues) sb.append ("  ");
 else sb.append ("\n");
sb.append (value).append ("\n");
}
sb.append (tabs.substring (1)).append ("}");
}, "JU.SB,~S,java.util.Map,~S,~B,~B,~N,~B");
c$.isRawType = Clazz_defineMethod (c$, "isRawType", 
 function (tok) {
switch (tok) {
case 4:
case 3:
case 2:
case 8:
case 9:
case 10:
case 15:
case 1048589:
case 1048588:
return true;
}
return false;
}, "~N");
c$.ptValue = Clazz_defineMethod (c$, "ptValue", 
function (x) {
switch (x.tok) {
case 8:
return x.value;
case 4:
var o = JU.Escape.uP (x.value);
if (Clazz_instanceOf (o, JU.P3)) return o;
}
return null;
}, "JS.SV");
c$.pt4Value = Clazz_defineMethod (c$, "pt4Value", 
function (x) {
switch (x.tok) {
case 9:
return x.value;
case 4:
var o = JU.Escape.uP (x.value);
if (!(Clazz_instanceOf (o, JU.P4))) break;
return o;
}
return null;
}, "JS.SV");
c$.toFloat = Clazz_defineMethod (c$, "toFloat", 
 function (s) {
return (s.equalsIgnoreCase ("true") ? 1 : s.length == 0 || s.equalsIgnoreCase ("false") ? 0 : JU.PT.parseFloatStrict (s));
}, "~S");
c$.concatList = Clazz_defineMethod (c$, "concatList", 
function (x1, x2, asNew) {
var v1 = x1.getList ();
var v2 = x2.getList ();
if (!asNew) {
if (v2 == null) v1.addLast (JS.SV.newT (x2));
 else for (var i = 0; i < v2.size (); i++) v1.addLast (v2.get (i));

return x1;
}var vlist =  new JU.Lst ();
if (v1 == null) vlist.addLast (x1);
 else for (var i = 0; i < v1.size (); i++) vlist.addLast (v1.get (i));

if (v2 == null) vlist.addLast (x2);
 else for (var i = 0; i < v2.size (); i++) vlist.addLast (v2.get (i));

return JS.SV.getVariableList (vlist);
}, "JS.SV,JS.SV,~B");
c$.bsSelectToken = Clazz_defineMethod (c$, "bsSelectToken", 
function (x) {
x = JS.SV.selectItemTok (x, -2147483648);
return x.value;
}, "JS.T");
c$.bsSelectVar = Clazz_defineMethod (c$, "bsSelectVar", 
function ($var) {
if ($var.index == 2147483647) $var = JS.SV.selectItemVar ($var);
return $var.value;
}, "JS.SV");
c$.bsSelectRange = Clazz_defineMethod (c$, "bsSelectRange", 
function (x, n) {
x = JS.SV.selectItemTok (x, -2147483648);
x = JS.SV.selectItemTok (x, (n <= 0 ? n : 1));
x = JS.SV.selectItemTok (x, (n <= 0 ? 2147483646 : n));
return x.value;
}, "JS.T,~N");
c$.selectItemVar = Clazz_defineMethod (c$, "selectItemVar", 
function ($var) {
if ($var.index != 2147483647 || ($var.tok == 7 || $var.tok == 15) && $var.intValue == 2147483647) return $var;
return JS.SV.selectItemTok ($var, -2147483648);
}, "JS.SV");
c$.selectItemTok = Clazz_defineMethod (c$, "selectItemTok", 
function (tokenIn, i2) {
switch (tokenIn.tok) {
case 11:
case 12:
case 10:
case 7:
case 15:
case 4:
break;
default:
return tokenIn;
}
var bs = null;
var s = null;
var i1 = tokenIn.intValue;
var isOne = (i2 == -2147483648);
if (i1 == 2147483647) {
return JS.SV.newSV (tokenIn.tok, (isOne ? i1 : i2), tokenIn.value);
}var len = 0;
var isInputSelected = (Clazz_instanceOf (tokenIn, JS.SV) && (tokenIn).index != 2147483647);
var tokenOut = JS.SV.newSV (tokenIn.tok, 2147483647, null);
switch (tokenIn.tok) {
case 10:
if (Clazz_instanceOf (tokenIn.value, JM.BondSet)) {
bs = JM.BondSet.newBS (tokenIn.value, (tokenIn.value).associatedAtoms);
len = JU.BSUtil.cardinalityOf (bs);
} else {
bs = JU.BSUtil.copy (tokenIn.value);
len = (isInputSelected ? 1 : JU.BSUtil.cardinalityOf (bs));
}break;
case 15:
len = (((tokenIn).value)).data.length;
break;
case 7:
len = (tokenIn).getList ().size ();
break;
case 4:
s = tokenIn.value;
len = s.length;
break;
case 11:
len = -3;
break;
case 12:
len = -4;
break;
}
if (len < 0) {
len = -len;
if (i1 > 0 && Math.abs (i1) > len) {
var col = i1 % 10;
var row = Clazz_doubleToInt ((i1 - col) / 10);
if (col > 0 && col <= len && row <= len) {
if (tokenIn.tok == 11) return JS.SV.newV (3, Float.$valueOf ((tokenIn.value).getElement (row - 1, col - 1)));
return JS.SV.newV (3, Float.$valueOf ((tokenIn.value).getElement (row - 1, col - 1)));
}return JS.SV.newV (4, "");
}if (Math.abs (i1) > len) return JS.SV.newV (4, "");
var data =  Clazz_newFloatArray (len, 0);
if (len == 3) {
if (i1 < 0) (tokenIn.value).getColumn (-1 - i1, data);
 else (tokenIn.value).getRow (i1 - 1, data);
} else {
if (i1 < 0) (tokenIn.value).getColumn (-1 - i1, data);
 else (tokenIn.value).getRow (i1 - 1, data);
}if (isOne) return JS.SV.getVariableAF (data);
if (i2 < 1 || i2 > len) return JS.SV.newV (4, "");
return JS.SV.newV (3, Float.$valueOf (data[i2 - 1]));
}if (i1 <= 0) i1 = len + i1;
if (!isOne) {
if (i1 < 1) i1 = 1;
if (i2 == 0) i2 = len;
 else if (i2 < 0) i2 = len + i2;
if (i2 < i1) i2 = i1;
}switch (tokenIn.tok) {
case 10:
tokenOut.value = bs;
if (isInputSelected) {
if (i1 > 1) bs.clearAll ();
break;
}if (isOne) {
if (i1 == len) {
i2 = bs.length () - 1;
} else if (i1 == 1) {
i2 = bs.nextSetBit (0);
}if (i2 >= -1) {
bs.clearAll ();
if (i2 >= 0) bs.set (i2);
break;
}i2 = i1;
}var n = 0;
for (var j = bs.nextSetBit (0); j >= 0; j = bs.nextSetBit (j + 1)) if (++n < i1 || n > i2) bs.clear (j);

break;
case 4:
tokenOut.value = (--i1 < 0 || i1 >= len ? "" : isOne ? s.substring (i1, i1 + 1) : s.substring (i1, Math.min (i2, len)));
break;
case 7:
if (--i1 < 0 || i1 >= len) return JS.SV.newV (4, "");
if (isOne) return (tokenIn).getList ().get (i1);
var o2 =  new JU.Lst ();
var o1 = (tokenIn).getList ();
var nn = Math.min (i2, len) - i1;
for (var i = 0; i < nn; i++) o2.addLast (JS.SV.newT (o1.get (i + i1)));

tokenOut.value = o2;
break;
case 15:
if (--i1 < 0 || i1 >= len) return JS.SV.newV (4, "");
var data = (((tokenIn).value)).data;
if (isOne) return JS.SV.newI (data[i1]);
var b =  Clazz_newByteArray (Math.min (i2, len) - i1, 0);
for (var i = b.length; --i >= 0; ) b[i] = data[i1 + i];

tokenOut.value =  new JU.BArray (b);
break;
}
return tokenOut;
}, "JS.T,~N");
Clazz_defineMethod (c$, "setSelectedValue", 
function (pt1, pt2, $var) {
if (pt1 == 2147483647) return;
var len;
switch (this.tok) {
case 11:
case 12:
len = (this.tok == 11 ? 3 : 4);
if (pt2 != 2147483647) {
var col = pt2;
var row = pt1;
if (col > 0 && col <= len && row <= len) {
if (this.tok == 11) (this.value).setElement (row - 1, col - 1, JS.SV.fValue ($var));
 else (this.value).setElement (row - 1, col - 1, JS.SV.fValue ($var));
return;
}}if (pt1 != 0 && Math.abs (pt1) <= len && $var.tok == 7) {
var sv = $var.getList ();
if (sv.size () == len) {
var data =  Clazz_newFloatArray (len, 0);
for (var i = 0; i < len; i++) data[i] = JS.SV.fValue (sv.get (i));

if (pt1 > 0) {
if (this.tok == 11) (this.value).setRowA (pt1 - 1, data);
 else (this.value).setRowA (pt1 - 1, data);
} else {
if (this.tok == 11) (this.value).setColumnA (-1 - pt1, data);
 else (this.value).setColumnA (-1 - pt1, data);
}break;
}}break;
case 4:
var str = this.value;
var pt = str.length;
if (pt1 <= 0) pt1 = pt + pt1;
if (--pt1 < 0) pt1 = 0;
while (pt1 >= str.length) str += " ";

if (pt2 == 2147483647) {
pt2 = pt1;
} else {
if (--pt2 < 0) pt2 = pt + pt2;
while (pt2 >= str.length) str += " ";

}if (pt2 >= pt1) this.value = str.substring (0, pt1) + JS.SV.sValue ($var) + str.substring (++pt2);
this.intValue = this.index = 2147483647;
break;
case 7:
len = this.getList ().size ();
if (pt1 <= 0) pt1 = len + pt1;
if (--pt1 < 0) pt1 = 0;
if (len <= pt1) {
for (var i = len; i <= pt1; i++) this.getList ().addLast (JS.SV.newV (4, ""));

}this.getList ().set (pt1, $var);
break;
}
}, "~N,~N,JS.SV");
Clazz_defineMethod (c$, "escape", 
function () {
switch (this.tok) {
case 4:
return JU.PT.esc (this.value);
case 11:
case 12:
return JU.PT.toJSON (null, this.value);
case 7:
case 6:
case 14:
var sb =  new JU.SB ();
JS.SV.sValueArray (sb, this, "", "", true, false, true, 2147483647, false);
return sb.toString ();
default:
return JS.SV.sValue (this);
}
});
c$.unescapePointOrBitsetAsVariable = Clazz_defineMethod (c$, "unescapePointOrBitsetAsVariable", 
function (o) {
if (o == null) return o;
var v = null;
var s = null;
if (Clazz_instanceOf (o, JS.SV)) {
var sv = o;
switch (sv.tok) {
case 8:
case 9:
case 11:
case 12:
case 10:
v = sv.value;
break;
case 4:
s = sv.value;
break;
default:
s = JS.SV.sValue (sv);
break;
}
} else if (Clazz_instanceOf (o, String)) {
s = o;
}if (s != null && s.length == 0) return s;
if (v == null) v = JU.Escape.uABsM (s);
if (Clazz_instanceOf (v, JU.P3)) return (JS.SV.newV (8, v));
if (Clazz_instanceOf (v, JU.P4)) return JS.SV.newV (9, v);
if (Clazz_instanceOf (v, JU.BS)) {
if (s != null && s.indexOf ("[{") == 0) v = JM.BondSet.newBS (v, null);
return JS.SV.newV (10, v);
}if (Clazz_instanceOf (v, JU.M34)) return (JS.SV.newV (Clazz_instanceOf (v, JU.M3) ? 11 : 12, v));
return o;
}, "~O");
c$.getBoolean = Clazz_defineMethod (c$, "getBoolean", 
function (value) {
return JS.SV.newT (value ? JS.SV.vT : JS.SV.vF);
}, "~B");
c$.sprintf = Clazz_defineMethod (c$, "sprintf", 
function (strFormat, $var) {
if ($var == null) return strFormat;
var vd = (strFormat.indexOf ("d") >= 0 || strFormat.indexOf ("i") >= 0 ?  Clazz_newIntArray (1, 0) : null);
var isArray = ($var.tok == 7);
var vf = (strFormat.indexOf ("f") >= 0 ?  Clazz_newFloatArray (1, 0) : null);
var ve = (strFormat.indexOf ("e") >= 0 ?  Clazz_newDoubleArray (1, 0) : null);
var getS = (strFormat.indexOf ("s") >= 0);
var getP = (strFormat.indexOf ("p") >= 0 && (isArray || $var.tok == 8));
var getQ = (strFormat.indexOf ("q") >= 0 && (isArray || $var.tok == 9));
var of = [vd, vf, ve, null, null, null];
if (!isArray) return JS.SV.sprintf (strFormat, $var, of, vd, vf, ve, getS, getP, getQ);
var sv = $var.getList ();
var list2 =  new Array (sv.size ());
for (var i = 0; i < list2.length; i++) list2[i] = JS.SV.sprintf (strFormat, sv.get (i), of, vd, vf, ve, getS, getP, getQ);

return list2;
}, "~S,JS.SV");
c$.sprintf = Clazz_defineMethod (c$, "sprintf", 
 function (strFormat, $var, of, vd, vf, ve, getS, getP, getQ) {
if (vd != null) vd[0] = JS.SV.iValue ($var);
if (vf != null) vf[0] = JS.SV.fValue ($var);
if (ve != null) ve[0] = JS.SV.fValue ($var);
if (getS) of[3] = JS.SV.sValue ($var);
if (getP) of[4] = $var.value;
if (getQ) of[5] = $var.value;
return JU.PT.sprintf (strFormat, "IFDspq", of);
}, "~S,JS.SV,~A,~A,~A,~A,~B,~B,~B");
c$.getFormatType = Clazz_defineMethod (c$, "getFormatType", 
function (format) {
return (format.indexOf (";") >= 0 ? -1 : ";json;base64;bytearray;array;".indexOf (";" + format.toLowerCase () + ";"));
}, "~S");
c$.format = Clazz_defineMethod (c$, "format", 
function (args, pt) {
switch (args.length) {
case 0:
return "";
case 1:
return JS.SV.sValue (args[0]);
case 2:
if (pt == 2147483647) pt = JS.SV.getFormatType (args[0].asString ());
switch (pt) {
case 0:
return args[1].toJSON ();
case 5:
case 12:
case 22:
var bytes;
switch (args[1].tok) {
case 15:
bytes = JU.AU.arrayCopyByte ((args[1].value).data, -1);
break;
case 7:
var l = args[1].getList ();
if (pt == 22) {
var l1 =  new JU.Lst ();
for (var i = l.size (); --i >= 0; ) l1.addLast (l.get (i));

return l1;
}bytes =  Clazz_newByteArray (l.size (), 0);
for (var i = bytes.length; --i >= 0; ) bytes[i] = l.get (i).asInt ();

break;
default:
var s = args[1].asString ();
if (s.startsWith (";base64,")) {
if (pt == 5) return s;
bytes = JU.Base64.decodeBase64 (s);
} else {
bytes = s.getBytes ();
}}
return (pt == 22 ? JS.SV.getVariable (bytes) : pt == 12 ?  new JU.BArray (bytes) : ";base64," + JU.Base64.getBase64 (bytes).toString ());
}
}
var sb =  new JU.SB ();
var format = JU.PT.split (JU.PT.rep (JS.SV.sValue (args[0]), "%%", "\1"), "%");
sb.append (format[0]);
for (var i = 1; i < format.length; i++) {
var ret = JS.SV.sprintf (JU.PT.formatCheck ("%" + format[i]), (i < args.length ? args[i] : null));
if (JU.PT.isAS (ret)) {
var list = ret;
for (var j = 0; j < list.length; j++) sb.append (list[j]).append ("\n");

continue;
}sb.append (ret);
}
return sb.toString ();
}, "~A,~N");
c$.getBitSet = Clazz_defineMethod (c$, "getBitSet", 
function (x, allowNull) {
switch (x.tok) {
case 10:
return JS.SV.bsSelectVar (x);
case 7:
var bs =  new JU.BS ();
var sv = x.value;
for (var i = 0; i < sv.size (); i++) if (!sv.get (i).unEscapeBitSetArray (bs) && allowNull) return null;

return bs;
}
return (allowNull ? null :  new JU.BS ());
}, "JS.SV,~B");
c$.areEqual = Clazz_defineMethod (c$, "areEqual", 
function (x1, x2) {
if (x1 == null || x2 == null) return false;
if (x1.tok == x2.tok) {
switch (x1.tok) {
case 4:
return (x1.value).equalsIgnoreCase (x2.value);
case 10:
case 15:
case 6:
case 7:
case 14:
return x1.equals (x2);
case 8:
return ((x1.value).distance (x2.value) < 0.000001);
case 9:
return ((x1.value).distance4 (x2.value) < 0.000001);
}
}return (Math.abs (JS.SV.fValue (x1) - JS.SV.fValue (x2)) < 0.000001);
}, "JS.SV,JS.SV");
c$.isLike = Clazz_defineMethod (c$, "isLike", 
function (x1, x2) {
return (x1 != null && x2 != null && x1.tok == 4 && x2.tok == 4 && JU.PT.isLike (x1.value, x2.value));
}, "JS.SV,JS.SV");
Clazz_defineMethod (c$, "sortOrReverse", 
function (arrayPt) {
var x = this.getList ();
if (x != null && x.size () > 1) {
if (arrayPt == -2147483648) {
var n = x.size ();
for (var i = 0; i < n; i++) {
var v = x.get (i);
x.set (i, x.get (--n));
x.set (n, v);
}
} else {
java.util.Collections.sort (this.getList (), Clazz_innerTypeInstance (JS.SV.Sort, this, null, --arrayPt));
}}return this;
}, "~N");
Clazz_defineMethod (c$, "pushPop", 
function (value, mapKey) {
if (mapKey != null) {
var m = this.getMap ();
if (value == null) {
var v;
return (m == null || (v = m.remove (mapKey.asString ())) == null ? JS.SV.newS ("") : v);
}if (m != null) m.put (mapKey.asString (), JS.SV.newI (0).setv (value));
} else {
var x = this.getList ();
if (value == null || x == null) return (x == null || x.size () == 0 ? JS.SV.newS ("") : x.remove (x.size () - 1));
x.addLast (JS.SV.newI (0).setv (value));
}return this;
}, "JS.SV,JS.SV");
Clazz_defineMethod (c$, "unEscapeBitSetArray", 
function (bs) {
switch (this.tok) {
case 4:
var bs1 = JU.BS.unescape (this.value);
if (bs1 == null) return false;
bs.or (bs1);
return true;
case 10:
bs.or (this.value);
return true;
}
return false;
}, "JU.BS");
c$.unEscapeBitSetArray = Clazz_defineMethod (c$, "unEscapeBitSetArray", 
function (x, allowNull) {
var bs =  new JU.BS ();
for (var i = 0; i < x.size (); i++) if (!x.get (i).unEscapeBitSetArray (bs) && allowNull) return null;

return bs;
}, "java.util.ArrayList,~B");
c$.strListValue = Clazz_defineMethod (c$, "strListValue", 
function (x) {
if (x.tok != 7) return [JS.SV.sValue (x)];
var sv = (x).getList ();
var list =  new Array (sv.size ());
for (var i = sv.size (); --i >= 0; ) list[i] = JS.SV.sValue (sv.get (i));

return list;
}, "JS.T");
c$.flistValue = Clazz_defineMethod (c$, "flistValue", 
function (x, nMin) {
if (x.tok != 7) return [JS.SV.fValue (x)];
var sv = (x).getList ();
var list;
list =  Clazz_newFloatArray (Math.max (nMin, sv.size ()), 0);
if (nMin == 0) nMin = list.length;
for (var i = Math.min (sv.size (), nMin); --i >= 0; ) list[i] = JS.SV.fValue (sv.get (i));

return list;
}, "JS.T,~N");
Clazz_defineMethod (c$, "toArray", 
function () {
var dim;
var m3 = null;
var m4 = null;
switch (this.tok) {
case 11:
m3 = this.value;
dim = 3;
break;
case 12:
m4 = this.value;
dim = 4;
break;
default:
return;
}
this.tok = 7;
var o2 =  new JU.Lst ();
for (var i = 0; i < dim; i++) {
var a =  Clazz_newFloatArray (dim, 0);
if (m3 == null) m4.getRow (i, a);
 else m3.getRow (i, a);
o2.addLast (JS.SV.getVariableAF (a));
}
this.value = o2;
});
Clazz_defineMethod (c$, "mapValue", 
function (key) {
switch (this.tok) {
case 6:
return (this.value).get (key);
case 14:
var sc = (this.value);
return (key.equals ("_path") ? JS.SV.newS (sc.contextPath) : sc.getVariable (key));
}
return null;
}, "~S");
Clazz_defineMethod (c$, "getList", 
function () {
return (this.tok == 7 ? this.value : null);
});
c$.isScalar = Clazz_defineMethod (c$, "isScalar", 
function (x) {
switch (x.tok) {
case 7:
return false;
case 4:
return ((x.value).indexOf ("\n") < 0);
default:
return true;
}
}, "JS.SV");
Clazz_overrideMethod (c$, "toJSON", 
function () {
switch (this.tok) {
case 1048589:
case 1048588:
case 2:
case 3:
return JS.SV.sValue (this);
case 15:
return JU.PT.byteArrayToJSON ((this.value).data);
case 14:
return JU.PT.toJSON (null, (this.value).getFullMap ());
default:
return JU.PT.toJSON (null, this.value);
}
});
Clazz_defineMethod (c$, "mapPut", 
function (key, v) {
this.getMap ().put (key, v);
}, "~S,JS.SV");
Clazz_defineMethod (c$, "mapGet", 
function (key) {
return (this.tok == 6 ? (this.value).get (key) : JS.SV.newS (""));
}, "~S");
Clazz_defineMethod (c$, "getMap", 
function () {
switch (this.tok) {
case 6:
return this.value;
case 14:
return (this.value).vars;
}
return null;
});
Clazz_overrideMethod (c$, "toString", 
function () {
return this.toString2 () + "[" + this.myName + " index =" + this.index + " intValue=" + this.intValue + "]";
});
Clazz_defineMethod (c$, "getMapKeys", 
function (nLevels, skipEmpty) {
if (this.tok != 6) return "";
var sb =  new JU.SB ();
JS.SV.sValueArray (sb, this, "", "", true, false, false, nLevels + 1, skipEmpty);
return sb.toString ();
}, "~N,~B");
c$.$SV$Sort$ = function () {
Clazz_pu$h(self.c$);
c$ = Clazz_decorateAsClass (function () {
Clazz_prepareCallback (this, arguments);
this.arrayPt = 0;
Clazz_instantialize (this, arguments);
}, JS.SV, "Sort", null, java.util.Comparator);
Clazz_makeConstructor (c$, 
function (a) {
this.arrayPt = a;
}, "~N");
Clazz_overrideMethod (c$, "compare", 
function (a, b) {
if (a.tok != b.tok) {
if (a.tok == 3 || a.tok == 2 || b.tok == 3 || b.tok == 2) {
var c = JS.SV.fValue (a);
var d = JS.SV.fValue (b);
return (c < d ? -1 : c > d ? 1 : 0);
}if (a.tok == 4 || b.tok == 4) return JS.SV.sValue (a).compareTo (JS.SV.sValue (b));
}switch (a.tok) {
case 4:
return JS.SV.sValue (a).compareTo (JS.SV.sValue (b));
case 7:
var c = a.getList ();
var d = b.getList ();
if (c.size () != d.size ()) return (c.size () < d.size () ? -1 : 1);
var e = this.arrayPt;
if (e < 0) e += c.size ();
if (e < 0 || e >= c.size ()) return 0;
return this.compare (c.get (e), d.get (e));
default:
var f = JS.SV.fValue (a);
var g = JS.SV.fValue (b);
return (f < g ? -1 : f > g ? 1 : 0);
}
}, "JS.SV,JS.SV");
c$ = Clazz_p0p ();
};
c$.vT = c$.prototype.vT = JS.SV.newSV (1048589, 1, "true");
c$.vF = c$.prototype.vF = JS.SV.newSV (1048588, 0, "false");
Clazz_defineStatics (c$,
"FLAG_CANINCREMENT", 1,
"FLAG_MODIFIED", 2);
c$.pt0 = c$.prototype.pt0 =  new JU.P3 ();
});
Clazz_declarePackage ("JS");
Clazz_load (["java.util.Hashtable"], "JS.T", ["java.lang.Boolean", "java.util.Arrays", "JU.AU", "$.Lst", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.tok = 0;
this.value = null;
this.intValue = 2147483647;
Clazz_instantialize (this, arguments);
}, JS, "T");
c$.t = Clazz_defineMethod (c$, "t", 
function (tok) {
var token =  new JS.T ();
token.tok = tok;
return token;
}, "~N");
c$.tv = Clazz_defineMethod (c$, "tv", 
function (tok, intValue, value) {
var token = JS.T.t (tok);
token.intValue = intValue;
token.value = value;
return token;
}, "~N,~N,~O");
c$.o = Clazz_defineMethod (c$, "o", 
function (tok, value) {
var token = JS.T.t (tok);
token.value = value;
return token;
}, "~N,~O");
c$.n = Clazz_defineMethod (c$, "n", 
function (tok, intValue) {
var token = JS.T.t (tok);
token.intValue = intValue;
return token;
}, "~N,~N");
c$.i = Clazz_defineMethod (c$, "i", 
function (intValue) {
var token = JS.T.t (2);
token.intValue = intValue;
return token;
}, "~N");
c$.tokAttr = Clazz_defineMethod (c$, "tokAttr", 
function (a, b) {
return (a & b) == (b & b);
}, "~N,~N");
c$.tokAttrOr = Clazz_defineMethod (c$, "tokAttrOr", 
function (a, b1, b2) {
return (a & b1) == (b1 & b1) || (a & b2) == (b2 & b2);
}, "~N,~N,~N");
c$.getPrecedence = Clazz_defineMethod (c$, "getPrecedence", 
function (tokOperator) {
return ((tokOperator >> 4) & 0xF);
}, "~N");
c$.getMaxMathParams = Clazz_defineMethod (c$, "getMaxMathParams", 
function (tokCommand) {
return ((tokCommand >> 9) & 0x3);
}, "~N");
c$.addToken = Clazz_defineMethod (c$, "addToken", 
function (ident, token) {
JS.T.tokenMap.put (ident, token);
}, "~S,JS.T");
c$.getTokenFromName = Clazz_defineMethod (c$, "getTokenFromName", 
function (name) {
if (name == null) System.out.println ("???");
return JS.T.tokenMap.get (name);
}, "~S");
c$.getTokFromName = Clazz_defineMethod (c$, "getTokFromName", 
function (name) {
var token = JS.T.getTokenFromName (name.toLowerCase ());
return (token == null ? 0 : token.tok);
}, "~S");
c$.nameOf = Clazz_defineMethod (c$, "nameOf", 
function (tok) {
for (var token, $token = JS.T.tokenMap.values ().iterator (); $token.hasNext () && ((token = $token.next ()) || true);) {
if (token.tok == tok) return "" + token.value;
}
return "0x" + Integer.toHexString (tok);
}, "~N");
Clazz_overrideMethod (c$, "toString", 
function () {
return this.toString2 ();
});
Clazz_defineMethod (c$, "toString2", 
function () {
return "Token[" + JS.T.astrType[this.tok < 16 ? this.tok : 16] + "(" + (this.tok % (512)) + "/0x" + Integer.toHexString (this.tok) + ")" + ((this.intValue == 2147483647) ? "" : " intValue=" + this.intValue + "(0x" + Integer.toHexString (this.intValue) + ")") + ((this.value == null) ? "" : Clazz_instanceOf (this.value, String) ? " value=\"" + this.value + "\"" : " value=" + this.value) + "]";
});
c$.getCommandSet = Clazz_defineMethod (c$, "getCommandSet", 
function (strBegin) {
var cmds = "";
var htSet =  new java.util.Hashtable ();
var nCmds = 0;
var s = (strBegin == null || strBegin.length == 0 ? null : strBegin.toLowerCase ());
var isMultiCharacter = (s != null && s.length > 1);
for (var entry, $entry = JS.T.tokenMap.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var name = entry.getKey ();
var token = entry.getValue ();
if ((token.tok & 4096) != 0 && (s == null || name.indexOf (s) == 0) && (isMultiCharacter || (token.value).equals (name))) htSet.put (name, Boolean.TRUE);
}
for (var entry, $entry = htSet.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var name = entry.getKey ();
if (name.charAt (name.length - 1) != 's' || !htSet.containsKey (name.substring (0, name.length - 1))) cmds += (nCmds++ == 0 ? "" : ";") + name;
}
return cmds;
}, "~S");
c$.getAtomPropertiesLike = Clazz_defineMethod (c$, "getAtomPropertiesLike", 
function (type) {
type = type.toLowerCase ();
var v =  new JU.Lst ();
var isAll = (type.length == 0);
for (var entry, $entry = JS.T.tokenMap.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var name = entry.getKey ();
if (name.charAt (0) == '_') continue;
var token = entry.getValue ();
if (JS.T.tokAttr (token.tok, 1078984704) && (isAll || name.toLowerCase ().startsWith (type))) {
if (isAll || !(token.value).toLowerCase ().startsWith (type)) token = JS.T.o (token.tok, name);
v.addLast (token);
}}
return (v.size () == 0 ? null : v);
}, "~S");
c$.getTokensLike = Clazz_defineMethod (c$, "getTokensLike", 
function (type) {
var attr = (type.equals ("setparam") ? 536870912 : type.equals ("misc") ? 1073741824 : type.equals ("mathfunc") ? 135266304 : 4096);
var notattr = (attr == 536870912 ? 1610612736 : 0);
var v =  new JU.Lst ();
for (var entry, $entry = JS.T.tokenMap.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var name = entry.getKey ();
var token = entry.getValue ();
if (JS.T.tokAttr (token.tok, attr) && (notattr == 0 || !JS.T.tokAttr (token.tok, notattr))) v.addLast (name);
}
var a = v.toArray ( new Array (v.size ()));
java.util.Arrays.sort (a);
return a;
}, "~S");
c$.getSettableTokFromString = Clazz_defineMethod (c$, "getSettableTokFromString", 
function (s) {
var tok = JS.T.getTokFromName (s);
return (tok != 0 && JS.T.tokAttr (tok, 2048) && !JS.T.tokAttr (tok, 1141899264) ? tok : 0);
}, "~S");
c$.completeCommand = Clazz_defineMethod (c$, "completeCommand", 
function (map, isSet, asCommand, str, n) {
if (map == null) map = JS.T.tokenMap;
 else asCommand = false;
var v =  new JU.Lst ();
str = str.toLowerCase ();
for (var name, $name = map.keySet ().iterator (); $name.hasNext () && ((name = $name.next ()) || true);) {
if (!name.startsWith (str)) continue;
var tok = JS.T.getTokFromName (name);
if (asCommand ? JS.T.tokAttr (tok, 4096) : isSet ? JS.T.tokAttr (tok, 536870912) && !JS.T.tokAttr (tok, 1610612736) : true) v.addLast (name);
}
return JU.AU.sortedItem (v, n);
}, "java.util.Map,~B,~B,~S,~N");
c$.getParamType = Clazz_defineMethod (c$, "getParamType", 
function (tok) {
if (!JS.T.tokAttr (tok, 536870912)) return 0;
return tok & 662700032;
}, "~N");
c$.getTokensType = Clazz_defineMethod (c$, "getTokensType", 
function (map, attr) {
for (var e, $e = JS.T.tokenMap.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
var t = e.getValue ();
if (JS.T.tokAttr (t.tok, attr)) map.put (e.getKey (), e.getValue ());
}
}, "java.util.Map,~N");
c$.isIDcmd = Clazz_defineMethod (c$, "isIDcmd", 
function (cmdtok) {
switch (cmdtok) {
case 135180:
case 135176:
case 135174:
case 135188:
case 135402505:
return true;
default:
return false;
}
}, "~N");
Clazz_defineMethod (c$, "equals", 
function (o) {
if (!(Clazz_instanceOf (o, JS.T))) return false;
var t = o;
if (this.tok == t.tok) return (t.intValue == this.intValue && (this.tok == 2 || t.value.equals (this.value)));
switch (this.tok) {
case 2:
return (t.tok == 3 && (t.value).floatValue () == this.intValue);
case 3:
return (t.tok == 2 && (this.value).floatValue () == t.intValue);
default:
return false;
}
}, "~O");
Clazz_defineStatics (c$,
"astrType", null);
{
JS.T.astrType = "nada identifier integer decimal string seqcode hash array point point4 bitset matrix3f matrix4f array hash bytearray keyword".$plit (" ");
}Clazz_defineStatics (c$,
"nada", 0,
"integer", 2,
"decimal", 3,
"string", 4,
"seqcode", 5,
"hash", 6,
"varray", 7,
"point3f", 8,
"point4f", 9,
"bitset", 10,
"matrix3f", 11,
"matrix4f", 12,
"listf", 13,
"context", 14,
"barray", 15,
"keyword", 16,
"setparam", 536870912,
"misc", 1073741824,
"deprecatedparam", 1610612736,
"identifier", 1073741824,
"scriptCommand", 4096,
"atomExpressionCommand", 12288,
"implicitStringCommand", 20480,
"mathExpressionCommand", 36864,
"flowCommand", 102400,
"shapeCommand", 135168,
"noArgs", 262144,
"defaultON", 524288,
"expression", 1048576,
"predefinedset", 3145728,
"atomproperty", 1078984704,
"strproperty", 1087373312,
"intproperty", 1095761920,
"floatproperty", 1112539136,
"PROPERTYFLAGS", 1137704960,
"strparam", 545259520,
"intparam", 553648128,
"floatparam", 570425344,
"booleanparam", 603979776,
"paramTypes", 662700032,
"mathproperty", 1141899264,
"mathfunc", 135266304,
"mathop", 269484032,
"comparator", 269484288,
"center", 12289,
"define", 1060866,
"$delete", 12291,
"display", 1610625028,
"fixed", 1060869,
"hide", 12294,
"restrict", 12295,
"subset", 3158024,
"zap", 1060873,
"print", 36865,
"returncmd", 36866,
"set", 1085443,
"$var", 36868,
"log", 36869,
"throwcmd", 36870,
"echo", 537022465,
"help", 20482,
"hover", 544771,
"message", 20485,
"pause", 20487,
"elseif", 102402,
"elsecmd", 364547,
"endifcmd", 364548,
"whilecmd", 102406,
"breakcmd", 102407,
"continuecmd", 102408,
"end", 1150985,
"switchcmd", 102410,
"casecmd", 102411,
"catchcmd", 102412,
"defaultcmd", 102413,
"trycmd", 364558,
"animation", 4097,
"assign", 4098,
"background", 1610616835,
"bind", 4100,
"bondorder", 4101,
"calculate", 4102,
"capture", 4103,
"cd", 1069064,
"centerat", 4105,
"connect", 4106,
"console", 528395,
"delay", 528397,
"depth", 554176526,
"exit", 266255,
"exitjmol", 266256,
"font", 4114,
"frame", 4115,
"gotocmd", 20500,
"hbond", 1612189718,
"history", 1610616855,
"initialize", 266264,
"invertSelected", 4121,
"loop", 528410,
"mapproperty", 1052700,
"minimize", 4126,
"move", 4128,
"moveto", 4130,
"navigate", 4131,
"parallel", 102436,
"plot", 4133,
"process", 102439,
"quit", 266281,
"ramachandran", 1052714,
"redomove", 4139,
"refresh", 266284,
"reset", 4141,
"restore", 4142,
"resume", 4143,
"rotate", 528432,
"rotateSelected", 4145,
"save", 4146,
"selectionhalos", 1611141171,
"slab", 554176565,
"spin", 1611141175,
"ssbond", 1611141176,
"step", 266298,
"stereo", 528443,
"sync", 4156,
"timeout", 536875070,
"translate", 4160,
"translateSelected", 4162,
"unbind", 4164,
"undomove", 4165,
"vibration", 4166,
"zoom", 4168,
"zoomTo", 4170,
"axes", 1611272194,
"cgo", 135174,
"dipole", 135175,
"draw", 135176,
"frank", 1611272202,
"isosurface", 135180,
"lcaocartoon", 135182,
"measurements", 537006096,
"mo", 1073877010,
"nbo", 1073877011,
"pmesh", 135188,
"plot3d", 135190,
"polyhedra", 135192,
"struts", 1708058,
"unitcell", 1614417948,
"vector", 135198,
"wireframe", 659488,
"expressionBegin", 1048577,
"expressionEnd", 1048578,
"all", 1048579,
"branch", 1048580,
"coord", 1048581,
"dollarsign", 1048582,
"per", 1048583,
"perper", 1048584,
"isaromatic", 1048585,
"leftbrace", 1048586,
"none", 1048587,
"off", 1048588,
"on", 1048589,
"rightbrace", 1048590,
"semicolon", 1048591,
"spec_alternate", 1048607,
"spec_atom", 1048608,
"spec_chain", 1048609,
"spec_model", 1048610,
"spec_model2", 1048611,
"spec_name_pattern", 1048612,
"spec_resid", 1048613,
"spec_seqcode", 1048614,
"spec_seqcode_range", 1048615,
"amino", 3145730,
"dna", 3145732,
"hetero", 1613758470,
"helixalpha", 3145735,
"helix310", 3145736,
"helixpi", 3145738,
"hydrogen", 1613758476,
"leadatom", 3145741,
"nucleic", 3145742,
"protein", 3145744,
"purine", 3145746,
"pyrimidine", 3145748,
"rna", 3145750,
"solvent", 1613758488,
"sidechain", 3145754,
"surface", 3145756,
"thismodel", 3145758,
"sheet", 3145760,
"spine", 3145762,
"carbohydrate", 3145764,
"clickable", 3145766,
"displayed", 3145768,
"hidden", 3145770,
"specialposition", 3145772,
"visible", 3145774,
"basemodel", 3145776,
"nonequivalent", 3145778,
"leftparen", 269484048,
"rightparen", 269484049,
"opIf", 806354977,
"colon", 269484066,
"comma", 269484080,
"leftsquare", 269484096,
"rightsquare", 269484097,
"opOr", 269484112,
"opXor", 269484113,
"opToggle", 269484114,
"opAnd", 269484128,
"opNot", 269484144,
"opAND", 269484160,
"opGT", 269484432,
"opGE", 269484433,
"opLE", 269484434,
"opLT", 269484435,
"opEQ", 269484436,
"opNE", 269484437,
"opLIKE", 269484438,
"minus", 269484192,
"plus", 269484193,
"divide", 269484208,
"times", 269484209,
"percent", 269484210,
"leftdivide", 269484211,
"unaryMinus", 269484224,
"minusMinus", 269484225,
"plusPlus", 269484226,
"timestimes", 269484227,
"propselector", 269484241,
"andequals", 269484242,
"minmaxmask", 480,
"min", 32,
"max", 64,
"average", 96,
"sum", 128,
"sum2", 160,
"stddev", 192,
"selectedfloat", 224,
"allfloat", 256,
"settable", 2048,
"atoms", 1141899265,
"bonds", 1678770178,
"length", 1141899267,
"lines", 1141899268,
"reverse", 1141899269,
"size", 1141899270,
"type", 1141899272,
"boundbox", 1679429641,
"xyz", 1146095626,
"fracxyz", 1146095627,
"screenxyz", 1146095628,
"fuxyz", 1146095629,
"unitxyz", 1146093582,
"vibxyz", 1146095631,
"modxyz", 1146093584,
"w", 1141899281,
"keys", 1141899282,
"occupancy", 1129318401,
"radius", 1666189314,
"structure", 1641025539,
"atomtype", 1087375361,
"atomname", 1087375362,
"altloc", 1087373315,
"chain", 1087373316,
"element", 1087375365,
"group", 1087373318,
"group1", 1087373319,
"sequence", 1087373320,
"identify", 1087373321,
"insertion", 1087373322,
"shape", 1087373323,
"strucid", 1087373324,
"symbol", 1087375373,
"symmetry", 1089470478,
"atomno", 1095763969,
"atomid", 1095761922,
"atomindex", 1095761923,
"bondcount", 1095761924,
"cell", 1095761925,
"centroid", 1095761926,
"chainno", 1095761927,
"configuration", 1095766024,
"elemisono", 1095761929,
"elemno", 1095763978,
"formalcharge", 1632634891,
"groupid", 1095761932,
"groupindex", 1095761933,
"model", 1095766030,
"modelindex", 1095761935,
"molecule", 1095761936,
"polymer", 1095761937,
"polymerlength", 1095761938,
"resno", 1095761939,
"seqid", 1095761940,
"site", 1095761941,
"strucno", 1095761942,
"subsystem", 1095761943,
"valence", 1095763991,
"adpmax", 1112539137,
"adpmin", 1112539138,
"chemicalshift", 1112539139,
"covalentradius", 1112539140,
"eta", 1112539141,
"magneticshielding", 1112539142,
"mass", 1112539143,
"omega", 1112539144,
"phi", 1112539145,
"psi", 1112539146,
"screenx", 1112539147,
"screeny", 1112539148,
"screenz", 1112539149,
"straightness", 1112539150,
"surfacedistance", 1112539151,
"theta", 1112539152,
"unitx", 1112539153,
"unity", 1112539154,
"unitz", 1112539155,
"modt1", 1112539156,
"modt2", 1112539157,
"modt3", 1112539158,
"modx", 1112539159,
"mody", 1112539160,
"modz", 1112539161,
"modo", 1112539162,
"vectorscale", 1649410049,
"atomx", 1112541185,
"atomy", 1112541186,
"atomz", 1112541187,
"fracx", 1112541188,
"fracy", 1112541189,
"fracz", 1112541190,
"fux", 1112541191,
"fuy", 1112541192,
"fuz", 1112541193,
"bondingradius", 1112541194,
"partialcharge", 1112541195,
"temperature", 1112541196,
"vibx", 1112541202,
"viby", 1112541203,
"vibz", 1112541204,
"x", 1112541205,
"y", 1112541206,
"z", 1112541207,
"vanderwaals", 1649412120,
"property", 1716520985,
"hydrophobicity", 1114638362,
"selected", 1114638363,
"backbone", 1115297793,
"cartoon", 1113200642,
"dots", 1113198595,
"ellipsoid", 1113198596,
"geosurface", 1113198597,
"halo", 1113200646,
"meshRibbon", 1113200647,
"ribbon", 1113200649,
"rocket", 1113200650,
"spacefill", 1113200651,
"star", 1113200652,
"strands", 1650071565,
"trace", 1113200654,
"angle", 135266305,
"array", 135266306,
"axisangle", 135266307,
"color", 1766856708,
"compare", 135270405,
"connected", 135266310,
"data", 135270408,
"format", 1288701959,
"$function", 135368713,
"getproperty", 1276121098,
"helix", 137363467,
"label", 1826248716,
"measure", 1746538509,
"now", 135266318,
"plane", 135266319,
"point", 135266320,
"pop", 1276383249,
"quaternion", 135270418,
"sort", 1276117011,
"count", 1276117012,
"within", 135266325,
"write", 135270422,
"cache", 135270423,
"tensor", 1276117016,
"modulation", 1276121113,
"acos", 135266819,
"sin", 135266820,
"cos", 135266821,
"sqrt", 135266822,
"file", 1229984263,
"forcmd", 135369224,
"ifcmd", 135369225,
"abs", 135266826,
"javascript", 135287308,
"eval", 135266829,
"show", 135270926,
"div", 1276117504,
"dot", 1276117505,
"mul", 1276117507,
"mul3", 1276117508,
"sub", 1276117511,
"trim", 1276117512,
"volume", 1313866249,
"col", 1276117514,
"row", 1276117515,
"cross", 135267329,
"load", 135271427,
"random", 135267332,
"script", 135271429,
"substructure", 1238369286,
"search", 135267335,
"smiles", 135267336,
"contact", 135402505,
"add", 1276118017,
"distance", 1276118018,
"push", 1276384259,
"join", 1276118020,
"split", 1276118021,
"hkl", 135267841,
"intersection", 135267842,
"prompt", 135304707,
"select", 135280132,
"bin", 1276118529,
"symop", 1297090050,
"find", 1276118531,
"$in", 1276116993,
"replace", 1276120578,
"bondmode", 1610612737,
"fontsize", 1610612738,
"measurementnumbers", 1610612739,
"scale3d", 1610612740,
"togglelabel", 1610612741,
"backgroundmodel", 536870914,
"debug", 536870916,
"defaultlattice", 536870918,
"highlight", 536870920,
"showscript", 536870922,
"specular", 536870924,
"trajectory", 536870926,
"undo", 536870928,
"usercolorscheme", 536870930,
"animationmode", 545259521,
"appletproxy", 545259522,
"atomtypes", 545259524,
"axescolor", 545259526,
"axis1color", 545259528,
"axis2color", 545259530,
"axis3color", 545259532,
"backgroundcolor", 545259534,
"boundboxcolor", 545259536,
"currentlocalpath", 545259538,
"dataseparator", 545259540,
"defaultanglelabel", 545259542,
"defaultlabelpdb", 545259543,
"defaultlabelxyz", 545259544,
"defaultcolorscheme", 545259545,
"defaultdirectory", 545259546,
"defaultdistancelabel", 545259547,
"defaultdropscript", 545259548,
"defaultloadfilter", 545259549,
"defaultloadscript", 545259550,
"defaults", 545259552,
"defaulttorsionlabel", 545259554,
"defaultvdw", 545259555,
"edsurlcutoff", 545259556,
"edsurlformat", 545259557,
"edsurlformatdiff", 545259558,
"energyunits", 545259559,
"filecachedirectory", 545259560,
"forcefield", 545259561,
"helppath", 545259562,
"hoverlabel", 545259563,
"language", 545259564,
"loadformat", 545259565,
"loadligandformat", 545259566,
"logfile", 545259567,
"measurementunits", 545259568,
"nmrpredictformat", 545259569,
"nmrurlformat", 545259570,
"pathforallfiles", 545259571,
"picking", 545259572,
"pickingstyle", 545259574,
"picklabel", 545259576,
"propertycolorscheme", 545259578,
"quaternionframe", 545259580,
"smilesurlformat", 545259582,
"smiles2dimageformat", 545259584,
"unitcellcolor", 545259586,
"axesscale", 570425346,
"bondtolerance", 570425348,
"cameradepth", 570425350,
"defaultdrawarrowscale", 570425352,
"defaulttranslucent", 570425354,
"dipolescale", 570425355,
"drawfontsize", 570425356,
"ellipsoidaxisdiameter", 570425357,
"exportscale", 570425358,
"gestureswipefactor", 570425359,
"hbondsangleminimum", 570425360,
"hbondsdistancemaximum", 570425361,
"hoverdelay", 570425362,
"loadatomdatatolerance", 570425363,
"minbonddistance", 570425364,
"minimizationcriterion", 570425365,
"modulationscale", 570425366,
"mousedragfactor", 570425367,
"mousewheelfactor", 570425368,
"multiplebondradiusfactor", 570425369,
"multiplebondspacing", 570425370,
"navfps", 570425371,
"navigationdepth", 570425372,
"navigationslab", 570425373,
"navigationspeed", 570425374,
"navx", 570425376,
"navy", 570425378,
"navz", 570425380,
"particleradius", 570425381,
"pointgroupdistancetolerance", 570425382,
"pointgrouplineartolerance", 570425384,
"rotationradius", 570425388,
"scaleangstromsperinch", 570425390,
"sheetsmoothing", 570425392,
"slabrange", 570425393,
"solventproberadius", 570425394,
"spinfps", 570425396,
"spinx", 570425398,
"spiny", 570425400,
"spinz", 570425402,
"starwidth", 570425403,
"stereodegrees", 570425404,
"strutdefaultradius", 570425406,
"strutlengthmaximum", 570425408,
"vibrationperiod", 570425412,
"vibrationscale", 570425414,
"visualrange", 570425416,
"ambientocclusion", 553648129,
"ambientpercent", 553648130,
"animationfps", 553648132,
"axesmode", 553648134,
"bondradiusmilliangstroms", 553648136,
"celshadingpower", 553648137,
"bondingversion", 553648138,
"delaymaximumms", 553648140,
"diffusepercent", 553648142,
"dotdensity", 553648143,
"dotscale", 553648144,
"ellipsoiddotcount", 553648145,
"helixstep", 553648146,
"hermitelevel", 553648147,
"historylevel", 553648148,
"isosurfacepropertysmoothingpower", 553648149,
"loglevel", 553648150,
"meshscale", 553648151,
"minimizationsteps", 553648152,
"minpixelselradius", 553648153,
"percentvdwatom", 553648154,
"perspectivemodel", 553648155,
"phongexponent", 553648156,
"pickingspinrate", 553648157,
"platformspeed", 553648158,
"propertyatomnumberfield", 553648159,
"propertyatomnumbercolumncount", 553648160,
"propertydatacolumncount", 553648162,
"propertydatafield", 553648164,
"repaintwaitms", 553648165,
"ribbonaspectratio", 553648166,
"scriptreportinglevel", 553648168,
"smallmoleculemaxatoms", 553648170,
"specularexponent", 553648172,
"specularpercent", 553648174,
"specularpower", 553648176,
"strandcount", 553648178,
"strandcountformeshribbon", 553648180,
"strandcountforstrands", 553648182,
"strutspacing", 553648184,
"zdepth", 553648186,
"zslab", 553648188,
"zshadepower", 553648190,
"allowembeddedscripts", 603979778,
"allowgestures", 603979780,
"allowkeystrokes", 603979781,
"allowmodelkit", 603979782,
"allowmoveatoms", 603979783,
"allowmultitouch", 603979784,
"allowrotateselected", 603979785,
"antialiasdisplay", 603979786,
"antialiasimages", 603979788,
"antialiastranslucent", 603979790,
"appendnew", 603979792,
"applysymmetrytobonds", 603979794,
"atompicking", 603979796,
"autobond", 603979798,
"autofps", 603979800,
"axesmolecular", 603979804,
"axesorientationrasmol", 603979806,
"axesunitcell", 603979808,
"axeswindow", 603979810,
"backbonesteps", 603979811,
"bondmodeor", 603979812,
"bondpicking", 603979814,
"cartoonbaseedges", 603979816,
"cartoonsfancy", 603979817,
"cartoonladders", 603979818,
"cartoonribose", 603979819,
"cartoonrockets", 603979820,
"celshading", 603979822,
"chaincasesensitive", 603979823,
"colorrasmol", 603979824,
"debugscript", 603979825,
"defaultstructuredssp", 603979826,
"disablepopupmenu", 603979827,
"displaycellparameters", 603979828,
"dotsselectedonly", 603979829,
"dotsurface", 603979830,
"dragselected", 603979831,
"drawhover", 603979832,
"drawpicking", 603979833,
"dsspcalchydrogen", 603979834,
"dynamicmeasurements", 603979835,
"ellipsoidarcs", 603979836,
"ellipsoidarrows", 603979837,
"ellipsoidaxes", 603979838,
"ellipsoidball", 603979839,
"ellipsoiddots", 603979840,
"ellipsoidfill", 603979841,
"filecaching", 603979842,
"fontcaching", 603979844,
"fontscaling", 603979845,
"forceautobond", 603979846,
"fractionalrelative", 603979848,
"greyscalerendering", 603979850,
"hbondsbackbone", 603979852,
"hbondsrasmol", 603979853,
"hbondssolid", 603979854,
"hidenameinpopup", 603979858,
"hidenavigationpoint", 603979860,
"hidenotselected", 603979862,
"highresolution", 603979864,
"imagestate", 603979867,
"iskiosk", 603979868,
"isosurfacekey", 603979869,
"isosurfacepropertysmoothing", 603979870,
"justifymeasurements", 603979871,
"languagetranslation", 603979872,
"legacyautobonding", 603979873,
"legacyhaddition", 603979874,
"legacyjavafloat", 603979875,
"logcommands", 603979876,
"loggestures", 603979877,
"measureallmodels", 603979878,
"measurementlabels", 603979879,
"messagestylechime", 603979880,
"minimizationrefresh", 603979881,
"minimizationsilent", 603979882,
"modelkitmode", 603979883,
"monitorenergy", 603979884,
"multiprocessor", 603979885,
"navigatesurface", 603979886,
"navigationmode", 603979887,
"navigationperiodic", 603979888,
"partialdots", 603979889,
"pdbaddhydrogens", 603979890,
"pdbgetheader", 603979891,
"pdbsequential", 603979892,
"perspectivedepth", 603979893,
"preservestate", 603979894,
"rangeselected", 603979895,
"refreshing", 603979896,
"ribbonborder", 603979898,
"rocketbarrels", 603979900,
"saveproteinstructurestate", 603979902,
"scriptqueue", 603979904,
"selectallmodels", 603979906,
"selecthetero", 603979908,
"selecthydrogen", 603979910,
"showaxes", 603979914,
"showboundbox", 603979916,
"showfrank", 603979918,
"showhiddenselectionhalos", 603979920,
"showhydrogens", 603979922,
"showkeystrokes", 603979924,
"showmeasurements", 603979926,
"showmodvecs", 603979927,
"showmultiplebonds", 603979928,
"shownavigationpointalways", 603979930,
"showtiming", 603979934,
"showunitcell", 603979936,
"showunitcelldetails", 603979937,
"slabbyatom", 603979939,
"slabbymolecule", 603979940,
"slabenabled", 603979942,
"smartaromatic", 603979944,
"solventprobe", 603979948,
"ssbondsbackbone", 603979952,
"statusreporting", 603979954,
"strutsmultiple", 603979955,
"syncmouse", 603979956,
"syncscript", 603979958,
"testflag1", 603979960,
"testflag2", 603979962,
"testflag3", 603979964,
"testflag4", 603979965,
"tracealpha", 603979966,
"translucent", 603979967,
"twistedsheets", 603979968,
"useminimizationthread", 603979970,
"usenumberlocalization", 603979971,
"vectorscentered", 603979972,
"vectorsymmetry", 603979973,
"waitformoveto", 603979974,
"windowcentered", 603979975,
"wireframerotation", 603979976,
"zerobasedxyzrasmol", 603979978,
"zoomenabled", 603979980,
"zoomheight", 603979982,
"zoomlarge", 603979983,
"zshade", 603979984,
"absolute", 1073741826,
"addhydrogens", 1073741828,
"adjust", 1073741830,
"align", 1073741832,
"allconnected", 1073741834,
"angstroms", 1073741836,
"anisotropy", 1073741837,
"append", 1073741839,
"arc", 1074790416,
"area", 1073741842,
"aromatic", 1076887572,
"arrow", 1073741846,
"as", 1073741848,
"async", 1073741849,
"atomicorbital", 1073741850,
"auto", 1073741852,
"axis", 1073741854,
"babel", 1073741856,
"babel21", 1073741858,
"back", 1073741859,
"balls", 1073741860,
"barb", 1073741861,
"backlit", 1073741862,
"best", 1073741863,
"basepair", 1073741864,
"binary", 1073741866,
"blockdata", 1073741868,
"bondset", 1073741870,
"bottom", 1073741871,
"brillouin", 1073741872,
"cancel", 1073741874,
"cap", 1074790451,
"cavity", 1073741876,
"check", 1073741878,
"chemical", 1073741879,
"circle", 1073741880,
"clash", 1073741881,
"clear", 1073741882,
"clipboard", 1073741884,
"collapsed", 1073741886,
"colorscheme", 1073741888,
"command", 1073741890,
"commands", 1073741892,
"constraint", 1073741894,
"contour", 1073741896,
"contourlines", 1073741898,
"contours", 1073741900,
"corners", 1073741902,
"create", 1073741904,
"criterion", 1073741905,
"crossed", 1073741906,
"curve", 1073741908,
"cutoff", 1073741910,
"cylinder", 1073741912,
"density", 1073741914,
"dssp", 1073741915,
"dssr", 1073741916,
"diameter", 1073741917,
"direction", 1073741918,
"discrete", 1073741920,
"displacement", 1073741922,
"distancefactor", 1073741924,
"domains", 1073741925,
"dotted", 1073741926,
"downsample", 1073741928,
"drawing", 1073741929,
"eccentricity", 1073741931,
"ed", 1074790508,
"edges", 1073741933,
"energy", 1073741934,
"error", 1073741935,
"facecenteroffset", 1073741937,
"fill", 1073741938,
"filter", 1073741940,
"first", 1073741942,
"fixedtemp", 1073741946,
"flat", 1073741948,
"fps", 1074790526,
"from", 1073741952,
"front", 1073741954,
"frontedges", 1073741956,
"frontlit", 1073741958,
"frontonly", 1073741960,
"full", 1073741961,
"fullplane", 1073741962,
"fullylit", 1073741964,
"functionxy", 1073741966,
"functionxyz", 1073741968,
"gridpoints", 1073741970,
"homo", 1073741973,
"id", 1074790550,
"ignore", 1073741976,
"inchi", 1073741977,
"inchikey", 1073741978,
"image", 1073741979,
"increment", 1073741981,
"info", 1073741982,
"inline", 1073741983,
"insideout", 1073741984,
"interior", 1073741986,
"internal", 1073741988,
"intramolecular", 1073741989,
"intermolecular", 1073741990,
"jmol", 1073741991,
"json", 1073741992,
"last", 1073741993,
"lattice", 1073741994,
"lighting", 1073741995,
"left", 1073741996,
"line", 1073741998,
"link", 1073741999,
"linedata", 1073742000,
"list", 1073742001,
"lobe", 1073742002,
"lonepair", 1073742004,
"lp", 1073742006,
"lumo", 1073742008,
"manifest", 1073742010,
"maxset", 1073742014,
"menu", 1073742015,
"mep", 1073742016,
"mesh", 1073742018,
"middle", 1073742019,
"minset", 1073742020,
"mlp", 1073742022,
"mode", 1073742024,
"modify", 1073742025,
"modifyorcreate", 1073742026,
"modelbased", 1073742027,
"molecular", 1073742028,
"monomer", 1073742029,
"morph", 1073742030,
"mouse", 1073742031,
"movie", 1073742032,
"mrc", 1073742033,
"msms", 1073742034,
"name", 1073742035,
"nci", 1073742036,
"next", 1073742037,
"nmr", 1073742038,
"nocontourlines", 1073742039,
"nocross", 1073742040,
"nodebug", 1073742041,
"nodots", 1073742042,
"noedges", 1073742044,
"nofill", 1073742046,
"nohead", 1073742048,
"noload", 1073742050,
"nomesh", 1073742052,
"noplane", 1073742054,
"normal", 1073742056,
"notfrontonly", 1073742058,
"notriangles", 1073742060,
"obj", 1073742062,
"object", 1073742064,
"offset", 1073742066,
"offsetside", 1073742068,
"once", 1073742070,
"only", 1073742072,
"opaque", 1073742074,
"options", 1073742075,
"orbital", 1073742076,
"orientation", 1073742077,
"origin", 1073742078,
"out", 1073742079,
"packed", 1073742080,
"palindrome", 1073742082,
"parameters", 1073742083,
"path", 1073742084,
"pdb", 1074790662,
"pdbheader", 1073742088,
"period", 1073742090,
"perpendicular", 1073742092,
"phase", 1073742094,
"play", 1073742096,
"playrev", 1073742098,
"pocket", 1073742100,
"pointgroup", 1073742102,
"pointsperangstrom", 1073742104,
"polygon", 1073742106,
"prev", 1073742108,
"probe", 1073742109,
"pymol", 1073742110,
"rad", 1073742111,
"radical", 1073742112,
"range", 1073742114,
"rasmol", 1073742116,
"reference", 1073742118,
"remove", 1073742119,
"residue", 1073742120,
"resolution", 1073742122,
"reversecolor", 1073742124,
"rewind", 1073742125,
"right", 1073742126,
"rmsd", 1073742127,
"rna3d", 1073742128,
"rock", 1073742129,
"rotate45", 1073742130,
"rotation", 1073742132,
"rubberband", 1073742134,
"sasurface", 1073742135,
"saved", 1073742136,
"scale", 1073742138,
"scene", 1073742139,
"selection", 1073742140,
"shapely", 1073742144,
"sigma", 1073742146,
"sign", 1073742147,
"silent", 1073742148,
"solid", 1073742150,
"spacegroup", 1073742152,
"sphere", 1073742154,
"squared", 1073742156,
"state", 1073742158,
"stdinchi", 1073742159,
"stdinchikey", 1073742160,
"stop", 1073742162,
"supercell", 1073742163,
"ticks", 1073742164,
"title", 1073742166,
"titleformat", 1073742168,
"to", 1074790746,
"top", 1074790748,
"torsion", 1073742174,
"transform", 1073742176,
"translation", 1073742178,
"triangles", 1073742182,
"url", 1074790760,
"user", 1073742186,
"val", 1073742188,
"validation", 1073742189,
"variable", 1073742190,
"variables", 1073742192,
"vertices", 1073742194,
"spacebeforesquare", 1073742195,
"width", 1073742196);
c$.tokenSpaceBeforeSquare = c$.prototype.tokenSpaceBeforeSquare = JS.T.o (1073742195, " ");
c$.tokenOn = c$.prototype.tokenOn = JS.T.tv (1048589, 1, "on");
c$.tokenOff = c$.prototype.tokenOff = JS.T.tv (1048588, 0, "off");
c$.tokenAll = c$.prototype.tokenAll = JS.T.o (1048579, "all");
c$.tokenIf = c$.prototype.tokenIf = JS.T.o (135369225, "if");
c$.tokenAnd = c$.prototype.tokenAnd = JS.T.o (269484128, "and");
c$.tokenAndSpec = c$.prototype.tokenAndSpec = JS.T.o (269484160, "");
c$.tokenOr = c$.prototype.tokenOr = JS.T.o (269484112, "or");
c$.tokenAndFALSE = c$.prototype.tokenAndFALSE = JS.T.o (269484128, "and");
c$.tokenOrTRUE = c$.prototype.tokenOrTRUE = JS.T.o (269484112, "or");
c$.tokenOpIf = c$.prototype.tokenOpIf = JS.T.o (806354977, "?");
c$.tokenComma = c$.prototype.tokenComma = JS.T.o (269484080, ",");
c$.tokenDefineString = c$.prototype.tokenDefineString = JS.T.tv (1060866, 4, "@");
c$.tokenPlus = c$.prototype.tokenPlus = JS.T.o (269484193, "+");
c$.tokenMinus = c$.prototype.tokenMinus = JS.T.o (269484192, "-");
c$.tokenMul3 = c$.prototype.tokenMul3 = JS.T.o (1276117508, "mul3");
c$.tokenTimes = c$.prototype.tokenTimes = JS.T.o (269484209, "*");
c$.tokenDivide = c$.prototype.tokenDivide = JS.T.o (269484208, "/");
c$.tokenLeftParen = c$.prototype.tokenLeftParen = JS.T.o (269484048, "(");
c$.tokenRightParen = c$.prototype.tokenRightParen = JS.T.o (269484049, ")");
c$.tokenArraySquare = c$.prototype.tokenArraySquare = JS.T.o (135266306, "[");
c$.tokenArraySelector = c$.prototype.tokenArraySelector = JS.T.o (269484096, "[");
c$.tokenExpressionBegin = c$.prototype.tokenExpressionBegin = JS.T.o (1048577, "expressionBegin");
c$.tokenExpressionEnd = c$.prototype.tokenExpressionEnd = JS.T.o (1048578, "expressionEnd");
c$.tokenConnected = c$.prototype.tokenConnected = JS.T.o (135266310, "connected");
c$.tokenCoordinateBegin = c$.prototype.tokenCoordinateBegin = JS.T.o (1048586, "{");
c$.tokenRightBrace = c$.prototype.tokenRightBrace = JS.T.o (1048590, "}");
c$.tokenCoordinateEnd = c$.prototype.tokenCoordinateEnd = JS.T.tokenRightBrace;
c$.tokenColon = c$.prototype.tokenColon = JS.T.o (269484066, ":");
c$.tokenSetCmd = c$.prototype.tokenSetCmd = JS.T.o (1085443, "set");
c$.tokenSet = c$.prototype.tokenSet = JS.T.tv (1085443, 61, "");
c$.tokenSetArray = c$.prototype.tokenSetArray = JS.T.tv (1085443, 91, "");
c$.tokenSetProperty = c$.prototype.tokenSetProperty = JS.T.tv (1085443, 46, "");
c$.tokenSetVar = c$.prototype.tokenSetVar = JS.T.tv (36868, 61, "var");
c$.tokenEquals = c$.prototype.tokenEquals = JS.T.o (269484436, "=");
c$.tokenScript = c$.prototype.tokenScript = JS.T.o (135271429, "script");
c$.tokenSwitch = c$.prototype.tokenSwitch = JS.T.o (102410, "switch");
c$.tokenMap = c$.prototype.tokenMap =  new java.util.Hashtable ();
{
var arrayPairs = ["(", JS.T.tokenLeftParen, ")", JS.T.tokenRightParen, "and", JS.T.tokenAnd, "&", null, "&&", null, "or", JS.T.tokenOr, "|", null, "||", null, "?", JS.T.tokenOpIf, ",", JS.T.tokenComma, "=", JS.T.tokenEquals, "==", null, ":", JS.T.tokenColon, "+", JS.T.tokenPlus, "-", JS.T.tokenMinus, "*", JS.T.tokenTimes, "/", JS.T.tokenDivide, "script", JS.T.tokenScript, "source", null, "set", JS.T.tokenSetCmd, "switch", JS.T.tokenSwitch, "all", JS.T.tokenAll, "off", JS.T.tokenOff, "false", null, "on", JS.T.tokenOn, "true", null];
var tokenThis;
var tokenLast = null;
var sTok;
var lcase;
var n = arrayPairs.length - 1;
for (var i = 0; i < n; i += 2) {
sTok = arrayPairs[i];
lcase = sTok.toLowerCase ();
tokenThis = arrayPairs[i + 1];
if (tokenThis == null) tokenThis = tokenLast;
 else if (tokenThis.value == null) tokenThis.value = sTok;
JS.T.tokenMap.put (lcase, tokenThis);
tokenLast = tokenThis;
}
arrayPairs = null;
var sTokens = ["+=", "-=", "*=", "/=", "\\=", "&=", "|=", "not", "!", "xor", "tog", "<", "<=", ">=", ">", "!=", "<>", "LIKE", "within", ".", "..", "[", "]", "{", "}", "$", "%", ";", "++", "--", "**", "\\", "animation", "anim", "assign", "axes", "backbone", "background", "bind", "bondorder", "boundbox", "boundingBox", "break", "calculate", "capture", "cartoon", "cartoons", "case", "catch", "cd", "center", "centre", "centerat", "cgo", "color", "colour", "compare", "configuration", "conformation", "config", "connect", "console", "contact", "contacts", "continue", "data", "default", "define", "@", "delay", "delete", "density", "depth", "dipole", "dipoles", "display", "dot", "dots", "draw", "echo", "ellipsoid", "ellipsoids", "else", "elseif", "end", "endif", "exit", "eval", "file", "files", "font", "for", "format", "frame", "frames", "frank", "function", "functions", "geosurface", "getProperty", "goto", "halo", "halos", "helix", "helixalpha", "helix310", "helixpi", "hbond", "hbonds", "help", "hide", "history", "hover", "if", "in", "initialize", "invertSelected", "isosurface", "javascript", "label", "labels", "lcaoCartoon", "lcaoCartoons", "load", "log", "loop", "measure", "measures", "monitor", "monitors", "meshribbon", "meshribbons", "message", "minimize", "minimization", "mo", "model", "models", "modulation", "move", "moveTo", "navigate", "navigation", "nbo", "origin", "out", "parallel", "pause", "wait", "plot", "plot3d", "pmesh", "polygon", "polyhedra", "print", "process", "prompt", "quaternion", "quaternions", "quit", "ramachandran", "rama", "refresh", "reset", "unset", "restore", "restrict", "return", "ribbon", "ribbons", "rocket", "rockets", "rotate", "rotateSelected", "save", "select", "selectionHalos", "selectionHalo", "showSelections", "sheet", "show", "slab", "spacefill", "cpk", "spin", "ssbond", "ssbonds", "star", "stars", "step", "steps", "stereo", "strand", "strands", "structure", "_structure", "strucNo", "struts", "strut", "subset", "subsystem", "synchronize", "sync", "trace", "translate", "translateSelected", "try", "unbind", "unitcell", "var", "vector", "vectors", "vibration", "while", "wireframe", "write", "zap", "zoom", "zoomTo", "atom", "atoms", "axis", "axisangle", "basepair", "basepairs", "orientation", "orientations", "pdbheader", "polymer", "polymers", "residue", "residues", "rotation", "row", "sequence", "shape", "state", "symbol", "symmetry", "spaceGroup", "transform", "translation", "url", "abs", "absolute", "acos", "add", "adpmax", "adpmin", "align", "altloc", "altlocs", "ambientOcclusion", "amino", "angle", "array", "as", "atomID", "_atomID", "_a", "atomIndex", "atomName", "atomno", "atomType", "atomX", "atomY", "atomZ", "average", "babel", "babel21", "back", "backlit", "balls", "baseModel", "best", "bin", "bondCount", "bottom", "branch", "brillouin", "bzone", "wignerSeitz", "cache", "carbohydrate", "cell", "chain", "chains", "chainNo", "chemicalShift", "cs", "clash", "clear", "clickable", "clipboard", "connected", "context", "constraint", "contourLines", "coord", "coordinates", "coords", "cos", "cross", "covalentRadius", "covalent", "direction", "displacement", "displayed", "distance", "div", "DNA", "domains", "dotted", "DSSP", "DSSR", "element", "elemno", "_e", "error", "exportScale", "fill", "find", "fixedTemperature", "forcefield", "formalCharge", "charge", "eta", "front", "frontlit", "frontOnly", "fullylit", "fx", "fy", "fz", "fxyz", "fux", "fuy", "fuz", "fuxyz", "group", "groups", "group1", "groupID", "_groupID", "_g", "groupIndex", "hidden", "highlight", "hkl", "hydrophobicity", "hydrophobic", "hydro", "id", "identify", "ident", "image", "info", "inline", "insertion", "insertions", "intramolecular", "intra", "intermolecular", "inter", "bondingRadius", "ionicRadius", "ionic", "isAromatic", "Jmol", "JSON", "join", "keys", "last", "left", "length", "lines", "list", "magneticShielding", "ms", "mass", "max", "mep", "mesh", "middle", "min", "mlp", "mode", "modify", "modifyOrCreate", "modt", "modt1", "modt2", "modt3", "modx", "mody", "modz", "modo", "modxyz", "molecule", "molecules", "modelIndex", "monomer", "morph", "movie", "mouse", "mul", "mul3", "nci", "next", "noDots", "noFill", "noMesh", "none", "null", "inherit", "normal", "noContourLines", "nonequivalent", "notFrontOnly", "noTriangles", "now", "nucleic", "occupancy", "omega", "only", "opaque", "options", "partialCharge", "phi", "plane", "planar", "play", "playRev", "point", "points", "pointGroup", "polymerLength", "pop", "previous", "prev", "probe", "property", "properties", "protein", "psi", "purine", "push", "PyMOL", "pyrimidine", "random", "range", "rasmol", "replace", "resno", "resume", "rewind", "reverse", "right", "rmsd", "RNA", "rna3d", "rock", "rubberband", "saSurface", "saved", "scale", "scene", "search", "smarts", "selected", "seqid", "shapely", "sidechain", "sin", "site", "size", "smiles", "substructure", "solid", "sort", "specialPosition", "sqrt", "split", "starWidth", "starScale", "stddev", "straightness", "structureId", "supercell", "sub", "sum", "sum2", "surface", "surfaceDistance", "symop", "sx", "sy", "sz", "sxyz", "temperature", "relativeTemperature", "tensor", "theta", "thisModel", "ticks", "top", "torsion", "trajectory", "trajectories", "translucent", "transparent", "triangles", "trim", "type", "ux", "uy", "uz", "uxyz", "user", "valence", "vanderWaals", "vdw", "vdwRadius", "visible", "volume", "vx", "vy", "vz", "vxyz", "xyz", "w", "x", "y", "z", "addHydrogens", "allConnected", "angstroms", "anisotropy", "append", "arc", "area", "aromatic", "arrow", "async", "auto", "barb", "binary", "blockData", "cancel", "cap", "cavity", "centroid", "check", "chemical", "circle", "collapsed", "col", "colorScheme", "command", "commands", "contour", "contours", "corners", "count", "criterion", "create", "crossed", "curve", "cutoff", "cylinder", "diameter", "discrete", "distanceFactor", "downsample", "drawing", "dynamicMeasurements", "eccentricity", "ed", "edges", "energy", "exitJmol", "faceCenterOffset", "filter", "first", "fixed", "fix", "flat", "fps", "from", "frontEdges", "full", "fullPlane", "functionXY", "functionXYZ", "gridPoints", "homo", "ignore", "InChI", "InChIKey", "increment", "insideout", "interior", "intersection", "intersect", "internal", "lattice", "line", "lineData", "link", "lobe", "lonePair", "lp", "lumo", "manifest", "mapProperty", "map", "maxSet", "menu", "minSet", "modelBased", "molecular", "mrc", "msms", "name", "nmr", "noCross", "noDebug", "noEdges", "noHead", "noLoad", "noPlane", "object", "obj", "offset", "offsetSide", "once", "orbital", "atomicOrbital", "packed", "palindrome", "parameters", "path", "pdb", "period", "periodic", "perpendicular", "perp", "phase", "pocket", "pointsPerAngstrom", "radical", "rad", "reference", "remove", "resolution", "reverseColor", "rotate45", "selection", "sigma", "sign", "silent", "sphere", "squared", "stdInChI", "stdInChIKey", "stop", "title", "titleFormat", "to", "validation", "value", "variable", "variables", "vertices", "width", "backgroundModel", "celShading", "celShadingPower", "debug", "defaultLattice", "measurements", "measurement", "scale3D", "toggleLabel", "userColorScheme", "throw", "timeout", "timeouts", "animationMode", "appletProxy", "atomTypes", "axesColor", "axis1Color", "axis2Color", "axis3Color", "backgroundColor", "bondmode", "boundBoxColor", "boundingBoxColor", "currentLocalPath", "dataSeparator", "defaultAngleLabel", "defaultColorScheme", "defaultColors", "defaultDirectory", "defaultDistanceLabel", "defaultDropScript", "defaultLabelPDB", "defaultLabelXYZ", "defaultLoadFilter", "defaultLoadScript", "defaults", "defaultTorsionLabel", "defaultVDW", "drawFontSize", "edsUrlCutoff", "edsUrlFormat", "edsUrlFormatDiff", "energyUnits", "fileCacheDirectory", "fontsize", "helpPath", "hoverLabel", "language", "loadFormat", "loadLigandFormat", "logFile", "measurementUnits", "nmrPredictFormat", "nmrUrlFormat", "pathForAllFiles", "picking", "pickingStyle", "pickLabel", "platformSpeed", "propertyColorScheme", "quaternionFrame", "smilesUrlFormat", "smiles2dImageFormat", "unitCellColor", "axesScale", "axisScale", "bondTolerance", "cameraDepth", "defaultDrawArrowScale", "defaultTranslucent", "dipoleScale", "ellipsoidAxisDiameter", "gestureSwipeFactor", "hbondsAngleMinimum", "hbondsDistanceMaximum", "hoverDelay", "loadAtomDataTolerance", "minBondDistance", "minimizationCriterion", "modulationScale", "mouseDragFactor", "mouseWheelFactor", "navFPS", "navigationDepth", "navigationSlab", "navigationSpeed", "navX", "navY", "navZ", "particleRadius", "pointGroupDistanceTolerance", "pointGroupLinearTolerance", "radius", "rotationRadius", "scaleAngstromsPerInch", "sheetSmoothing", "slabRange", "solventProbeRadius", "spinFPS", "spinX", "spinY", "spinZ", "stereoDegrees", "strutDefaultRadius", "strutLengthMaximum", "vectorScale", "vectorsCentered", "vectorSymmetry", "vibrationPeriod", "vibrationScale", "visualRange", "ambientPercent", "ambient", "animationFps", "axesMode", "bondRadiusMilliAngstroms", "bondingVersion", "delayMaximumMs", "diffusePercent", "diffuse", "dotDensity", "dotScale", "ellipsoidDotCount", "helixStep", "hermiteLevel", "historyLevel", "lighting", "logLevel", "meshScale", "minimizationSteps", "minPixelSelRadius", "percentVdwAtom", "perspectiveModel", "phongExponent", "pickingSpinRate", "propertyAtomNumberField", "propertyAtomNumberColumnCount", "propertyDataColumnCount", "propertyDataField", "repaintWaitMs", "ribbonAspectRatio", "scriptReportingLevel", "showScript", "smallMoleculeMaxAtoms", "specular", "specularExponent", "specularPercent", "specPercent", "specularPower", "specpower", "strandCount", "strandCountForMeshRibbon", "strandCountForStrands", "strutSpacing", "zDepth", "zSlab", "zshadePower", "allowEmbeddedScripts", "allowGestures", "allowKeyStrokes", "allowModelKit", "allowMoveAtoms", "allowMultiTouch", "allowRotateSelected", "antialiasDisplay", "antialiasImages", "antialiasTranslucent", "appendNew", "applySymmetryToBonds", "atomPicking", "autobond", "autoFPS", "axesMolecular", "axesOrientationRasmol", "axesUnitCell", "axesWindow", "backboneSteps", "bondModeOr", "bondPicking", "bonds", "bond", "cartoonBaseEdges", "cartoonsFancy", "cartoonFancy", "cartoonLadders", "cartoonRibose", "cartoonRockets", "chainCaseSensitive", "colorRasmol", "debugScript", "defaultStructureDssp", "disablePopupMenu", "displayCellParameters", "showUnitcellInfo", "dotsSelectedOnly", "dotSurface", "dragSelected", "drawHover", "drawPicking", "dsspCalculateHydrogenAlways", "ellipsoidArcs", "ellipsoidArrows", "ellipsoidAxes", "ellipsoidBall", "ellipsoidDots", "ellipsoidFill", "fileCaching", "fontCaching", "fontScaling", "forceAutoBond", "fractionalRelative", "greyscaleRendering", "hbondsBackbone", "hbondsRasmol", "hbondsSolid", "hetero", "hideNameInPopup", "hideNavigationPoint", "hideNotSelected", "highResolution", "hydrogen", "hydrogens", "imageState", "isKiosk", "isosurfaceKey", "isosurfacePropertySmoothing", "isosurfacePropertySmoothingPower", "justifyMeasurements", "languageTranslation", "leadAtom", "leadAtoms", "legacyAutoBonding", "legacyHAddition", "legacyJavaFloat", "logCommands", "logGestures", "measureAllModels", "measurementLabels", "measurementNumbers", "messageStyleChime", "minimizationRefresh", "minimizationSilent", "modelkitMode", "monitorEnergy", "multipleBondRadiusFactor", "multipleBondSpacing", "multiProcessor", "navigateSurface", "navigationMode", "navigationPeriodic", "partialDots", "pdbAddHydrogens", "pdbGetHeader", "pdbSequential", "perspectiveDepth", "preserveState", "rangeSelected", "redoMove", "refreshing", "ribbonBorder", "rocketBarrels", "saveProteinStructureState", "scriptQueue", "selectAllModels", "selectHetero", "selectHydrogen", "showAxes", "showBoundBox", "showBoundingBox", "showFrank", "showHiddenSelectionHalos", "showHydrogens", "showKeyStrokes", "showMeasurements", "showModulationVectors", "showMultipleBonds", "showNavigationPointAlways", "showTiming", "showUnitcell", "showUnitcellDetails", "slabByAtom", "slabByMolecule", "slabEnabled", "smartAromatic", "solvent", "solventProbe", "ssBondsBackbone", "statusReporting", "strutsMultiple", "syncMouse", "syncScript", "testFlag1", "testFlag2", "testFlag3", "testFlag4", "traceAlpha", "twistedSheets", "undo", "undoMove", "useMinimizationThread", "useNumberLocalization", "waitForMoveTo", "windowCentered", "wireframeRotation", "zeroBasedXyzRasmol", "zoomEnabled", "zoomHeight", "zoomLarge", "zShade"];
var iTokens = [269484242, -1, -1, -1, -1, -1, -1, 269484144, -1, 269484113, 269484114, 269484435, 269484434, 269484433, 269484432, 269484437, -1, 269484438, 135266325, 1048583, 1048584, 269484096, 269484097, 1048586, 1048590, 1048582, 269484210, 1048591, 269484226, 269484225, 269484227, 269484211, 4097, -1, 4098, 1611272194, 1115297793, 1610616835, 4100, 4101, 1679429641, -1, 102407, 4102, 4103, 1113200642, -1, 102411, 102412, 1069064, 12289, -1, 4105, 135174, 1766856708, -1, 135270405, 1095766024, -1, -1, 4106, 528395, 135402505, -1, 102408, 135270408, 102413, 1060866, -1, 528397, 12291, 1073741914, 554176526, 135175, -1, 1610625028, 1276117505, 1113198595, 135176, 537022465, 1113198596, -1, 364547, 102402, 1150985, 364548, 266255, 135266829, 1229984263, -1, 4114, 135369224, 1288701959, 4115, -1, 1611272202, 135368713, -1, 1113198597, 1276121098, 20500, 1113200646, -1, 137363467, 3145735, 3145736, 3145738, 1612189718, -1, 20482, 12294, 1610616855, 544771, 135369225, 1276116993, 266264, 4121, 135180, 135287308, 1826248716, -1, 135182, -1, 135271427, 36869, 528410, 1746538509, -1, -1, -1, 1113200647, -1, 20485, 4126, -1, 1073877010, 1095766030, -1, 1276121113, 4128, 4130, 4131, -1, 1073877011, 1073742078, 1073742079, 102436, 20487, -1, 4133, 135190, 135188, 1073742106, 135192, 36865, 102439, 135304707, 135270418, -1, 266281, 1052714, -1, 266284, 4141, -1, 4142, 12295, 36866, 1113200649, -1, 1113200650, -1, 528432, 4145, 4146, 135280132, 1611141171, -1, -1, 3145760, 135270926, 554176565, 1113200651, -1, 1611141175, 1611141176, -1, 1113200652, -1, 266298, -1, 528443, 1650071565, -1, 1641025539, -1, 1095761942, 1708058, -1, 3158024, 1095761943, 4156, -1, 1113200654, 4160, 4162, 364558, 4164, 1614417948, 36868, 135198, -1, 4166, 102406, 659488, 135270422, 1060873, 4168, 4170, 1141899265, -1, 1073741854, 135266307, 1073741864, -1, 1073742077, -1, 1073742088, 1095761937, -1, 1073742120, -1, 1073742132, 1276117515, 1087373320, 1087373323, 1073742158, 1087375373, 1089470478, 1073742152, 1073742176, 1073742178, 1074790760, 135266826, 1073741826, 135266819, 1276118017, 1112539137, 1112539138, 1073741832, 1087373315, -1, 553648129, 3145730, 135266305, 135266306, 1073741848, 1095761922, -1, -1, 1095761923, 1087375362, 1095763969, 1087375361, 1112541185, 1112541186, 1112541187, 96, 1073741856, 1073741858, 1073741859, 1073741862, 1073741860, 3145776, 1073741863, 1276118529, 1095761924, 1073741871, 1048580, 1073741872, -1, -1, 135270423, 3145764, 1095761925, 1087373316, -1, 1095761927, 1112539139, -1, 1073741881, 1073741882, 3145766, 1073741884, 135266310, 14, 1073741894, 1073741898, 1048581, -1, -1, 135266821, 135267329, 1112539140, -1, 1073741918, 1073741922, 3145768, 1276118018, 1276117504, 3145732, 1073741925, 1073741926, 1073741915, 1073741916, 1087375365, 1095763978, 1095761929, 1073741935, 570425358, 1073741938, 1276118531, 1073741946, 545259561, 1632634891, -1, 1112539141, 1073741954, 1073741958, 1073741960, 1073741964, 1112541188, 1112541189, 1112541190, 1146095627, 1112541191, 1112541192, 1112541193, 1146095629, 1087373318, -1, 1087373319, 1095761932, -1, -1, 1095761933, 3145770, 536870920, 135267841, 1114638362, -1, -1, 1074790550, 1087373321, -1, 1073741979, 1073741982, 1073741983, 1087373322, -1, 1073741989, -1, 1073741990, -1, 1112541194, -1, -1, 1048585, 1073741991, 1073741992, 1276118020, 1141899282, 1073741993, 1073741996, 1141899267, 1141899268, 1073742001, 1112539142, -1, 1112539143, 64, 1073742016, 1073742018, 1073742019, 32, 1073742022, 1073742024, 1073742025, 1073742026, 1112539156, -1, 1112539157, 1112539158, 1112539159, 1112539160, 1112539161, 1112539162, 1146093584, 1095761936, -1, 1095761935, 1073742029, 1073742030, 1073742032, 1073742031, 1276117507, 1276117508, 1073742036, 1073742037, 1073742042, 1073742046, 1073742052, 1048587, -1, -1, 1073742056, 1073742039, 3145778, 1073742058, 1073742060, 135266318, 3145742, 1129318401, 1112539144, 1073742072, 1073742074, 1073742075, 1112541195, 1112539145, 135266319, -1, 1073742096, 1073742098, 135266320, -1, 1073742102, 1095761938, 1276383249, 1073742108, -1, 1073742109, 1716520985, -1, 3145744, 1112539146, 3145746, 1276384259, 1073742110, 3145748, 135267332, 1073742114, 1073742116, 1276120578, 1095761939, 4143, 1073742125, 1141899269, 1073742126, 1073742127, 3145750, 1073742128, 1073742129, 1073742134, 1073742135, 1073742136, 1073742138, 1073742139, 135267335, -1, 1114638363, 1095761940, 1073742144, 3145754, 135266820, 1095761941, 1141899270, 135267336, 1238369286, 1073742150, 1276117011, 3145772, 135266822, 1276118021, 570425403, -1, 192, 1112539150, 1087373324, 1073742163, 1276117511, 128, 160, 3145756, 1112539151, 1297090050, 1112539147, 1112539148, 1112539149, 1146095628, 1112541196, -1, 1276117016, 1112539152, 3145758, 1073742164, 1074790748, 1073742174, 536870926, -1, 603979967, -1, 1073742182, 1276117512, 1141899272, 1112539153, 1112539154, 1112539155, 1146093582, 1073742186, 1095763991, 1649412120, -1, -1, 3145774, 1313866249, 1112541202, 1112541203, 1112541204, 1146095631, 1146095626, 1141899281, 1112541205, 1112541206, 1112541207, 1073741828, 1073741834, 1073741836, 1073741837, 1073741839, 1074790416, 1073741842, 1076887572, 1073741846, 1073741849, 1073741852, 1073741861, 1073741866, 1073741868, 1073741874, 1074790451, 1073741876, 1095761926, 1073741878, 1073741879, 1073741880, 1073741886, 1276117514, 1073741888, 1073741890, 1073741892, 1073741896, 1073741900, 1073741902, 1276117012, 1073741905, 1073741904, 1073741906, 1073741908, 1073741910, 1073741912, 1073741917, 1073741920, 1073741924, 1073741928, 1073741929, 603979835, 1073741931, 1074790508, 1073741933, 1073741934, 266256, 1073741937, 1073741940, 1073741942, 1060869, -1, 1073741948, 1074790526, 1073741952, 1073741956, 1073741961, 1073741962, 1073741966, 1073741968, 1073741970, 1073741973, 1073741976, 1073741977, 1073741978, 1073741981, 1073741984, 1073741986, 135267842, -1, 1073741988, 1073741994, 1073741998, 1073742000, 1073741999, 1073742002, 1073742004, 1073742006, 1073742008, 1073742010, 1052700, -1, 1073742014, 1073742015, 1073742020, 1073742027, 1073742028, 1073742033, 1073742034, 1073742035, 1073742038, 1073742040, 1073742041, 1073742044, 1073742048, 1073742050, 1073742054, 1073742064, 1073742062, 1073742066, 1073742068, 1073742070, 1073742076, 1073741850, 1073742080, 1073742082, 1073742083, 1073742084, 1074790662, 1073742090, -1, 1073742092, -1, 1073742094, 1073742100, 1073742104, 1073742112, 1073742111, 1073742118, 1073742119, 1073742122, 1073742124, 1073742130, 1073742140, 1073742146, 1073742147, 1073742148, 1073742154, 1073742156, 1073742159, 1073742160, 1073742162, 1073742166, 1073742168, 1074790746, 1073742189, 1073742188, 1073742190, 1073742192, 1073742194, 1073742196, 536870914, 603979822, 553648137, 536870916, 536870918, 537006096, -1, 1610612740, 1610612741, 536870930, 36870, 536875070, -1, 545259521, 545259522, 545259524, 545259526, 545259528, 545259530, 545259532, 545259534, 1610612737, 545259536, -1, 545259538, 545259540, 545259542, 545259545, -1, 545259546, 545259547, 545259548, 545259543, 545259544, 545259549, 545259550, 545259552, 545259554, 545259555, 570425356, 545259556, 545259557, 545259558, 545259559, 545259560, 1610612738, 545259562, 545259563, 545259564, 545259565, 545259566, 545259567, 545259568, 545259569, 545259570, 545259571, 545259572, 545259574, 545259576, 553648158, 545259578, 545259580, 545259582, 545259584, 545259586, 570425346, -1, 570425348, 570425350, 570425352, 570425354, 570425355, 570425357, 570425359, 570425360, 570425361, 570425362, 570425363, 570425364, 570425365, 570425366, 570425367, 570425368, 570425371, 570425372, 570425373, 570425374, 570425376, 570425378, 570425380, 570425381, 570425382, 570425384, 1666189314, 570425388, 570425390, 570425392, 570425393, 570425394, 570425396, 570425398, 570425400, 570425402, 570425404, 570425406, 570425408, 1649410049, 603979972, 603979973, 570425412, 570425414, 570425416, 553648130, -1, 553648132, 553648134, 553648136, 553648138, 553648140, 553648142, -1, 553648143, 553648144, 553648145, 553648146, 553648147, 553648148, 1073741995, 553648150, 553648151, 553648152, 553648153, 553648154, 553648155, 553648156, 553648157, 553648159, 553648160, 553648162, 553648164, 553648165, 553648166, 553648168, 536870922, 553648170, 536870924, 553648172, 553648174, -1, 553648176, -1, 553648178, 553648180, 553648182, 553648184, 553648186, 553648188, 553648190, 603979778, 603979780, 603979781, 603979782, 603979783, 603979784, 603979785, 603979786, 603979788, 603979790, 603979792, 603979794, 603979796, 603979798, 603979800, 603979804, 603979806, 603979808, 603979810, 603979811, 603979812, 603979814, 1678770178, -1, 603979816, 603979817, -1, 603979818, 603979819, 603979820, 603979823, 603979824, 603979825, 603979826, 603979827, 603979828, -1, 603979829, 603979830, 603979831, 603979832, 603979833, 603979834, 603979836, 603979837, 603979838, 603979839, 603979840, 603979841, 603979842, 603979844, 603979845, 603979846, 603979848, 603979850, 603979852, 603979853, 603979854, 1613758470, 603979858, 603979860, 603979862, 603979864, 1613758476, -1, 603979867, 603979868, 603979869, 603979870, 553648149, 603979871, 603979872, 3145741, -1, 603979873, 603979874, 603979875, 603979876, 603979877, 603979878, 603979879, 1610612739, 603979880, 603979881, 603979882, 603979883, 603979884, 570425369, 570425370, 603979885, 603979886, 603979887, 603979888, 603979889, 603979890, 603979891, 603979892, 603979893, 603979894, 603979895, 4139, 603979896, 603979898, 603979900, 603979902, 603979904, 603979906, 603979908, 603979910, 603979914, 603979916, -1, 603979918, 603979920, 603979922, 603979924, 603979926, 603979927, 603979928, 603979930, 603979934, 603979936, 603979937, 603979939, 603979940, 603979942, 603979944, 1613758488, 603979948, 603979952, 603979954, 603979955, 603979956, 603979958, 603979960, 603979962, 603979964, 603979965, 603979966, 603979968, 536870928, 4165, 603979970, 603979971, 603979974, 603979975, 603979976, 603979978, 603979980, 603979982, 603979983, 603979984];
if (sTokens.length != iTokens.length) JU.Logger.error ("sTokens.length (" + sTokens.length + ") != iTokens.length! (" + iTokens.length + ")");
n = sTokens.length;
for (var i = 0; i < n; i++) {
sTok = sTokens[i];
lcase = sTok.toLowerCase ();
var t = iTokens[i];
tokenThis = tokenLast = (t == -1 ? tokenLast : JS.T.o (t, sTok));
if (JS.T.tokenMap.get (lcase) != null) JU.Logger.error ("duplicate token definition:" + lcase);
JS.T.tokenMap.put (lcase, tokenThis);
}
sTokens = null;
iTokens = null;
}});
Clazz_declarePackage ("J.shape");
Clazz_load (["J.shape.Shape"], "J.shape.AtomShape", ["JU.AU", "$.BS", "J.atomdata.RadiusData", "J.c.PAL", "$.VDW", "JU.BSUtil", "$.C"], function () {
c$ = Clazz_decorateAsClass (function () {
this.mad = -1;
this.mads = null;
this.colixes = null;
this.paletteIDs = null;
this.ac = 0;
this.atoms = null;
this.isActive = false;
this.monomerCount = 0;
this.bsSizeDefault = null;
this.rd = null;
Clazz_instantialize (this, arguments);
}, J.shape, "AtomShape", J.shape.Shape);
Clazz_defineMethod (c$, "getMonomers", 
function () {
return null;
});
Clazz_overrideMethod (c$, "initModelSet", 
function () {
this.atoms = this.ms.at;
this.ac = this.ms.ac;
if (this.mads != null) this.mads = JU.AU.arrayCopyShort (this.mads, this.ac);
if (this.colixes != null) this.colixes = JU.AU.arrayCopyShort (this.colixes, this.ac);
if (this.paletteIDs != null) this.paletteIDs = JU.AU.arrayCopyByte (this.paletteIDs, this.ac);
});
Clazz_overrideMethod (c$, "getSize", 
function (atomIndex) {
return (this.mads == null ? 0 : this.mads[atomIndex]);
}, "~N");
Clazz_overrideMethod (c$, "setSize", 
function (size, bsSelected) {
this.setSize2 (size, bsSelected);
}, "~N,JU.BS");
Clazz_defineMethod (c$, "setSize2", 
function (size, bsSelected) {
if (size == 0) {
this.setSizeRD (null, bsSelected);
return;
}if (this.rd == null) this.rd =  new J.atomdata.RadiusData (null, size, J.atomdata.RadiusData.EnumType.SCREEN, null);
 else this.rd.value = size;
this.setSizeRD (this.rd, bsSelected);
}, "~N,JU.BS");
Clazz_overrideMethod (c$, "setSizeRD", 
function (rd, bsSelected) {
if (this.atoms == null) return;
this.isActive = true;
if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS ();
var isVisible = (rd != null && rd.value != 0);
var isAll = (bsSelected == null);
var i0 = (isAll ? this.ac - 1 : bsSelected.nextSetBit (0));
if (this.mads == null && i0 >= 0) this.mads =  Clazz_newShortArray (this.ac, 0);
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsSelected.nextSetBit (i + 1))) this.setSizeRD2 (i, rd, isVisible);

}, "J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod (c$, "setSizeRD2", 
function (i, rd, isVisible) {
var atom = this.atoms[i];
this.mads[i] = atom.calculateMad (this.vwr, rd);
this.bsSizeSet.setBitTo (i, isVisible);
this.setShapeVisibility (atom, isVisible);
}, "~N,J.atomdata.RadiusData,~B");
Clazz_defineMethod (c$, "setPropAS", 
function (propertyName, value, bs) {
if ("color" === propertyName) {
this.isActive = true;
var colix = JU.C.getColixO (value);
var pid = J.c.PAL.pidOf (value);
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) this.setColixAndPalette (colix, pid, i);

return;
}if ("params" === propertyName) {
this.isActive = true;
var data = value;
var colixes = data[0];
var atrans = data[1];
var sizes = data[2];
var rd =  new J.atomdata.RadiusData (null, 0, J.atomdata.RadiusData.EnumType.FACTOR, J.c.VDW.AUTO);
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS ();
var i0 = bs.nextSetBit (0);
if (this.mads == null && i0 >= 0) this.mads =  Clazz_newShortArray (this.ac, 0);
for (var i = i0, pt = 0; i >= 0; i = bs.nextSetBit (i + 1), pt++) {
var colix = (colixes == null ? 0 : colixes[pt]);
if (colix == 0) colix = 0;
var f = (atrans == null ? 0 : atrans[pt]);
if (f > 0.01) colix = JU.C.getColixTranslucent3 (colix, true, f);
this.setColixAndPalette (colix, J.c.PAL.UNKNOWN.id, i);
if (sizes == null) continue;
var isVisible = ((rd.value = sizes[pt]) > 0);
this.setSizeRD2 (i, rd, isVisible);
}
return;
}if ("translucency" === propertyName) {
this.isActive = true;
var isTranslucent = (value.equals ("translucent"));
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (this.colixes == null) {
this.colixes =  Clazz_newShortArray (this.ac, 0);
this.paletteIDs =  Clazz_newByteArray (this.ac, 0);
}this.colixes[i] = JU.C.getColixTranslucent3 (this.colixes[i], isTranslucent, this.translucentLevel);
if (isTranslucent) this.bsColixSet.set (i);
}
return;
}if (propertyName === "deleteModelAtoms") {
this.atoms = (value)[1];
var info = (value)[2];
this.ac = this.ms.ac;
var firstAtomDeleted = info[1];
var nAtomsDeleted = info[2];
this.mads = JU.AU.deleteElements (this.mads, firstAtomDeleted, nAtomsDeleted);
this.colixes = JU.AU.deleteElements (this.colixes, firstAtomDeleted, nAtomsDeleted);
this.paletteIDs = JU.AU.deleteElements (this.paletteIDs, firstAtomDeleted, nAtomsDeleted);
JU.BSUtil.deleteBits (this.bsSizeSet, bs);
JU.BSUtil.deleteBits (this.bsColixSet, bs);
return;
}this.setPropS (propertyName, value, bs);
}, "~S,~O,JU.BS");
Clazz_defineMethod (c$, "setColixAndPalette", 
function (colix, paletteID, atomIndex) {
if (this.colixes == null || atomIndex >= this.colixes.length) {
if (colix == 0) return;
this.colixes = JU.AU.ensureLengthShort (this.colixes, atomIndex + 1);
this.paletteIDs = JU.AU.ensureLengthByte (this.paletteIDs, atomIndex + 1);
}if (this.bsColixSet == null) this.bsColixSet = JU.BS.newN (this.ac);
this.colixes[atomIndex] = colix = this.getColixI (colix, paletteID, atomIndex);
this.bsColixSet.setBitTo (atomIndex, colix != 0);
this.paletteIDs[atomIndex] = paletteID;
}, "~N,~N,~N");
Clazz_overrideMethod (c$, "setAtomClickability", 
function () {
if (!this.isActive) return;
for (var i = this.ac; --i >= 0; ) {
var atom = this.atoms[i];
if ((atom.shapeVisibilityFlags & this.vf) == 0 || this.ms.isAtomHidden (i)) continue;
atom.setClickable (this.vf);
}
});
Clazz_overrideMethod (c$, "getShapeState", 
function () {
return (this.isActive ? this.vwr.getAtomShapeState (this) : "");
});
Clazz_defineMethod (c$, "getInfoAsString", 
function (i) {
return null;
}, "~N");
});
Clazz_declarePackage ("J.shape");
Clazz_load (["J.shape.AtomShape"], "J.shape.Balls", ["JU.BS", "J.c.PAL", "JU.C"], function () {
c$ = Clazz_declareType (J.shape, "Balls", J.shape.AtomShape);
Clazz_overrideMethod (c$, "setSize", 
function (size, bsSelected) {
if (size == 2147483647) {
this.isActive = true;
if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS ();
this.bsSizeSet.or (bsSelected);
return;
}this.setSize2 (size, bsSelected);
}, "~N,JU.BS");
Clazz_overrideMethod (c$, "setSizeRD", 
function (rd, bsSelected) {
this.isActive = true;
if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS ();
var bsLength = Math.min (this.atoms.length, bsSelected.length ());
for (var i = bsSelected.nextSetBit (0); i >= 0 && i < bsLength; i = bsSelected.nextSetBit (i + 1)) {
var atom = this.atoms[i];
atom.setMadAtom (this.vwr, rd);
this.bsSizeSet.set (i);
}
}, "J.atomdata.RadiusData,JU.BS");
Clazz_overrideMethod (c$, "setProperty", 
function (propertyName, value, bs) {
if ("color" === propertyName) {
var colix = JU.C.getColixO (value);
if (colix == 0) colix = 2;
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
var pid = J.c.PAL.pidOf (value);
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var atom = this.atoms[i];
atom.colixAtom = this.getColixA (colix, pid, atom);
this.bsColixSet.setBitTo (i, colix != 2 || pid != J.c.PAL.NONE.id);
atom.paletteID = pid;
}
return;
}if ("colorValues" === propertyName) {
var values = value;
if (values.length == 0) return;
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
var n = 0;
var color = null;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (n >= values.length) return;
color = Integer.$valueOf (values[n++]);
var colix = JU.C.getColixO (color);
if (colix == 0) colix = 2;
var pid = J.c.PAL.pidOf (color);
var atom = this.atoms[i];
atom.colixAtom = this.getColixA (colix, pid, atom);
this.bsColixSet.setBitTo (i, colix != 2 || pid != J.c.PAL.NONE.id);
atom.paletteID = pid;
}
return;
}if ("colors" === propertyName) {
var data = value;
var colixes = data[0];
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (i >= colixes.length) continue;
this.atoms[i].colixAtom = colixes[i];
this.atoms[i].paletteID = J.c.PAL.UNKNOWN.id;
this.bsColixSet.set (i);
}
return;
}if ("translucency" === propertyName) {
var isTranslucent = ((value).equals ("translucent"));
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
this.atoms[i].setTranslucent (isTranslucent, this.translucentLevel);
if (isTranslucent) this.bsColixSet.set (i);
}
return;
}if (propertyName.startsWith ("ball")) {
propertyName = propertyName.substring (4).intern ();
}this.setPropAS (propertyName, value, bs);
}, "~S,~O,JU.BS");
Clazz_overrideMethod (c$, "setAtomClickability", 
function () {
var bsDeleted = this.vwr.slm.bsDeleted;
for (var i = this.ac; --i >= 0; ) {
var atom = this.atoms[i];
atom.setClickable (0);
if (bsDeleted != null && bsDeleted.get (i) || (atom.shapeVisibilityFlags & this.vf) == 0 || this.ms.isAtomHidden (i)) continue;
atom.setClickable (this.vf);
}
});
Clazz_overrideMethod (c$, "getShapeState", 
function () {
return this.vwr.getShapeState (this);
});
});
Clazz_declarePackage ("J.shape");
Clazz_load (["J.shape.FontShape"], "J.shape.FontLineShape", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.tickInfos = null;
this.mad = 0;
Clazz_instantialize (this, arguments);
}, J.shape, "FontLineShape", J.shape.FontShape);
Clazz_prepareFields (c$, function () {
this.tickInfos =  new Array (4);
});
Clazz_defineMethod (c$, "setPropFLS", 
function (propertyName, value) {
if ("tickInfo" === propertyName) {
var t = value;
if (t.ticks == null) {
if (t.type.equals (" ")) this.tickInfos[0] = this.tickInfos[1] = this.tickInfos[2] = this.tickInfos[3] = null;
 else this.tickInfos["xyz".indexOf (t.type) + 1] = null;
return;
}this.tickInfos["xyz".indexOf (t.type) + 1] = t;
return;
}this.setPropFS (propertyName, value);
}, "~S,~O");
Clazz_overrideMethod (c$, "getShapeState", 
function () {
var s = this.vwr.getFontState (this.myType, this.font3d);
return (this.tickInfos == null ? s : this.vwr.getFontLineShapeState (s, this.myType, this.tickInfos));
});
});
Clazz_declarePackage ("J.shape");
Clazz_load (["J.shape.Shape"], "J.shape.FontShape", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.myType = null;
this.font3d = null;
Clazz_instantialize (this, arguments);
}, J.shape, "FontShape", J.shape.Shape);
Clazz_overrideMethod (c$, "initShape", 
function () {
this.translucentAllowed = false;
});
Clazz_defineMethod (c$, "setPropFS", 
function (propertyName, value) {
if ("font" === propertyName) {
this.font3d = value;
return;
}}, "~S,~O");
});
Clazz_declarePackage ("J.shape");
Clazz_load (["J.shape.FontShape"], "J.shape.Frank", ["J.i18n.GT"], function () {
c$ = Clazz_decorateAsClass (function () {
this.frankString = "Jmol";
this.currentMetricsFont3d = null;
this.baseFont3d = null;
this.frankWidth = 0;
this.frankAscent = 0;
this.frankDescent = 0;
this.x = 0;
this.y = 0;
this.dx = 0;
this.dy = 0;
Clazz_instantialize (this, arguments);
}, J.shape, "Frank", J.shape.FontShape);
Clazz_defineMethod (c$, "initShape", 
function () {
Clazz_superCall (this, J.shape.Frank, "initShape", []);
this.myType = "frank";
this.baseFont3d = this.font3d = this.vwr.gdata.getFont3DFSS ("SansSerif", "Plain", 16);
this.calcMetrics ();
});
Clazz_overrideMethod (c$, "setProperty", 
function (propertyName, value, bs) {
this.setPropFS (propertyName, value);
}, "~S,~O,JU.BS");
Clazz_overrideMethod (c$, "wasClicked", 
function (x, y) {
var width = this.vwr.getScreenWidth ();
var height = this.vwr.getScreenHeight ();
return (width > 0 && height > 0 && x > width - this.frankWidth - 4 && y > height - this.frankAscent - 4);
}, "~N,~N");
Clazz_overrideMethod (c$, "checkObjectHovered", 
function (x, y, bsVisible) {
if (!this.vwr.getShowFrank () || !this.wasClicked (x, y) || !this.vwr.menuEnabled ()) return false;
if (this.vwr.gdata.antialiasEnabled && !this.vwr.isSingleThreaded) {
x <<= 1;
y <<= 1;
}this.vwr.hoverOnPt (x, y, J.i18n.GT._ ("Click for menu..."), null, null);
return true;
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "calcMetrics", 
function () {
if (this.vwr.isJS) this.frankString = "JSmol";
 else if (this.vwr.isSignedApplet) this.frankString = "Jmol_S";
if (this.font3d === this.currentMetricsFont3d) return;
this.currentMetricsFont3d = this.font3d;
this.frankWidth = this.font3d.stringWidth (this.frankString);
this.frankDescent = this.font3d.getDescent ();
this.frankAscent = this.font3d.getAscent ();
});
Clazz_defineMethod (c$, "getFont", 
function (imageFontScaling) {
this.font3d = this.vwr.gdata.getFont3DScaled (this.baseFont3d, imageFontScaling);
this.calcMetrics ();
}, "~N");
Clazz_overrideMethod (c$, "getShapeState", 
function () {
return this.vwr.getFontState (this.myType, this.font3d);
});
Clazz_defineStatics (c$,
"defaultFontName", "SansSerif",
"defaultFontStyle", "Plain",
"defaultFontSize", 16,
"frankMargin", 4);
});
Clazz_declarePackage ("J.shape");
Clazz_load (null, "J.shape.Shape", ["J.c.PAL", "JU.C", "$.Logger", "JV.JC"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.ms = null;
this.shapeID = 0;
this.vf = 0;
this.translucentLevel = 0;
this.translucentAllowed = true;
this.isBioShape = false;
this.bsSizeSet = null;
this.bsColixSet = null;
Clazz_instantialize (this, arguments);
}, J.shape, "Shape");
Clazz_defineMethod (c$, "initializeShape", 
function (vwr, modelSet, shapeID) {
this.vwr = vwr;
this.shapeID = shapeID;
this.vf = JV.JC.getShapeVisibilityFlag (shapeID);
this.setModelSet (modelSet);
this.initShape ();
}, "JV.Viewer,JM.ModelSet,~N");
Clazz_defineMethod (c$, "setModelVisibilityFlags", 
function (bsModels) {
}, "JU.BS");
Clazz_defineMethod (c$, "getSize", 
function (atomIndex) {
return 0;
}, "~N");
Clazz_defineMethod (c$, "getSizeG", 
function (group) {
return 0;
}, "JM.Group");
Clazz_defineMethod (c$, "setModelSet", 
function (modelSet) {
this.ms = modelSet;
this.initModelSet ();
}, "JM.ModelSet");
Clazz_defineMethod (c$, "initModelSet", 
function () {
});
Clazz_defineMethod (c$, "setShapeVisibility", 
function (atom, isVisible) {
atom.setShapeVisibility (this.vf, isVisible);
}, "JM.Atom,~B");
Clazz_defineMethod (c$, "initShape", 
function () {
});
Clazz_defineMethod (c$, "merge", 
function (shape) {
}, "J.shape.Shape");
Clazz_defineMethod (c$, "setShapeSizeRD", 
function (size, rd, bsSelected) {
if (rd == null) this.setSize (size, bsSelected);
 else this.setSizeRD (rd, bsSelected);
}, "~N,J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod (c$, "setSize", 
function (size, bsSelected) {
}, "~N,JU.BS");
Clazz_defineMethod (c$, "setSizeRD", 
function (rd, bsSelected) {
}, "J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod (c$, "getPropertyData", 
function (property, data) {
return false;
}, "~S,~A");
Clazz_defineMethod (c$, "setPropS", 
function (propertyName, value, bsSelected) {
if (propertyName === "setProperties") {
if (bsSelected == null) bsSelected = this.vwr.bsA ();
var propertyList = value;
while (propertyList.size () > 0) {
var data = propertyList.remove (0);
this.setProperty ((data[0]).intern (), data[1], bsSelected);
}
return;
}if (propertyName === "translucentLevel") {
this.translucentLevel = (value).floatValue ();
return;
}if (propertyName === "refreshTrajectories") {
return;
}JU.Logger.warn ("unassigned " + JV.JC.shapeClassBases[this.shapeID] + " + shape setProperty:" + propertyName + ":" + value);
}, "~S,~O,JU.BS");
Clazz_defineMethod (c$, "getProperty", 
function (property, index) {
return null;
}, "~S,~N");
Clazz_defineMethod (c$, "getIndexFromName", 
function (thisID) {
return -1;
}, "~S");
Clazz_defineMethod (c$, "wasClicked", 
function (x, y) {
return false;
}, "~N,~N");
Clazz_defineMethod (c$, "findNearestAtomIndex", 
function (xMouse, yMouse, closest, bsNot) {
}, "~N,~N,~A,JU.BS");
Clazz_defineMethod (c$, "checkBoundsMinMax", 
function (pointMin, pointMax) {
}, "JU.P3,JU.P3");
Clazz_defineMethod (c$, "setAtomClickability", 
function () {
});
Clazz_defineMethod (c$, "checkObjectClicked", 
function (x, y, modifiers, bsVisible, drawPicking) {
return null;
}, "~N,~N,~N,JU.BS,~B");
Clazz_defineMethod (c$, "checkObjectHovered", 
function (x, y, bsVisible) {
return false;
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "checkObjectDragged", 
function (prevX, prevY, x, y, dragAction, bsVisible) {
return false;
}, "~N,~N,~N,~N,~N,JU.BS");
Clazz_defineMethod (c$, "coordinateInRange", 
function (x, y, vertex, dmin2, ptXY) {
this.vwr.tm.transformPtScr (vertex, ptXY);
var d2 = (x - ptXY.x) * (x - ptXY.x) + (y - ptXY.y) * (y - ptXY.y);
return (d2 < dmin2 ? d2 : -1);
}, "~N,~N,JU.T3,~N,JU.P3i");
Clazz_defineMethod (c$, "getColixI", 
function (colix, paletteID, atomIndex) {
return this.getColixA (colix, paletteID, this.ms.at[atomIndex]);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getColixA", 
function (colix, paletteID, atom) {
return (colix == 2 ? this.vwr.cm.getColixAtomPalette (atom, paletteID) : colix);
}, "~N,~N,JM.Atom");
Clazz_defineMethod (c$, "getColixB", 
function (colix, pid, bond) {
return (colix == 2 ? this.vwr.cm.getColixBondPalette (bond, pid) : colix);
}, "~N,~N,JM.Bond");
Clazz_defineMethod (c$, "getShapeDetail", 
function () {
return null;
});
c$.getColix = Clazz_defineMethod (c$, "getColix", 
function (colixes, i, atom) {
return JU.C.getColixInherited ((colixes == null || i >= colixes.length ? 0 : colixes[i]), atom.colixAtom);
}, "~A,~N,JM.Atom");
c$.getFontCommand = Clazz_defineMethod (c$, "getFontCommand", 
function (type, font) {
if (font == null) return "";
return "font " + type + " " + font.getInfo ();
}, "~S,javajs.awt.Font");
c$.getColorCommandUnk = Clazz_defineMethod (c$, "getColorCommandUnk", 
function (type, colix, translucentAllowed) {
return J.shape.Shape.getColorCommand (type, J.c.PAL.UNKNOWN.id, colix, translucentAllowed);
}, "~S,~N,~B");
c$.getColorCommand = Clazz_defineMethod (c$, "getColorCommand", 
function (type, pid, colix, translucentAllowed) {
if (pid == J.c.PAL.UNKNOWN.id && colix == 0) return "";
var s = (pid == J.c.PAL.UNKNOWN.id && colix == 0 ? "" : (translucentAllowed ? J.shape.Shape.getTranslucentLabel (colix) + " " : "") + (pid != J.c.PAL.UNKNOWN.id && !J.c.PAL.isPaletteVariable (pid) ? J.c.PAL.getPaletteName (pid) : J.shape.Shape.encodeColor (colix)));
return "color " + type + " " + s;
}, "~S,~N,~N,~B");
c$.encodeColor = Clazz_defineMethod (c$, "encodeColor", 
function (colix) {
return (JU.C.isColixColorInherited (colix) ? "none" : JU.C.getHexCode (colix));
}, "~N");
c$.getTranslucentLabel = Clazz_defineMethod (c$, "getTranslucentLabel", 
function (colix) {
return (JU.C.isColixTranslucent (colix) ? "translucent " + JU.C.getColixTranslucencyFractional (colix) : "opaque");
}, "~N");
c$.appendCmd = Clazz_defineMethod (c$, "appendCmd", 
function (s, cmd) {
if (cmd.length == 0) return;
s.append ("  ").append (cmd).append (";\n");
}, "JU.SB,~S");
Clazz_defineStatics (c$,
"RADIUS_MAX", 4);
});
Clazz_declarePackage ("J.shape");
Clazz_load (["J.shape.Shape", "JU.P3i"], "J.shape.Sticks", ["java.util.Hashtable", "JU.BS", "$.P3", "J.c.PAL", "JU.BSUtil", "$.C", "$.Edge", "$.Escape"], function () {
c$ = Clazz_decorateAsClass (function () {
this.myMask = 0;
this.reportAll = false;
this.bsOrderSet = null;
this.selectedBonds = null;
this.ptXY = null;
Clazz_instantialize (this, arguments);
}, J.shape, "Sticks", J.shape.Shape);
Clazz_prepareFields (c$, function () {
this.ptXY =  new JU.P3i ();
});
Clazz_defineMethod (c$, "initShape", 
function () {
Clazz_superCall (this, J.shape.Sticks, "initShape", []);
this.myMask = 1023;
this.reportAll = false;
});
Clazz_overrideMethod (c$, "setSize", 
function (size, bsSelected) {
if (size == 2147483647) {
this.selectedBonds = JU.BSUtil.copy (bsSelected);
return;
}if (size == -2147483648) {
if (this.bsOrderSet == null) this.bsOrderSet =  new JU.BS ();
this.bsOrderSet.or (bsSelected);
return;
}if (this.bsSizeSet == null) this.bsSizeSet =  new JU.BS ();
var iter = (this.selectedBonds != null ? this.ms.getBondIterator (this.selectedBonds) : this.ms.getBondIteratorForType (this.myMask, bsSelected));
var mad = size;
while (iter.hasNext ()) {
this.bsSizeSet.set (iter.nextIndex ());
iter.next ().setMad (mad);
}
}, "~N,JU.BS");
Clazz_overrideMethod (c$, "setProperty", 
function (propertyName, value, bs) {
if ("type" === propertyName) {
this.myMask = (value).intValue ();
return;
}if ("reportAll" === propertyName) {
this.reportAll = true;
return;
}if ("reset" === propertyName) {
this.bsOrderSet = null;
this.bsSizeSet = null;
this.bsColixSet = null;
this.selectedBonds = null;
return;
}if ("bondOrder" === propertyName) {
if (this.bsOrderSet == null) this.bsOrderSet =  new JU.BS ();
var order = (value).shortValue ();
var iter = (this.selectedBonds != null ? this.ms.getBondIterator (this.selectedBonds) : this.ms.getBondIteratorForType (65535, bs));
while (iter.hasNext ()) {
this.bsOrderSet.set (iter.nextIndex ());
iter.next ().setOrder (order);
}
return;
}if ("color" === propertyName) {
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
var colix = JU.C.getColixO (value);
var pal = (Clazz_instanceOf (value, J.c.PAL) ? value : null);
if (pal === J.c.PAL.TYPE || pal === J.c.PAL.ENERGY) {
var isEnergy = (pal === J.c.PAL.ENERGY);
var iter = (this.selectedBonds != null ? this.ms.getBondIterator (this.selectedBonds) : this.ms.getBondIteratorForType (this.myMask, bs));
while (iter.hasNext ()) {
this.bsColixSet.set (iter.nextIndex ());
var bond = iter.next ();
bond.colix = (isEnergy ? this.getColixB (colix, pal.id, bond) : JU.C.getColix (JU.Edge.getArgbHbondType (bond.order)));
}
return;
}if (colix == 2 && pal !== J.c.PAL.CPK) return;
var iter = (this.selectedBonds != null ? this.ms.getBondIterator (this.selectedBonds) : this.ms.getBondIteratorForType (this.myMask, bs));
while (iter.hasNext ()) {
var iBond = iter.nextIndex ();
iter.next ().colix = colix;
this.bsColixSet.setBitTo (iBond, (colix != 0 && colix != 2));
}
return;
}if ("translucency" === propertyName) {
if (this.bsColixSet == null) this.bsColixSet =  new JU.BS ();
var isTranslucent = ((value).equals ("translucent"));
var iter = (this.selectedBonds != null ? this.ms.getBondIterator (this.selectedBonds) : this.ms.getBondIteratorForType (this.myMask, bs));
while (iter.hasNext ()) {
this.bsColixSet.set (iter.nextIndex ());
iter.next ().setTranslucent (isTranslucent, this.translucentLevel);
}
return;
}if ("deleteModelAtoms" === propertyName) {
return;
}this.setPropS (propertyName, value, bs);
}, "~S,~O,JU.BS");
Clazz_overrideMethod (c$, "getProperty", 
function (property, index) {
if (property.equals ("selectionState")) return (this.selectedBonds != null ? "select BONDS " + JU.Escape.eBS (this.selectedBonds) + "\n" : "");
if (property.equals ("sets")) return [this.bsOrderSet, this.bsSizeSet, this.bsColixSet];
return null;
}, "~S,~N");
Clazz_overrideMethod (c$, "setAtomClickability", 
function () {
var bonds = this.ms.bo;
for (var i = this.ms.bondCount; --i >= 0; ) {
var bond = bonds[i];
if ((bond.shapeVisibilityFlags & this.vf) == 0 || this.ms.isAtomHidden (bond.atom1.i) || this.ms.isAtomHidden (bond.atom2.i)) continue;
bond.atom1.setClickable (this.vf);
bond.atom2.setClickable (this.vf);
}
});
Clazz_overrideMethod (c$, "getShapeState", 
function () {
return this.vwr.getBondState (this, this.bsOrderSet, this.reportAll);
});
Clazz_overrideMethod (c$, "checkObjectHovered", 
function (x, y, bsVisible) {
var pt =  new JU.P3 ();
var bond = this.findPickedBond (x, y, bsVisible, pt);
if (bond == null) return false;
this.vwr.highlightBond (bond.index, true);
return true;
}, "~N,~N,JU.BS");
Clazz_overrideMethod (c$, "checkObjectClicked", 
function (x, y, modifiers, bsVisible, drawPicking) {
var pt =  new JU.P3 ();
var bond = this.findPickedBond (x, y, bsVisible, pt);
if (bond == null) return null;
var modelIndex = bond.atom1.mi;
var info = bond.getIdentity ();
var map =  new java.util.Hashtable ();
map.put ("pt", pt);
map.put ("index", Integer.$valueOf (bond.index));
map.put ("modelIndex", Integer.$valueOf (modelIndex));
map.put ("model", this.vwr.getModelNumberDotted (modelIndex));
map.put ("type", "bond");
map.put ("info", info);
this.vwr.setStatusAtomPicked (-3, "[\"bond\",\"" + bond.getIdentity () + "\"," + pt.x + "," + pt.y + "," + pt.z + "]", map);
return map;
}, "~N,~N,~N,JU.BS,~B");
Clazz_defineMethod (c$, "findPickedBond", 
 function (x, y, bsVisible, pt) {
var dmin2 = 100;
if (this.vwr.gdata.isAntialiased ()) {
x <<= 1;
y <<= 1;
dmin2 <<= 1;
}var pickedBond = null;
var v =  new JU.P3 ();
var bonds = this.ms.bo;
for (var i = this.ms.bondCount; --i >= 0; ) {
var bond = bonds[i];
if (bond.shapeVisibilityFlags == 0) continue;
var atom1 = bond.atom1;
var atom2 = bond.atom2;
if (!atom1.checkVisible () || !atom2.checkVisible ()) continue;
v.ave (atom1, atom2);
var d2 = this.coordinateInRange (x, y, v, dmin2, this.ptXY);
if (d2 >= 0) {
var f = 1 * (this.ptXY.x - atom1.sX) / (atom2.sX - atom1.sX);
if (f < 0.4 || f > 0.6) continue;
dmin2 = d2;
pickedBond = bond;
pt.setT (v);
}}
return pickedBond;
}, "~N,~N,JU.BS,JU.P3");
Clazz_defineStatics (c$,
"MAX_BOND_CLICK_DISTANCE_SQUARED", 100);
});
Clazz_declarePackage ("J.thread");
Clazz_load (["J.thread.JmolThread"], "J.thread.HoverWatcherThread", ["java.lang.Thread"], function () {
c$ = Clazz_decorateAsClass (function () {
this.actionManager = null;
this.current = null;
this.moved = null;
this.hoverDelay = 0;
Clazz_instantialize (this, arguments);
}, J.thread, "HoverWatcherThread", J.thread.JmolThread);
Clazz_makeConstructor (c$, 
function (actionManager, current, moved, vwr) {
this.setViewer (vwr, "HoverWatcher");
this.actionManager = actionManager;
this.current = current;
this.moved = moved;
this.start ();
}, "JV.ActionManager,JV.MouseState,JV.MouseState,JV.Viewer");
Clazz_overrideMethod (c$, "run1", 
function (mode) {
while (true) switch (mode) {
case -1:
if (!this.isJS) Thread.currentThread ().setPriority (1);
mode = 0;
break;
case 0:
this.hoverDelay = this.vwr.getHoverDelay ();
if (this.stopped || this.hoverDelay <= 0 || !this.runSleep (this.hoverDelay, 1)) return;
mode = 1;
break;
case 1:
if (this.moved.is (this.current)) {
this.currentTime = System.currentTimeMillis ();
var howLong = (this.currentTime - this.moved.time);
if (howLong > this.hoverDelay && !this.stopped) {
this.actionManager.checkHover ();
}}mode = 0;
break;
}

}, "~N");
});
Clazz_declarePackage ("J.thread");
Clazz_load (["java.lang.Thread"], "J.thread.JmolThread", ["JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.$name = "JmolThread";
this.vwr = null;
this.eval = null;
this.sc = null;
this.haveReference = false;
this.hoverEnabled = false;
this.startTime = 0;
this.targetTime = 0;
this.lastRepaintTime = 0;
this.currentTime = 0;
this.sleepTime = 0;
this.isJS = false;
this.stopped = false;
this.isReset = false;
this.useTimeout = true;
this.junk = 0;
Clazz_instantialize (this, arguments);
}, J.thread, "JmolThread", Thread);
Clazz_defineMethod (c$, "setManager", 
function (manager, vwr, params) {
return 0;
}, "~O,JV.Viewer,~O");
Clazz_defineMethod (c$, "setViewer", 
function (vwr, name) {
this.setName (name);
this.$name = name + "_" + (++J.thread.JmolThread.threadIndex);
this.vwr = vwr;
this.isJS = vwr.isSingleThreaded;
}, "JV.Viewer,~S");
Clazz_defineMethod (c$, "setEval", 
function (eval) {
this.eval = eval;
this.sc = this.vwr.getEvalContextAndHoldQueue (eval);
if (this.sc != null) this.useTimeout = eval.getAllowJSThreads ();
}, "J.api.JmolScriptEvaluator");
Clazz_defineMethod (c$, "resumeEval", 
function () {
if (this.eval == null || !this.isJS && !this.vwr.testAsync || !this.useTimeout) return;
this.sc.mustResumeEval = !this.stopped;
this.eval.resumeEval (this.sc);
this.eval = null;
this.sc = null;
});
Clazz_defineMethod (c$, "start", 
function () {
if (this.isJS) {
this.run ();
} else {
Clazz_superCall (this, J.thread.JmolThread, "start", []);
}});
Clazz_overrideMethod (c$, "run", 
function () {
this.startTime = System.currentTimeMillis ();
try {
this.run1 (-1);
} catch (e$$) {
if (Clazz_exceptionOf (e$$, InterruptedException)) {
var e = e$$;
{
if (JU.Logger.debugging && !(Clazz_instanceOf (this, J.thread.HoverWatcherThread))) this.oops (e);
}
} else if (Clazz_exceptionOf (e$$, Exception)) {
var e = e$$;
{
this.oops (e);
}
} else {
throw e$$;
}
}
});
Clazz_defineMethod (c$, "oops", 
function (e) {
JU.Logger.debug (this.$name + " exception " + e);
if (!this.vwr.isJS) e.printStackTrace ();
this.vwr.queueOnHold = false;
}, "Exception");
Clazz_defineMethod (c$, "runSleep", 
function (millis, runPtr) {
if (this.isJS && !this.useTimeout) {
return true;
}{
var me = this;
setTimeout(function(){me.run1(runPtr)}, Math.max(millis, 0));
return false;
}}, "~N,~N");
Clazz_defineMethod (c$, "interrupt", 
function () {
this.stopped = true;
this.vwr.startHoverWatcher (true);
if (!this.isJS) Clazz_superCall (this, J.thread.JmolThread, "interrupt", []);
});
Clazz_defineMethod (c$, "checkInterrupted", 
function (ref) {
if (this.haveReference && (ref == null || !ref.$name.equals (this.$name))) return true;
{
return this.stopped;
}}, "J.thread.JmolThread");
Clazz_defineMethod (c$, "reset", 
function () {
this.isReset = true;
this.interrupt ();
});
Clazz_defineStatics (c$,
"threadIndex", 0,
"INIT", -1,
"MAIN", 0,
"FINISH", -2,
"CHECK1", 1,
"CHECK2", 2,
"CHECK3", 3);
});
Clazz_declarePackage ("J.thread");
Clazz_load (["J.thread.JmolThread"], "J.thread.TimeoutThread", ["java.lang.Thread", "JU.SB"], function () {
c$ = Clazz_decorateAsClass (function () {
this.script = null;
this.status = 0;
this.triggered = true;
Clazz_instantialize (this, arguments);
}, J.thread, "TimeoutThread", J.thread.JmolThread);
Clazz_makeConstructor (c$, 
function (vwr, name, ms, script) {
this.setViewer (vwr, name);
this.$name = name;
this.set (ms, script);
}, "JV.Viewer,~S,~N,~S");
Clazz_defineMethod (c$, "set", 
 function (ms, script) {
this.sleepTime = ms;
if (script != null) this.script = script;
}, "~N,~S");
Clazz_overrideMethod (c$, "toString", 
function () {
return "timeout name=" + this.$name + " executions=" + this.status + " mSec=" + this.sleepTime + " secRemaining=" + (this.targetTime - System.currentTimeMillis ()) / 1000 + " script=" + this.script;
});
Clazz_overrideMethod (c$, "run1", 
function (mode) {
while (true) {
switch (mode) {
case -1:
if (!this.isJS) Thread.currentThread ().setPriority (1);
this.targetTime = System.currentTimeMillis () + Math.abs (this.sleepTime);
mode = 0;
break;
case 0:
if (this.checkInterrupted (null) || this.script == null || this.script.length == 0) return;
if (!this.runSleep (26, 1)) return;
mode = 1;
break;
case 1:
mode = (System.currentTimeMillis () < this.targetTime ? 0 : 2);
break;
case 2:
this.currentTime = System.currentTimeMillis ();
if (this.vwr.timeouts.get (this.$name) == null) return;
this.status++;
var continuing = (this.sleepTime < 0);
if (continuing) this.targetTime = System.currentTimeMillis () + Math.abs (this.sleepTime);
 else this.vwr.timeouts.remove (this.$name);
if (this.triggered) {
this.triggered = false;
if (this.$name.equals ("_SET_IN_MOTION_")) {
this.vwr.checkInMotion (2);
} else {
this.vwr.evalStringQuiet ((continuing ? this.script + ";\ntimeout ID \"" + this.$name + "\";" : this.script));
}}mode = (continuing ? 0 : -2);
break;
case -2:
this.vwr.timeouts.remove (this.$name);
return;
}
}
}, "~N");
c$.clear = Clazz_defineMethod (c$, "clear", 
function (timeouts) {
for (var o, $o = timeouts.values ().iterator (); $o.hasNext () && ((o = $o.next ()) || true);) {
var t = o;
if (!t.script.equals ("exitJmol")) t.interrupt ();
}
timeouts.clear ();
}, "java.util.Map");
c$.setTimeout = Clazz_defineMethod (c$, "setTimeout", 
function (vwr, timeouts, name, mSec, script) {
var t = timeouts.get (name);
if (mSec == 0) {
if (t != null) {
t.interrupt ();
timeouts.remove (name);
}return;
}if (t != null) {
t.set (mSec, script);
return;
}t =  new J.thread.TimeoutThread (vwr, name, mSec, script);
timeouts.put (name, t);
t.start ();
}, "JV.Viewer,java.util.Map,~S,~N,~S");
c$.trigger = Clazz_defineMethod (c$, "trigger", 
function (timeouts, name) {
var t = timeouts.get (name);
if (t != null) t.triggered = (t.sleepTime < 0);
}, "java.util.Map,~S");
c$.showTimeout = Clazz_defineMethod (c$, "showTimeout", 
function (timeouts, name) {
var sb =  new JU.SB ();
if (timeouts != null) {
for (var o, $o = timeouts.values ().iterator (); $o.hasNext () && ((o = $o.next ()) || true);) {
var t = o;
if (name == null || t.$name.equalsIgnoreCase (name)) sb.append (t.toString ()).append ("\n");
}
}return (sb.length () > 0 ? sb.toString () : "<no timeouts set>");
}, "java.util.Map,~S");
});
Clazz_declarePackage ("JM");
Clazz_load (["JU.BNode", "$.Point3fi", "J.c.PAL"], "JM.Atom", ["java.lang.Float", "JU.BS", "$.CU", "$.P3", "$.PT", "$.SB", "J.atomdata.RadiusData", "J.c.VDW", "JM.Group", "JU.C", "$.Elements"], function () {
c$ = Clazz_decorateAsClass (function () {
this.altloc = '\0';
this.atomID = 0;
this.atomSite = 0;
this.group = null;
this.userDefinedVanDerWaalRadius = 0;
this.valence = 0;
this.atomicAndIsotopeNumber = 0;
this.atomSymmetry = null;
this.formalChargeAndFlags = 0;
this.madAtom = 0;
this.colixAtom = 0;
this.paletteID = 0;
this.bonds = null;
this.nBondsDisplayed = 0;
this.nBackbonesDisplayed = 0;
this.clickabilityFlags = 0;
this.shapeVisibilityFlags = 0;
Clazz_instantialize (this, arguments);
}, JM, "Atom", JU.Point3fi, JU.BNode);
Clazz_prepareFields (c$, function () {
this.paletteID = J.c.PAL.CPK.id;
});
Clazz_overrideMethod (c$, "setAtom", 
function (modelIndex, atomIndex, xyz, radius, atomSymmetry, atomSite, atomicAndIsotopeNumber, formalCharge, isHetero) {
this.mi = modelIndex;
this.atomSymmetry = atomSymmetry;
this.atomSite = atomSite;
this.i = atomIndex;
this.atomicAndIsotopeNumber = atomicAndIsotopeNumber;
if (isHetero) this.formalChargeAndFlags = 2;
if (formalCharge != 0 && formalCharge != -2147483648) this.setFormalCharge (formalCharge);
this.userDefinedVanDerWaalRadius = radius;
this.setT (xyz);
return this;
}, "~N,~N,JU.P3,~N,JU.BS,~N,~N,~N,~B");
Clazz_defineMethod (c$, "setShapeVisibility", 
function (flag, isVisible) {
if (isVisible) this.shapeVisibilityFlags |= flag;
 else this.shapeVisibilityFlags &= ~flag;
}, "~N,~B");
Clazz_defineMethod (c$, "isCovalentlyBonded", 
function (atomOther) {
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) if (this.bonds[i].isCovalent () && this.bonds[i].getOtherAtom (this) === atomOther) return true;

return false;
}, "JM.Atom");
Clazz_defineMethod (c$, "isBonded", 
function (atomOther) {
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) if (this.bonds[i].getOtherAtom (this) === atomOther) return true;

return false;
}, "JM.Atom");
Clazz_defineMethod (c$, "getBond", 
function (atomOther) {
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) if (this.bonds[i].getOtherAtom (atomOther) != null) return this.bonds[i];

return null;
}, "JM.Atom");
Clazz_defineMethod (c$, "addDisplayedBond", 
function (stickVisibilityFlag, isVisible) {
this.nBondsDisplayed += (isVisible ? 1 : -1);
this.setShapeVisibility (stickVisibilityFlag, (this.nBondsDisplayed > 0));
}, "~N,~B");
Clazz_defineMethod (c$, "addDisplayedBackbone", 
function (backboneVisibilityFlag, isVisible) {
this.nBackbonesDisplayed += (isVisible ? 1 : -1);
this.setShapeVisibility (backboneVisibilityFlag, isVisible);
}, "~N,~B");
Clazz_defineMethod (c$, "deleteBond", 
function (bond) {
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) if (this.bonds[i] === bond) {
this.deleteBondAt (i);
return;
}
}, "JM.Bond");
Clazz_defineMethod (c$, "deleteBondAt", 
 function (i) {
var newLength = this.bonds.length - 1;
if (newLength == 0) {
this.bonds = null;
return;
}var bondsNew =  new Array (newLength);
var j = 0;
for (; j < i; ++j) bondsNew[j] = this.bonds[j];

for (; j < newLength; ++j) bondsNew[j] = this.bonds[j + 1];

this.bonds = bondsNew;
}, "~N");
Clazz_overrideMethod (c$, "getBondedAtomIndex", 
function (bondIndex) {
return this.bonds[bondIndex].getOtherAtom (this).i;
}, "~N");
Clazz_defineMethod (c$, "setMadAtom", 
function (vwr, rd) {
this.madAtom = this.calculateMad (vwr, rd);
}, "JV.Viewer,J.atomdata.RadiusData");
Clazz_defineMethod (c$, "calculateMad", 
function (vwr, rd) {
if (rd == null) return 0;
var f = rd.value;
if (f == 0) return 0;
switch (rd.factorType) {
case J.atomdata.RadiusData.EnumType.SCREEN:
return Clazz_floatToShort (f);
case J.atomdata.RadiusData.EnumType.FACTOR:
case J.atomdata.RadiusData.EnumType.OFFSET:
var r = 0;
switch (rd.vdwType) {
case J.c.VDW.TEMP:
var tmax = vwr.ms.getBfactor100Hi ();
r = (tmax > 0 ? this.getBfactor100 () / tmax : 0);
break;
case J.c.VDW.HYDRO:
r = Math.abs (this.getHydrophobicity ());
break;
case J.c.VDW.BONDING:
r = this.getBondingRadius ();
break;
case J.c.VDW.ADPMIN:
case J.c.VDW.ADPMAX:
r = this.getADPMinMax (rd.vdwType === J.c.VDW.ADPMAX);
break;
default:
r = this.getVanderwaalsRadiusFloat (vwr, rd.vdwType);
}
if (rd.factorType === J.atomdata.RadiusData.EnumType.FACTOR) f *= r;
 else f += r;
break;
case J.atomdata.RadiusData.EnumType.ABSOLUTE:
if (f == 16.1) return JM.Atom.MAD_GLOBAL;
break;
}
var mad = Clazz_floatToShort (f < 0 ? f : f * 2000);
if (mad < 0 && f > 0) mad = 0;
return mad;
}, "JV.Viewer,J.atomdata.RadiusData");
Clazz_defineMethod (c$, "getADPMinMax", 
function (isMax) {
var tensors = this.getTensors ();
if (tensors == null) return 0;
var t = tensors[0];
if (t == null || t.iType != 1) return 0;
if (this.group.chain.model.ms.isModulated (this.i) && t.isUnmodulated) t = tensors[1];
return t.getFactoredValue (isMax ? 2 : 1);
}, "~B");
Clazz_defineMethod (c$, "getTensors", 
function () {
return this.group.chain.model.ms.getAtomTensorList (this.i);
});
Clazz_defineMethod (c$, "getRasMolRadius", 
function () {
return Math.abs (Clazz_doubleToInt (this.madAtom / 8));
});
Clazz_overrideMethod (c$, "getCovalentBondCount", 
function () {
if (this.bonds == null) return 0;
var n = 0;
var b;
for (var i = this.bonds.length; --i >= 0; ) if (((b = this.bonds[i]).order & 1023) != 0 && !b.getOtherAtom (this).isDeleted ()) ++n;

return n;
});
Clazz_overrideMethod (c$, "getCovalentHydrogenCount", 
function () {
if (this.bonds == null) return 0;
var n = 0;
for (var i = this.bonds.length; --i >= 0; ) {
if ((this.bonds[i].order & 1023) == 0) continue;
var a = this.bonds[i].getOtherAtom (this);
if (a.valence >= 0 && a.getElementNumber () == 1) ++n;
}
return n;
});
Clazz_overrideMethod (c$, "getEdges", 
function () {
return (this.bonds == null ?  new Array (0) : this.bonds);
});
Clazz_defineMethod (c$, "setTranslucent", 
function (isTranslucent, translucentLevel) {
this.colixAtom = JU.C.getColixTranslucent3 (this.colixAtom, isTranslucent, translucentLevel);
}, "~B,~N");
Clazz_defineMethod (c$, "isTranslucent", 
function () {
return JU.C.isColixTranslucent (this.colixAtom);
});
Clazz_overrideMethod (c$, "getElementNumber", 
function () {
return JU.Elements.getElementNumber (this.atomicAndIsotopeNumber);
});
Clazz_overrideMethod (c$, "getIsotopeNumber", 
function () {
return JU.Elements.getIsotopeNumber (this.atomicAndIsotopeNumber);
});
Clazz_overrideMethod (c$, "getAtomicAndIsotopeNumber", 
function () {
return this.atomicAndIsotopeNumber;
});
Clazz_defineMethod (c$, "setAtomicAndIsotopeNumber", 
function (n) {
if (n < 0 || (n & 127) >= JU.Elements.elementNumberMax || n > 32767) n = 0;
this.atomicAndIsotopeNumber = n;
}, "~N");
Clazz_defineMethod (c$, "getElementSymbolIso", 
function (withIsotope) {
return JU.Elements.elementSymbolFromNumber (withIsotope ? this.atomicAndIsotopeNumber : this.atomicAndIsotopeNumber & 127);
}, "~B");
Clazz_defineMethod (c$, "getElementSymbol", 
function () {
return this.getElementSymbolIso (true);
});
Clazz_defineMethod (c$, "isAltLoc", 
function (strPattern) {
if (strPattern == null) return (this.altloc == '\0');
if (strPattern.length != 1) return false;
var ch = strPattern.charAt (0);
return (ch == '*' || ch == '?' && this.altloc != '\0' || this.altloc == ch);
}, "~S");
Clazz_defineMethod (c$, "isHetero", 
function () {
return (this.formalChargeAndFlags & 2) != 0;
});
Clazz_defineMethod (c$, "hasVibration", 
function () {
return (this.formalChargeAndFlags & 1) != 0;
});
Clazz_defineMethod (c$, "setFormalCharge", 
function (charge) {
this.formalChargeAndFlags = ((this.formalChargeAndFlags & 3) | ((charge == -2147483648 ? 0 : charge > 7 ? 7 : charge < -3 ? -3 : charge) << 2));
}, "~N");
Clazz_defineMethod (c$, "setVibrationVector", 
function () {
this.formalChargeAndFlags |= 1;
});
Clazz_overrideMethod (c$, "getFormalCharge", 
function () {
return this.formalChargeAndFlags >> 2;
});
Clazz_defineMethod (c$, "getOccupancy100", 
function () {
var occupancies = this.group.chain.model.ms.occupancies;
return occupancies == null ? 100 : Math.round (occupancies[this.i]);
});
Clazz_defineMethod (c$, "getBfactor100", 
function () {
var bfactor100s = this.group.chain.model.ms.bfactor100s;
if (bfactor100s == null) return 0;
return bfactor100s[this.i];
});
Clazz_defineMethod (c$, "getHydrophobicity", 
 function () {
var values = this.group.chain.model.ms.hydrophobicities;
if (values == null) return JU.Elements.getHydrophobicity (this.group.groupID);
return values[this.i];
});
Clazz_defineMethod (c$, "setRadius", 
function (radius) {
return !Float.isNaN (this.userDefinedVanDerWaalRadius = (radius > 0 ? radius : NaN));
}, "~N");
Clazz_defineMethod (c$, "deleteBonds", 
function (bsBonds) {
this.valence = -1;
if (this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) {
var bond = this.bonds[i];
bond.getOtherAtom (this).deleteBond (bond);
bsBonds.set (bond.index);
}
this.bonds = null;
}, "JU.BS");
Clazz_overrideMethod (c$, "isDeleted", 
function () {
return (this.valence < 0);
});
Clazz_defineMethod (c$, "setValence", 
function (nBonds) {
if (this.isDeleted ()) return;
this.valence = (nBonds < 0 ? 0 : nBonds < 0xEF ? nBonds : 0xEF);
}, "~N");
Clazz_overrideMethod (c$, "getValence", 
function () {
if (this.isDeleted ()) return -1;
var n = this.valence;
if (n == 0 && this.bonds != null) for (var i = this.bonds.length; --i >= 0; ) n += this.bonds[i].getValence ();

return n;
});
Clazz_overrideMethod (c$, "getImplicitHydrogenCount", 
function () {
return this.group.chain.model.ms.getImplicitHydrogenCount (this, false);
});
Clazz_defineMethod (c$, "getTargetValence", 
function () {
switch (this.getElementNumber ()) {
case 6:
case 14:
return 4;
case 5:
case 7:
case 15:
return 3;
case 8:
case 16:
return 2;
case 1:
case 9:
case 17:
case 35:
case 53:
return 1;
}
return -1;
});
Clazz_defineMethod (c$, "getDimensionValue", 
function (dimension) {
return (dimension == 0 ? this.x : (dimension == 1 ? this.y : this.z));
}, "~N");
Clazz_defineMethod (c$, "getVanderwaalsRadiusFloat", 
function (vwr, type) {
return (Float.isNaN (this.userDefinedVanDerWaalRadius) ? vwr.getVanderwaalsMarType (this.atomicAndIsotopeNumber, this.getVdwType (type)) / 1000 : this.userDefinedVanDerWaalRadius);
}, "JV.Viewer,J.c.VDW");
Clazz_defineMethod (c$, "getVdwType", 
 function (type) {
switch (type) {
case J.c.VDW.AUTO:
type = this.group.chain.model.ms.getDefaultVdwType (this.mi);
break;
case J.c.VDW.NOJMOL:
type = this.group.chain.model.ms.getDefaultVdwType (this.mi);
if (type === J.c.VDW.AUTO_JMOL) type = J.c.VDW.AUTO_BABEL;
break;
}
return type;
}, "J.c.VDW");
Clazz_defineMethod (c$, "getBondingRadius", 
function () {
var rr = this.group.chain.model.ms.bondingRadii;
var r = (rr == null ? 0 : rr[this.i]);
return (r == 0 ? JU.Elements.getBondingRadius (this.atomicAndIsotopeNumber, this.getFormalCharge ()) : r);
});
Clazz_defineMethod (c$, "getVolume", 
function (vwr, vType) {
var r1 = (vType == null ? this.userDefinedVanDerWaalRadius : NaN);
if (Float.isNaN (r1)) r1 = vwr.getVanderwaalsMarType (this.getElementNumber (), this.getVdwType (vType)) / 1000;
var volume = 0;
if (this.bonds != null) for (var j = 0; j < this.bonds.length; j++) {
if (!this.bonds[j].isCovalent ()) continue;
var atom2 = this.bonds[j].getOtherAtom (this);
var r2 = (vType == null ? atom2.userDefinedVanDerWaalRadius : NaN);
if (Float.isNaN (r2)) r2 = vwr.getVanderwaalsMarType (atom2.getElementNumber (), atom2.getVdwType (vType)) / 1000;
var d = this.distance (atom2);
if (d > r1 + r2) continue;
if (d + r1 <= r2) return 0;
var h = r1 - (r1 * r1 + d * d - r2 * r2) / (2.0 * d);
volume -= 1.0471975511965976 * h * h * (3 * r1 - h);
}
return (volume + 4.1887902047863905 * r1 * r1 * r1);
}, "JV.Viewer,J.c.VDW");
Clazz_defineMethod (c$, "getCurrentBondCount", 
function () {
return this.bonds == null ? 0 : this.bonds.length;
});
Clazz_defineMethod (c$, "getRadius", 
function () {
return Math.abs (this.madAtom / 2000);
});
Clazz_overrideMethod (c$, "getIndex", 
function () {
return this.i;
});
Clazz_overrideMethod (c$, "getAtomSite", 
function () {
return this.atomSite;
});
Clazz_defineMethod (c$, "setGroup", 
function (group) {
this.group = group;
}, "JM.Group");
Clazz_overrideMethod (c$, "getGroupBits", 
function (bs) {
this.group.selectAtoms (bs);
}, "JU.BS");
Clazz_overrideMethod (c$, "getAtomName", 
function () {
return (this.atomID > 0 ? JM.Group.specialAtomNames[this.atomID] : this.group.chain.model.ms.atomNames[this.i]);
});
Clazz_overrideMethod (c$, "getAtomType", 
function () {
var atomTypes = this.group.chain.model.ms.atomTypes;
var type = (atomTypes == null ? null : atomTypes[this.i]);
return (type == null ? this.getAtomName () : type);
});
Clazz_defineMethod (c$, "getAtomNumber", 
function () {
var atomSerials = this.group.chain.model.ms.atomSerials;
return (atomSerials == null ? this.i : atomSerials[this.i]);
});
Clazz_defineMethod (c$, "getSeqID", 
function () {
var ids = this.group.chain.model.ms.atomSeqIDs;
return (ids == null ? 0 : ids[this.i]);
});
Clazz_defineMethod (c$, "isVisible", 
function (flags) {
return ((this.shapeVisibilityFlags & flags) == flags);
}, "~N");
Clazz_defineMethod (c$, "getPartialCharge", 
function () {
var partialCharges = this.group.chain.model.ms.partialCharges;
return partialCharges == null ? 0 : partialCharges[this.i];
});
Clazz_defineMethod (c$, "getSymmetryTranslation", 
function (symop, cellRange, nOps) {
var pt = symop;
for (var i = 0; i < cellRange.length; i++) if (this.atomSymmetry.get (pt += nOps)) return cellRange[i];

return 0;
}, "~N,~A,~N");
Clazz_defineMethod (c$, "getCellTranslation", 
function (cellNNN, cellRange, nOps) {
var pt = nOps;
for (var i = 0; i < cellRange.length; i++) for (var j = 0; j < nOps; j++, pt++) if (this.atomSymmetry.get (pt) && cellRange[i] == cellNNN) return cellRange[i];


return 0;
}, "~N,~A,~N");
Clazz_defineMethod (c$, "getSymmetryOperatorList", 
function (isAll) {
var str = "";
var f = this.group.chain.model.ms;
var nOps = f.getModelSymmetryCount (this.mi);
if (nOps == 0 || this.atomSymmetry == null) return "";
var cellRange = f.getModelCellRange (this.mi);
var pt = nOps;
var n = (cellRange == null ? 1 : cellRange.length);
var bs = (isAll ? null :  new JU.BS ());
for (var i = 0; i < n; i++) for (var j = 0; j < nOps; j++) if (this.atomSymmetry.get (pt++)) if (isAll) {
str += "," + (j + 1) + cellRange[i];
} else {
bs.set (j + 1);
}

if (!isAll) for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) str += "," + i;

return (str.length == 0 ? "" : str.substring (1));
}, "~B");
Clazz_overrideMethod (c$, "getModelIndex", 
function () {
return this.mi;
});
Clazz_defineMethod (c$, "getMoleculeNumber", 
function (inModel) {
return (this.group.chain.model.ms.getMoleculeIndex (this.i, inModel) + 1);
}, "~B");
Clazz_defineMethod (c$, "getFractionalCoord", 
 function (fixJavaFloat, ch, asAbsolute, pt) {
pt = this.getFractionalCoordPt (fixJavaFloat, asAbsolute, pt);
return (ch == 'X' ? pt.x : ch == 'Y' ? pt.y : pt.z);
}, "~B,~S,~B,JU.P3");
Clazz_defineMethod (c$, "getFractionalCoordPt", 
 function (fixJavaFloat, asAbsolute, pt) {
var c = this.getUnitCell ();
if (c == null) return this;
if (pt == null) pt = JU.P3.newP (this);
 else pt.setT (this);
c.toFractional (pt, asAbsolute);
if (fixJavaFloat) JU.PT.fixPtFloats (pt, 100000.0);
return pt;
}, "~B,~B,JU.P3");
Clazz_defineMethod (c$, "getUnitCell", 
function () {
return this.group.chain.model.ms.getUnitCellForAtom (this.i);
});
Clazz_defineMethod (c$, "getFractionalUnitCoord", 
 function (fixJavaFloat, ch, pt) {
pt = this.getFractionalUnitCoordPt (fixJavaFloat, false, pt);
return (ch == 'X' ? pt.x : ch == 'Y' ? pt.y : pt.z);
}, "~B,~S,JU.P3");
Clazz_defineMethod (c$, "getFractionalUnitCoordPt", 
function (fixJavaFloat, asCartesian, pt) {
var c = this.getUnitCell ();
if (c == null) return this;
if (pt == null) pt = JU.P3.newP (this);
 else pt.setT (this);
if (this.group.chain.model.isJmolDataFrame) {
c.toFractional (pt, false);
if (asCartesian) c.toCartesian (pt, false);
} else {
c.toUnitCell (pt, null);
if (!asCartesian) c.toFractional (pt, false);
}if (fixJavaFloat) JU.PT.fixPtFloats (pt, asCartesian ? 10000.0 : 100000.0);
return pt;
}, "~B,~B,JU.P3");
Clazz_defineMethod (c$, "getFractionalUnitDistance", 
function (pt, ptTemp1, ptTemp2) {
var c = this.getUnitCell ();
if (c == null) return this.distance (pt);
ptTemp1.setT (this);
ptTemp2.setT (pt);
if (this.group.chain.model.isJmolDataFrame) {
c.toFractional (ptTemp1, true);
c.toFractional (ptTemp2, true);
} else {
c.toUnitCell (ptTemp1, null);
c.toUnitCell (ptTemp2, null);
}return ptTemp1.distance (ptTemp2);
}, "JU.P3,JU.P3,JU.P3");
Clazz_defineMethod (c$, "setFractionalCoord", 
function (tok, fValue, asAbsolute) {
var c = this.getUnitCell ();
if (c != null) c.toFractional (this, asAbsolute);
switch (tok) {
case 1112541191:
case 1112541188:
this.x = fValue;
break;
case 1112541192:
case 1112541189:
this.y = fValue;
break;
case 1112541193:
case 1112541190:
this.z = fValue;
break;
}
if (c != null) c.toCartesian (this, asAbsolute);
}, "~N,~N,~B");
Clazz_defineMethod (c$, "setFractionalCoordTo", 
function (ptNew, asAbsolute) {
this.setFractionalCoordPt (this, ptNew, asAbsolute);
}, "JU.P3,~B");
Clazz_defineMethod (c$, "setFractionalCoordPt", 
function (pt, ptNew, asAbsolute) {
pt.setT (ptNew);
var c = this.getUnitCell ();
if (c != null) c.toCartesian (pt, asAbsolute && !this.group.chain.model.isJmolDataFrame);
}, "JU.P3,JU.P3,~B");
Clazz_defineMethod (c$, "isCursorOnTopOf", 
function (xCursor, yCursor, minRadius, competitor) {
var r = Clazz_doubleToInt (this.sD / 2);
if (r < minRadius) r = minRadius;
var r2 = r * r;
var dx = this.sX - xCursor;
var dx2 = dx * dx;
if (dx2 > r2) return false;
var dy = this.sY - yCursor;
var dy2 = dy * dy;
var dz2 = r2 - (dx2 + dy2);
if (dz2 < 0) return false;
if (competitor == null) return true;
var z = this.sZ;
var zCompetitor = competitor.sZ;
var rCompetitor = Clazz_doubleToInt (competitor.sD / 2);
if (z < zCompetitor - rCompetitor) return true;
var dxCompetitor = competitor.sX - xCursor;
var dx2Competitor = dxCompetitor * dxCompetitor;
var dyCompetitor = competitor.sY - yCursor;
var dy2Competitor = dyCompetitor * dyCompetitor;
var r2Competitor = rCompetitor * rCompetitor;
var dz2Competitor = r2Competitor - (dx2Competitor + dy2Competitor);
return (z - Math.sqrt (dz2) < zCompetitor - Math.sqrt (dz2Competitor));
}, "~N,~N,~N,JM.Atom");
Clazz_defineMethod (c$, "getInfo", 
function () {
return this.getIdentity (true);
});
Clazz_defineMethod (c$, "getInfoXYZ", 
function (fixJavaFloat, useChimeFormat, pt) {
if (useChimeFormat) {
var group3 = this.getGroup3 (true);
var chainID = this.getChainID ();
pt = this.getFractionalCoordPt (fixJavaFloat, true, pt);
return "Atom: " + (group3 == null ? this.getElementSymbol () : this.getAtomName ()) + " " + this.getAtomNumber () + (group3 != null && group3.length > 0 ? (this.isHetero () ? " Hetero: " : " Group: ") + group3 + " " + this.getResno () + (chainID != 0 && chainID != 32 ? " Chain: " + this.group.chain.getIDStr () : "") : "") + " Model: " + this.getModelNumber () + " Coordinates: " + this.x + " " + this.y + " " + this.z + (pt == null ? "" : " Fractional: " + pt.x + " " + pt.y + " " + pt.z);
}return this.getIdentityXYZ (true, pt);
}, "~B,~B,JU.P3");
Clazz_defineMethod (c$, "getIdentityXYZ", 
function (allInfo, pt) {
pt = (this.group.chain.model.isJmolDataFrame ? this.getFractionalCoordPt (!this.group.chain.model.ms.vwr.g.legacyJavaFloat, false, pt) : this);
return this.getIdentity (allInfo) + " " + pt.x + " " + pt.y + " " + pt.z;
}, "~B,JU.P3");
Clazz_defineMethod (c$, "getIdentity", 
function (allInfo) {
var info =  new JU.SB ();
var group3 = this.getGroup3 (true);
if (group3 != null && group3.length > 0 && !group3.equals ("UNK")) {
info.append ("[");
info.append (group3);
info.append ("]");
var seqcodeString = this.getSeqcodeString ();
if (seqcodeString != null) info.append (seqcodeString);
var chainID = this.getChainID ();
if (chainID != 0 && chainID != 32) {
info.append (":");
var s = this.getChainIDStr ();
if (chainID >= 256) s = JU.PT.esc (s);
info.append (s);
}if (!allInfo) return info.toString ();
info.append (".");
}info.append (this.getAtomName ());
if (info.length () == 0) {
info.append (this.getElementSymbolIso (false));
info.append (" ");
info.appendI (this.getAtomNumber ());
}if (this.altloc.charCodeAt (0) != 0) {
info.append ("%");
info.appendC (this.altloc);
}if (this.group.chain.model.ms.mc > 1 && !this.group.chain.model.isJmolDataFrame) {
info.append ("/");
info.append (this.getModelNumberForLabel ());
}info.append (" #");
info.appendI (this.getAtomNumber ());
return info.toString ();
}, "~B");
Clazz_overrideMethod (c$, "getGroup3", 
function (allowNull) {
var group3 = this.group.getGroup3 ();
return (allowNull || group3 != null && group3.length > 0 ? group3 : "UNK");
}, "~B");
Clazz_overrideMethod (c$, "getGroup1", 
function (c0) {
var c = this.group.getGroup1 ();
return (c != '\0' ? "" + c : c0 != '\0' ? "" + c0 : "");
}, "~S");
Clazz_overrideMethod (c$, "isProtein", 
function () {
return this.group.isProtein ();
});
Clazz_defineMethod (c$, "isCarbohydrate", 
function () {
return this.group.isCarbohydrate ();
});
Clazz_overrideMethod (c$, "isNucleic", 
function () {
return this.group.isNucleic ();
});
Clazz_overrideMethod (c$, "isDna", 
function () {
return this.group.isDna ();
});
Clazz_overrideMethod (c$, "isRna", 
function () {
return this.group.isRna ();
});
Clazz_overrideMethod (c$, "isPurine", 
function () {
return this.group.isPurine ();
});
Clazz_overrideMethod (c$, "isPyrimidine", 
function () {
return this.group.isPyrimidine ();
});
Clazz_defineMethod (c$, "getSeqcode", 
function () {
return this.group.seqcode;
});
Clazz_overrideMethod (c$, "getResno", 
function () {
return this.group.getResno ();
});
Clazz_defineMethod (c$, "isClickable", 
function () {
return (this.checkVisible () && this.clickabilityFlags != 0 && ((this.shapeVisibilityFlags | this.group.shapeVisibilityFlags) & this.clickabilityFlags) != 0);
});
Clazz_defineMethod (c$, "setClickable", 
function (flag) {
if (flag == 0) {
this.clickabilityFlags = 0;
} else {
this.clickabilityFlags |= flag;
if (flag != 1040384) this.shapeVisibilityFlags |= flag;
}}, "~N");
Clazz_defineMethod (c$, "checkVisible", 
function () {
if (this.isVisible (2)) return this.isVisible (4);
var isVis = this.isVisible (9);
if (isVis) {
var flags = this.shapeVisibilityFlags;
if (this.group.shapeVisibilityFlags != 0 && (this.group.shapeVisibilityFlags != 8192 || this.isLeadAtom ())) flags |= this.group.shapeVisibilityFlags;
flags &= -10;
if (flags == 32 && this.clickabilityFlags == 0) flags = 0;
isVis = (flags != 0);
if (isVis) this.shapeVisibilityFlags |= 4;
}this.shapeVisibilityFlags |= 2;
return isVis;
});
Clazz_overrideMethod (c$, "isLeadAtom", 
function () {
return this.group.isLeadAtom (this.i);
});
Clazz_defineMethod (c$, "getGroupParameter", 
function (tok) {
return this.group.getGroupParameter (tok);
}, "~N");
Clazz_overrideMethod (c$, "getChainID", 
function () {
return this.group.chain.chainID;
});
Clazz_overrideMethod (c$, "getChainIDStr", 
function () {
return this.group.chain.getIDStr ();
});
Clazz_defineMethod (c$, "getSurfaceDistance100", 
function () {
return this.group.chain.model.ms.getSurfaceDistance100 (this.i);
});
Clazz_defineMethod (c$, "getVibrationVector", 
function () {
return this.group.chain.model.ms.getVibration (this.i, false);
});
Clazz_defineMethod (c$, "getModulation", 
function () {
return this.group.chain.model.ms.getModulation (this.i);
});
Clazz_defineMethod (c$, "getVibrationCoord", 
function (ch) {
return this.group.chain.model.ms.getVibrationCoord (this.i, ch);
}, "~S");
Clazz_defineMethod (c$, "getModulationCoord", 
function (ch) {
return this.group.chain.model.ms.getModulationCoord (this.i, ch);
}, "~S");
Clazz_defineMethod (c$, "getPolymerLength", 
function () {
return this.group.getBioPolymerLength ();
});
Clazz_defineMethod (c$, "getPolymerIndexInModel", 
function () {
return this.group.getBioPolymerIndexInModel ();
});
Clazz_defineMethod (c$, "getMonomerIndex", 
function () {
return this.group.getMonomerIndex ();
});
Clazz_defineMethod (c$, "getSelectedGroupCountWithinChain", 
function () {
return this.group.chain.selectedGroupCount;
});
Clazz_defineMethod (c$, "getSelectedGroupIndexWithinChain", 
function () {
return this.group.getSelectedGroupIndex ();
});
Clazz_defineMethod (c$, "getSelectedMonomerCountWithinPolymer", 
function () {
return this.group.getSelectedMonomerCount ();
});
Clazz_defineMethod (c$, "getSelectedMonomerIndexWithinPolymer", 
function () {
return this.group.getSelectedMonomerIndex ();
});
Clazz_defineMethod (c$, "getChain", 
function () {
return this.group.chain;
});
Clazz_defineMethod (c$, "getModelNumberForLabel", 
function () {
return this.group.chain.model.ms.getModelNumberForAtomLabel (this.mi);
});
Clazz_defineMethod (c$, "getModelNumber", 
function () {
return this.group.chain.model.ms.getModelNumber (this.mi) % 1000000;
});
Clazz_overrideMethod (c$, "getBioStructureTypeName", 
function () {
return this.getProteinStructureType ().getBioStructureTypeName (true);
});
Clazz_defineMethod (c$, "getProteinStructureType", 
function () {
return this.group.getProteinStructureType ();
});
Clazz_defineMethod (c$, "getProteinStructureSubType", 
function () {
return this.group.getProteinStructureSubType ();
});
Clazz_defineMethod (c$, "getStrucNo", 
function () {
return this.group.getStrucNo ();
});
Clazz_defineMethod (c$, "getStructureId", 
function () {
return this.group.getStructureId ();
});
Clazz_defineMethod (c$, "getProteinStructureTag", 
function () {
return this.group.getProteinStructureTag ();
});
Clazz_defineMethod (c$, "getGroupID", 
function () {
return this.group.groupID;
});
Clazz_defineMethod (c$, "getSeqcodeString", 
function () {
return this.group.getSeqcodeString ();
});
Clazz_defineMethod (c$, "getInsertionCode", 
function () {
return this.group.getInsertionCode ();
});
Clazz_overrideMethod (c$, "equals", 
function (obj) {
return (this === obj);
}, "~O");
Clazz_overrideMethod (c$, "hashCode", 
function () {
return this.i;
});
Clazz_defineMethod (c$, "findAromaticNeighbor", 
function (notAtomIndex) {
if (this.bonds == null) return null;
for (var i = this.bonds.length; --i >= 0; ) {
var bondT = this.bonds[i];
var a = bondT.getOtherAtom (this);
if (bondT.isAromatic () && a.i != notAtomIndex) return a;
}
return null;
}, "~N");
Clazz_defineMethod (c$, "atomPropertyInt", 
function (tokWhat) {
switch (tokWhat) {
case 1095763969:
return this.getAtomNumber ();
case 1095761940:
return this.getSeqID ();
case 1095761922:
return this.atomID;
case 1095761943:
return Math.max (0, this.altloc.charCodeAt (0) - 32);
case 1095761923:
return this.i;
case 1095761924:
return this.getCovalentBondCount ();
case 1095761927:
return this.group.chain.index + 1;
case 1766856708:
return this.group.chain.model.ms.vwr.gdata.getColorArgbOrGray (this.colixAtom);
case 1087375365:
case 1095763978:
return this.getElementNumber ();
case 1095761929:
return this.atomicAndIsotopeNumber;
case 1229984263:
return this.group.chain.model.fileIndex + 1;
case 1632634891:
return this.getFormalCharge ();
case 1095761932:
return this.getGroupID ();
case 1095761933:
return this.group.groupIndex;
case 1095766030:
return this.getModelNumber ();
case -1095766030:
return this.group.chain.model.ms.modelFileNumbers[this.mi];
case 1095761935:
return this.mi;
case 1095761936:
return this.getMoleculeNumber (true);
case 1129318401:
return this.getOccupancy100 ();
case 1095761937:
return this.group.getBioPolymerIndexInModel () + 1;
case 1095761938:
return this.getPolymerLength ();
case 1666189314:
return this.getRasMolRadius ();
case 1095761939:
return this.getResno ();
case 1095761941:
return this.getAtomSite ();
case 1641025539:
return this.getProteinStructureType ().getId ();
case 1238369286:
return this.getProteinStructureSubType ().getId ();
case 1095761942:
return this.getStrucNo ();
case 1297090050:
return this.getSymOp ();
case 1095763991:
return this.getValence ();
}
return 0;
}, "~N");
Clazz_defineMethod (c$, "getSymOp", 
function () {
return (this.atomSymmetry == null ? 0 : this.atomSymmetry.nextSetBit (0) + 1);
});
Clazz_defineMethod (c$, "atomPropertyFloat", 
function (vwr, tokWhat, ptTemp) {
switch (tokWhat) {
case 1112539137:
return this.getADPMinMax (true);
case 1112539138:
return this.getADPMinMax (false);
case 1112541185:
case 1112541205:
return this.x;
case 1112541186:
case 1112541206:
return this.y;
case 1112541187:
case 1112541207:
return this.z;
case 1115297793:
case 1113200642:
case 1113198595:
case 1113198596:
case 1113198597:
case 1113200646:
case 1113200647:
case 1113200649:
case 1113200650:
case 1113200652:
case 1650071565:
case 1113200654:
return vwr.shm.getAtomShapeValue (tokWhat, this.group, this.i);
case 1112541194:
return this.getBondingRadius ();
case 1112539139:
return vwr.getNMRCalculation ().getChemicalShift (this);
case 1112539140:
return JU.Elements.getCovalentRadius (this.atomicAndIsotopeNumber);
case 1112539141:
case 1112539152:
case 1112539150:
return this.getGroupParameter (tokWhat);
case 1112541188:
return this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'X', true, ptTemp);
case 1112541189:
return this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'Y', true, ptTemp);
case 1112541190:
return this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'Z', true, ptTemp);
case 1112541191:
return this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'X', false, ptTemp);
case 1112541192:
return this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'Y', false, ptTemp);
case 1112541193:
return this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'Z', false, ptTemp);
case 1114638362:
return this.getHydrophobicity ();
case 1112539142:
return vwr.getNMRCalculation ().getMagneticShielding (this);
case 1112539143:
return this.getMass ();
case 1129318401:
return this.getOccupancy100 () / 100;
case 1112541195:
return this.getPartialCharge ();
case 1112539145:
case 1112539146:
case 1112539144:
if (this.group.chain.model.isJmolDataFrame && this.group.chain.model.jmolFrameType.startsWith ("plot ramachandran")) {
switch (tokWhat) {
case 1112539145:
return this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'X', false, ptTemp);
case 1112539146:
return this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'Y', false, ptTemp);
case 1112539144:
if (this.group.chain.model.isJmolDataFrame && this.group.chain.model.jmolFrameType.equals ("plot ramachandran")) {
var omega = this.getFractionalCoord (!vwr.g.legacyJavaFloat, 'Z', false, ptTemp) - 180;
return (omega < -180 ? 360 + omega : omega);
}}
}return this.getGroupParameter (tokWhat);
case 1666189314:
case 1113200651:
return this.getRadius ();
case 1112539147:
return this.sX;
case 1112539148:
return this.group.chain.model.ms.vwr.getScreenHeight () - this.sY;
case 1112539149:
return this.sZ;
case 1114638363:
return (vwr.slm.isAtomSelected (this.i) ? 1 : 0);
case 1112539151:
this.group.chain.model.ms.getSurfaceDistanceMax ();
return this.getSurfaceDistance100 () / 100;
case 1112541196:
return this.getBfactor100 () / 100;
case 1112539153:
return this.getFractionalUnitCoord (!vwr.g.legacyJavaFloat, 'X', ptTemp);
case 1112539154:
return this.getFractionalUnitCoord (!vwr.g.legacyJavaFloat, 'Y', ptTemp);
case 1112539155:
return this.getFractionalUnitCoord (!vwr.g.legacyJavaFloat, 'Z', ptTemp);
case 1649412120:
return this.getVanderwaalsRadiusFloat (vwr, J.c.VDW.AUTO);
case 1649410049:
var v = this.getVibrationVector ();
return (v == null ? 0 : v.length () * vwr.getFloat (1649410049));
case 1112541202:
return this.getVibrationCoord ('X');
case 1112541203:
return this.getVibrationCoord ('Y');
case 1112541204:
return this.getVibrationCoord ('Z');
case 1112539159:
return this.getModulationCoord ('X');
case 1112539156:
return this.getModulationCoord ('1');
case 1112539157:
return this.getModulationCoord ('2');
case 1112539158:
return this.getModulationCoord ('3');
case 1112539160:
return this.getModulationCoord ('Y');
case 1112539161:
return this.getModulationCoord ('Z');
case 1112539162:
return this.getModulationCoord ('O');
case 1313866249:
return this.getVolume (vwr, J.c.VDW.AUTO);
case 1146095627:
case 1146095629:
case 1146093582:
case 1146095628:
case 1146095631:
case 1146093584:
case 1146095626:
var v3 = this.atomPropertyTuple (vwr, tokWhat, ptTemp);
return (v3 == null ? -1 : v3.length ());
}
return this.atomPropertyInt (tokWhat);
}, "JV.Viewer,~N,JU.P3");
Clazz_defineMethod (c$, "getMass", 
 function () {
var mass = this.getIsotopeNumber ();
return (mass > 0 ? mass : JU.Elements.getAtomicMass (this.getElementNumber ()));
});
Clazz_defineMethod (c$, "atomPropertyString", 
function (vwr, tokWhat) {
var ch;
switch (tokWhat) {
case 1087373315:
ch = this.altloc;
return (ch == '\0' ? "" : "" + ch);
case 1087375362:
return this.getAtomName ();
case 1087375361:
return this.getAtomType ();
case 1087373316:
return this.getChainIDStr ();
case 1087373320:
return this.getGroup1 ('?');
case 1087373319:
return this.getGroup1 ('\0');
case 1087373318:
return this.getGroup3 (false);
case 1087375365:
return this.getElementSymbolIso (true);
case 1087373321:
return this.getIdentity (true);
case 1087373322:
ch = this.getInsertionCode ();
return (ch == '\0' ? "" : "" + ch);
case 1826248716:
case 1288701959:
var s = vwr.shm.getShapePropertyIndex (5, "label", this.i);
if (s == null) s = "";
return s;
case 1641025539:
return this.getProteinStructureType ().getBioStructureTypeName (false);
case 1238369286:
return this.getProteinStructureSubType ().getBioStructureTypeName (false);
case 1087373324:
return this.getStructureId ();
case 1087373323:
return vwr.getHybridizationAndAxes (this.i, null, null, "d");
case 1087375373:
return this.getElementSymbolIso (false);
case 1089470478:
return this.getSymmetryOperatorList (true);
}
return "";
}, "JV.Viewer,~N");
Clazz_defineMethod (c$, "atomPropertyTuple", 
function (vwr, tok, ptTemp) {
switch (tok) {
case 1146095627:
return this.getFractionalCoordPt (!vwr.g.legacyJavaFloat, !this.group.chain.model.isJmolDataFrame, ptTemp);
case 1146095629:
return this.getFractionalCoordPt (!vwr.g.legacyJavaFloat, false, ptTemp);
case 1146093582:
return (this.group.chain.model.isJmolDataFrame ? this.getFractionalCoordPt (!vwr.g.legacyJavaFloat, false, ptTemp) : this.getFractionalUnitCoordPt (!vwr.g.legacyJavaFloat, false, ptTemp));
case 1146095628:
return JU.P3.new3 (this.sX, this.group.chain.model.ms.vwr.getScreenHeight () - this.sY, this.sZ);
case 1146095631:
return this.getVibrationVector ();
case 1146093584:
var ms = this.getModulation ();
return (ms == null ? null : ms.getV3 ());
case 1146095626:
return this;
case 1766856708:
return JU.CU.colorPtFromInt (this.group.chain.model.ms.vwr.gdata.getColorArgbOrGray (this.colixAtom), ptTemp);
}
return null;
}, "JV.Viewer,~N,JU.P3");
Clazz_defineMethod (c$, "isWithinStructure", 
function (type) {
return this.group.isWithinStructure (type);
}, "J.c.STR");
Clazz_overrideMethod (c$, "getOffsetResidueAtom", 
function (name, offset) {
return this.group.getAtomIndex (name, offset);
}, "~S,~N");
Clazz_overrideMethod (c$, "isCrossLinked", 
function (node) {
return this.group.isCrossLinked ((node).group);
}, "JU.BNode");
Clazz_overrideMethod (c$, "getCrossLinkLeadAtomIndexes", 
function (vReturn) {
return this.group.getCrossLinkLead (vReturn);
}, "JU.Lst");
Clazz_overrideMethod (c$, "toString", 
function () {
return this.getInfo ();
});
Clazz_overrideMethod (c$, "findAtomsLike", 
function (atomExpression) {
return this.group.chain.model.ms.vwr.getAtomBitSet (atomExpression);
}, "~S");
Clazz_defineStatics (c$,
"VIBRATION_VECTOR_FLAG", 1,
"IS_HETERO_FLAG", 2,
"FLAG_MASK", 3,
"RADIUS_MAX", 16,
"RADIUS_GLOBAL", 16.1,
"MAD_GLOBAL", 32200);
});
Clazz_declarePackage ("JM");
Clazz_load (["JU.V3"], "JM.AtomCollection", ["java.lang.Character", "$.Float", "java.util.Arrays", "$.Hashtable", "JU.A4", "$.AU", "$.BS", "$.Lst", "$.M3", "$.Measure", "$.P3", "$.PT", "J.api.Interface", "$.JmolModulationSet", "J.atomdata.RadiusData", "J.c.PAL", "$.STR", "$.VDW", "JM.Group", "JS.T", "JU.BSUtil", "$.Elements", "$.Escape", "$.Logger", "$.Parser", "$.Vibration"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.g3d = null;
this.at = null;
this.ac = 0;
this.atomNames = null;
this.atomTypes = null;
this.atomSerials = null;
this.atomSeqIDs = null;
this.vibrations = null;
this.occupancies = null;
this.bfactor100s = null;
this.partialCharges = null;
this.bondingRadii = null;
this.hydrophobicities = null;
this.atomTensorList = null;
this.atomTensors = null;
this.surfaceDistance100s = null;
this.labeler = null;
this.maxBondingRadius = 1.4E-45;
this.maxVanderwaalsRadius = 1.4E-45;
this.hasBfactorRange = false;
this.bfactor100Lo = 0;
this.bfactor100Hi = 0;
this.bsSurface = null;
this.nSurfaceAtoms = 0;
this.surfaceDistanceMax = 0;
this.averageAtomPoint = null;
this.bspf = null;
this.preserveState = true;
this.canSkipLoad = true;
this.haveStraightness = false;
this.tainted = null;
this.bsHidden = null;
this.bsVisible = null;
this.bsClickable = null;
this.bsModulated = null;
this.haveBSVisible = false;
this.haveBSClickable = false;
this.aaRet = null;
if (!Clazz_isClassDefined ("JM.AtomCollection.AtomSorter")) {
JM.AtomCollection.$AtomCollection$AtomSorter$ ();
}
Clazz_instantialize (this, arguments);
}, JM, "AtomCollection");
Clazz_defineMethod (c$, "setupAC", 
function () {
this.bsHidden =  new JU.BS ();
this.bsVisible =  new JU.BS ();
this.bsClickable =  new JU.BS ();
if (JM.AtomCollection.userSettableValues == null) JM.AtomCollection.userSettableValues = "atomName atomType coord element formalCharge hydrophobicity ionic occupancy partialCharge temperature valence vanderWaals vibrationVector atomNo seqID".$plit (" ");
});
Clazz_defineMethod (c$, "releaseModelSet", 
function () {
this.releaseModelSetAC ();
});
Clazz_defineMethod (c$, "releaseModelSetAC", 
function () {
this.at = null;
this.vwr = null;
this.g3d = null;
this.bspf = null;
this.surfaceDistance100s = null;
this.bsSurface = null;
this.tainted = null;
this.atomNames = null;
this.atomTypes = null;
this.atomSerials = null;
this.atomSeqIDs = null;
this.vibrations = null;
this.occupancies = null;
this.bfactor100s = null;
this.partialCharges = null;
this.bondingRadii = null;
this.atomTensors = null;
});
Clazz_defineMethod (c$, "mergeAtomArrays", 
function (mergeModelSet) {
this.tainted = mergeModelSet.tainted;
this.atomNames = mergeModelSet.atomNames;
this.atomTypes = mergeModelSet.atomTypes;
this.atomSerials = mergeModelSet.atomSerials;
this.atomSeqIDs = mergeModelSet.atomSeqIDs;
this.vibrations = mergeModelSet.vibrations;
this.occupancies = mergeModelSet.occupancies;
this.bfactor100s = mergeModelSet.bfactor100s;
this.bondingRadii = mergeModelSet.bondingRadii;
this.partialCharges = mergeModelSet.partialCharges;
this.atomTensors = mergeModelSet.atomTensors;
this.atomTensorList = mergeModelSet.atomTensorList;
this.bsModulated = mergeModelSet.bsModulated;
this.haveStraightness = false;
this.surfaceDistance100s = null;
}, "JM.AtomCollection");
Clazz_defineMethod (c$, "getAtomPointVector", 
function (bs) {
var v =  new JU.Lst ();
if (bs != null) {
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
v.addLast (this.at[i]);
}
}return v;
}, "JU.BS");
Clazz_defineMethod (c$, "modelSetHasVibrationVectors", 
function () {
return (this.vibrations != null);
});
Clazz_defineMethod (c$, "getAtomTypes", 
function () {
return this.atomTypes;
});
Clazz_defineMethod (c$, "getPartialCharges", 
function () {
return this.partialCharges;
});
Clazz_defineMethod (c$, "getBondingRadii", 
function () {
return this.bondingRadii;
});
Clazz_defineMethod (c$, "getBFactors", 
function () {
return this.bfactor100s;
});
Clazz_defineMethod (c$, "getHydrophobicity", 
function () {
return this.hydrophobicities;
});
Clazz_defineMethod (c$, "setBsHidden", 
function (bs) {
this.bsHidden = bs;
}, "JU.BS");
Clazz_defineMethod (c$, "isAtomHidden", 
function (iAtom) {
return this.bsHidden.get (iAtom);
}, "~N");
Clazz_defineMethod (c$, "getLabeler", 
function () {
return (this.labeler == null ? this.labeler = J.api.Interface.getInterface ("JM.LabelToken", this.vwr, "ms") : this.labeler);
});
Clazz_defineMethod (c$, "getAtomInfo", 
function (i, format, ptTemp) {
return (format == null ? this.at[i].getInfo () : this.getLabeler ().formatLabel (this.vwr, this.at[i], format, ptTemp));
}, "~N,~S,JU.P3");
Clazz_defineMethod (c$, "getElementName", 
function (i) {
return JU.Elements.elementNameFromNumber (this.at[i].getAtomicAndIsotopeNumber ());
}, "~N");
Clazz_defineMethod (c$, "getQuaternion", 
function (i, qtype) {
return (i < 0 ? null : this.at[i].group.getQuaternion (qtype));
}, "~N,~S");
Clazz_defineMethod (c$, "getAtomIndexFromAtomNumber", 
function (atomNumber, bsVisibleFrames) {
for (var i = 0; i < this.ac; i++) {
var atom = this.at[i];
if (atom.getAtomNumber () == atomNumber && bsVisibleFrames.get (atom.mi)) return i;
}
return -1;
}, "~N,JU.BS");
Clazz_defineMethod (c$, "setFormalCharges", 
function (bs, formalCharge) {
if (bs != null) for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
this.at[i].setFormalCharge (formalCharge);
this.taintAtom (i, 4);
}
}, "JU.BS,~N");
Clazz_defineMethod (c$, "getAtomicCharges", 
function () {
var charges =  Clazz_newFloatArray (this.ac, 0);
for (var i = this.ac; --i >= 0; ) charges[i] = this.at[i].getElementNumber ();

return charges;
});
Clazz_defineMethod (c$, "getRadiusVdwJmol", 
function (atom) {
return JU.Elements.getVanderwaalsMar (atom.getElementNumber (), J.c.VDW.JMOL) / 1000;
}, "JM.Atom");
Clazz_defineMethod (c$, "getMaxVanderwaalsRadius", 
function () {
if (this.maxVanderwaalsRadius == 1.4E-45) this.findMaxRadii ();
return this.maxVanderwaalsRadius;
});
Clazz_defineMethod (c$, "findMaxRadii", 
function () {
var r;
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if ((r = atom.getBondingRadius ()) > this.maxBondingRadius) this.maxBondingRadius = r;
if ((r = atom.getVanderwaalsRadiusFloat (this.vwr, J.c.VDW.AUTO)) > this.maxVanderwaalsRadius) this.maxVanderwaalsRadius = r;
}
});
Clazz_defineMethod (c$, "clearBfactorRange", 
function () {
this.hasBfactorRange = false;
});
Clazz_defineMethod (c$, "calcBfactorRange", 
 function (bs) {
if (this.hasBfactorRange) return;
this.bfactor100Lo = 2147483647;
this.bfactor100Hi = -2147483648;
if (bs == null) {
for (var i = 0; i < this.ac; i++) this.setBf (i);

} else {
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) this.setBf (i);

}this.hasBfactorRange = true;
}, "JU.BS");
Clazz_defineMethod (c$, "setBf", 
 function (i) {
var bf = this.at[i].getBfactor100 ();
if (bf < this.bfactor100Lo) this.bfactor100Lo = bf;
 else if (bf > this.bfactor100Hi) this.bfactor100Hi = bf;
}, "~N");
Clazz_defineMethod (c$, "getBfactor100Lo", 
function () {
if (!this.hasBfactorRange) {
if (this.vwr.g.rangeSelected) {
this.calcBfactorRange (this.vwr.bsA ());
} else {
this.calcBfactorRange (null);
}}return this.bfactor100Lo;
});
Clazz_defineMethod (c$, "getBfactor100Hi", 
function () {
this.getBfactor100Lo ();
return this.bfactor100Hi;
});
Clazz_defineMethod (c$, "getSurfaceDistanceMax", 
function () {
if (this.surfaceDistance100s == null) this.calcSurfaceDistances ();
return this.surfaceDistanceMax;
});
Clazz_defineMethod (c$, "calculateVolume", 
function (bs, vType) {
var volume = 0;
if (bs != null) for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) volume += this.at[i].getVolume (this.vwr, vType);

return volume;
}, "JU.BS,J.c.VDW");
Clazz_defineMethod (c$, "getSurfaceDistance100", 
function (atomIndex) {
if (this.nSurfaceAtoms == 0) return -1;
if (this.surfaceDistance100s == null) this.calcSurfaceDistances ();
return this.surfaceDistance100s[atomIndex];
}, "~N");
Clazz_defineMethod (c$, "calcSurfaceDistances", 
 function () {
this.calculateSurface (null, -1);
});
Clazz_defineMethod (c$, "calculateSurface", 
function (bsSelected, envelopeRadius) {
if (envelopeRadius < 0) envelopeRadius = 3.0;
var ec = (J.api.Interface.getOption ("geodesic.EnvelopeCalculation", this.vwr, "ms")).set (this.vwr, this.ac, null);
ec.calculate ( new J.atomdata.RadiusData (null, envelopeRadius, J.atomdata.RadiusData.EnumType.ABSOLUTE, null), 3.4028235E38, bsSelected, JU.BSUtil.copyInvert (bsSelected, this.ac), false, false, false, true);
var points = ec.getPoints ();
this.surfaceDistanceMax = 0;
this.bsSurface = ec.getBsSurfaceClone ();
this.surfaceDistance100s =  Clazz_newIntArray (this.ac, 0);
this.nSurfaceAtoms = JU.BSUtil.cardinalityOf (this.bsSurface);
if (this.nSurfaceAtoms == 0 || points == null || points.length == 0) return points;
var radiusAdjust = (envelopeRadius == 3.4028235E38 ? 0 : envelopeRadius);
for (var i = 0; i < this.ac; i++) {
if (this.bsSurface.get (i)) {
this.surfaceDistance100s[i] = 0;
} else {
var dMin = 3.4028235E38;
var atom = this.at[i];
for (var j = points.length; --j >= 0; ) {
var d = Math.abs (points[j].distance (atom) - radiusAdjust);
if (d < 0 && JU.Logger.debugging) JU.Logger.debug ("draw d" + j + " " + JU.Escape.eP (points[j]) + " \"" + d + " ? " + atom.getInfo () + "\"");
dMin = Math.min (d, dMin);
}
var d = this.surfaceDistance100s[i] = Clazz_doubleToInt (Math.floor (dMin * 100));
this.surfaceDistanceMax = Math.max (this.surfaceDistanceMax, d);
}}
return points;
}, "JU.BS,~N");
Clazz_defineMethod (c$, "setAtomCoord2", 
function (bs, tokType, xyzValues) {
var xyz = null;
var values = null;
var v = null;
var type = 0;
var nValues = 1;
if (Clazz_instanceOf (xyzValues, JU.P3)) {
xyz = xyzValues;
} else if (Clazz_instanceOf (xyzValues, JU.Lst)) {
v = xyzValues;
if ((nValues = v.size ()) == 0) return;
type = 1;
} else if (JU.PT.isAP (xyzValues)) {
values = xyzValues;
if ((nValues = values.length) == 0) return;
type = 2;
} else {
return;
}var n = 0;
if (bs != null) for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
switch (type) {
case 1:
if (n >= nValues) return;
xyz = v.get (n++);
break;
case 2:
if (n >= nValues) return;
xyz = values[n++];
break;
}
if (xyz != null) switch (tokType) {
case 1146095626:
this.setAtomCoord (i, xyz.x, xyz.y, xyz.z);
break;
case 1146095627:
this.at[i].setFractionalCoordTo (xyz, true);
this.taintAtom (i, 2);
break;
case 1146095629:
this.at[i].setFractionalCoordTo (xyz, false);
this.taintAtom (i, 2);
break;
case 1146095631:
this.setAtomVibrationVector (i, xyz);
break;
}
}
}, "JU.BS,~N,~O");
Clazz_defineMethod (c$, "setAtomVibrationVector", 
 function (atomIndex, vib) {
this.setVibrationVector (atomIndex, vib);
this.taintAtom (atomIndex, 12);
}, "~N,JU.T3");
Clazz_defineMethod (c$, "setAtomCoord", 
function (atomIndex, x, y, z) {
if (atomIndex < 0 || atomIndex >= this.ac) return;
var a = this.at[atomIndex];
a.set (x, y, z);
this.fixTrajectory (a);
this.taintAtom (atomIndex, 2);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "fixTrajectory", 
 function (a) {
var m = a.mi;
var mc = this;
var isTraj = mc.isTrajectory (m);
if (!isTraj) return;
var isFrac = mc.unitCells != null && mc.unitCells[m].getCoordinatesAreFractional ();
var pt = mc.trajectorySteps.get (m)[a.i - mc.am[m].firstAtomIndex];
pt.set (a.x, a.y, a.z);
if (isFrac) mc.unitCells[m].toFractional (pt, true);
}, "JM.Atom");
Clazz_defineMethod (c$, "setAtomCoordRelative", 
function (atomIndex, x, y, z) {
if (atomIndex < 0 || atomIndex >= this.ac) return;
var a = this.at[atomIndex];
a.add3 (x, y, z);
this.fixTrajectory (a);
this.taintAtom (atomIndex, 2);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "setAtomsCoordRelative", 
function (bs, x, y, z) {
if (bs != null) for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) this.setAtomCoordRelative (i, x, y, z);

}, "JU.BS,~N,~N,~N");
Clazz_defineMethod (c$, "setAPa", 
function (bs, tok, iValue, fValue, sValue, values, list) {
var n = 0;
if (values != null && values.length == 0 || bs == null) return;
var isAll = (values != null && values.length == this.ac || list != null && list.length == this.ac);
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (isAll) n = i;
if (values != null) {
if (n >= values.length) return;
fValue = values[n++];
if (Float.isNaN (fValue)) continue;
iValue = Clazz_floatToInt (fValue);
} else if (list != null) {
if (n >= list.length) return;
sValue = list[n++];
}var atom = this.at[i];
switch (tok) {
case 1087375362:
this.taintAtom (i, 0);
this.setAtomName (i, sValue);
break;
case 1095763969:
this.taintAtom (i, 13);
this.setAtomNumber (i, iValue);
break;
case 1095761940:
this.taintAtom (i, 14);
this.setAtomSeqID (i, iValue);
break;
case 1087375361:
this.taintAtom (i, 1);
this.setAtomType (i, sValue);
break;
case 1112541185:
case 1112541205:
this.setAtomCoord (i, fValue, atom.y, atom.z);
break;
case 1112541186:
case 1112541206:
this.setAtomCoord (i, atom.x, fValue, atom.z);
break;
case 1112541187:
case 1112541207:
this.setAtomCoord (i, atom.x, atom.y, fValue);
break;
case 1112541202:
case 1112541203:
case 1112541204:
this.setVibrationVector2 (i, tok, fValue);
break;
case 1112541188:
case 1112541189:
case 1112541190:
atom.setFractionalCoord (tok, fValue, true);
this.taintAtom (i, 2);
break;
case 1112541191:
case 1112541192:
case 1112541193:
atom.setFractionalCoord (tok, fValue, false);
this.taintAtom (i, 2);
break;
case 1095763978:
case 1087375365:
this.setElement (atom, iValue);
break;
case 1632634891:
atom.setFormalCharge (iValue);
this.taintAtom (i, 4);
break;
case 1114638362:
if (this.setHydrophobicity (i, fValue)) this.taintAtom (i, 5);
break;
case 1826248716:
case 1288701959:
this.vwr.shm.setAtomLabel (sValue, i);
break;
case 1129318401:
if (fValue < 2 && fValue > 0.01) fValue = 100 * fValue;
if (this.setOccupancy (i, fValue)) this.taintAtom (i, 7);
break;
case 1112541195:
if (this.setPartialCharge (i, fValue)) this.taintAtom (i, 8);
break;
case 1112541194:
if (this.setBondingRadius (i, fValue)) this.taintAtom (i, 6);
break;
case 1666189314:
case 1113200651:
if (fValue < 0) fValue = 0;
 else if (fValue > 16) fValue = 16.1;
atom.madAtom = (Clazz_floatToShort (fValue * 2000));
break;
case 1114638363:
this.vwr.slm.setSelectedAtom (atom.i, (fValue != 0));
break;
case 1112541196:
if (this.setBFactor (i, fValue)) this.taintAtom (i, 9);
break;
case 1095763991:
atom.setValence (iValue);
this.taintAtom (i, 10);
break;
case 1649412120:
if (atom.setRadius (fValue)) this.taintAtom (i, 11);
 else this.untaint (i, 11);
break;
default:
JU.Logger.error ("unsettable atom property: " + JS.T.nameOf (tok));
break;
}
}
switch (tok) {
case 1114638363:
this.vwr.slm.setSelectedAtom (-1, false);
break;
case 1666189314:
case 1113200651:
this.vwr.setShapeSize (0, 2147483647, bs);
}
}, "JU.BS,~N,~N,~N,~S,~A,~A");
Clazz_defineMethod (c$, "setElement", 
function (atom, atomicNumber) {
this.taintAtom (atom.i, 3);
atom.setAtomicAndIsotopeNumber (atomicNumber);
atom.paletteID = J.c.PAL.CPK.id;
atom.colixAtom = this.vwr.cm.getColixAtomPalette (atom, J.c.PAL.CPK.id);
}, "JM.Atom,~N");
Clazz_defineMethod (c$, "getVibrationCoord", 
function (atomIndex, c) {
var v = this.getVibration (atomIndex, false);
if (v == null) return NaN;
switch (c) {
case 'X':
return v.x;
case 'Y':
return v.y;
default:
return v.z;
}
}, "~N,~S");
Clazz_defineMethod (c$, "getModulationCoord", 
function (atomIndex, c) {
var ms = this.getModulation (atomIndex);
if (ms != null) {
var v = ms.getVibration (false);
if (v == null) v = ms;
switch (c) {
case 'X':
return v.x;
case 'Y':
return v.y;
case 'Z':
return v.z;
case 'O':
return (ms.getModulation ('O', null)).floatValue ();
case '1':
case '2':
case '3':
var t = ms.getModulation ('T', null);
var x = (c == '1' ? t.x : c == '2' ? t.y : t.z);
return (x - Math.floor (x));
}
}return NaN;
}, "~N,~S");
Clazz_defineMethod (c$, "getVibration", 
function (atomIndex, forceNew) {
var v = (this.vibrations == null ? null : this.vibrations[atomIndex]);
return (Clazz_instanceOf (v, J.api.JmolModulationSet) ? (v).getVibration (forceNew) : v == null && forceNew ?  new JU.Vibration () : v);
}, "~N,~B");
Clazz_defineMethod (c$, "getModulation", 
function (iAtom) {
var v = (this.vibrations == null ? null : this.vibrations[iAtom]);
return (v != null && v.modDim > 0 ? v : null);
}, "~N");
Clazz_defineMethod (c$, "setVibrationVector", 
function (atomIndex, vib) {
if (Float.isNaN (vib.x) || Float.isNaN (vib.y) || Float.isNaN (vib.z)) return;
if (this.vibrations == null || this.vibrations.length < atomIndex) this.vibrations =  new Array (this.at.length);
if (Clazz_instanceOf (vib, JU.Vibration)) {
this.vibrations[atomIndex] = vib;
} else {
if (this.vibrations[atomIndex] == null) this.vibrations[atomIndex] =  new JU.Vibration ();
this.vibrations[atomIndex].setXYZ (vib);
}this.at[atomIndex].setVibrationVector ();
}, "~N,JU.T3");
Clazz_defineMethod (c$, "setVibrationVector2", 
 function (atomIndex, tok, fValue) {
var v = this.getVibration (atomIndex, true);
if (v == null) return;
switch (tok) {
case 1112541202:
v.x = fValue;
break;
case 1112541203:
v.y = fValue;
break;
case 1112541204:
v.z = fValue;
break;
}
this.setAtomVibrationVector (atomIndex, v);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setAtomName", 
function (atomIndex, name) {
var id = ((this).am[this.at[atomIndex].mi].isBioModel ? this.vwr.getJBR ().lookupSpecialAtomID (name) : 0);
this.at[atomIndex].atomID = id;
if (id > 0) return;
if (this.atomNames == null) this.atomNames =  new Array (this.at.length);
this.atomNames[atomIndex] = name;
}, "~N,~S");
Clazz_defineMethod (c$, "setAtomType", 
function (atomIndex, type) {
if (this.atomTypes == null) this.atomTypes =  new Array (this.at.length);
this.atomTypes[atomIndex] = type;
}, "~N,~S");
Clazz_defineMethod (c$, "setAtomNumber", 
function (atomIndex, atomno) {
if (this.atomSerials == null) {
this.atomSerials =  Clazz_newIntArray (this.at.length, 0);
}this.atomSerials[atomIndex] = atomno;
return true;
}, "~N,~N");
Clazz_defineMethod (c$, "setAtomSeqID", 
function (atomIndex, seqID) {
if (this.atomSeqIDs == null) {
this.atomSeqIDs =  Clazz_newIntArray (this.at.length, 0);
}this.atomSeqIDs[atomIndex] = seqID;
return true;
}, "~N,~N");
Clazz_defineMethod (c$, "setOccupancy", 
function (atomIndex, occupancy) {
if (this.occupancies == null) {
if (occupancy == 100) return false;
this.occupancies =  Clazz_newFloatArray (this.at.length, 0);
for (var i = this.at.length; --i >= 0; ) this.occupancies[i] = 100;

}this.occupancies[atomIndex] = occupancy;
return true;
}, "~N,~N");
Clazz_defineMethod (c$, "setPartialCharge", 
function (atomIndex, partialCharge) {
if (Float.isNaN (partialCharge)) return false;
if (this.partialCharges == null) {
if (partialCharge == 0) return false;
this.partialCharges =  Clazz_newFloatArray (this.at.length, 0);
}this.partialCharges[atomIndex] = partialCharge;
return true;
}, "~N,~N");
Clazz_defineMethod (c$, "setBondingRadius", 
function (atomIndex, radius) {
if (Float.isNaN (radius)) return false;
if (this.bondingRadii == null) {
this.bondingRadii =  Clazz_newFloatArray (this.at.length, 0);
}this.bondingRadii[atomIndex] = radius;
return true;
}, "~N,~N");
Clazz_defineMethod (c$, "setBFactor", 
function (atomIndex, bfactor) {
if (Float.isNaN (bfactor)) return false;
if (this.bfactor100s == null) {
if (bfactor == 0 && this.bfactor100s == null) return false;
this.bfactor100s =  Clazz_newShortArray (this.at.length, 0);
}this.bfactor100s[atomIndex] = Clazz_doubleToShort ((bfactor < -327.68 ? -327.68 : bfactor > 327.67 ? 327.67 : bfactor) * 100 + (bfactor < 0 ? -0.5 : 0.5));
return true;
}, "~N,~N");
Clazz_defineMethod (c$, "setHydrophobicity", 
function (atomIndex, value) {
if (Float.isNaN (value)) return false;
if (this.hydrophobicities == null) {
this.hydrophobicities =  Clazz_newFloatArray (this.at.length, 0);
for (var i = 0; i < this.at.length; i++) this.hydrophobicities[i] = JU.Elements.getHydrophobicity (this.at[i].getGroupID ());

}this.hydrophobicities[atomIndex] = value;
return true;
}, "~N,~N");
Clazz_defineMethod (c$, "setAtomData", 
function (type, name, dataString, isDefault) {
var fData = null;
var bs = null;
switch (type) {
case 2:
this.loadCoordinates (dataString, false, !isDefault);
return;
case 12:
this.loadCoordinates (dataString, true, true);
return;
case 15:
fData =  Clazz_newFloatArray (this.ac, 0);
bs = JU.BS.newN (this.ac);
break;
}
var lines = JU.Parser.markLines (dataString, ';');
var n = 0;
try {
var nData = JU.PT.parseInt (dataString.substring (0, lines[0] - 1));
for (var i = 1; i <= nData; i++) {
var tokens = JU.PT.getTokens (JU.PT.parseTrimmed (dataString.substring (lines[i], lines[i + 1] - 1)));
var atomIndex = JU.PT.parseInt (tokens[0]) - 1;
if (atomIndex < 0 || atomIndex >= this.ac) continue;
var atom = this.at[atomIndex];
n++;
var pt = tokens.length - 1;
var x = JU.PT.parseFloat (tokens[pt]);
switch (type) {
case 15:
fData[atomIndex] = x;
bs.set (atomIndex);
continue;
case 13:
this.setAtomNumber (atomIndex, Clazz_floatToInt (x));
break;
case 14:
this.setAtomSeqID (atomIndex, Clazz_floatToInt (x));
break;
case 0:
this.setAtomName (atomIndex, tokens[pt]);
break;
case 1:
this.setAtomType (atomIndex, tokens[pt]);
break;
case 3:
atom.setAtomicAndIsotopeNumber (Clazz_floatToInt (x));
atom.paletteID = J.c.PAL.CPK.id;
atom.colixAtom = this.vwr.cm.getColixAtomPalette (atom, J.c.PAL.CPK.id);
break;
case 4:
atom.setFormalCharge (Clazz_floatToInt (x));
break;
case 5:
this.setHydrophobicity (atomIndex, x);
break;
case 6:
this.setBondingRadius (atomIndex, x);
break;
case 8:
this.setPartialCharge (atomIndex, x);
break;
case 9:
this.setBFactor (atomIndex, x);
break;
case 10:
atom.setValence (Clazz_floatToInt (x));
break;
case 11:
atom.setRadius (x);
break;
}
this.taintAtom (atomIndex, type);
}
if (type == 15 && n > 0) this.vwr.setData (name, [name, fData, bs, Integer.$valueOf (1)], 0, 0, 0, 0, 0);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error ("AtomCollection.loadData error: " + e);
} else {
throw e;
}
}
}, "~N,~S,~S,~B");
Clazz_defineMethod (c$, "loadCoordinates", 
 function (data, isVibrationVectors, doTaint) {
var lines = JU.Parser.markLines (data, ';');
var v = (isVibrationVectors ?  new JU.V3 () : null);
try {
var nData = JU.PT.parseInt (data.substring (0, lines[0] - 1));
for (var i = 1; i <= nData; i++) {
var tokens = JU.PT.getTokens (JU.PT.parseTrimmed (data.substring (lines[i], lines[i + 1])));
var atomIndex = JU.PT.parseInt (tokens[0]) - 1;
var x = JU.PT.parseFloat (tokens[3]);
var y = JU.PT.parseFloat (tokens[4]);
var z = JU.PT.parseFloat (tokens[5]);
if (isVibrationVectors) {
v.set (x, y, z);
this.setAtomVibrationVector (atomIndex, v);
} else {
this.setAtomCoord (atomIndex, x, y, z);
if (!doTaint) this.untaint (atomIndex, 2);
}}
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error ("Frame.loadCoordinate error: " + e);
} else {
throw e;
}
}
}, "~S,~B,~B");
Clazz_defineMethod (c$, "validateBspf", 
function (isValid) {
if (this.bspf != null) this.bspf.isValid = isValid;
this.averageAtomPoint = null;
}, "~B");
Clazz_defineMethod (c$, "validateBspfForModel", 
function (modelIndex, isValid) {
if (this.bspf != null) this.bspf.validateModel (modelIndex, isValid);
}, "~N,~B");
Clazz_defineMethod (c$, "setPreserveState", 
function (TF) {
this.preserveState = TF;
}, "~B");
c$.getUserSettableType = Clazz_defineMethod (c$, "getUserSettableType", 
function (dataType) {
var isExplicit = (dataType.indexOf ("property_") == 0);
var check = (isExplicit ? dataType.substring (9) : dataType);
for (var i = 0; i < 15; i++) if (JM.AtomCollection.userSettableValues[i].equalsIgnoreCase (check)) return i;

return (isExplicit ? 15 : -1);
}, "~S");
Clazz_defineMethod (c$, "getTaintedAtoms", 
function (type) {
return this.tainted == null ? null : this.tainted[type];
}, "~N");
Clazz_defineMethod (c$, "taintAtoms", 
function (bsAtoms, type) {
this.canSkipLoad = false;
if (!this.preserveState) return;
for (var i = bsAtoms.nextSetBit (0); i >= 0; i = bsAtoms.nextSetBit (i + 1)) this.taintAtom (i, type);

}, "JU.BS,~N");
Clazz_defineMethod (c$, "taintAtom", 
function (atomIndex, type) {
if (!this.preserveState) return;
if (this.tainted == null) this.tainted =  new Array (15);
if (this.tainted[type] == null) this.tainted[type] = JU.BS.newN (this.ac);
this.tainted[type].set (atomIndex);
if (type == 2) this.validateBspfForModel ((this).am[this.at[atomIndex].mi].trajectoryBaseIndex, false);
}, "~N,~N");
Clazz_defineMethod (c$, "untaint", 
 function (atomIndex, type) {
if (!this.preserveState) return;
if (this.tainted == null || this.tainted[type] == null) return;
this.tainted[type].clear (atomIndex);
}, "~N,~N");
Clazz_defineMethod (c$, "setTaintedAtoms", 
function (bs, type) {
if (!this.preserveState) return;
if (bs == null) {
if (this.tainted == null) return;
this.tainted[type] = null;
return;
}if (this.tainted == null) this.tainted =  new Array (15);
if (this.tainted[type] == null) this.tainted[type] = JU.BS.newN (this.ac);
JU.BSUtil.copy2 (bs, this.tainted[type]);
}, "JU.BS,~N");
Clazz_defineMethod (c$, "unTaintAtoms", 
function (bs, type) {
if (this.tainted == null || this.tainted[type] == null) return;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) this.tainted[type].clear (i);

if (this.tainted[type].nextSetBit (0) < 0) this.tainted[type] = null;
}, "JU.BS,~N");
Clazz_defineMethod (c$, "findNearest2", 
function (x, y, closest, bsNot, min) {
var champion = null;
for (var i = this.ac; --i >= 0; ) {
if (bsNot != null && bsNot.get (i)) continue;
var contender = this.at[i];
if (contender.isClickable () && this.isCursorOnTopOf (contender, x, y, min, champion)) champion = contender;
}
closest[0] = champion;
}, "~N,~N,~A,JU.BS,~N");
Clazz_defineMethod (c$, "isCursorOnTopOf", 
function (contender, x, y, radius, champion) {
return contender.sZ > 1 && !this.g3d.isClippedZ (contender.sZ) && this.g3d.isInDisplayRange (contender.sX, contender.sY) && contender.isCursorOnTopOf (x, y, radius, champion);
}, "JM.Atom,~N,~N,~N,JM.Atom");
Clazz_defineMethod (c$, "fillADa", 
function (atomData, mode) {
atomData.atomXyz = this.at;
atomData.ac = this.ac;
atomData.atomicNumber =  Clazz_newIntArray (this.ac, 0);
var includeRadii = ((mode & 2) != 0);
if (includeRadii) atomData.atomRadius =  Clazz_newFloatArray (this.ac, 0);
var isMultiModel = ((mode & 16) != 0);
for (var i = 0; i < this.ac; i++) {
var atom = this.at[i];
if (atom.isDeleted () || !isMultiModel && atomData.modelIndex >= 0 && atom.mi != atomData.firstModelIndex) {
if (atomData.bsIgnored == null) atomData.bsIgnored =  new JU.BS ();
atomData.bsIgnored.set (i);
continue;
}atomData.atomicNumber[i] = atom.getElementNumber ();
atomData.lastModelIndex = atom.mi;
if (includeRadii) atomData.atomRadius[i] = this.getWorkingRadius (atom, atomData);
}
}, "J.atomdata.AtomData,~N");
Clazz_defineMethod (c$, "getWorkingRadius", 
 function (atom, atomData) {
var r = 0;
var rd = atomData.radiusData;
switch (rd.factorType) {
case J.atomdata.RadiusData.EnumType.ABSOLUTE:
r = rd.value;
break;
case J.atomdata.RadiusData.EnumType.FACTOR:
case J.atomdata.RadiusData.EnumType.OFFSET:
switch (rd.vdwType) {
case J.c.VDW.BONDING:
r = atom.getBondingRadius ();
break;
case J.c.VDW.ADPMAX:
r = atom.getADPMinMax (true);
break;
case J.c.VDW.ADPMIN:
r = atom.getADPMinMax (false);
break;
default:
r = atom.getVanderwaalsRadiusFloat (this.vwr, atomData.radiusData.vdwType);
}
if (rd.factorType === J.atomdata.RadiusData.EnumType.FACTOR) r *= rd.value;
 else r += rd.value;
}
return r + rd.valueExtended;
}, "JM.Atom,J.atomdata.AtomData");
Clazz_defineMethod (c$, "calculateHydrogens", 
function (bs, nTotal, doAll, justCarbon, vConnect) {
var z =  new JU.V3 ();
var x =  new JU.V3 ();
var hAtoms =  new Array (this.ac);
var bsDeleted = this.vwr.slm.bsDeleted;
var pt;
var nH = 0;
if (bs != null) for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (bsDeleted != null && bsDeleted.get (i)) continue;
var atom = this.at[i];
var atomicNumber = atom.getElementNumber ();
if (justCarbon && atomicNumber != 6) continue;
var dHX = (atomicNumber <= 6 ? 1.1 : atomicNumber <= 10 ? 1.0 : 1.3);
switch (atomicNumber) {
case 7:
case 8:
dHX = 1.0;
break;
case 6:
}
if (doAll && atom.getCovalentHydrogenCount () > 0) continue;
var n = this.getImplicitHydrogenCount (atom, false);
if (n == 0) continue;
var targetValence = this.aaRet[0];
var hybridization = this.aaRet[2];
var nBonds = this.aaRet[3];
hAtoms[i] =  new Array (n);
var hPt = 0;
if (nBonds == 0) {
switch (n) {
case 4:
z.set (0.635, 0.635, 0.635);
pt = JU.P3.newP (z);
pt.add (atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
case 3:
z.set (-0.635, -0.635, 0.635);
pt = JU.P3.newP (z);
pt.add (atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
case 2:
z.set (-0.635, 0.635, -0.635);
pt = JU.P3.newP (z);
pt.add (atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
case 1:
z.set (0.635, -0.635, -0.635);
pt = JU.P3.newP (z);
pt.add (atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
}
} else {
switch (n) {
default:
break;
case 3:
this.getHybridizationAndAxes (i, atomicNumber, z, x, "sp3b", false, true);
pt =  new JU.P3 ();
pt.scaleAdd2 (dHX, z, atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
this.getHybridizationAndAxes (i, atomicNumber, z, x, "sp3c", false, true);
pt =  new JU.P3 ();
pt.scaleAdd2 (dHX, z, atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
this.getHybridizationAndAxes (i, atomicNumber, z, x, "sp3d", false, true);
pt =  new JU.P3 ();
pt.scaleAdd2 (dHX, z, atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
break;
case 2:
var isEne = (hybridization == 2 || atomicNumber == 5 || nBonds == 1 && targetValence == 4 || atomicNumber == 7 && this.isAdjacentSp2 (atom));
this.getHybridizationAndAxes (i, atomicNumber, z, x, (isEne ? "sp2b" : targetValence == 3 ? "sp3c" : "lpa"), false, true);
pt = JU.P3.newP (z);
pt.scaleAdd2 (dHX, z, atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
this.getHybridizationAndAxes (i, atomicNumber, z, x, (isEne ? "sp2c" : targetValence == 3 ? "sp3d" : "lpb"), false, true);
pt = JU.P3.newP (z);
pt.scaleAdd2 (dHX, z, atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
break;
case 1:
switch (targetValence - nBonds) {
case 1:
if (atomicNumber == 8 && atom === atom.group.getCarbonylOxygenAtom ()) {
hAtoms[i] = null;
continue;
}if (this.getHybridizationAndAxes (i, atomicNumber, z, x, (hybridization == 2 || atomicNumber == 5 || atomicNumber == 7 && this.isAdjacentSp2 (atom) ? "sp2c" : "sp3d"), true, false) != null) {
pt = JU.P3.newP (z);
pt.scaleAdd2 (dHX, z, atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
} else {
hAtoms[i] =  new Array (0);
}break;
case 2:
this.getHybridizationAndAxes (i, atomicNumber, z, x, (targetValence == 4 ? "sp2c" : "sp2b"), false, false);
pt = JU.P3.newP (z);
pt.scaleAdd2 (dHX, z, atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
break;
case 3:
this.getHybridizationAndAxes (i, atomicNumber, z, x, "spb", false, true);
pt = JU.P3.newP (z);
pt.scaleAdd2 (dHX, z, atom);
hAtoms[i][hPt++] = pt;
if (vConnect != null) vConnect.addLast (atom);
break;
}
}
}nH += hPt;
}
nTotal[0] = nH;
return hAtoms;
}, "JU.BS,~A,~B,~B,JU.Lst");
Clazz_defineMethod (c$, "isAdjacentSp2", 
 function (atom) {
var bonds = atom.bonds;
for (var i = 0; i < bonds.length; i++) {
var b2 = bonds[i].getOtherAtom (atom).bonds;
for (var j = 0; j < b2.length; j++) switch (b2[j].order) {
case 515:
case 514:
case 2:
case 3:
return true;
}

}
return false;
}, "JM.Atom");
Clazz_defineMethod (c$, "getImplicitHydrogenCount", 
function (atom, allowNegative) {
var targetValence = atom.getTargetValence ();
if (targetValence < 0) return 0;
var charge = atom.getFormalCharge ();
if (this.aaRet == null) this.aaRet =  Clazz_newIntArray (4, 0);
this.aaRet[0] = targetValence;
this.aaRet[1] = charge;
this.aaRet[2] = 0;
this.aaRet[3] = atom.getCovalentBondCount ();
var model = (this).am[atom.mi];
var s = (model.isBioModel && !model.isPdbWithMultipleBonds ? atom.group.getGroup3 () : null);
if (s != null && charge == 0) {
if (this.vwr.getJBR ().getAminoAcidValenceAndCharge (s, atom.getAtomName (), this.aaRet)) {
targetValence = this.aaRet[0];
charge = this.aaRet[1];
}}if (charge != 0) {
targetValence += (targetValence == 4 ? -Math.abs (charge) : charge);
this.aaRet[0] = targetValence;
}var n = targetValence - atom.getValence ();
return (n < 0 && !allowNegative ? 0 : n);
}, "JM.Atom,~B");
Clazz_defineMethod (c$, "fixFormalCharges", 
function (bs) {
var n = 0;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var a = this.at[i];
var nH = this.getImplicitHydrogenCount (a, true);
if (nH != 0) {
var c0 = a.getFormalCharge ();
var c = c0 - nH;
a.setFormalCharge (c);
this.taintAtom (i, 4);
if (JU.Logger.debugging) JU.Logger.debug ("atom " + a + " formal charge " + c0 + " -> " + c);
n++;
}}
return n;
}, "JU.BS");
Clazz_defineMethod (c$, "getHybridizationAndAxes", 
function (atomIndex, atomicNumber, z, x, lcaoTypeRaw, hybridizationCompatible, doAlignZ) {
var lcaoType = (lcaoTypeRaw.length > 0 && lcaoTypeRaw.charAt (0) == '-' ? lcaoTypeRaw.substring (1) : lcaoTypeRaw);
if (lcaoTypeRaw.indexOf ("d") >= 0 && !lcaoTypeRaw.endsWith ("sp3d")) return this.getHybridizationAndAxesD (atomIndex, z, x, lcaoType);
var atom = this.at[atomIndex];
if (atomicNumber == 0) atomicNumber = atom.getElementNumber ();
var attached = this.getAttached (atom, 4, hybridizationCompatible);
var nAttached = attached.length;
var pt = lcaoType.charCodeAt (lcaoType.length - 1) - 97;
if (pt < 0 || pt > 6) pt = 0;
z.set (0, 0, 0);
x.set (0, 0, 0);
var v =  new Array (4);
for (var i = 0; i < nAttached; i++) {
v[i] = JU.V3.newVsub (atom, attached[i]);
v[i].normalize ();
z.add (v[i]);
}
if (nAttached > 0) x.setT (v[0]);
var isPlanar = false;
var vTemp =  new JU.V3 ();
if (nAttached >= 3) {
if (x.angle (v[1]) < 2.984513) vTemp.cross (x, v[1]);
 else vTemp.cross (x, v[2]);
vTemp.normalize ();
var vTemp2 =  new JU.V3 ();
if (v[1].angle (v[2]) < 2.984513) vTemp2.cross (v[1], v[2]);
 else vTemp2.cross (x, v[2]);
vTemp2.normalize ();
isPlanar = (Math.abs (vTemp2.dot (vTemp)) >= 0.95);
}var isSp3 = (lcaoType.indexOf ("sp3") == 0);
var isSp2 = (!isSp3 && lcaoType.indexOf ("sp2") == 0);
var isSp = (!isSp3 && !isSp2 && lcaoType.indexOf ("sp") == 0);
var isP = (lcaoType.indexOf ("p") == 0);
var isLp = (lcaoType.indexOf ("lp") == 0);
var hybridization = null;
if (hybridizationCompatible) {
if (nAttached == 0) return null;
if (isSp3) {
if (pt > 3 || nAttached > 4) return null;
} else if (isSp2) {
if (pt > 2 || nAttached > 3) return null;
} else if (isSp) {
if (pt > 1 || nAttached > 2) return null;
}switch (nAttached) {
case 1:
if (atomicNumber == 1 && !isSp3) return null;
if (isSp3) {
hybridization = "sp3";
break;
}switch (attached[0].getCovalentBondCount ()) {
case 1:
if (attached[0].getValence () != 2) {
hybridization = "sp";
break;
}case 2:
hybridization = (isSp ? "sp" : "sp2");
break;
case 3:
if (!isSp2 && !isP) return null;
hybridization = "sp2";
break;
}
break;
case 2:
if (z.length () < 0.1) {
if (lcaoType.indexOf ("2") >= 0 || lcaoType.indexOf ("3") >= 0) return null;
hybridization = "sp";
break;
}hybridization = (isSp3 ? "sp3" : "sp2");
if (lcaoType.indexOf ("sp") == 0) {
break;
}if (isLp) {
hybridization = "lp";
break;
}hybridization = lcaoType;
break;
default:
if (isPlanar) {
hybridization = "sp2";
} else {
if (isLp && nAttached == 3) {
hybridization = "lp";
break;
}hybridization = "sp3";
}}
if (hybridization == null) return null;
if (lcaoType.indexOf ("p") == 0) {
if (hybridization === "sp3") return null;
} else if (lcaoType.indexOf (hybridization) < 0) {
return null;
}}if (pt < nAttached && !lcaoType.startsWith ("p") && !lcaoType.startsWith ("l")) {
z.sub2 (attached[pt], atom);
z.normalize ();
return hybridization;
}switch (nAttached) {
case 0:
if (lcaoType.equals ("sp3c") || lcaoType.equals ("sp2d") || lcaoType.equals ("lpa")) {
z.set (-0.5, -0.7, 1);
x.set (1, 0, 0);
} else if (lcaoType.equals ("sp3b") || lcaoType.equals ("lpb")) {
z.set (0.5, -0.7, -1.0);
x.set (1, 0, 0);
} else if (lcaoType.equals ("sp3a")) {
z.set (0, 1, 0);
x.set (1, 0, 0);
} else {
z.set (0, 0, 1);
x.set (1, 0, 0);
}break;
case 1:
vTemp.setT (JM.AtomCollection.vRef);
x.cross (vTemp, z);
if (isSp3) {
for (var i = 0; i < attached[0].bonds.length; i++) {
if (attached[0].bonds[i].isCovalent () && attached[0].getBondedAtomIndex (i) != atom.i) {
x.sub2 (attached[0], attached[0].bonds[i].getOtherAtom (attached[0]));
x.cross (z, x);
if (x.length () == 0) continue;
x.cross (x, z);
break;
}}
x.normalize ();
if (Float.isNaN (x.x)) {
x.setT (JM.AtomCollection.vRef);
x.cross (x, z);
}vTemp.cross (z, x);
vTemp.normalize ();
z.normalize ();
x.scaleAdd2 (2.828, x, z);
if (pt != 3) {
x.normalize ();
 new JU.M3 ().setAA (JU.A4.new4 (z.x, z.y, z.z, (pt == 2 ? 1 : -1) * 2.09439507)).rotate (x);
}z.setT (x);
x.cross (vTemp, z);
break;
}vTemp.cross (x, z);
switch (attached[0].getCovalentBondCount ()) {
case 1:
if (attached[0].getValence () != 2) {
break;
}case 2:
var isCumulated = false;
var a0 = attached[0];
x.setT (z);
vTemp.setT (JM.AtomCollection.vRef);
while (a0 != null && a0.getCovalentBondCount () == 2) {
var bonds = a0.bonds;
var a = null;
isCumulated = !isCumulated;
for (var i = 0; i < bonds.length; i++) if (bonds[i].isCovalent ()) {
a = bonds[i].getOtherAtom (a0);
if (a !== atom) {
vTemp.sub2 (a, a0);
break;
}}
vTemp.cross (vTemp, x);
if (vTemp.length () > 0.1 || a.getCovalentBondCount () != 2) break;
atom = a0;
a0 = a;
}
if (vTemp.length () > 0.1) {
z.cross (vTemp, x);
z.normalize ();
if (pt == 1) z.scale (-1);
z.scale (JM.AtomCollection.sqrt3_2);
z.scaleAdd2 (0.5, x, z);
if (isP) {
vTemp.cross (z, x);
z.setT (vTemp);
vTemp.setT (x);
}x.cross (vTemp, z);
} else {
z.setT (x);
x.cross (JM.AtomCollection.vRef, x);
}break;
case 3:
this.getHybridizationAndAxes (attached[0].i, 0, x, vTemp, "pz", false, doAlignZ);
vTemp.setT (x);
if (isSp2) {
x.cross (x, z);
if (pt == 1) x.scale (-1);
x.scale (JM.AtomCollection.sqrt3_2);
z.scaleAdd2 (0.5, z, x);
} else {
vTemp.setT (z);
z.setT (x);
}x.cross (vTemp, z);
break;
}
break;
case 2:
if (z.length () < 0.1) {
if (!lcaoType.equals ("pz")) {
var a = attached[0];
var ok = (a.getCovalentBondCount () == 3);
if (!ok) ok = ((a = attached[1]).getCovalentBondCount () == 3);
if (ok) {
this.getHybridizationAndAxes (a.i, 0, x, z, "pz", false, doAlignZ);
if (lcaoType.equals ("px")) x.scale (-1);
z.setT (v[0]);
break;
}vTemp.setT (JM.AtomCollection.vRef);
z.cross (vTemp, x);
vTemp.cross (z, x);
}z.setT (x);
x.cross (vTemp, z);
break;
}vTemp.cross (z, x);
if (isSp2) {
x.cross (z, vTemp);
break;
}if (isSp3 || isLp) {
vTemp.normalize ();
z.normalize ();
if (!lcaoType.equals ("lp")) {
if (pt == 0 || pt == 2) z.scaleAdd2 (-1.2, vTemp, z);
 else z.scaleAdd2 (1.2, vTemp, z);
}x.cross (z, vTemp);
break;
}x.cross (z, vTemp);
z.setT (vTemp);
if (z.z < 0) {
z.scale (-1);
x.scale (-1);
}break;
default:
if (isSp3) break;
if (!isPlanar) {
x.cross (z, x);
break;
}z.setT (vTemp);
if (z.z < 0 && doAlignZ) {
z.scale (-1);
x.scale (-1);
}}
x.normalize ();
z.normalize ();
return hybridization;
}, "~N,~N,JU.V3,JU.V3,~S,~B,~B");
Clazz_defineMethod (c$, "getHybridizationAndAxesD", 
 function (atomIndex, z, x, lcaoType) {
if (lcaoType.startsWith ("sp3d2")) lcaoType = "d2sp3" + (lcaoType.length == 5 ? "a" : lcaoType.substring (5));
if (lcaoType.startsWith ("sp3d")) lcaoType = "dsp3" + (lcaoType.length == 4 ? "a" : lcaoType.substring (4));
if (lcaoType.equals ("d2sp3") || lcaoType.equals ("dsp3")) lcaoType += "a";
var isTrigonal = lcaoType.startsWith ("dsp3");
var pt = lcaoType.charCodeAt (lcaoType.length - 1) - 97;
if (z != null && (!isTrigonal && (pt > 5 || !lcaoType.startsWith ("d2sp3")) || isTrigonal && pt > 4)) return null;
var atom = this.at[atomIndex];
var attached = this.getAttached (atom, 6, true);
if (attached == null) return (z == null ? null : "?");
var nAttached = attached.length;
if (nAttached < 3 && z != null) return null;
var isLP = (pt >= nAttached);
var nAngles = Clazz_doubleToInt (nAttached * (nAttached - 1) / 2);
var angles = JU.AU.newInt2 (nAngles);
var ntypes =  Clazz_newIntArray (3, 0);
var typePtrs =  Clazz_newIntArray (3, nAngles, 0);
var n = 0;
var _90 = 0;
var _120 = 1;
var _180 = 2;
var n120_atom0 = 0;
for (var i = 0; i < nAttached - 1; i++) for (var j = i + 1; j < nAttached; j++) {
var angle = JU.Measure.computeAngleABC (attached[i], atom, attached[j], true);
var itype = (angle < 105 ? _90 : angle >= 150 ? _180 : _120);
typePtrs[itype][ntypes[itype]] = n;
ntypes[itype]++;
angles[n++] = [i, j];
if (i == 0 && itype == _120) n120_atom0++;
}

n = ntypes[_90] * 100 + ntypes[_120] * 10 + ntypes[_180];
if (z == null) {
switch (n) {
default:
return "";
case 0:
return "";
case 1:
return "linear";
case 100:
case 10:
return "bent";
case 111:
case 201:
return "T-shaped";
case 30:
case 120:
case 210:
case 300:
if (Math.abs (JU.Measure.computeTorsion (attached[0], atom, attached[1], attached[2], true)) > 162) return "trigonal planar";
return "trigonal pyramidal";
case 330:
return (n120_atom0 % 2 == 1 ? "tetrahedral" : "uncapped trigonal pyramid");
case 60:
case 150:
case 240:
return "tetrahedral";
case 402:
return "square planar";
case 411:
case 501:
return "see-saw";
case 631:
return "trigonal bipyramidal";
case 802:
return "uncapped square pyramid";
case 1203:
return "octahedral";
}
}switch (n) {
default:
return null;
case 201:
break;
case 210:
case 330:
case 411:
case 631:
if (!isTrigonal) return null;
break;
case 300:
case 402:
case 501:
case 802:
case 1203:
if (isTrigonal) return null;
break;
}
if (isLP) {
var a;
var bs;
if (isTrigonal) {
switch (ntypes[_120]) {
case 0:
z.sub2 (attached[angles[typePtrs[_90][0]][0]], atom);
x.sub2 (attached[angles[typePtrs[_90][0]][1]], atom);
z.cross (z, x);
z.normalize ();
if (pt == 4) z.scale (-1);
bs = this.findNotAttached (nAttached, angles, typePtrs[_180], ntypes[_180]);
var i = bs.nextSetBit (0);
x.sub2 (attached[i], atom);
x.normalize ();
x.scale (0.5);
z.scaleAdd2 (JM.AtomCollection.sqrt3_2, z, x);
pt = -1;
break;
case 1:
if (pt == 4) {
a = angles[typePtrs[_120][0]];
z.add2 (attached[a[0]], attached[a[1]]);
z.scaleAdd2 (-2, atom, z);
pt = -1;
} else {
bs = this.findNotAttached (nAttached, angles, typePtrs[_120], ntypes[_120]);
pt = bs.nextSetBit (0);
}break;
default:
bs = this.findNotAttached (nAttached, angles, typePtrs[_120], ntypes[_120]);
pt = bs.nextSetBit (0);
}
} else {
var isPlanar = false;
if (nAttached == 4) {
switch (ntypes[_180]) {
case 1:
bs = this.findNotAttached (nAttached, angles, typePtrs[_180], ntypes[_180]);
var i = bs.nextSetBit (0);
if (pt == 4) pt = i;
 else pt = bs.nextSetBit (i + 1);
break;
default:
isPlanar = true;
}
} else {
bs = this.findNotAttached (nAttached, angles, typePtrs[_180], ntypes[_180]);
var i = bs.nextSetBit (0);
for (var j = nAttached; j < pt && i >= 0; j++) i = bs.nextSetBit (i + 1);

if (i == -1) isPlanar = true;
 else pt = i;
}if (isPlanar) {
z.sub2 (attached[angles[typePtrs[_90][0]][0]], atom);
x.sub2 (attached[angles[typePtrs[_90][0]][1]], atom);
z.cross (z, x);
if (pt == 4) z.scale (-1);
pt = -1;
}}}if (pt >= 0) z.sub2 (attached[pt], atom);
if (isLP) z.scale (-1);
z.normalize ();
return (isTrigonal ? "dsp3" : "d2sp3");
}, "~N,JU.V3,JU.V3,~S");
Clazz_defineMethod (c$, "getAttached", 
 function (atom, nMax, doSort) {
var nAttached = atom.getCovalentBondCount ();
if (nAttached > nMax) return null;
var attached =  new Array (nAttached);
if (nAttached > 0) {
var bonds = atom.bonds;
var n = 0;
for (var i = 0; i < bonds.length; i++) if (bonds[i].isCovalent ()) attached[n++] = bonds[i].getOtherAtom (atom);

if (doSort) java.util.Arrays.sort (attached, Clazz_innerTypeInstance (JM.AtomCollection.AtomSorter, this, null));
}return attached;
}, "JM.Atom,~N,~B");
Clazz_defineMethod (c$, "findNotAttached", 
 function (nAttached, angles, ptrs, nPtrs) {
var bs = JU.BS.newN (nAttached);
bs.setBits (0, nAttached);
for (var i = 0; i < nAttached; i++) for (var j = 0; j < nPtrs; j++) {
var a = angles[ptrs[j]];
if (a[0] == i || a[1] == i) bs.clear (i);
}

return bs;
}, "~N,~A,~A,~N");
Clazz_defineMethod (c$, "getAtomBitsMDa", 
function (tokType, specInfo) {
var bs =  new JU.BS ();
var bsInfo;
var bsTemp;
var iSpec = (Clazz_instanceOf (specInfo, Integer) ? (specInfo).intValue () : 0);
var i = 0;
switch (tokType) {
case 1613758488:
return this.getWaterAtoms (bs);
case 1095761939:
for (i = this.ac; --i >= 0; ) if (this.at[i].getResno () == iSpec) bs.set (i);

break;
case 1297090050:
for (i = this.ac; --i >= 0; ) if (this.at[i].getSymOp () == iSpec) bs.set (i);

break;
case 1095763969:
for (i = this.ac; --i >= 0; ) if (this.at[i].getAtomNumber () == iSpec) bs.set (i);

break;
case 1087375362:
var names = "," + specInfo + ",";
for (i = this.ac; --i >= 0; ) {
var name = this.at[i].getAtomName ();
if (names.indexOf (name) >= 0) if (names.indexOf ("," + name + ",") >= 0) bs.set (i);
}
break;
case 1087375361:
var types = "," + specInfo + ",";
for (i = this.ac; --i >= 0; ) {
var type = this.at[i].getAtomType ();
if (types.indexOf (type) >= 0) if (types.indexOf ("," + type + ",") >= 0) bs.set (i);
}
break;
case 1048613:
for (i = this.ac; --i >= 0; ) if (this.at[i].getGroupID () == iSpec) bs.set (i);

break;
case 1048609:
return JU.BSUtil.copy (this.getChainBits (iSpec));
case 1048614:
return JU.BSUtil.copy (this.getSeqcodeBits (iSpec, true));
case 1613758470:
for (i = this.ac; --i >= 0; ) if (this.at[i].isHetero ()) bs.set (i);

break;
case 1613758476:
for (i = this.ac; --i >= 0; ) if (this.at[i].getElementNumber () == 1) bs.set (i);

break;
case 3145741:
for (i = this.ac; --i >= 0; ) if (this.at[i].isLeadAtom ()) bs.set (i);

break;
case 3145744:
for (i = this.ac; --i >= 0; ) if (this.at[i].isProtein ()) bs.set (i);

break;
case 3145764:
for (i = this.ac; --i >= 0; ) if (this.at[i].isCarbohydrate ()) bs.set (i);

break;
case 137363467:
case 3145760:
var type = (tokType == 137363467 ? J.c.STR.HELIX : J.c.STR.SHEET);
for (i = this.ac; --i >= 0; ) if (this.at[i].isWithinStructure (type)) bs.set (i);

break;
case 3145742:
for (i = this.ac; --i >= 0; ) if (this.at[i].isNucleic ()) bs.set (i);

break;
case 3145732:
for (i = this.ac; --i >= 0; ) if (this.at[i].isDna ()) bs.set (i);

break;
case 3145750:
for (i = this.ac; --i >= 0; ) if (this.at[i].isRna ()) bs.set (i);

break;
case 3145746:
for (i = this.ac; --i >= 0; ) if (this.at[i].isPurine ()) bs.set (i);

break;
case 3145748:
for (i = this.ac; --i >= 0; ) if (this.at[i].isPyrimidine ()) bs.set (i);

break;
case 1087375365:
bsInfo = specInfo;
bsTemp =  new JU.BS ();
for (i = bsInfo.nextSetBit (0); i >= 0; i = bsInfo.nextSetBit (i + 1)) bsTemp.set (this.at[i].getElementNumber ());

for (i = this.ac; --i >= 0; ) if (bsTemp.get (this.at[i].getElementNumber ())) bs.set (i);

break;
case 1095761941:
bsInfo = specInfo;
bsTemp =  new JU.BS ();
for (i = bsInfo.nextSetBit (0); i >= 0; i = bsInfo.nextSetBit (i + 1)) bsTemp.set (this.at[i].atomSite);

for (i = this.ac; --i >= 0; ) if (bsTemp.get (this.at[i].atomSite)) bs.set (i);

break;
case 1073741824:
return this.getIdentifierOrNull (specInfo);
case 1048608:
var atomSpec = (specInfo).toUpperCase ();
if (atomSpec.indexOf ("\\?") >= 0) atomSpec = JU.PT.rep (atomSpec, "\\?", "\1");
var allowStar = atomSpec.startsWith ("?*");
if (allowStar) atomSpec = atomSpec.substring (1);
for (i = this.ac; --i >= 0; ) if (this.isAtomNameMatch (this.at[i], atomSpec, allowStar, allowStar)) bs.set (i);

break;
case 1048607:
var spec = specInfo;
for (i = this.ac; --i >= 0; ) if (this.at[i].isAltLoc (spec)) bs.set (i);

break;
case 1048612:
return this.getSpecName (specInfo);
}
if (i < 0) return bs;
bsInfo = specInfo;
var iModel;
var iPolymer;
var i0 = bsInfo.nextSetBit (0);
if (i0 < 0) return bs;
i = 0;
switch (tokType) {
case 1087373318:
for (i = i0; i >= 0; i = bsInfo.nextSetBit (i + 1)) {
var j = this.at[i].group.selectAtoms (bs);
if (j > i) i = j;
}
break;
case 1095766030:
for (i = i0; i >= 0; i = bsInfo.nextSetBit (i + 1)) {
if (bs.get (i)) continue;
iModel = this.at[i].mi;
bs.set (i);
for (var j = i; --j >= 0; ) if (this.at[j].mi == iModel) bs.set (j);
 else break;

for (; ++i < this.ac; ) if (this.at[i].mi == iModel) bs.set (i);
 else break;

}
break;
case 1087373316:
bsInfo = JU.BSUtil.copy (specInfo);
for (i = bsInfo.nextSetBit (0); i >= 0; i = bsInfo.nextSetBit (i + 1)) {
var chain = this.at[i].getChain ();
chain.setAtomBitSet (bs);
bsInfo.andNot (bs);
}
break;
case 1095761937:
for (i = i0; i >= 0; i = bsInfo.nextSetBit (i + 1)) {
if (bs.get (i)) continue;
iPolymer = this.at[i].getPolymerIndexInModel ();
bs.set (i);
for (var j = i; --j >= 0; ) if (this.at[j].getPolymerIndexInModel () == iPolymer) bs.set (j);
 else break;

for (; ++i < this.ac; ) if (this.at[i].getPolymerIndexInModel () == iPolymer) bs.set (i);
 else break;

}
break;
case 1641025539:
for (i = i0; i >= 0; i = bsInfo.nextSetBit (i + 1)) {
if (bs.get (i)) continue;
var structure = this.at[i].group.getStructure ();
bs.set (i);
for (var j = i; --j >= 0; ) if (this.at[j].group.getStructure () === structure) bs.set (j);
 else break;

for (; ++i < this.ac; ) if (this.at[i].group.getStructure () === structure) bs.set (i);
 else break;

}
break;
}
if (i == 0) JU.Logger.error ("MISSING getAtomBits entry for " + JS.T.nameOf (tokType));
return bs;
}, "~N,~O");
Clazz_defineMethod (c$, "getWaterAtoms", 
 function (bs) {
var hs =  Clazz_newIntArray (2, 0);
var a;
for (var i = this.ac; --i >= 0; ) {
var g = this.at[i].getGroupID ();
if (g >= 42 && g < 45) {
bs.set (i);
} else if ((a = this.at[i]).getElementNumber () == 8 && a.getCovalentBondCount () == 2) {
var bonds = a.bonds;
var n = 0;
var b;
for (var j = bonds.length; --j >= 0 && n < 3; ) if (bonds[j].isCovalent () && (b = bonds[j].getOtherAtom (a)).getElementNumber () == 1) hs[n++ % 2] = b.i;

if (n == 2) {
bs.set (hs[1]);
bs.set (hs[0]);
bs.set (i);
}}}
return bs;
}, "JU.BS");
Clazz_defineMethod (c$, "getIdentifierOrNull", 
 function (identifier) {
var bs = this.getSpecNameOrNull (identifier, false);
if (identifier.indexOf ("\\?") >= 0) identifier = JU.PT.rep (identifier, "\\?", "\1");
if (bs != null || identifier.indexOf ("?") > 0) return bs;
if (identifier.indexOf ("*") > 0) {
return this.getSpecNameOrNull (identifier, true);
}var len = identifier.length;
var pt = 0;
while (pt < len && JU.PT.isLetter (identifier.charAt (pt))) ++pt;

bs = this.getSpecNameOrNull (identifier.substring (0, pt), false);
if (pt == len) return bs;
if (bs == null) bs =  new JU.BS ();
var pt0 = pt;
while (pt < len && JU.PT.isDigit (identifier.charAt (pt))) ++pt;

var seqNumber = 0;
try {
seqNumber = Integer.parseInt (identifier.substring (pt0, pt));
} catch (nfe) {
if (Clazz_exceptionOf (nfe, NumberFormatException)) {
return null;
} else {
throw nfe;
}
}
var insertionCode = ' ';
if (pt < len && identifier.charAt (pt) == '^') if (++pt < len) insertionCode = identifier.charAt (pt);
var seqcode = JM.Group.getSeqcodeFor (seqNumber, insertionCode);
var bsInsert = this.getSeqcodeBits (seqcode, false);
if (bsInsert == null) {
if (insertionCode != ' ') bsInsert = this.getSeqcodeBits (Character.toUpperCase (identifier.charAt (pt)).charCodeAt (0), false);
if (bsInsert == null) return null;
pt++;
}bs.and (bsInsert);
if (pt >= len) return bs;
if (pt != len - 1) return null;
bs.and (this.getChainBits (identifier.charCodeAt (pt)));
return bs;
}, "~S");
Clazz_defineMethod (c$, "getSpecName", 
 function (name) {
var bs = this.getSpecNameOrNull (name, false);
if (bs != null) return bs;
if (name.indexOf ("*") > 0) bs = this.getSpecNameOrNull (name, true);
return (bs == null ?  new JU.BS () : bs);
}, "~S");
Clazz_defineMethod (c$, "getSpecNameOrNull", 
 function (name, checkStar) {
var bs = null;
name = name.toUpperCase ();
if (name.indexOf ("\\?") >= 0) name = JU.PT.rep (name, "\\?", "\1");
var allowInitialStar = name.startsWith ("?*");
if (allowInitialStar) name = name.substring (1);
for (var i = this.ac; --i >= 0; ) {
var g3 = this.at[i].getGroup3 (true);
if (g3 != null && g3.length > 0) {
if (JU.PT.isMatch (g3, name, checkStar, true)) {
if (bs == null) bs = JU.BS.newN (i + 1);
bs.set (i);
while (--i >= 0 && this.at[i].getGroup3 (true).equals (g3)) bs.set (i);

i++;
}} else if (this.isAtomNameMatch (this.at[i], name, checkStar, allowInitialStar)) {
if (bs == null) bs = JU.BS.newN (i + 1);
bs.set (i);
}}
return bs;
}, "~S,~B");
Clazz_defineMethod (c$, "isAtomNameMatch", 
 function (atom, strPattern, checkStar, allowInitialStar) {
return JU.PT.isMatch (atom.getAtomName ().toUpperCase (), strPattern, checkStar, allowInitialStar);
}, "JM.Atom,~S,~B,~B");
Clazz_defineMethod (c$, "getSeqcodeBits", 
function (seqcode, returnEmpty) {
var bs =  new JU.BS ();
var seqNum = JM.Group.getSeqNumberFor (seqcode);
var haveSeqNumber = (seqNum != 2147483647);
var isEmpty = true;
var insCode = JM.Group.getInsertionCodeChar (seqcode);
switch (insCode) {
case '?':
for (var i = this.ac; --i >= 0; ) {
var atomSeqcode = this.at[i].getSeqcode ();
if (!haveSeqNumber || seqNum == JM.Group.getSeqNumberFor (atomSeqcode) && JM.Group.getInsertionCodeFor (atomSeqcode) != 0) {
bs.set (i);
isEmpty = false;
}}
break;
default:
for (var i = this.ac; --i >= 0; ) {
var atomSeqcode = this.at[i].getSeqcode ();
if (seqcode == atomSeqcode || !haveSeqNumber && seqcode == JM.Group.getInsertionCodeFor (atomSeqcode) || insCode == '*' && seqNum == JM.Group.getSeqNumberFor (atomSeqcode)) {
bs.set (i);
isEmpty = false;
}}
}
return (!isEmpty || returnEmpty ? bs : null);
}, "~N,~B");
Clazz_defineMethod (c$, "getChainBits", 
function (chainID) {
var caseSensitive = this.vwr.getBoolean (603979823);
if (chainID >= 0 && chainID < 300 && !caseSensitive) chainID = JM.AtomCollection.chainToUpper (chainID);
var bs =  new JU.BS ();
var bsDone = JU.BS.newN (this.ac);
var id;
for (var i = bsDone.nextClearBit (0); i < this.ac; i = bsDone.nextClearBit (i + 1)) {
var chain = this.at[i].getChain ();
if (chainID == (id = chain.chainID) || !caseSensitive && id >= 0 && id < 300 && chainID == JM.AtomCollection.chainToUpper (id)) {
chain.setAtomBitSet (bs);
bsDone.or (bs);
} else {
chain.setAtomBitSet (bsDone);
}}
return bs;
}, "~N");
c$.chainToUpper = Clazz_defineMethod (c$, "chainToUpper", 
function (chainID) {
return (chainID >= 97 && chainID <= 122 ? chainID - 32 : chainID >= 256 && chainID < 300 ? chainID - 191 : chainID);
}, "~N");
Clazz_defineMethod (c$, "getAtomIndices", 
function (bs) {
var n = 0;
var indices =  Clazz_newIntArray (this.ac, 0);
for (var j = bs.nextSetBit (0); j >= 0 && j < this.ac; j = bs.nextSetBit (j + 1)) indices[j] = ++n;

return indices;
}, "JU.BS");
Clazz_defineMethod (c$, "getAtomsNearPlane", 
function (distance, plane) {
var bsResult =  new JU.BS ();
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
var d = JU.Measure.distanceToPlane (plane, atom);
if (distance > 0 && d >= -0.1 && d <= distance || distance < 0 && d <= 0.1 && d >= distance || distance == 0 && Math.abs (d) < 0.01) bsResult.set (atom.i);
}
return bsResult;
}, "~N,JU.P4");
Clazz_defineMethod (c$, "getAtomsNearPts", 
function (distance, points, bsInclude) {
var bsResult =  new JU.BS ();
if (points.length == 0 || bsInclude != null && bsInclude.cardinality () == 0) return bsResult;
if (bsInclude == null) bsInclude = JU.BSUtil.setAll (points.length);
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
for (var j = bsInclude.nextSetBit (0); j >= 0; j = bsInclude.nextSetBit (j + 1)) if (atom.distance (points[j]) < distance) {
bsResult.set (i);
break;
}
}
return bsResult;
}, "~N,~A,JU.BS");
Clazz_defineMethod (c$, "clearVisibleSets", 
function () {
this.haveBSVisible = false;
this.haveBSClickable = false;
});
Clazz_defineMethod (c$, "getRenderable", 
function (bsAtoms) {
this.clearVisibleSets ();
bsAtoms.clearAll ();
for (var i = this.ac; --i >= 0; ) if (this.at[i].isVisible (1)) bsAtoms.set (i);

}, "JU.BS");
Clazz_defineMethod (c$, "getVisibleSet", 
function (forceNew) {
if (forceNew) this.vwr.setModelVisibility ();
 else if (this.haveBSVisible) return this.bsVisible;
this.bsVisible.clearAll ();
for (var i = this.ac; --i >= 0; ) if (this.at[i].checkVisible ()) this.bsVisible.set (i);

this.haveBSVisible = true;
return this.bsVisible;
}, "~B");
Clazz_defineMethod (c$, "getClickableSet", 
function (forceNew) {
if (forceNew) this.vwr.setModelVisibility ();
 else if (this.haveBSClickable) return this.bsClickable;
this.bsClickable.clearAll ();
for (var i = this.ac; --i >= 0; ) if (this.at[i].isClickable ()) this.bsClickable.set (i);

this.haveBSClickable = true;
return this.bsClickable;
}, "~B");
Clazz_defineMethod (c$, "isModulated", 
function (i) {
return this.bsModulated != null && this.bsModulated.get (i);
}, "~N");
Clazz_defineMethod (c$, "deleteModelAtoms", 
function (firstAtomIndex, nAtoms, bsAtoms) {
this.at = JU.AU.deleteElements (this.at, firstAtomIndex, nAtoms);
this.ac = this.at.length;
for (var j = firstAtomIndex; j < this.ac; j++) {
this.at[j].i = j;
this.at[j].mi--;
}
if (this.bsModulated != null) JU.BSUtil.deleteBits (this.bsModulated, bsAtoms);
this.deleteAtomTensors (bsAtoms);
this.atomNames = JU.AU.deleteElements (this.atomNames, firstAtomIndex, nAtoms);
this.atomTypes = JU.AU.deleteElements (this.atomTypes, firstAtomIndex, nAtoms);
this.atomSerials = JU.AU.deleteElements (this.atomSerials, firstAtomIndex, nAtoms);
this.atomSeqIDs = JU.AU.deleteElements (this.atomSeqIDs, firstAtomIndex, nAtoms);
this.bfactor100s = JU.AU.deleteElements (this.bfactor100s, firstAtomIndex, nAtoms);
this.hasBfactorRange = false;
this.occupancies = JU.AU.deleteElements (this.occupancies, firstAtomIndex, nAtoms);
this.partialCharges = JU.AU.deleteElements (this.partialCharges, firstAtomIndex, nAtoms);
this.atomTensorList = JU.AU.deleteElements (this.atomTensorList, firstAtomIndex, nAtoms);
this.vibrations = JU.AU.deleteElements (this.vibrations, firstAtomIndex, nAtoms);
this.nSurfaceAtoms = 0;
this.bsSurface = null;
this.surfaceDistance100s = null;
if (this.tainted != null) for (var i = 0; i < 15; i++) JU.BSUtil.deleteBits (this.tainted[i], bsAtoms);

}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "getAtomIdentityInfo", 
function (i, info, ptTemp) {
info.put ("_ipt", Integer.$valueOf (i));
info.put ("atomIndex", Integer.$valueOf (i));
info.put ("atomno", Integer.$valueOf (this.at[i].getAtomNumber ()));
info.put ("info", this.getAtomInfo (i, null, ptTemp));
info.put ("sym", this.at[i].getElementSymbol ());
}, "~N,java.util.Map,JU.P3");
Clazz_defineMethod (c$, "getAtomTensorList", 
function (i) {
return (i < 0 || this.atomTensorList == null || i >= this.atomTensorList.length ? null : this.atomTensorList[i]);
}, "~N");
Clazz_defineMethod (c$, "deleteAtomTensors", 
 function (bsAtoms) {
if (this.atomTensors == null) return;
var toDelete =  new JU.Lst ();
for (var key, $key = this.atomTensors.keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) {
var list = this.atomTensors.get (key);
for (var i = list.size (); --i >= 0; ) {
var t = list.get (i);
if (bsAtoms.get (t.atomIndex1) || t.atomIndex2 >= 0 && bsAtoms.get (t.atomIndex2)) list.remove (i);
}
if (list.size () == 0) toDelete.addLast (key);
}
for (var i = toDelete.size (); --i >= 0; ) this.atomTensors.remove (toDelete.get (i));

}, "JU.BS");
Clazz_defineMethod (c$, "setAtomTensors", 
function (atomIndex, list) {
if (list == null || list.size () == 0) return;
if (this.atomTensors == null) this.atomTensors =  new java.util.Hashtable ();
if (this.atomTensorList == null) this.atomTensorList =  new Array (this.at.length);
this.atomTensorList = JU.AU.ensureLength (this.atomTensorList, this.at.length);
this.atomTensorList[atomIndex] = JM.AtomCollection.getTensorList (list);
for (var i = list.size (); --i >= 0; ) {
var t = list.get (i);
t.atomIndex1 = atomIndex;
t.atomIndex2 = -1;
t.modelIndex = this.at[atomIndex].mi;
this.addTensor (t, t.type);
if (t.altType != null) this.addTensor (t, t.altType);
}
}, "~N,JU.Lst");
c$.getTensorList = Clazz_defineMethod (c$, "getTensorList", 
 function (list) {
var pt = -1;
var haveTLS = false;
var n = list.size ();
for (var i = n; --i >= 0; ) {
var t = list.get (i);
if (t.forThermalEllipsoid) pt = i;
 else if (t.iType == 2) haveTLS = true;
}
var a =  new Array ((pt >= 0 || !haveTLS ? 0 : 1) + n);
if (pt >= 0) {
a[0] = list.get (pt);
if (list.size () == 1) return a;
}if (haveTLS) {
pt = 0;
for (var i = n; --i >= 0; ) {
var t = list.get (i);
if (t.forThermalEllipsoid) continue;
a[++pt] = t;
}
} else {
for (var i = 0; i < n; i++) a[i] = list.get (i);

}return a;
}, "JU.Lst");
Clazz_defineMethod (c$, "getAtomTensor", 
function (i, type) {
var tensors = this.getAtomTensorList (i);
if (tensors != null && type != null) {
type = type.toLowerCase ();
for (var j = 0; j < tensors.length; j++) {
var t = tensors[j];
if (t != null && (type.equals (t.type) || type.equals (t.altType))) return t;
}
}return null;
}, "~N,~S");
Clazz_defineMethod (c$, "addTensor", 
function (t, type) {
type = type.toLowerCase ();
var tensors = this.atomTensors.get (type);
if (tensors == null) this.atomTensors.put (type, tensors =  new JU.Lst ());
tensors.addLast (t);
}, "JU.Tensor,~S");
Clazz_defineMethod (c$, "getAllAtomTensors", 
function (type) {
if (this.atomTensors == null) return null;
if (type != null) return this.atomTensors.get (type.toLowerCase ());
var list =  new JU.Lst ();
for (var e, $e = this.atomTensors.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) list.addAll (e.getValue ());

return list;
}, "~S");
Clazz_defineMethod (c$, "scaleVectorsToMax", 
function (max) {
if (this.vibrations == null || max == 0) return;
var m = 0;
var bsVib = JU.BS.newN (this.ac);
for (var i = this.vibrations.length; --i >= 0; ) {
var v = this.getVibration (i, false);
if (v != null && (v.modDim == -1 || v.modDim == -2)) {
m = Math.max (m, v.length ());
bsVib.set (i);
}}
if (m == 0 || m == max) return;
m = max / m;
var ok = false;
for (var i = bsVib.nextSetBit (0); i >= 0; i = bsVib.nextSetBit (i + 1)) {
var v = this.getVibration (i, false);
var mod = this.getModulation (i);
if (mod != null) mod.scaleVibration (m);
 else v.scale (m);
if (!ok) {
this.taintAtom (i, 12);
ok = true;
}}
this.tainted[12].or (bsVib);
}, "~N");
c$.$AtomCollection$AtomSorter$ = function () {
Clazz_pu$h(self.c$);
c$ = Clazz_decorateAsClass (function () {
Clazz_prepareCallback (this, arguments);
Clazz_instantialize (this, arguments);
}, JM.AtomCollection, "AtomSorter", null, java.util.Comparator);
Clazz_overrideMethod (c$, "compare", 
function (a, b) {
return (a.i > b.i ? 1 : a.i < b.i ? -1 : 0);
}, "JM.Atom,JM.Atom");
c$ = Clazz_p0p ();
};
Clazz_defineStatics (c$,
"TAINT_ATOMNAME", 0,
"TAINT_ATOMTYPE", 1,
"TAINT_COORD", 2,
"TAINT_ELEMENT", 3,
"TAINT_FORMALCHARGE", 4,
"TAINT_HYDROPHOBICITY", 5,
"TAINT_BONDINGRADIUS", 6,
"TAINT_OCCUPANCY", 7,
"TAINT_PARTIALCHARGE", 8,
"TAINT_TEMPERATURE", 9,
"TAINT_VALENCE", 10,
"TAINT_VANDERWAALS", 11,
"TAINT_VIBRATION", 12,
"TAINT_ATOMNO", 13,
"TAINT_SEQID", 14,
"TAINT_MAX", 15,
"userSettableValues", null,
"almost180", 2.984513);
c$.sqrt3_2 = c$.prototype.sqrt3_2 = (Math.sqrt (3) / 2);
c$.vRef = c$.prototype.vRef = JU.V3.new3 (3.14159, 2.71828, 1.41421);
});
Clazz_declarePackage ("JM");
Clazz_load (["J.api.AtomIndexIterator"], "JM.AtomIteratorWithinModel", ["J.atomdata.RadiusData"], function () {
c$ = Clazz_decorateAsClass (function () {
this.cubeIterator = null;
this.bspf = null;
this.threadSafe = false;
this.hemisphereOnly = false;
this.isZeroBased = false;
this.modelIndex = 2147483647;
this.atomIndex = -1;
this.zeroBase = 0;
this.distanceSquared = 0;
this.bsSelected = null;
this.isGreaterOnly = false;
this.checkGreater = false;
this.radiusData = null;
this.vdw1 = 0;
this.isVdw = false;
this.atoms = null;
this.vwr = null;
this.iNext = 0;
Clazz_instantialize (this, arguments);
}, JM, "AtomIteratorWithinModel", null, J.api.AtomIndexIterator);
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "initialize", 
function (bspf, bsSelected, isGreaterOnly, isZeroBased, hemisphereOnly, threadSafe) {
this.bspf = bspf;
this.bsSelected = bsSelected;
this.isGreaterOnly = isGreaterOnly;
this.isZeroBased = isZeroBased;
this.hemisphereOnly = hemisphereOnly;
this.threadSafe = threadSafe;
this.cubeIterator = null;
}, "J.bspt.Bspf,JU.BS,~B,~B,~B,~B");
Clazz_overrideMethod (c$, "setModel", 
function (modelSet, modelIndex, firstModelAtom, atomIndex, center, distance, rd) {
if (this.threadSafe) modelIndex = -1 - modelIndex;
if (modelIndex != this.modelIndex || this.cubeIterator == null) {
this.cubeIterator = this.bspf.getCubeIterator (modelIndex);
this.modelIndex = modelIndex;
}this.zeroBase = (this.isZeroBased ? firstModelAtom : 0);
if (distance == -2147483648) return;
this.atomIndex = (distance < 0 ? -1 : atomIndex);
this.isVdw = (rd != null);
if (this.isVdw) {
this.radiusData = rd;
this.atoms = modelSet.at;
this.vwr = modelSet.vwr;
distance = (rd.factorType === J.atomdata.RadiusData.EnumType.OFFSET ? 5 + rd.value : 5 * rd.value);
this.vdw1 = this.atoms[atomIndex].getVanderwaalsRadiusFloat (this.vwr, rd.vdwType);
}this.checkGreater = (this.isGreaterOnly && atomIndex != 2147483647);
this.setCenter (center, distance);
}, "JM.ModelSet,~N,~N,~N,JU.T3,~N,J.atomdata.RadiusData");
Clazz_overrideMethod (c$, "setCenter", 
function (center, distance) {
this.setCenter2 (center, distance);
}, "JU.T3,~N");
Clazz_defineMethod (c$, "setCenter2", 
function (center, distance) {
if (this.cubeIterator == null) return;
this.cubeIterator.initialize (center, distance, this.hemisphereOnly);
this.distanceSquared = distance * distance;
}, "JU.T3,~N");
Clazz_overrideMethod (c$, "hasNext", 
function () {
return this.hasNext2 ();
});
Clazz_defineMethod (c$, "hasNext2", 
function () {
if (this.atomIndex >= 0) while (this.cubeIterator.hasMoreElements ()) {
var a = this.cubeIterator.nextElement ();
if ((this.iNext = a.i) != this.atomIndex && (!this.checkGreater || this.iNext > this.atomIndex) && (this.bsSelected == null || this.bsSelected.get (this.iNext))) {
return true;
}}
 else if (this.cubeIterator.hasMoreElements ()) {
var a = this.cubeIterator.nextElement ();
this.iNext = a.i;
return true;
}this.iNext = -1;
return false;
});
Clazz_overrideMethod (c$, "next", 
function () {
return this.iNext - this.zeroBase;
});
Clazz_overrideMethod (c$, "foundDistance2", 
function () {
return (this.cubeIterator == null ? -1 : this.cubeIterator.foundDistance2 ());
});
Clazz_overrideMethod (c$, "addAtoms", 
function (bsResult) {
var iAtom;
while (this.hasNext ()) if ((iAtom = this.next ()) >= 0) {
var d;
if (this.isVdw) {
d = this.atoms[iAtom].getVanderwaalsRadiusFloat (this.vwr, this.radiusData.vdwType) + this.vdw1;
switch (this.radiusData.factorType) {
case J.atomdata.RadiusData.EnumType.OFFSET:
d += this.radiusData.value * 2;
break;
case J.atomdata.RadiusData.EnumType.FACTOR:
d *= this.radiusData.value;
break;
}
d *= d;
} else {
d = this.distanceSquared;
}if (this.foundDistance2 () <= d) bsResult.set (iAtom);
}
}, "JU.BS");
Clazz_overrideMethod (c$, "release", 
function () {
if (this.cubeIterator != null) {
this.cubeIterator.release ();
this.cubeIterator = null;
}});
});
Clazz_declarePackage ("JM");
Clazz_load (["JM.AtomIteratorWithinModel"], "JM.AtomIteratorWithinModelSet", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.bsModels = null;
this.center = null;
this.distance = 0;
Clazz_instantialize (this, arguments);
}, JM, "AtomIteratorWithinModelSet", JM.AtomIteratorWithinModel);
Clazz_makeConstructor (c$, 
function (bsModels) {
Clazz_superConstructor (this, JM.AtomIteratorWithinModelSet, []);
this.bsModels = bsModels;
}, "JU.BS");
Clazz_overrideMethod (c$, "setCenter", 
function (center, distance) {
this.center = center;
this.distance = distance;
this.set (0);
}, "JU.T3,~N");
Clazz_defineMethod (c$, "set", 
 function (iModel) {
if ((this.modelIndex = this.bsModels.nextSetBit (iModel)) < 0 || (this.cubeIterator = this.bspf.getCubeIterator (this.modelIndex)) == null) return false;
this.setCenter2 (this.center, this.distance);
return true;
}, "~N");
Clazz_overrideMethod (c$, "hasNext", 
function () {
if (this.hasNext2 ()) return true;
if (!this.set (this.modelIndex + 1)) return false;
return this.hasNext ();
});
});
Clazz_declarePackage ("JM");
Clazz_load (["JU.Edge", "JV.JC"], "JM.Bond", ["JU.C"], function () {
c$ = Clazz_decorateAsClass (function () {
this.atom1 = null;
this.atom2 = null;
this.mad = 0;
this.colix = 0;
this.shapeVisibilityFlags = 0;
Clazz_instantialize (this, arguments);
}, JM, "Bond", JU.Edge);
Clazz_makeConstructor (c$, 
function (atom1, atom2, order, mad, colix) {
this.atom1 = atom1;
this.atom2 = atom2;
this.colix = colix;
this.setOrder (order);
this.setMad (mad);
}, "JM.Atom,JM.Atom,~N,~N,~N");
Clazz_defineMethod (c$, "setMad", 
function (mad) {
this.mad = mad;
this.setShapeVisibility (mad != 0);
}, "~N");
Clazz_defineMethod (c$, "setShapeVisibility", 
function (isVisible) {
var wasVisible = ((this.shapeVisibilityFlags & JM.Bond.myVisibilityFlag) != 0);
if (wasVisible == isVisible) return;
this.atom1.addDisplayedBond (JM.Bond.myVisibilityFlag, isVisible);
this.atom2.addDisplayedBond (JM.Bond.myVisibilityFlag, isVisible);
if (isVisible) this.shapeVisibilityFlags |= JM.Bond.myVisibilityFlag;
 else this.shapeVisibilityFlags &= ~JM.Bond.myVisibilityFlag;
}, "~B");
Clazz_defineMethod (c$, "getIdentity", 
function () {
return (this.index + 1) + " " + JU.Edge.getBondOrderNumberFromOrder (this.order) + " " + this.atom1.getInfo () + " -- " + this.atom2.getInfo () + " " + this.atom1.distance (this.atom2);
});
Clazz_overrideMethod (c$, "isCovalent", 
function () {
return (this.order & 1023) != 0;
});
Clazz_overrideMethod (c$, "isHydrogen", 
function () {
return JM.Bond.isOrderH (this.order);
});
c$.isOrderH = Clazz_defineMethod (c$, "isOrderH", 
function (order) {
return (order & 30720) != 0;
}, "~N");
Clazz_defineMethod (c$, "isStereo", 
function () {
return (this.order & 1024) != 0;
});
Clazz_defineMethod (c$, "isPartial", 
function () {
return (this.order & 224) != 0;
});
Clazz_defineMethod (c$, "isAromatic", 
function () {
return (this.order & 512) != 0;
});
Clazz_defineMethod (c$, "isPymolStyle", 
function () {
return (this.order & 98304) == 98304;
});
Clazz_defineMethod (c$, "getEnergy", 
function () {
return 0;
});
Clazz_defineMethod (c$, "getValence", 
function () {
return (!this.isCovalent () ? 0 : this.isPartial () || this.is (515) ? 1 : this.order & 7);
});
Clazz_defineMethod (c$, "deleteAtomReferences", 
function () {
if (this.atom1 != null) this.atom1.deleteBond (this);
if (this.atom2 != null) this.atom2.deleteBond (this);
this.atom1 = this.atom2 = null;
});
Clazz_defineMethod (c$, "setTranslucent", 
function (isTranslucent, translucentLevel) {
this.colix = JU.C.getColixTranslucent3 (this.colix, isTranslucent, translucentLevel);
}, "~B,~N");
Clazz_defineMethod (c$, "setOrder", 
function (order) {
if (this.atom1.getElementNumber () == 16 && this.atom2.getElementNumber () == 16) order |= 256;
if (order == 512) order = 515;
this.order = order | (this.order & 131072);
}, "~N");
Clazz_overrideMethod (c$, "getAtomIndex1", 
function () {
return this.atom1.i;
});
Clazz_overrideMethod (c$, "getAtomIndex2", 
function () {
return this.atom2.i;
});
Clazz_overrideMethod (c$, "getCovalentOrder", 
function () {
return JU.Edge.getCovalentBondOrder (this.order);
});
Clazz_defineMethod (c$, "getOtherAtom", 
function (thisAtom) {
return (this.atom1 === thisAtom ? this.atom2 : this.atom2 === thisAtom ? this.atom1 : null);
}, "JM.Atom");
Clazz_defineMethod (c$, "is", 
function (bondType) {
return (this.order & -131073) == bondType;
}, "~N");
Clazz_overrideMethod (c$, "getOtherAtomNode", 
function (thisAtom) {
return (this.atom1 === thisAtom ? this.atom2 : this.atom2 === thisAtom ? this.atom1 : null);
}, "JU.Node");
Clazz_overrideMethod (c$, "toString", 
function () {
return this.atom1 + " - " + this.atom2;
});
c$.myVisibilityFlag = c$.prototype.myVisibilityFlag = JV.JC.getShapeVisibilityFlag (1);
});
Clazz_declarePackage ("JM");
Clazz_load (["JM.AtomCollection"], "JM.BondCollection", ["JU.AU", "$.BS", "JM.Bond", "$.BondIteratorSelected", "$.HBond", "JU.BSUtil", "$.C", "$.Edge", "$.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.bo = null;
this.bondCount = 0;
this.numCached = null;
this.freeBonds = null;
this.molecules = null;
this.moleculeCount = 0;
this.defaultCovalentMad = 0;
this.bsAromaticSingle = null;
this.bsAromaticDouble = null;
this.bsAromatic = null;
this.haveHiddenBonds = false;
Clazz_instantialize (this, arguments);
}, JM, "BondCollection", JM.AtomCollection);
Clazz_defineMethod (c$, "setupBC", 
function () {
this.bsAromatic =  new JU.BS ();
this.numCached =  Clazz_newIntArray (5, 0);
this.freeBonds =  new Array (5);
for (var i = 5; --i > 0; ) this.freeBonds[i] =  new Array (200);

this.setupAC ();
});
Clazz_overrideMethod (c$, "releaseModelSet", 
function () {
this.releaseModelSetBC ();
});
Clazz_defineMethod (c$, "releaseModelSetBC", 
function () {
this.bo = null;
this.freeBonds = null;
this.releaseModelSetAC ();
});
Clazz_defineMethod (c$, "resetMolecules", 
function () {
this.molecules = null;
this.moleculeCount = 0;
});
Clazz_defineMethod (c$, "getBondIteratorForType", 
function (bondType, bsAtoms) {
return  new JM.BondIteratorSelected (this.bo, this.bondCount, bondType, bsAtoms, this.vwr.getBoolean (603979812));
}, "~N,JU.BS");
Clazz_defineMethod (c$, "getBondIterator", 
function (bsBonds) {
return  new JM.BondIteratorSelected (this.bo, this.bondCount, 131071, bsBonds, false);
}, "JU.BS");
Clazz_defineMethod (c$, "getBondColix1", 
function (i) {
return JU.C.getColixInherited (this.bo[i].colix, this.bo[i].atom1.colixAtom);
}, "~N");
Clazz_defineMethod (c$, "getBondColix2", 
function (i) {
return JU.C.getColixInherited (this.bo[i].colix, this.bo[i].atom2.colixAtom);
}, "~N");
Clazz_defineMethod (c$, "getBondCountInModel", 
function (modelIndex) {
var n = 0;
for (var i = this.bondCount; --i >= 0; ) if (this.bo[i].atom1.mi == modelIndex) n++;

return n;
}, "~N");
Clazz_defineMethod (c$, "getBondsForSelectedAtoms", 
function (bsAtoms, bondSelectionModeOr) {
var bs =  new JU.BS ();
for (var iBond = 0; iBond < this.bondCount; ++iBond) {
var bond = this.bo[iBond];
var isSelected1 = bsAtoms.get (bond.atom1.i);
var isSelected2 = bsAtoms.get (bond.atom2.i);
if (( new Boolean (!bondSelectionModeOr & isSelected1 & isSelected2).valueOf ()) || ( new Boolean (bondSelectionModeOr & ( new Boolean (isSelected1 | isSelected2).valueOf ())).valueOf ())) bs.set (iBond);
}
return bs;
}, "JU.BS,~B");
Clazz_defineMethod (c$, "bondAtoms", 
function (atom1, atom2, order, mad, bsBonds, energy, addGroup, isNew) {
var bond = this.getOrAddBond (atom1, atom2, order, mad, bsBonds, energy, true);
if (isNew) {
bond.order |= 131072;
if (addGroup) {
atom1.group = atom2.group;
atom1.group.addAtoms (atom1.i);
}}return bond;
}, "JM.Atom,JM.Atom,~N,~N,JU.BS,~N,~B,~B");
Clazz_defineMethod (c$, "getOrAddBond", 
function (atom, atomOther, order, mad, bsBonds, energy, overrideBonding) {
var i;
if (order == 131071 || order == 65535) order = 1;
if (atom.isBonded (atomOther)) {
i = atom.getBond (atomOther).index;
if (overrideBonding) {
this.bo[i].setOrder (order);
this.bo[i].setMad (mad);
if (Clazz_instanceOf (this.bo[i], JM.HBond)) (this.bo[i]).energy = energy;
}} else {
if (this.bondCount == this.bo.length) this.bo = JU.AU.arrayCopyObject (this.bo, this.bondCount + 250);
i = this.setBond (this.bondCount++, this.bondMutually (atom, atomOther, order, mad, energy)).index;
}if (bsBonds != null) bsBonds.set (i);
return this.bo[i];
}, "JM.Atom,JM.Atom,~N,~N,JU.BS,~N,~B");
Clazz_defineMethod (c$, "setBond", 
function (index, bond) {
return this.bo[bond.index = index] = bond;
}, "~N,JM.Bond");
Clazz_defineMethod (c$, "bondMutually", 
function (atom, atomOther, order, mad, energy) {
var bond;
if (JM.Bond.isOrderH (order)) {
bond =  new JM.HBond (atom, atomOther, order, mad, 0, energy);
} else {
bond =  new JM.Bond (atom, atomOther, order, mad, 0);
}this.addBondToAtom (atom, bond);
this.addBondToAtom (atomOther, bond);
return bond;
}, "JM.Atom,JM.Atom,~N,~N,~N");
Clazz_defineMethod (c$, "addBondToAtom", 
 function (atom, bond) {
if (atom.bonds == null) {
atom.bonds =  new Array (1);
atom.bonds[0] = bond;
} else {
atom.bonds = this.addToBonds (bond, atom.bonds);
}}, "JM.Atom,JM.Bond");
Clazz_defineMethod (c$, "addToBonds", 
 function (newBond, oldBonds) {
var newBonds;
if (oldBonds == null) {
if (this.numCached[1] > 0) newBonds = this.freeBonds[1][--this.numCached[1]];
 else newBonds =  new Array (1);
newBonds[0] = newBond;
} else {
var oldLength = oldBonds.length;
var newLength = oldLength + 1;
if (newLength < 5 && this.numCached[newLength] > 0) newBonds = this.freeBonds[newLength][--this.numCached[newLength]];
 else newBonds =  new Array (newLength);
newBonds[oldLength] = newBond;
for (var i = oldLength; --i >= 0; ) newBonds[i] = oldBonds[i];

if (oldLength < 5 && this.numCached[oldLength] < 200) this.freeBonds[oldLength][this.numCached[oldLength]++] = oldBonds;
}return newBonds;
}, "JM.Bond,~A");
Clazz_defineMethod (c$, "addHBond", 
function (atom1, atom2, order, energy) {
if (this.bondCount == this.bo.length) this.bo = JU.AU.arrayCopyObject (this.bo, this.bondCount + 250);
return this.setBond (this.bondCount++, this.bondMutually (atom1, atom2, order, 1, energy)).index;
}, "JM.Atom,JM.Atom,~N,~N");
c$.getBondOrderFull = Clazz_defineMethod (c$, "getBondOrderFull", 
function (bondingRadiusA, bondingRadiusB, distance2, minBondDistance2, bondTolerance) {
if (bondingRadiusA == 0 || bondingRadiusB == 0 || distance2 < minBondDistance2) return 0;
var maxAcceptable = bondingRadiusA + bondingRadiusB + bondTolerance;
var maxAcceptable2 = maxAcceptable * maxAcceptable;
return (distance2 > maxAcceptable2 ? 0 : 1);
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "deleteAllBonds2", 
function () {
this.vwr.setShapeProperty (1, "reset", null);
for (var i = this.bondCount; --i >= 0; ) {
this.bo[i].deleteAtomReferences ();
this.bo[i] = null;
}
this.bondCount = 0;
});
Clazz_defineMethod (c$, "getDefaultMadFromOrder", 
function (order) {
return (JM.Bond.isOrderH (order) ? 1 : order == 32768 ? Clazz_doubleToInt (Math.floor (this.vwr.getFloat (570425406) * 2000)) : this.defaultCovalentMad);
}, "~N");
Clazz_defineMethod (c$, "deleteConnections", 
function (minD, maxD, order, bsA, bsB, isBonds, matchNull) {
var minDIsFraction = (minD < 0);
var maxDIsFraction = (maxD < 0);
var isFractional = (minDIsFraction || maxDIsFraction);
minD = this.fixD (minD, minDIsFraction);
maxD = this.fixD (maxD, maxDIsFraction);
var bsDelete =  new JU.BS ();
var nDeleted = 0;
var newOrder = order |= 131072;
if (!matchNull && JM.Bond.isOrderH (order)) order = 30720;
var bsBonds;
if (isBonds) {
bsBonds = bsA;
} else {
bsBonds =  new JU.BS ();
for (var i = bsA.nextSetBit (0); i >= 0; i = bsA.nextSetBit (i + 1)) {
var a = this.at[i];
if (a.bonds != null) for (var j = a.bonds.length; --j >= 0; ) if (bsB.get (a.getBondedAtomIndex (j))) bsBonds.set (a.bonds[j].index);

}
}for (var i = bsBonds.nextSetBit (0); i < this.bondCount && i >= 0; i = bsBonds.nextSetBit (i + 1)) {
var bond = this.bo[i];
if (!this.isInRange (bond.atom1, bond.atom2, minD, maxD, minDIsFraction, maxDIsFraction, isFractional)) continue;
if (matchNull || newOrder == (bond.order & -257 | 131072) || (order & bond.order & 30720) != 0) {
bsDelete.set (i);
nDeleted++;
}}
if (nDeleted > 0) this.dBm (bsDelete, false);
return [0, nDeleted];
}, "~N,~N,~N,JU.BS,JU.BS,~B,~B");
Clazz_defineMethod (c$, "fixD", 
function (d, isF) {
return (isF ? -d : d * d);
}, "~N,~B");
Clazz_defineMethod (c$, "isInRange", 
function (atom1, atom2, minD, maxD, minFrac, maxfrac, isFractional) {
var d2 = atom1.distanceSquared (atom2);
if (isFractional) {
var dAB = Math.sqrt (d2);
var dABcalc = atom1.getBondingRadius () + atom2.getBondingRadius ();
return ((minFrac ? dAB >= dABcalc * minD : d2 >= minD) && (maxfrac ? dAB <= dABcalc * maxD : d2 <= maxD));
}return (d2 >= minD && d2 <= maxD);
}, "JM.Atom,JM.Atom,~N,~N,~B,~B,~B");
Clazz_defineMethod (c$, "dBm", 
function (bsBonds, isFullModel) {
(this).deleteBonds (bsBonds, isFullModel);
}, "JU.BS,~B");
Clazz_defineMethod (c$, "dBb", 
function (bsBond, isFullModel) {
var iDst = bsBond.nextSetBit (0);
if (iDst < 0) return;
this.resetMolecules ();
var modelIndexLast = -1;
var n = bsBond.cardinality ();
for (var iSrc = iDst; iSrc < this.bondCount; ++iSrc) {
var bond = this.bo[iSrc];
if (n > 0 && bsBond.get (iSrc)) {
n--;
if (!isFullModel) {
var modelIndex = bond.atom1.mi;
if (modelIndex != modelIndexLast) (this).am[modelIndexLast = modelIndex].resetBoundCount ();
}bond.deleteAtomReferences ();
} else {
this.setBond (iDst++, bond);
}}
for (var i = this.bondCount; --i >= iDst; ) this.bo[i] = null;

this.bondCount = iDst;
var sets = this.vwr.getShapeProperty (1, "sets");
if (sets != null) for (var i = 0; i < sets.length; i++) JU.BSUtil.deleteBits (sets[i], bsBond);

JU.BSUtil.deleteBits (this.bsAromatic, bsBond);
}, "JU.BS,~B");
Clazz_defineMethod (c$, "resetAromatic", 
function () {
for (var i = this.bondCount; --i >= 0; ) {
var bond = this.bo[i];
if (bond.isAromatic ()) bond.setOrder (515);
}
});
Clazz_defineMethod (c$, "assignAromaticBondsBs", 
function (isUserCalculation, bsBonds) {
if (!isUserCalculation) this.bsAromatic =  new JU.BS ();
this.bsAromaticSingle =  new JU.BS ();
this.bsAromaticDouble =  new JU.BS ();
var isAll = (bsBonds == null);
var i0 = (isAll ? this.bondCount - 1 : bsBonds.nextSetBit (0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit (i + 1))) {
var bond = this.bo[i];
if (this.bsAromatic.get (i)) bond.setOrder (515);
switch (bond.order & -131073) {
case 515:
this.bsAromatic.set (i);
break;
case 513:
this.bsAromaticSingle.set (i);
break;
case 514:
this.bsAromaticDouble.set (i);
break;
}
}
var bond;
isAll = (bsBonds == null);
i0 = (isAll ? this.bondCount - 1 : bsBonds.nextSetBit (0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit (i + 1))) {
bond = this.bo[i];
if (!bond.is (515) || this.bsAromaticDouble.get (i) || this.bsAromaticSingle.get (i)) continue;
if (!this.assignAromaticDouble (bond)) this.assignAromaticSingle (bond);
}
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsBonds.nextSetBit (i + 1))) {
bond = this.bo[i];
if (this.bsAromaticDouble.get (i)) {
if (!bond.is (514)) {
this.bsAromatic.set (i);
bond.setOrder (514);
}} else if (this.bsAromaticSingle.get (i) || bond.isAromatic ()) {
if (!bond.is (513)) {
this.bsAromatic.set (i);
bond.setOrder (513);
}}}
this.assignAromaticNandO (bsBonds);
this.bsAromaticSingle = null;
this.bsAromaticDouble = null;
}, "~B,JU.BS");
Clazz_defineMethod (c$, "assignAromaticDouble", 
 function (bond) {
var bondIndex = bond.index;
if (this.bsAromaticSingle.get (bondIndex)) return false;
if (this.bsAromaticDouble.get (bondIndex)) return true;
this.bsAromaticDouble.set (bondIndex);
if (!this.assignAromaticSingleForAtom (bond.atom1, bondIndex) || !this.assignAromaticSingleForAtom (bond.atom2, bondIndex)) {
this.bsAromaticDouble.clear (bondIndex);
return false;
}return true;
}, "JM.Bond");
Clazz_defineMethod (c$, "assignAromaticSingle", 
 function (bond) {
var bondIndex = bond.index;
if (this.bsAromaticDouble.get (bondIndex)) return false;
if (this.bsAromaticSingle.get (bondIndex)) return true;
this.bsAromaticSingle.set (bondIndex);
if (!this.assignAromaticDoubleForAtom (bond.atom1) || !this.assignAromaticDoubleForAtom (bond.atom2)) {
this.bsAromaticSingle.clear (bondIndex);
return false;
}return true;
}, "JM.Bond");
Clazz_defineMethod (c$, "assignAromaticSingleForAtom", 
 function (atom, notBondIndex) {
var bonds = atom.bonds;
if (bonds == null || this.assignAromaticSingleHetero (atom)) return false;
for (var i = bonds.length; --i >= 0; ) {
var bond = bonds[i];
var bondIndex = bond.index;
if (bondIndex == notBondIndex || !bond.isAromatic () || this.bsAromaticSingle.get (bondIndex)) continue;
if (this.bsAromaticDouble.get (bondIndex) || !this.assignAromaticSingle (bond)) {
return false;
}}
return true;
}, "JM.Atom,~N");
Clazz_defineMethod (c$, "assignAromaticDoubleForAtom", 
 function (atom) {
var bonds = atom.bonds;
if (bonds == null) return false;
var haveDouble = this.assignAromaticSingleHetero (atom);
var lastBond = -1;
for (var i = bonds.length; --i >= 0; ) {
if (this.bsAromaticDouble.get (bonds[i].index)) haveDouble = true;
if (bonds[i].isAromatic ()) lastBond = i;
}
for (var i = bonds.length; --i >= 0; ) {
var bond = bonds[i];
var bondIndex = bond.index;
if (!bond.isAromatic () || this.bsAromaticDouble.get (bondIndex) || this.bsAromaticSingle.get (bondIndex)) continue;
if (!haveDouble && this.assignAromaticDouble (bond)) haveDouble = true;
 else if ((haveDouble || i < lastBond) && !this.assignAromaticSingle (bond)) {
return false;
}}
return haveDouble;
}, "JM.Atom");
Clazz_defineMethod (c$, "assignAromaticSingleHetero", 
 function (atom) {
var n = atom.getElementNumber ();
switch (n) {
case 6:
case 7:
case 8:
case 16:
break;
default:
return true;
}
var nAtoms = atom.getValence ();
switch (n) {
case 6:
return (nAtoms == 4);
case 7:
case 8:
return (nAtoms == 10 - n && atom.getFormalCharge () < 1);
case 16:
return (nAtoms == 18 - n && atom.getFormalCharge () < 1);
}
return false;
}, "JM.Atom");
Clazz_defineMethod (c$, "assignAromaticNandO", 
 function (bsSelected) {
var bond;
var isAll = (bsSelected == null);
var i0 = (isAll ? this.bondCount - 1 : bsSelected.nextSetBit (0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsSelected.nextSetBit (i + 1))) {
bond = this.bo[i];
if (!bond.is (513)) continue;
var atom1;
var atom2 = bond.atom2;
var n1;
var n2 = atom2.getElementNumber ();
if (n2 == 7 || n2 == 8) {
n1 = n2;
atom1 = atom2;
atom2 = bond.atom1;
n2 = atom2.getElementNumber ();
} else {
atom1 = bond.atom1;
n1 = atom1.getElementNumber ();
}if (n1 != 7 && n1 != 8) continue;
var valence = atom1.getValence ();
if (valence < 0) continue;
var bondorder = atom1.getCovalentBondCount ();
var charge = atom1.getFormalCharge ();
switch (n1) {
case 7:
if (valence == 3 && bondorder == 3 && charge < 1 && n2 == 6 && atom2.getValence () == 3) bond.setOrder (514);
break;
case 8:
if (valence == 1 && charge == 0 && (n2 == 14 || n2 == 16)) bond.setOrder (514);
break;
}
}
}, "JU.BS");
Clazz_defineMethod (c$, "getAtomBitsMDb", 
function (tokType, specInfo) {
var bs;
switch (tokType) {
default:
return this.getAtomBitsMDa (tokType, specInfo);
case 1678770178:
bs =  new JU.BS ();
var bsBonds = specInfo;
for (var i = bsBonds.nextSetBit (0); i >= 0; i = bsBonds.nextSetBit (i + 1)) {
bs.set (this.bo[i].atom1.i);
bs.set (this.bo[i].atom2.i);
}
return bs;
case 1048585:
bs =  new JU.BS ();
for (var i = this.bondCount; --i >= 0; ) if (this.bo[i].isAromatic ()) {
bs.set (this.bo[i].atom1.i);
bs.set (this.bo[i].atom2.i);
}
return bs;
}
}, "~N,~O");
Clazz_defineMethod (c$, "setBondOrder", 
function (bondIndex, type) {
var bondOrder = type.charCodeAt (0) - 48;
var bond = this.bo[bondIndex];
switch (type) {
case '0':
case '1':
case '2':
case '3':
break;
case 'p':
case 'm':
bondOrder = JU.Edge.getBondOrderNumberFromOrder (bond.getCovalentOrder ()).charCodeAt (0) - 48 + (type == 'p' ? 1 : -1);
if (bondOrder > 3) bondOrder = 1;
 else if (bondOrder < 0) bondOrder = 3;
break;
default:
return null;
}
var bsAtoms =  new JU.BS ();
try {
if (bondOrder == 0) {
var bs =  new JU.BS ();
bs.set (bond.index);
bsAtoms.set (bond.atom1.i);
bsAtoms.set (bond.atom2.i);
this.dBm (bs, false);
return bsAtoms;
}bond.setOrder (bondOrder | 131072);
this.removeUnnecessaryBonds (bond.atom1, false);
this.removeUnnecessaryBonds (bond.atom2, false);
bsAtoms.set (bond.atom1.i);
bsAtoms.set (bond.atom2.i);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error ("Exception in seBondOrder: " + e.toString ());
} else {
throw e;
}
}
return bsAtoms;
}, "~N,~S");
Clazz_defineMethod (c$, "removeUnnecessaryBonds", 
function (atom, deleteAtom) {
var bs =  new JU.BS ();
var bsBonds =  new JU.BS ();
var bonds = atom.bonds;
if (bonds == null) return;
for (var i = 0; i < bonds.length; i++) if (bonds[i].isCovalent ()) {
var atom2 = bonds[i].getOtherAtom (atom);
if (atom2.getElementNumber () == 1) bs.set (bonds[i].getOtherAtom (atom).i);
} else {
bsBonds.set (bonds[i].index);
}
if (bsBonds.nextSetBit (0) >= 0) this.dBm (bsBonds, false);
if (deleteAtom) bs.set (atom.i);
if (bs.nextSetBit (0) >= 0) this.vwr.deleteAtoms (bs, false);
}, "JM.Atom,~B");
Clazz_defineMethod (c$, "displayBonds", 
function (bs, isDisplay) {
if (!isDisplay) this.haveHiddenBonds = true;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) if (i < this.bondCount && this.bo[i].mad != 0) this.bo[i].setShapeVisibility (isDisplay);

}, "JM.BondSet,~B");
Clazz_defineStatics (c$,
"BOND_GROWTH_INCREMENT", 250,
"MAX_BONDS_LENGTH_TO_CACHE", 5,
"MAX_NUM_TO_CACHE", 200);
});
Clazz_declarePackage ("JM");
Clazz_declareInterface (JM, "BondIterator");
Clazz_declarePackage ("JM");
Clazz_load (["JM.BondIterator"], "JM.BondIteratorSelected", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.bonds = null;
this.bondCount = 0;
this.bondType = 0;
this.iBond = 0;
this.bsSelected = null;
this.bondSelectionModeOr = false;
Clazz_instantialize (this, arguments);
}, JM, "BondIteratorSelected", null, JM.BondIterator);
Clazz_makeConstructor (c$, 
function (bonds, bondCount, bondType, bsSelected, bondSelectionModeOr) {
this.bonds = bonds;
this.bondCount = bondCount;
this.bondType = bondType;
this.bsSelected = bsSelected;
this.bondSelectionModeOr = bondSelectionModeOr;
}, "~A,~N,~N,JU.BS,~B");
Clazz_overrideMethod (c$, "hasNext", 
function () {
if (this.bondType == 131071) {
this.iBond = this.bsSelected.nextSetBit (this.iBond);
return (this.iBond >= 0 && this.iBond < this.bondCount);
}for (; this.iBond < this.bondCount; ++this.iBond) {
var bond = this.bonds[this.iBond];
if (this.bondType != 65535 && (bond.order & this.bondType) == 0) {
continue;
} else if (this.bondType == 65535 && bond.order != 32768) continue;
var isSelected1 = this.bsSelected.get (bond.atom1.i);
var isSelected2 = this.bsSelected.get (bond.atom2.i);
if ((!this.bondSelectionModeOr && isSelected1 && isSelected2) || (this.bondSelectionModeOr && (isSelected1 || isSelected2))) return true;
}
return false;
});
Clazz_overrideMethod (c$, "nextIndex", 
function () {
return this.iBond;
});
Clazz_overrideMethod (c$, "next", 
function () {
return this.bonds[this.iBond++];
});
});
Clazz_declarePackage ("JM");
Clazz_load (["JU.BS"], "JM.BondSet", ["JU.BSUtil"], function () {
c$ = Clazz_decorateAsClass (function () {
this.associatedAtoms = null;
Clazz_instantialize (this, arguments);
}, JM, "BondSet", JU.BS);
Clazz_makeConstructor (c$, 
function () {
Clazz_superConstructor (this, JM.BondSet, []);
});
c$.newBS = Clazz_defineMethod (c$, "newBS", 
function (bs, atoms) {
var b =  new JM.BondSet ();
JU.BSUtil.copy2 (bs, b);
b.associatedAtoms = atoms;
return b;
}, "JU.BS,~A");
});
Clazz_declarePackage ("JM");
c$ = Clazz_decorateAsClass (function () {
this.model = null;
this.chainID = 0;
this.index = 0;
this.isDna = false;
this.isRna = false;
this.groupCount = 0;
this.groups = null;
this.selectedGroupCount = 0;
Clazz_instantialize (this, arguments);
}, JM, "Chain");
Clazz_defineMethod (c$, "getAtom", 
function (index) {
return this.model.ms.at[index];
}, "~N");
Clazz_makeConstructor (c$, 
function (model, chainID, index) {
this.model = model;
this.chainID = chainID;
this.index = index;
this.groups =  new Array (16);
}, "JM.Model,~N,~N");
Clazz_defineMethod (c$, "calcSelectedGroupsCount", 
function (bsSelected) {
this.selectedGroupCount = 0;
for (var i = 0; i < this.groupCount; i++) this.groups[i].selectedIndex = (this.groups[i].isSelected (bsSelected) ? this.selectedGroupCount++ : -1);

}, "JU.BS");
Clazz_defineMethod (c$, "selectSeqcodeRange", 
function (index0, seqcodeA, seqcodeB, bs) {
var seqcode;
var indexA;
var indexB;
var minDiff;
var isInexact = false;
for (indexA = index0; indexA < this.groupCount && this.groups[indexA].seqcode != seqcodeA; indexA++) {
}
if (indexA == this.groupCount) {
if (index0 > 0) return -1;
isInexact = true;
minDiff = 2147483647;
for (var i = this.groupCount; --i >= 0; ) if ((seqcode = this.groups[i].seqcode) > seqcodeA && (seqcode - seqcodeA) < minDiff) {
indexA = i;
minDiff = seqcode - seqcodeA;
}
if (minDiff == 2147483647) return -1;
}if (seqcodeB == 2147483647) {
indexB = this.groupCount - 1;
isInexact = true;
} else {
for (indexB = indexA; indexB < this.groupCount && this.groups[indexB].seqcode != seqcodeB; indexB++) {
}
if (indexB == this.groupCount) {
if (index0 > 0) return -1;
isInexact = true;
minDiff = 2147483647;
for (var i = indexA; i < this.groupCount; i++) if ((seqcode = this.groups[i].seqcode) < seqcodeB && (seqcodeB - seqcode) < minDiff) {
indexB = i;
minDiff = seqcodeB - seqcode;
}
if (minDiff == 2147483647) return -1;
}}for (var i = indexA; i <= indexB; ++i) this.groups[i].selectAtoms (bs);

return (isInexact ? -1 : indexB + 1);
}, "~N,~N,~N,JU.BS");
Clazz_defineMethod (c$, "fixIndices", 
function (atomsDeleted, bsDeleted) {
for (var i = 0; i < this.groupCount; i++) this.groups[i].fixIndices (atomsDeleted, bsDeleted);

}, "~N,JU.BS");
Clazz_defineMethod (c$, "setAtomBitSet", 
function (bs) {
for (var i = 0; i < this.groupCount; i++) this.groups[i].selectAtoms (bs);

}, "JU.BS");
Clazz_defineMethod (c$, "getIDStr", 
function () {
return (this.chainID == 0 ? "" : this.chainID < 256 ? "" + String.fromCharCode (this.chainID) : this.model.ms.vwr.chainMap.get (Integer.$valueOf (this.chainID)));
});
Clazz_declarePackage ("JM");
Clazz_load (["java.lang.Short", "java.util.Hashtable", "JV.JC"], "JM.Group", ["JU.BS", "$.Quat", "J.c.STR", "JU.BSUtil", "$.Escape", "$.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.groupIndex = 0;
this.group1 = '\0';
this.chain = null;
this.firstAtomIndex = -1;
this.leadAtomIndex = -1;
this.lastAtomIndex = 0;
this.seqcode = 0;
this.groupID = 0;
this.selectedIndex = 0;
this.shapeVisibilityFlags = 0;
this.bsAdded = null;
Clazz_instantialize (this, arguments);
}, JM, "Group");
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "setGroup", 
function (chain, group3, seqcode, firstAtomIndex, lastAtomIndex) {
this.chain = chain;
this.seqcode = seqcode;
this.firstAtomIndex = firstAtomIndex;
this.lastAtomIndex = lastAtomIndex;
if (group3 != null && group3.length > 0) this.setGroupID (group3);
return this;
}, "JM.Chain,~S,~N,~N,~N");
Clazz_defineMethod (c$, "setGroupID", 
function (group3) {
}, "~S");
Clazz_defineMethod (c$, "setShapeVisibility", 
function (visFlag, isVisible) {
if (isVisible) {
this.shapeVisibilityFlags |= visFlag;
} else {
this.shapeVisibilityFlags &= ~visFlag;
}}, "~N,~B");
Clazz_defineMethod (c$, "getGroup3", 
function () {
return (this.groupID < 1 ? "" : JM.Group.group3Names[this.groupID]);
});
Clazz_defineMethod (c$, "getGroup1", 
function () {
return '?';
});
Clazz_defineMethod (c$, "getBioPolymerLength", 
function () {
return 0;
});
Clazz_defineMethod (c$, "getMonomerIndex", 
function () {
return -1;
});
Clazz_defineMethod (c$, "getGroups", 
function () {
return null;
});
Clazz_defineMethod (c$, "getStructure", 
function () {
return null;
});
Clazz_defineMethod (c$, "getStrucNo", 
function () {
return 0;
});
Clazz_defineMethod (c$, "getProteinStructureType", 
function () {
return J.c.STR.NOT;
});
Clazz_defineMethod (c$, "getProteinStructureSubType", 
function () {
return this.getProteinStructureType ();
});
Clazz_defineMethod (c$, "setProteinStructureType", 
function (type, monomerIndexCurrent) {
return -1;
}, "J.c.STR,~N");
Clazz_defineMethod (c$, "isProtein", 
function () {
return false;
});
Clazz_defineMethod (c$, "isNucleic", 
function () {
return false;
});
Clazz_defineMethod (c$, "isDna", 
function () {
return false;
});
Clazz_defineMethod (c$, "isRna", 
function () {
return false;
});
Clazz_defineMethod (c$, "isPurine", 
function () {
return false;
});
Clazz_defineMethod (c$, "isPyrimidine", 
function () {
return false;
});
Clazz_defineMethod (c$, "isCarbohydrate", 
function () {
return false;
});
Clazz_defineMethod (c$, "getResno", 
function () {
return (this.seqcode == -2147483648 ? 0 : this.seqcode >> 8);
});
c$.getSeqNumberFor = Clazz_defineMethod (c$, "getSeqNumberFor", 
function (seqcode) {
return (JM.Group.haveSequenceNumber (seqcode) ? seqcode >> 8 : 2147483647);
}, "~N");
c$.haveSequenceNumber = Clazz_defineMethod (c$, "haveSequenceNumber", 
function (seqcode) {
return ((seqcode & 128) != 0);
}, "~N");
Clazz_defineMethod (c$, "getSeqcodeString", 
function () {
return JM.Group.getSeqcodeStringFor (this.seqcode);
});
c$.getSeqcodeFor = Clazz_defineMethod (c$, "getSeqcodeFor", 
function (seqNo, insCode) {
if (seqNo == -2147483648) return seqNo;
if (!((insCode >= 'A' && insCode <= 'Z') || (insCode >= 'a' && insCode <= 'z') || (insCode >= '0' && insCode <= '9') || insCode == '?' || insCode == '*')) {
if (insCode != ' ' && insCode != '\0') JU.Logger.warn ("unrecognized insertionCode:" + insCode);
insCode = '\0';
}return ((seqNo == 2147483647 ? 0 : (seqNo << 8) | 128)) + insCode.charCodeAt (0);
}, "~N,~S");
c$.getSeqcodeStringFor = Clazz_defineMethod (c$, "getSeqcodeStringFor", 
function (seqcode) {
if (seqcode == -2147483648) return null;
return (seqcode & 127) == 0 ? "" + (seqcode >> 8) : "" + (seqcode >> 8) + '^' + String.fromCharCode (seqcode & 127);
}, "~N");
Clazz_defineMethod (c$, "getInsertionCode", 
function () {
if (this.seqcode == -2147483648) return '\0';
return String.fromCharCode (this.seqcode & 127);
});
c$.getInsertionCodeFor = Clazz_defineMethod (c$, "getInsertionCodeFor", 
function (seqcode) {
return (seqcode & 127);
}, "~N");
c$.getInsertionCodeChar = Clazz_defineMethod (c$, "getInsertionCodeChar", 
function (seqcode) {
return (seqcode == -2147483648 ? '\0' : String.fromCharCode (seqcode & 127));
}, "~N");
Clazz_defineMethod (c$, "isAdded", 
function (atomIndex) {
return this.bsAdded != null && this.bsAdded.get (atomIndex);
}, "~N");
Clazz_defineMethod (c$, "addAtoms", 
function (atomIndex) {
if (this.bsAdded == null) this.bsAdded =  new JU.BS ();
this.bsAdded.set (atomIndex);
}, "~N");
Clazz_defineMethod (c$, "selectAtoms", 
function (bs) {
bs.setBits (this.firstAtomIndex, this.lastAtomIndex + 1);
if (this.bsAdded != null) bs.or (this.bsAdded);
return this.lastAtomIndex;
}, "JU.BS");
Clazz_defineMethod (c$, "isSelected", 
function (bs) {
var pt = bs.nextSetBit (this.firstAtomIndex);
return (pt >= 0 && pt <= this.lastAtomIndex || this.bsAdded != null && this.bsAdded.intersects (bs));
}, "JU.BS");
Clazz_defineMethod (c$, "isHetero", 
function () {
return this.chain.getAtom (this.firstAtomIndex).isHetero ();
});
Clazz_overrideMethod (c$, "toString", 
function () {
return "[" + this.getGroup3 () + "-" + this.getSeqcodeString () + "]";
});
Clazz_defineMethod (c$, "scaleToScreen", 
function (Z, mar) {
return this.chain.model.ms.vwr.tm.scaleToScreen (Z, mar);
}, "~N,~N");
Clazz_defineMethod (c$, "isCursorOnTopOf", 
function (atom, x, y, radius, champ) {
return this.chain.model.ms.isCursorOnTopOf (atom, x, y, radius, champ);
}, "JM.Atom,~N,~N,~N,JM.Atom");
Clazz_defineMethod (c$, "getModel", 
function () {
return this.chain.model;
});
Clazz_defineMethod (c$, "getModelIndex", 
function () {
return this.chain.model.modelIndex;
});
Clazz_defineMethod (c$, "getSelectedMonomerCount", 
function () {
return 0;
});
Clazz_defineMethod (c$, "getSelectedMonomerIndex", 
function () {
return -1;
});
Clazz_defineMethod (c$, "getSelectedGroupIndex", 
function () {
return this.selectedIndex;
});
Clazz_defineMethod (c$, "isLeadAtom", 
function (atomIndex) {
return false;
}, "~N");
Clazz_defineMethod (c$, "getLeadAtomOr", 
function (atom) {
var a = this.getLeadAtom ();
return (a == null ? atom : a);
}, "JM.Atom");
Clazz_defineMethod (c$, "getLeadAtom", 
function () {
return null;
});
Clazz_defineMethod (c$, "getQuaternion", 
function (qType) {
return null;
}, "~S");
Clazz_defineMethod (c$, "getQuaternionFrame", 
function (atoms) {
if (this.lastAtomIndex - this.firstAtomIndex < 3) return null;
var pt = this.firstAtomIndex;
return JU.Quat.getQuaternionFrame (atoms[pt], atoms[++pt], atoms[++pt]);
}, "~A");
Clazz_defineMethod (c$, "setStrucNo", 
function (i) {
}, "~N");
Clazz_defineMethod (c$, "getHelixData", 
function (tokType, qType, mStep) {
return JU.Escape.escapeHelical (null, tokType, null, null, null);
}, "~N,~S,~N");
Clazz_defineMethod (c$, "isWithinStructure", 
function (type) {
return false;
}, "J.c.STR");
Clazz_defineMethod (c$, "getProteinStructureTag", 
function () {
return null;
});
Clazz_defineMethod (c$, "getStructureId", 
function () {
return "";
});
Clazz_defineMethod (c$, "getBioPolymerIndexInModel", 
function () {
return -1;
});
Clazz_defineMethod (c$, "isCrossLinked", 
function (g) {
return false;
}, "JM.Group");
Clazz_defineMethod (c$, "getCrossLinkLead", 
function (vReturn) {
return false;
}, "JU.Lst");
Clazz_defineMethod (c$, "isConnectedPrevious", 
function () {
return false;
});
Clazz_defineMethod (c$, "getNitrogenAtom", 
function () {
return null;
});
Clazz_defineMethod (c$, "getCarbonylOxygenAtom", 
function () {
return null;
});
Clazz_defineMethod (c$, "fixIndices", 
function (atomsDeleted, bsDeleted) {
this.firstAtomIndex -= atomsDeleted;
this.leadAtomIndex -= atomsDeleted;
this.lastAtomIndex -= atomsDeleted;
if (this.bsAdded != null) JU.BSUtil.deleteBits (this.bsAdded, bsDeleted);
}, "~N,JU.BS");
Clazz_defineMethod (c$, "getGroupInfo", 
function (igroup, ptTemp) {
var infoGroup =  new java.util.Hashtable ();
infoGroup.put ("groupIndex", Integer.$valueOf (igroup));
infoGroup.put ("groupID", Short.$valueOf (this.groupID));
var s = this.getSeqcodeString ();
if (s != null) infoGroup.put ("seqCode", s);
infoGroup.put ("_apt1", Integer.$valueOf (this.firstAtomIndex));
infoGroup.put ("_apt2", Integer.$valueOf (this.lastAtomIndex));
if (this.bsAdded != null) infoGroup.put ("addedAtoms", this.bsAdded);
infoGroup.put ("atomInfo1", this.chain.model.ms.getAtomInfo (this.firstAtomIndex, null, ptTemp));
infoGroup.put ("atomInfo2", this.chain.model.ms.getAtomInfo (this.lastAtomIndex, null, ptTemp));
infoGroup.put ("visibilityFlags", Integer.$valueOf (this.shapeVisibilityFlags));
return infoGroup;
}, "~N,JU.P3");
Clazz_defineMethod (c$, "getMinZ", 
function (atoms, minZ) {
minZ[0] = 2147483647;
for (var i = this.firstAtomIndex; i <= this.lastAtomIndex; i++) this.checkMinZ (atoms[i], minZ);

if (this.bsAdded != null) for (var i = this.bsAdded.nextSetBit (0); i >= 0; i = this.bsAdded.nextSetBit (i + 1)) this.checkMinZ (atoms[i], minZ);

}, "~A,~A");
Clazz_defineMethod (c$, "checkMinZ", 
 function (atom, minZ) {
var z = atom.sZ - Clazz_doubleToInt (atom.sD / 2) - 2;
if (z < minZ[0]) minZ[0] = Math.max (1, z);
}, "JM.Atom,~A");
Clazz_defineMethod (c$, "getGroupParameter", 
function (tok) {
return NaN;
}, "~N");
Clazz_defineMethod (c$, "getAtomIndex", 
function (name, offset) {
return -1;
}, "~S,~N");
Clazz_defineMethod (c$, "getBSSideChain", 
function () {
return  new JU.BS ();
});
Clazz_defineStatics (c$,
"SEQUENCE_NUMBER_FLAG", 0x80,
"INSERTION_CODE_MASK", 0x7F,
"SEQUENCE_NUMBER_SHIFT", 8);
c$.htGroup = c$.prototype.htGroup =  new java.util.Hashtable ();
Clazz_defineStatics (c$,
"standardGroupList", null);
c$.group3Names = c$.prototype.group3Names =  new Array (128);
Clazz_defineStatics (c$,
"specialAtomNames", null);
});
Clazz_declarePackage ("JM");
Clazz_load (["JM.Bond"], "JM.HBond", ["JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.energy = 0;
Clazz_instantialize (this, arguments);
}, JM, "HBond", JM.Bond);
Clazz_makeConstructor (c$, 
function (atom1, atom2, order, mad, colix, energy) {
Clazz_superConstructor (this, JM.HBond, [atom1, atom2, order, mad, colix]);
this.energy = energy;
if (JU.Logger.debugging) JU.Logger.debug ("HBond energy = " + energy + " #" + this.getIdentity ());
}, "JM.Atom,JM.Atom,~N,~N,~N,~N");
Clazz_defineMethod (c$, "getEnergy", 
function () {
return this.energy;
});
c$.getEnergy = Clazz_defineMethod (c$, "getEnergy", 
function (distAH, distCH, distCD, distAD) {
var energy = Math.round (-27888.0 / distAH - -27888.0 / distAD + -27888.0 / distCD - -27888.0 / distCH);
return energy;
}, "~N,~N,~N,~N");
Clazz_defineStatics (c$,
"QConst", -27888.0);
});
Clazz_declarePackage ("JM");
Clazz_load (null, "JM.LabelToken", ["java.lang.Float", "java.util.Hashtable", "JU.Lst", "$.PT", "$.SB", "$.T3", "JS.SV", "$.T", "JU.Edge"], function () {
c$ = Clazz_decorateAsClass (function () {
this.text = null;
this.key = null;
this.data = null;
this.tok = 0;
this.pt = -1;
this.ch1 = '\0';
this.width = 0;
this.precision = 2147483647;
this.alignLeft = false;
this.zeroPad = false;
this.intAsFloat = false;
Clazz_instantialize (this, arguments);
}, JM, "LabelToken");
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "set", 
 function (text, pt) {
this.text = text;
this.pt = pt;
return this;
}, "~S,~N");
c$.isLabelPropertyTok = Clazz_defineMethod (c$, "isLabelPropertyTok", 
 function (tok) {
for (var i = JM.LabelToken.labelTokenIds.length; --i >= 0; ) if (JM.LabelToken.labelTokenIds[i] == tok) return true;

return false;
}, "~N");
c$.compile = Clazz_defineMethod (c$, "compile", 
function (vwr, strFormat, chAtom, htValues) {
if (strFormat == null || strFormat.length == 0) return null;
if (strFormat.indexOf ("%") < 0 || strFormat.length < 2) return [ new JM.LabelToken ().set (strFormat, -1)];
var n = 0;
var ich = -1;
var cch = strFormat.length;
while (++ich < cch && (ich = strFormat.indexOf ('%', ich)) >= 0) n++;

var tokens =  new Array (n * 2 + 1);
var ichPercent;
var i = 0;
for (ich = 0; (ichPercent = strFormat.indexOf ('%', ich)) >= 0; ) {
if (ich != ichPercent) tokens[i++] =  new JM.LabelToken ().set (strFormat.substring (ich, ichPercent), -1);
var lt = tokens[i++] =  new JM.LabelToken ().set (null, ichPercent);
vwr.autoCalculate (lt.tok);
ich = JM.LabelToken.setToken (vwr, strFormat, lt, cch, chAtom.charCodeAt (0), htValues);
}
if (ich < cch) tokens[i++] =  new JM.LabelToken ().set (strFormat.substring (ich), -1);
return tokens;
}, "JV.Viewer,~S,~S,java.util.Map");
Clazz_defineMethod (c$, "formatLabel", 
function (vwr, atom, strFormat, ptTemp) {
return (strFormat == null || strFormat.length == 0 ? null : JM.LabelToken.formatLabelAtomArray (vwr, atom, JM.LabelToken.compile (vwr, strFormat, '\0', null), '\0', null, ptTemp));
}, "JV.Viewer,JM.Atom,~S,JU.P3");
c$.formatLabelAtomArray = Clazz_defineMethod (c$, "formatLabelAtomArray", 
function (vwr, atom, tokens, chAtom, indices, ptTemp) {
if (atom == null) return null;
var strLabel = (chAtom > '0' ? null :  new JU.SB ());
if (tokens != null) for (var i = 0; i < tokens.length; i++) {
var t = tokens[i];
if (t == null) break;
if (chAtom > '0' && t.ch1 != chAtom) continue;
if (t.tok <= 0 || t.key != null) {
if (strLabel != null) {
strLabel.append (t.text);
if (t.ch1 != '\0') strLabel.appendC (t.ch1);
}} else {
JM.LabelToken.appendAtomTokenValue (vwr, atom, t, strLabel, indices, ptTemp);
}}
return (strLabel == null ? null : strLabel.toString ().intern ());
}, "JV.Viewer,JM.Atom,~A,~S,~A,JU.P3");
c$.getBondLabelValues = Clazz_defineMethod (c$, "getBondLabelValues", 
function () {
var htValues =  new java.util.Hashtable ();
htValues.put ("#", "");
htValues.put ("ORDER", "");
htValues.put ("TYPE", "");
htValues.put ("LENGTH", Float.$valueOf (0));
htValues.put ("ENERGY", Float.$valueOf (0));
return htValues;
});
c$.formatLabelBond = Clazz_defineMethod (c$, "formatLabelBond", 
function (vwr, bond, tokens, values, indices, ptTemp) {
values.put ("#", "" + (bond.index + 1));
values.put ("ORDER", "" + JU.Edge.getBondOrderNumberFromOrder (bond.order));
values.put ("TYPE", JU.Edge.getBondOrderNameFromOrder (bond.order));
values.put ("LENGTH", Float.$valueOf (bond.atom1.distance (bond.atom2)));
values.put ("ENERGY", Float.$valueOf (bond.getEnergy ()));
JM.LabelToken.setValues (tokens, values);
JM.LabelToken.formatLabelAtomArray (vwr, bond.atom1, tokens, '1', indices, ptTemp);
JM.LabelToken.formatLabelAtomArray (vwr, bond.atom2, tokens, '2', indices, ptTemp);
return JM.LabelToken.getLabel (tokens);
}, "JV.Viewer,JM.Bond,~A,java.util.Map,~A,JU.P3");
c$.formatLabelMeasure = Clazz_defineMethod (c$, "formatLabelMeasure", 
function (vwr, m, label, value, units) {
var htValues =  new java.util.Hashtable ();
htValues.put ("#", "" + (m.index + 1));
htValues.put ("VALUE", Float.$valueOf (value));
htValues.put ("UNITS", units);
var tokens = JM.LabelToken.compile (vwr, label, '\1', htValues);
if (tokens == null) return "";
JM.LabelToken.setValues (tokens, htValues);
var atoms = m.ms.at;
var indices = m.countPlusIndices;
for (var i = indices[0]; i >= 1; --i) if (indices[i] >= 0) JM.LabelToken.formatLabelAtomArray (vwr, atoms[indices[i]], tokens, String.fromCharCode (48 + i), null, null);

label = JM.LabelToken.getLabel (tokens);
return (label == null ? "" : label);
}, "JV.Viewer,JM.Measurement,~S,~N,~S");
c$.setValues = Clazz_defineMethod (c$, "setValues", 
function (tokens, values) {
for (var i = 0; i < tokens.length; i++) {
var lt = tokens[i];
if (lt == null) break;
if (lt.key == null) continue;
var value = values.get (lt.key);
lt.text = (Clazz_instanceOf (value, Float) ? lt.format ((value).floatValue (), null, null) : lt.format (NaN, value, null));
}
}, "~A,java.util.Map");
c$.getLabel = Clazz_defineMethod (c$, "getLabel", 
function (tokens) {
var sb =  new JU.SB ();
for (var i = 0; i < tokens.length; i++) {
var lt = tokens[i];
if (lt == null) break;
sb.append (lt.text);
}
return sb.toString ();
}, "~A");
c$.setToken = Clazz_defineMethod (c$, "setToken", 
 function (vwr, strFormat, lt, cch, chAtom, htValues) {
var ich = lt.pt + 1;
if (ich >= cch) return ich;
var ch;
if (strFormat.charAt (ich) == '-') {
lt.alignLeft = true;
++ich;
}if (ich < cch && strFormat.charAt (ich) == '0') {
lt.zeroPad = true;
++ich;
}while (ich < cch && JU.PT.isDigit (ch = strFormat.charAt (ich))) {
lt.width = (10 * lt.width) + (ch.charCodeAt (0) - 48);
++ich;
}
lt.precision = 2147483647;
var isNegative = false;
if (ich < cch && strFormat.charAt (ich) == '.') {
++ich;
if (ich < cch && (ch = strFormat.charAt (ich)) == '-') {
isNegative = true;
++ich;
}if (ich < cch && JU.PT.isDigit (ch = strFormat.charAt (ich))) {
lt.precision = ch.charCodeAt (0) - 48;
if (isNegative) lt.precision = -1 - lt.precision;
++ich;
}}if (ich < cch && htValues != null) for (var key, $key = htValues.keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) if (strFormat.indexOf (key) == ich) return ich + (lt.key = key).length;

if (ich < cch) switch (ch = strFormat.charAt (ich++)) {
case '%':
lt.text = "%";
return ich;
case '[':
var ichClose = strFormat.indexOf (']', ich);
if (ichClose < ich) {
ich = cch;
break;
}var propertyName = strFormat.substring (ich, ichClose).toLowerCase ();
if (propertyName.startsWith ("property_")) {
lt.tok = 135270408;
lt.data = vwr.getDataFloat (propertyName);
} else if (propertyName.startsWith ("validation.")) {
lt.tok = 1073742189;
lt.data = vwr.getDataFloat ("property_" + propertyName.substring (11));
} else {
var token = JS.T.getTokenFromName (propertyName);
if (token != null && JM.LabelToken.isLabelPropertyTok (token.tok)) lt.tok = token.tok;
}ich = ichClose + 1;
break;
case '{':
var ichCloseBracket = strFormat.indexOf ('}', ich);
if (ichCloseBracket < ich) {
ich = cch;
break;
}var s = strFormat.substring (ich, ichCloseBracket);
lt.data = vwr.getDataFloat (s);
if (lt.data == null) {
lt.data = vwr.getData (s);
if (Clazz_instanceOf (lt.data, Array)) {
lt.data = (lt.data)[1];
if (Clazz_instanceOf (lt.data, String)) lt.data = JU.PT.split (lt.data, "\n");
if (!(JU.PT.isAS (lt.data))) lt.data = null;
}if (lt.data == null) {
lt.tok = 1716520985;
lt.data = s;
} else {
lt.tok = 135266306;
}} else {
lt.tok = 135270408;
}ich = ichCloseBracket + 1;
break;
default:
var i;
var i1;
if (ich < cch && (i = "fuv".indexOf (ch)) >= 0 && (i1 = "xyz".indexOf (strFormat.charAt (ich))) >= 0) {
lt.tok = JM.LabelToken.twoCharLabelTokenIds[i * 3 + i1];
ich++;
} else if ((i = "AaBbCcDEefGgIiLlMmNnOoPpQqRrSsTtUuVvWXxxYyyZzz%%%gqW".indexOf (ch)) >= 0) {
lt.tok = JM.LabelToken.labelTokenIds[i];
}}
lt.text = strFormat.substring (lt.pt, ich);
if (ich < cch && chAtom != 0 && JU.PT.isDigit (ch = strFormat.charAt (ich))) {
ich++;
lt.ch1 = ch;
if (ch.charCodeAt (0) != chAtom && chAtom != 1) lt.tok = 0;
}return ich;
}, "JV.Viewer,~S,JM.LabelToken,~N,~N,java.util.Map");
c$.appendAtomTokenValue = Clazz_defineMethod (c$, "appendAtomTokenValue", 
 function (vwr, atom, t, strLabel, indices, ptTemp) {
var strT = null;
var floatT = NaN;
var ptT = null;
try {
switch (t.tok) {
case 1095761923:
strT = "" + (indices == null ? atom.i : indices[atom.i]);
break;
case 1766856708:
ptT = atom.atomPropertyTuple (vwr, t.tok, ptTemp);
break;
case 135270408:
case 1073742189:
if (t.data != null) {
floatT = (t.data)[atom.i];
if (t.tok == 1073742189 && floatT != 1 && floatT != 0) {
var o = vwr.getAtomValidation (t.text.substring (13, t.text.length - 1), atom);
if (o == null) {
System.out.println ("?? o is null ??");
} else if (o.size () == 1) {
floatT = o.get (0).floatValue ();
} else {
floatT = NaN;
strT = "";
for (var i = 0, n = o.size (); i < n; i++) {
strT += "," + o.get (i);
}
if (strT.length > 1) strT = strT.substring (1);
}}}break;
case 1716520985:
var data = vwr.ms.getInfo (atom.mi, t.data);
var iatom = atom.i - vwr.ms.am[atom.mi].firstAtomIndex;
var o = null;
if (iatom >= 0) if ((Clazz_instanceOf (data, Array))) {
var sdata = data;
o = (iatom < sdata.length ? sdata[iatom] : null);
} else if (Clazz_instanceOf (data, JU.Lst)) {
var list = data;
o = (iatom < list.size () ? JS.SV.oValue (list.get (iatom)) : null);
}if (o == null) {
strT = "";
} else if (Clazz_instanceOf (o, Float)) {
floatT = (o).floatValue ();
} else if (Clazz_instanceOf (o, Integer)) {
floatT = (o).intValue ();
} else if (Clazz_instanceOf (o, JU.T3)) {
ptT = o;
} else {
strT = o.toString ();
}break;
case 135266306:
if (t.data != null) {
var sdata = t.data;
strT = (atom.i < sdata.length ? sdata[atom.i] : "");
}break;
case 1632634891:
var formalCharge = atom.getFormalCharge ();
strT = (formalCharge > 0 ? "" + formalCharge + "+" : formalCharge < 0 ? "" + -formalCharge + "-" : "");
break;
case 'g':
strT = "" + atom.getSelectedGroupIndexWithinChain ();
break;
case 1095766030:
strT = atom.getModelNumberForLabel ();
break;
case 'O':
strT = atom.getSymmetryOperatorList (false);
break;
case 1129318401:
strT = "" + atom.atomPropertyInt (t.tok);
break;
case 'Q':
floatT = atom.getOccupancy100 () / 100;
break;
case 1666189314:
floatT = atom.atomPropertyFloat (vwr, t.tok, ptTemp);
break;
case 'r':
strT = atom.getSeqcodeString ();
break;
case 1087373324:
strT = atom.getStructureId ();
break;
case 1095761942:
var id = atom.getStrucNo ();
strT = (id <= 0 ? "" : "" + id);
break;
case 1112539150:
if (Float.isNaN (floatT = atom.getGroupParameter (1112539150))) strT = "null";
break;
case 1112541202:
case 1112541203:
case 1112541204:
case 1112539159:
case 1112539160:
case 1112539161:
case 1112539162:
floatT = atom.atomPropertyFloat (vwr, t.tok, ptTemp);
if (Float.isNaN (floatT)) strT = "";
break;
case 1641025539:
case 1238369286:
strT = atom.atomPropertyString (vwr, t.tok);
break;
case 'W':
strT = atom.getIdentityXYZ (false, ptTemp);
break;
default:
switch (t.tok & 1137704960) {
case 1095761920:
if (t.intAsFloat) floatT = atom.atomPropertyInt (t.tok);
 else strT = "" + atom.atomPropertyInt (t.tok);
break;
case 1112539136:
floatT = atom.atomPropertyFloat (vwr, t.tok, ptTemp);
break;
case 1087373312:
strT = atom.atomPropertyString (vwr, t.tok);
break;
case 1078984704:
ptT = atom.atomPropertyTuple (vwr, t.tok, ptTemp);
if (ptT == null) strT = "";
break;
default:
}
}
} catch (ioobe) {
if (Clazz_exceptionOf (ioobe, IndexOutOfBoundsException)) {
floatT = NaN;
strT = null;
ptT = null;
} else {
throw ioobe;
}
}
strT = t.format (floatT, strT, ptT);
if (strLabel == null) t.text = strT;
 else strLabel.append (strT);
}, "JV.Viewer,JM.Atom,JM.LabelToken,JU.SB,~A,JU.P3");
Clazz_defineMethod (c$, "format", 
 function (floatT, strT, ptT) {
if (!Float.isNaN (floatT)) {
return JU.PT.formatF (floatT, this.width, this.precision, this.alignLeft, this.zeroPad);
} else if (strT != null) {
return JU.PT.formatS (strT, this.width, this.precision, this.alignLeft, this.zeroPad);
} else if (ptT != null) {
if (this.width == 0 && this.precision == 2147483647) {
this.width = 6;
this.precision = 2;
}return JU.PT.formatF (ptT.x, this.width, this.precision, false, false) + JU.PT.formatF (ptT.y, this.width, this.precision, false, false) + JU.PT.formatF (ptT.z, this.width, this.precision, false, false);
} else {
return this.text;
}}, "~N,~S,JU.T3");
Clazz_defineStatics (c$,
"labelTokenParams", "AaBbCcDEefGgIiLlMmNnOoPpQqRrSsTtUuVvWXxxYyyZzz%%%gqW",
"labelTokenIds", [1087373315, 1087375362, 1087375361, 1112541196, 1632634891, 1087373316, 1095761923, 1087373322, 1087375365, 1112539145, 1095761933, 'g', 1112541194, 1095763969, 1095761938, 1095763978, 1095766030, 1087373319, 1095761936, 1087373318, 'O', 1089470478, 1112541195, 1112539146, 'Q', 1129318401, 1095761939, 'r', 1095761941, 1087373316, 1112539150, 1112541196, 1087373321, 1112539151, 1649412120, 1146095631, 'W', 1112541188, 1112541185, 1112541205, 1112541189, 1112541186, 1112541206, 1112541190, 1112541187, 1112541207, 1115297793, 1113200642, 1113198595, 1113198596, 1113198597, 1113200646, 1113200647, 1113200649, 1113200650, 1113200652, 1650071565, 1113200654, 1112539137, 1112539138, 1095761922, 1095761924, 1766856708, 1095761932, 1112539140, 1229984263, 1288701959, 1826248716, 1112539143, 1095761935, 1112539141, 1112539144, 1095761937, 1716520985, 1666189314, 1114638363, 1087373323, 1087373320, 1113200651, 1641025539, 1238369286, 1095761942, 1087373324, 1087375373, 1112539152, 1112539153, 1112539154, 1112539155, 1095763991, 1649410049, 1112541202, 1112541203, 1112541204, 1313866249, 1146093582, 1146095627, 1146095626, 1146095629, 1112541191, 1112541192, 1112541193, 1114638362, 1112539147, 1112539148, 1112539149, 1146095628, 1112539142, 1112539139, 1095761927, 1095761940, 1112539159, 1112539160, 1112539161, 1112539162, 1146093584, 1297090050],
"STANDARD_LABEL", "%[identify]",
"twoCharLabelTokenParams", "fuv",
"twoCharLabelTokenIds", [1112541188, 1112541189, 1112541190, 1112539153, 1112539154, 1112539155, 1112541202, 1112541203, 1112541204]);
});
Clazz_declarePackage ("JM");
Clazz_load (null, "JM.Measurement", ["java.lang.Float", "JU.Lst", "$.Measure", "$.PT", "$.SB", "J.atomdata.RadiusData", "J.c.VDW", "JM.LabelToken", "JU.Escape"], function () {
c$ = Clazz_decorateAsClass (function () {
this.thisID = null;
this.ms = null;
this.index = 0;
this.isVisible = true;
this.isHidden = false;
this.isTrajectory = false;
this.$isValid = true;
this.colix = 0;
this.labelColix = -1;
this.mad = 0;
this.tickInfo = null;
this.traceX = -2147483648;
this.traceY = 0;
this.count = 0;
this.countPlusIndices = null;
this.pts = null;
this.value = 0;
this.strFormat = null;
this.text = null;
this.vwr = null;
this.strMeasurement = null;
this.type = null;
this.tainted = false;
this.renderAxis = null;
this.renderArc = null;
Clazz_instantialize (this, arguments);
}, JM, "Measurement");
Clazz_prepareFields (c$, function () {
this.countPlusIndices =  Clazz_newIntArray (5, 0);
});
Clazz_defineMethod (c$, "isTainted", 
function () {
return (this.tainted && !(this.tainted = false));
});
Clazz_defineMethod (c$, "setM", 
function (modelSet, m, value, colix, strFormat, index) {
this.ms = modelSet;
this.index = index;
this.vwr = modelSet.vwr;
this.colix = colix;
this.strFormat = strFormat;
if (m != null) {
this.tickInfo = m.tickInfo;
this.pts = m.pts;
this.mad = m.mad;
this.thisID = m.thisID;
this.text = m.text;
if (this.thisID != null && this.text != null) this.labelColix = this.text.colix;
}if (this.pts == null) this.pts =  new Array (4);
var indices = (m == null ? null : m.countPlusIndices);
this.count = (indices == null ? 0 : indices[0]);
if (this.count > 0) {
System.arraycopy (indices, 0, this.countPlusIndices, 0, this.count + 1);
this.isTrajectory = modelSet.isTrajectoryMeasurement (this.countPlusIndices);
}this.value = (Float.isNaN (value) || this.isTrajectory ? this.getMeasurement (null) : value);
this.formatMeasurement (null);
return this;
}, "JM.ModelSet,JM.Measurement,~N,~N,~S,~N");
Clazz_defineMethod (c$, "setPoints", 
function (modelSet, indices, points, tickInfo) {
this.ms = modelSet;
this.countPlusIndices = indices;
this.count = indices[0];
this.pts = (points == null ?  new Array (4) : points);
this.vwr = modelSet.vwr;
this.tickInfo = tickInfo;
return this;
}, "JM.ModelSet,~A,~A,JM.TickInfo");
Clazz_defineMethod (c$, "setCount", 
function (count) {
this.setCountM (count);
}, "~N");
Clazz_defineMethod (c$, "setCountM", 
function (count) {
this.count = this.countPlusIndices[0] = count;
}, "~N");
Clazz_defineMethod (c$, "getAtomIndex", 
function (n) {
return (n > 0 && n <= this.count ? this.countPlusIndices[n] : -1);
}, "~N");
Clazz_defineMethod (c$, "getAtom", 
function (n) {
var pt = this.countPlusIndices[n];
return (pt < -1 ? this.pts[-2 - pt] : this.ms.at[pt]);
}, "~N");
Clazz_defineMethod (c$, "getLastIndex", 
function () {
return (this.count > 0 ? this.countPlusIndices[this.count] : -1);
});
Clazz_defineMethod (c$, "getString", 
function () {
return this.strMeasurement;
});
Clazz_defineMethod (c$, "getStringUsing", 
function (vwr, strFormat, units) {
this.vwr = vwr;
this.value = this.getMeasurement (null);
this.formatMeasurementAs (strFormat, units, true);
if (strFormat == null) return this.getInfoAsString (units);
return this.strMeasurement;
}, "JV.Viewer,~S,~S");
Clazz_defineMethod (c$, "getStringDetail", 
function () {
return (this.count == 2 ? "Distance" : this.count == 3 ? "Angle" : "Torsion") + this.getMeasurementScript (" - ", false) + " : " + this.value;
});
Clazz_defineMethod (c$, "refresh", 
function (pts) {
this.value = this.getMeasurement (pts);
this.isTrajectory = this.ms.isTrajectoryMeasurement (this.countPlusIndices);
this.formatMeasurement (null);
}, "~A");
Clazz_defineMethod (c$, "getMeasurementScript", 
function (sep, withModelIndex) {
var str = "";
var asScript = (sep.equals (" "));
for (var i = 1; i <= this.count; i++) str += (i > 1 ? sep : " ") + this.getLabel (i, asScript, withModelIndex);

return str;
}, "~S,~B");
Clazz_defineMethod (c$, "formatMeasurementAs", 
function (strFormat, units, useDefault) {
if (strFormat != null && strFormat.length == 0) strFormat = null;
if (!useDefault && strFormat != null && strFormat.indexOf (this.countPlusIndices[0] + ":") != 0) return;
this.strFormat = strFormat;
this.formatMeasurement (units);
}, "~S,~S,~B");
Clazz_defineMethod (c$, "formatMeasurement", 
function (units) {
this.tainted = true;
switch (Float.isNaN (this.value) ? 0 : this.count) {
default:
this.strMeasurement = null;
return;
case 2:
this.strMeasurement = this.formatDistance (units);
return;
case 3:
case 4:
this.strMeasurement = this.formatAngle (this.value);
return;
}
}, "~S");
Clazz_defineMethod (c$, "reformatDistanceIfSelected", 
function () {
if (this.count != 2) return;
if (this.vwr.slm.isSelected (this.countPlusIndices[1]) && this.vwr.slm.isSelected (this.countPlusIndices[2])) this.formatMeasurement (null);
});
Clazz_defineMethod (c$, "formatDistance", 
 function (units) {
var label = this.getLabelString ();
if (label == null) return "";
if (units == null) {
var pt = this.strFormat.indexOf ("//");
units = (pt >= 0 ? this.strFormat.substring (pt + 2) : null);
if (units == null) {
units = this.vwr.g.measureDistanceUnits;
this.strFormat += "//" + units;
}}units = JM.Measurement.fixUnits (units);
var pt = label.indexOf ("//");
if (pt >= 0) {
label = label.substring (0, pt);
if (label.length == 0) label = "%VALUE";
}var f = this.fixValue (units, (label.indexOf ("%V") >= 0));
return this.formatString (f, units, label);
}, "~S");
c$.fixUnits = Clazz_defineMethod (c$, "fixUnits", 
 function (units) {
if (units.equals ("nanometers")) return "nm";
 else if (units.equals ("picometers")) return "pm";
 else if (units.equals ("angstroms")) return "\u00C5";
 else if (units.equals ("vanderwaals") || units.equals ("vdw")) return "%";
return units;
}, "~S");
Clazz_defineMethod (c$, "fixValue", 
function (units, andRound) {
if (this.count != 2) return this.value;
var dist = this.value;
if (units != null) {
var isPercent = units.equals ("%");
if (isPercent || units.endsWith ("hz")) {
var i1 = this.getAtomIndex (1);
var i2 = this.getAtomIndex (2);
if (i1 >= 0 && i2 >= 0) {
var a1 = this.getAtom (1);
var a2 = this.getAtom (2);
var isDC = (!isPercent && JM.Measurement.nmrType (units) == 1);
this.type = (isPercent ? "percent" : isDC ? "dipoleCouplingConstant" : "J-CouplingConstant");
dist = (isPercent ? dist / (a1.getVanderwaalsRadiusFloat (this.vwr, J.c.VDW.AUTO) + a2.getVanderwaalsRadiusFloat (this.vwr, J.c.VDW.AUTO)) : isDC ? this.vwr.getNMRCalculation ().getDipolarConstantHz (a1, a2) : this.vwr.getNMRCalculation ().getIsoOrAnisoHz (true, a1, a2, units, null));
this.$isValid = !Float.isNaN (dist);
if (isPercent) units = "pm";
}}if (units.equals ("nm")) return (andRound ? Math.round (dist * 100) / 1000 : dist / 10);
if (units.equals ("pm")) return (andRound ? Math.round (dist * 1000) / 10 : dist * 100);
if (units.equals ("au")) return (andRound ? Math.round (dist / 0.5291772 * 1000) / 1000 : dist / 0.5291772);
if (units.endsWith ("khz")) return (andRound ? Math.round (dist / 10) / 100 : dist / 1000);
}return (andRound ? Math.round (dist * 100) / 100 : dist);
}, "~S,~B");
c$.nmrType = Clazz_defineMethod (c$, "nmrType", 
function (units) {
return (units.indexOf ("hz") < 0 ? 0 : units.startsWith ("dc_") || units.equals ("khz") ? 1 : 2);
}, "~S");
Clazz_defineMethod (c$, "formatAngle", 
 function (angle) {
var label = this.getLabelString ();
if (label.indexOf ("%V") >= 0) angle = Math.round (angle * 10) / 10;
return this.formatString (angle, "\u00B0", label);
}, "~N");
Clazz_defineMethod (c$, "getLabelString", 
 function () {
var s = this.countPlusIndices[0] + ":";
var label = null;
if (this.strFormat != null) {
if (this.strFormat.length == 0) return null;
label = (this.strFormat.length > 2 && this.strFormat.indexOf (s) == 0 ? this.strFormat : null);
}if (label == null) {
this.strFormat = null;
label = this.vwr.getDefaultMeasurementLabel (this.countPlusIndices[0]);
}if (label.indexOf (s) == 0) label = label.substring (2);
if (this.strFormat == null) this.strFormat = s + label;
return label;
});
Clazz_defineMethod (c$, "formatString", 
 function (value, units, label) {
return JM.LabelToken.formatLabelMeasure (this.vwr, this, label, value, units);
}, "~N,~S,~S");
Clazz_defineMethod (c$, "sameAsPoints", 
function (indices, points) {
if (this.count != indices[0]) return false;
var isSame = true;
for (var i = 1; i <= this.count && isSame; i++) isSame = (this.countPlusIndices[i] == indices[i]);

if (isSame) for (var i = 0; i < this.count && isSame; i++) {
if (points[i] != null) isSame = (this.pts[i].distance (points[i]) < 0.01);
}
if (isSame) return true;
switch (this.count) {
default:
return true;
case 2:
return this.sameAsIJ (indices, points, 1, 2) && this.sameAsIJ (indices, points, 2, 1);
case 3:
return this.sameAsIJ (indices, points, 1, 3) && this.sameAsIJ (indices, points, 2, 2) && this.sameAsIJ (indices, points, 3, 1);
case 4:
return this.sameAsIJ (indices, points, 1, 4) && this.sameAsIJ (indices, points, 2, 3) && this.sameAsIJ (indices, points, 3, 2) && this.sameAsIJ (indices, points, 4, 1);
}
}, "~A,~A");
Clazz_defineMethod (c$, "sameAsIJ", 
 function (atoms, points, i, j) {
var ipt = this.countPlusIndices[i];
var jpt = atoms[j];
return (ipt >= 0 || jpt >= 0 ? ipt == jpt : this.pts[-2 - ipt].distance (points[-2 - jpt]) < 0.01);
}, "~A,~A,~N,~N");
Clazz_defineMethod (c$, "sameAs", 
function (i, j) {
return this.sameAsIJ (this.countPlusIndices, this.pts, i, j);
}, "~N,~N");
Clazz_defineMethod (c$, "toVector", 
function (asBitSet) {
var V =  new JU.Lst ();
for (var i = 1; i <= this.count; i++) V.addLast (this.getLabel (i, asBitSet, false));

V.addLast (this.strMeasurement);
return V;
}, "~B");
Clazz_defineMethod (c$, "getMeasurement", 
function (pts) {
if (this.countPlusIndices == null) return NaN;
if (this.count < 2) return NaN;
for (var i = this.count; --i >= 0; ) if (this.countPlusIndices[i + 1] == -1) {
return NaN;
}
var ptA = (pts == null ? this.getAtom (1) : pts[0]);
var ptB = (pts == null ? this.getAtom (2) : pts[1]);
var ptC;
switch (this.count) {
case 2:
return ptA.distance (ptB);
case 3:
ptC = (pts == null ? this.getAtom (3) : pts[2]);
return JU.Measure.computeAngleABC (ptA, ptB, ptC, true);
case 4:
ptC = (pts == null ? this.getAtom (3) : pts[2]);
var ptD = (pts == null ? this.getAtom (4) : pts[3]);
return JU.Measure.computeTorsion (ptA, ptB, ptC, ptD, true);
default:
return NaN;
}
}, "~A");
Clazz_defineMethod (c$, "getLabel", 
function (i, asBitSet, withModelIndex) {
var atomIndex = this.countPlusIndices[i];
return (atomIndex < 0 ? (withModelIndex ? "modelIndex " + this.getAtom (i).mi + " " : "") + JU.Escape.eP (this.getAtom (i)) : asBitSet ? "(({" + atomIndex + "}))" : this.vwr.getAtomInfo (atomIndex));
}, "~N,~B,~B");
Clazz_defineMethod (c$, "setModelIndex", 
function (modelIndex) {
if (this.pts == null) return;
for (var i = 0; i < this.count; i++) {
if (this.pts[i] != null) this.pts[i].mi = modelIndex;
}
}, "~N");
Clazz_defineMethod (c$, "isValid", 
function () {
return !(this.sameAs (1, 2) || this.count > 2 && this.sameAs (1, 3) || this.count == 4 && this.sameAs (2, 4));
});
c$.find = Clazz_defineMethod (c$, "find", 
function (measurements, m) {
var indices = m.countPlusIndices;
var points = m.pts;
for (var i = measurements.size (); --i >= 0; ) if (measurements.get (i).sameAsPoints (indices, points)) return i;

return -1;
}, "JU.Lst,JM.Measurement");
Clazz_defineMethod (c$, "isConnected", 
function (atoms, count) {
var atomIndexLast = -1;
for (var i = 1; i <= count; i++) {
var atomIndex = this.getAtomIndex (i);
if (atomIndex < 0) continue;
if (atomIndexLast >= 0 && !atoms[atomIndex].isBonded (atoms[atomIndexLast])) return false;
atomIndexLast = atomIndex;
}
return true;
}, "~A,~N");
Clazz_defineMethod (c$, "getInfoAsString", 
function (units) {
var f = this.fixValue (units, true);
var sb =  new JU.SB ();
sb.append (this.count == 2 ? (this.type == null ? "distance" : this.type) : this.count == 3 ? "angle" : "dihedral");
sb.append (" \t").appendF (f);
sb.append (" \t").append (JU.PT.esc (this.strMeasurement));
for (var i = 1; i <= this.count; i++) sb.append (" \t").append (this.getLabel (i, false, false));

if (this.thisID != null) sb.append (" \t").append (this.thisID);
return sb.toString ();
}, "~S");
Clazz_defineMethod (c$, "isInRange", 
function (radiusData, value) {
if (radiusData.factorType === J.atomdata.RadiusData.EnumType.FACTOR) {
var atom1 = this.getAtom (1);
var atom2 = this.getAtom (2);
var d = (atom1.getVanderwaalsRadiusFloat (this.vwr, radiusData.vdwType) + atom2.getVanderwaalsRadiusFloat (this.vwr, radiusData.vdwType)) * radiusData.value;
return (value <= d);
}return (radiusData.values[0] == 3.4028235E38 || value >= radiusData.values[0] && value <= radiusData.values[1]);
}, "J.atomdata.RadiusData,~N");
Clazz_defineMethod (c$, "isIntramolecular", 
function (atoms, count) {
var molecule = -1;
for (var i = 1; i <= count; i++) {
var atomIndex = this.getAtomIndex (i);
if (atomIndex < 0) continue;
var m = atoms[atomIndex].getMoleculeNumber (false);
if (molecule < 0) molecule = m;
 else if (m != molecule) return false;
}
return true;
}, "~A,~N");
Clazz_defineMethod (c$, "isMin", 
function (htMin) {
var a1 = this.getAtom (1);
var a2 = this.getAtom (2);
var d = Clazz_floatToInt (a2.distanceSquared (a1) * 100);
var n1 = a1.getAtomName ();
var n2 = a2.getAtomName ();
var key = (n1.compareTo (n2) < 0 ? n1 + n2 : n2 + n1);
var min = htMin.get (key);
return (min != null && d == min.intValue ());
}, "java.util.Map");
Clazz_defineStatics (c$,
"NMR_NOT", 0,
"NMR_DC", 1,
"NMR_JC", 2);
});
Clazz_declarePackage ("JM");
Clazz_load (["J.api.JmolMeasurementClient"], "JM.MeasurementData", ["java.lang.Float", "JU.BS", "$.Lst", "JM.Measurement", "JU.BSUtil"], function () {
c$ = Clazz_decorateAsClass (function () {
this.client = null;
this.measurementStrings = null;
this.measurements = null;
this.points = null;
this.mustBeConnected = false;
this.mustNotBeConnected = false;
this.tickInfo = null;
this.tokAction = 1060866;
this.radiusData = null;
this.strFormat = null;
this.note = null;
this.isAll = false;
this.colix = 0;
this.intramolecular = null;
this.mad = 0;
this.thisID = null;
this.text = null;
this.atoms = null;
this.units = null;
this.minArray = null;
this.ms = null;
this.vwr = null;
this.iFirstAtom = 0;
this.justOneModel = true;
this.htMin = null;
Clazz_instantialize (this, arguments);
}, JM, "MeasurementData", null, J.api.JmolMeasurementClient);
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "init", 
function (id, vwr, points) {
this.vwr = vwr;
this.points = points;
this.thisID = id;
return this;
}, "~S,JV.Viewer,JU.Lst");
Clazz_defineMethod (c$, "setModelSet", 
function (m) {
this.ms = m;
return this;
}, "JM.ModelSet");
Clazz_defineMethod (c$, "set", 
function (tokAction, htMin, radiusData, strFormat, units, tickInfo, mustBeConnected, mustNotBeConnected, intramolecular, isAll, mad, colix, text) {
this.ms = this.vwr.ms;
this.tokAction = tokAction;
if (this.points.size () >= 2 && Clazz_instanceOf (this.points.get (0), JU.BS) && Clazz_instanceOf (this.points.get (1), JU.BS)) {
this.justOneModel = JU.BSUtil.haveCommon (this.vwr.ms.getModelBS (this.points.get (0), false), this.vwr.ms.getModelBS (this.points.get (1), false));
}this.htMin = htMin;
this.radiusData = radiusData;
this.strFormat = strFormat;
this.units = units;
this.tickInfo = tickInfo;
this.mustBeConnected = mustBeConnected;
this.mustNotBeConnected = mustNotBeConnected;
this.intramolecular = intramolecular;
this.isAll = isAll;
this.mad = mad;
this.colix = colix;
this.text = text;
return this;
}, "~N,java.util.Map,J.atomdata.RadiusData,~S,~S,JM.TickInfo,~B,~B,Boolean,~B,~N,~N,JM.Text");
Clazz_defineMethod (c$, "processNextMeasure", 
function (m) {
var value = m.getMeasurement (null);
if (this.htMin != null && !m.isMin (this.htMin) || this.radiusData != null && !m.isInRange (this.radiusData, value)) return;
if (this.measurementStrings == null && this.measurements == null) {
var f = this.minArray[this.iFirstAtom];
m.value = value;
value = m.fixValue (this.units, false);
this.minArray[this.iFirstAtom] = (1 / f == -Infinity ? value : Math.min (f, value));
return;
}if (this.measurementStrings != null) this.measurementStrings.addLast (m.getStringUsing (this.vwr, this.strFormat, this.units));
 else this.measurements.addLast (Float.$valueOf (m.getMeasurement (null)));
}, "JM.Measurement");
Clazz_defineMethod (c$, "getMeasurements", 
function (asArray, asMinArray) {
if (asMinArray) {
this.minArray =  Clazz_newFloatArray ((this.points.get (0)).cardinality (), 0);
for (var i = 0; i < this.minArray.length; i++) this.minArray[i] = -0.0;

this.define (null, this.ms);
return this.minArray;
}if (asArray) {
this.measurements =  new JU.Lst ();
this.define (null, this.ms);
return this.measurements;
}this.measurementStrings =  new JU.Lst ();
this.define (null, this.ms);
return this.measurementStrings;
}, "~B,~B");
Clazz_defineMethod (c$, "define", 
function (client, modelSet) {
this.client = (client == null ? this : client);
this.atoms = modelSet.at;
var nPoints = this.points.size ();
if (nPoints < 2) return;
var modelIndex = -1;
var pts =  new Array (4);
var indices =  Clazz_newIntArray (5, 0);
var m =  new JM.Measurement ().setPoints (modelSet, indices, pts, null);
m.setCount (nPoints);
var ptLastAtom = -1;
for (var i = 0; i < nPoints; i++) {
var obj = this.points.get (i);
if (Clazz_instanceOf (obj, JU.BS)) {
var bs = obj;
var nAtoms = bs.cardinality ();
if (nAtoms == 0) return;
if (nAtoms > 1) modelIndex = 0;
ptLastAtom = i;
if (i == 0) this.iFirstAtom = 0;
indices[i + 1] = bs.nextSetBit (0);
} else {
pts[i] = obj;
indices[i + 1] = -2 - i;
}}
this.nextMeasure (0, ptLastAtom, m, modelIndex);
}, "J.api.JmolMeasurementClient,JM.ModelSet");
Clazz_defineMethod (c$, "nextMeasure", 
 function (thispt, ptLastAtom, m, thisModel) {
if (thispt > ptLastAtom) {
if (m.isValid () && (!this.mustBeConnected || m.isConnected (this.atoms, thispt)) && (!this.mustNotBeConnected || !m.isConnected (this.atoms, thispt)) && (this.intramolecular == null || m.isIntramolecular (this.atoms, thispt) == this.intramolecular.booleanValue ())) this.client.processNextMeasure (m);
return;
}var bs = this.points.get (thispt);
var indices = m.countPlusIndices;
var thisAtomIndex = (thispt == 0 ? 2147483647 : indices[thispt]);
if (thisAtomIndex < 0) {
this.nextMeasure (thispt + 1, ptLastAtom, m, thisModel);
return;
}var haveNext = false;
for (var i = bs.nextSetBit (0), pt = 0; i >= 0; i = bs.nextSetBit (i + 1), pt++) {
if (i == thisAtomIndex) continue;
var modelIndex = this.atoms[i].mi;
if (thisModel >= 0 && this.justOneModel) {
if (thispt == 0) thisModel = modelIndex;
 else if (thisModel != modelIndex) continue;
}indices[thispt + 1] = i;
if (thispt == 0) this.iFirstAtom = pt;
haveNext = true;
this.nextMeasure (thispt + 1, ptLastAtom, m, thisModel);
}
if (!haveNext) this.nextMeasure (thispt + 1, ptLastAtom, m, thisModel);
}, "~N,~N,JM.Measurement,~N");
});
Clazz_declarePackage ("JM");
Clazz_load (["JM.Measurement"], "JM.MeasurementPending", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.haveTarget = false;
this.haveModified = false;
this.numSet = 0;
this.lastIndex = -1;
Clazz_instantialize (this, arguments);
}, JM, "MeasurementPending", JM.Measurement);
Clazz_defineMethod (c$, "set", 
function (modelSet) {
return this.setM (modelSet, null, NaN, 0, null, 0);
}, "JM.ModelSet");
Clazz_defineMethod (c$, "checkPoint", 
 function (ptClicked) {
for (var i = 1; i <= this.numSet; i++) if (this.countPlusIndices[i] == -1 - i && this.pts[i - 1].distance (ptClicked) < 0.01) return false;

return true;
}, "JU.Point3fi");
Clazz_defineMethod (c$, "getIndexOf", 
function (atomIndex) {
for (var i = 1; i <= this.numSet; i++) if (this.countPlusIndices[i] == atomIndex) return i;

return 0;
}, "~N");
Clazz_overrideMethod (c$, "setCount", 
function (count) {
this.setCountM (count);
this.numSet = count;
}, "~N");
Clazz_defineMethod (c$, "addPoint", 
function (atomIndex, ptClicked, doSet) {
this.haveModified = (atomIndex != this.lastIndex);
this.lastIndex = atomIndex;
if (ptClicked == null) {
if (this.getIndexOf (atomIndex) > 0) {
if (doSet) this.numSet = this.count;
return this.count;
}this.haveTarget = (atomIndex >= 0);
if (!this.haveTarget) return this.count = this.numSet;
this.count = this.numSet + 1;
this.countPlusIndices[this.count] = atomIndex;
} else {
if (!this.checkPoint (ptClicked)) {
if (doSet) this.numSet = this.count;
return this.count;
}var pt = this.numSet;
this.haveModified = this.haveTarget = true;
this.count = this.numSet + 1;
this.pts[pt] = ptClicked;
this.countPlusIndices[this.count] = -2 - pt;
}this.countPlusIndices[0] = this.count;
if (doSet) this.numSet = this.count;
this.value = this.getMeasurement (null);
this.strFormat = null;
this.formatMeasurement (null);
return this.count;
}, "~N,JU.Point3fi,~B");
});
Clazz_declarePackage ("JM");
Clazz_load (["JU.BS", "$.SB"], "JM.Model", ["java.util.Hashtable", "JU.AU", "JU.BSUtil"], function () {
c$ = Clazz_decorateAsClass (function () {
this.ms = null;
this.modelIndex = 0;
this.fileIndex = 0;
this.hydrogenCount = 0;
this.isBioModel = false;
this.isPdbWithMultipleBonds = false;
this.hasRasmolHBonds = false;
this.loadState = "";
this.loadScript = null;
this.isModelKit = false;
this.dataFrames = null;
this.dataSourceFrame = -1;
this.jmolData = null;
this.jmolFrameType = null;
this.firstAtomIndex = 0;
this.ac = 0;
this.bsAtoms = null;
this.bsAtomsDeleted = null;
this.trajectoryBaseIndex = 0;
this.isTrajectory = false;
this.selectedTrajectory = -1;
this.bondCount = -1;
this.firstMoleculeIndex = 0;
this.moleculeCount = 0;
this.nAltLocs = 0;
this.nInsertions = 0;
this.groupCount = -1;
this.chainCount = 0;
this.chains = null;
this.biosymmetryCount = 0;
this.auxiliaryInfo = null;
this.properties = null;
this.defaultRotationRadius = 0;
this.defaultStructure = null;
this.biosymmetry = null;
this.orientation = null;
this.structureTainted = false;
this.isJmolDataFrame = false;
this.frameDelay = 0;
this.simpleCage = null;
this.dssrCache = null;
Clazz_instantialize (this, arguments);
}, JM, "Model");
Clazz_prepareFields (c$, function () {
this.loadScript =  new JU.SB ();
this.bsAtoms =  new JU.BS ();
this.bsAtomsDeleted =  new JU.BS ();
this.chains =  new Array (8);
});
Clazz_defineMethod (c$, "getModelSet", 
function () {
return this.ms;
});
Clazz_defineMethod (c$, "isModelkit", 
function () {
return this.isModelKit;
});
Clazz_defineMethod (c$, "getTrueAtomCount", 
function () {
return this.bsAtoms.cardinality () - this.bsAtomsDeleted.cardinality ();
});
Clazz_defineMethod (c$, "resetBoundCount", 
function () {
this.bondCount = -1;
});
Clazz_defineMethod (c$, "getBondCount", 
function () {
if (this.bondCount >= 0) return this.bondCount;
var bonds = this.ms.bo;
this.bondCount = 0;
for (var i = this.ms.bondCount; --i >= 0; ) if (bonds[i].atom1.mi == this.modelIndex) this.bondCount++;

return this.bondCount;
});
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "set", 
function (modelSet, modelIndex, trajectoryBaseIndex, jmolData, properties, auxiliaryInfo) {
this.ms = modelSet;
this.dataSourceFrame = this.modelIndex = modelIndex;
this.isTrajectory = (trajectoryBaseIndex >= 0);
this.trajectoryBaseIndex = (this.isTrajectory ? trajectoryBaseIndex : modelIndex);
if (auxiliaryInfo == null) {
auxiliaryInfo =  new java.util.Hashtable ();
}this.auxiliaryInfo = auxiliaryInfo;
if (auxiliaryInfo.containsKey ("biosymmetryCount")) {
this.biosymmetryCount = (auxiliaryInfo.get ("biosymmetryCount")).intValue ();
this.biosymmetry = auxiliaryInfo.get ("biosymmetry");
}this.properties = properties;
if (jmolData == null) {
this.jmolFrameType = "modelSet";
} else {
this.jmolData = jmolData;
this.isJmolDataFrame = true;
auxiliaryInfo.put ("jmolData", jmolData);
auxiliaryInfo.put ("title", jmolData);
this.jmolFrameType = (jmolData.indexOf ("ramachandran") >= 0 ? "ramachandran" : jmolData.indexOf ("quaternion") >= 0 ? "quaternion" : "data");
}return this;
}, "JM.ModelSet,~N,~N,~S,java.util.Properties,java.util.Map");
Clazz_defineMethod (c$, "getChainCount", 
function (countWater) {
if (this.chainCount > 1 && !countWater) for (var i = 0; i < this.chainCount; i++) if (this.chains[i].chainID == 0) return this.chainCount - 1;

return this.chainCount;
}, "~B");
Clazz_defineMethod (c$, "getGroupCountHetero", 
function (isHetero) {
var n = 0;
for (var i = this.chainCount; --i >= 0; ) for (var j = this.chains[i].groupCount; --j >= 0; ) if (this.chains[i].groups[j].isHetero () == isHetero) n++;


return n;
}, "~B");
Clazz_defineMethod (c$, "calcSelectedGroupsCount", 
function (bsSelected) {
for (var i = this.chainCount; --i >= 0; ) this.chains[i].calcSelectedGroupsCount (bsSelected);

}, "JU.BS");
Clazz_defineMethod (c$, "getGroupCount", 
function () {
if (this.groupCount < 0) {
this.groupCount = 0;
for (var i = this.chainCount; --i >= 0; ) this.groupCount += this.chains[i].groupCount;

}return this.groupCount;
});
Clazz_defineMethod (c$, "getChainAt", 
function (i) {
return (i < this.chainCount ? this.chains[i] : null);
}, "~N");
Clazz_defineMethod (c$, "getChain", 
function (chainID) {
for (var i = this.chainCount; --i >= 0; ) {
var chain = this.chains[i];
if (chain.chainID == chainID) return chain;
}
return null;
}, "~N");
Clazz_defineMethod (c$, "fixIndices", 
function (modelIndex, nAtomsDeleted, bsDeleted) {
this.fixIndicesM (modelIndex, nAtomsDeleted, bsDeleted);
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "fixIndicesM", 
function (modelIndex, nAtomsDeleted, bsDeleted) {
if (this.dataSourceFrame > modelIndex) this.dataSourceFrame--;
if (this.trajectoryBaseIndex > modelIndex) this.trajectoryBaseIndex--;
this.firstAtomIndex -= nAtomsDeleted;
for (var i = 0; i < this.chainCount; i++) this.chains[i].fixIndices (nAtomsDeleted, bsDeleted);

JU.BSUtil.deleteBits (this.bsAtoms, bsDeleted);
JU.BSUtil.deleteBits (this.bsAtomsDeleted, bsDeleted);
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "freeze", 
function () {
this.freezeM ();
});
Clazz_defineMethod (c$, "freezeM", 
function () {
this.chains = JU.AU.arrayCopyObject (this.chains, this.chainCount);
this.groupCount = -1;
this.getGroupCount ();
for (var i = 0; i < this.chainCount; ++i) this.chains[i].groups = JU.AU.arrayCopyObject (this.chains[i].groups, this.chains[i].groupCount);

});
Clazz_defineMethod (c$, "getPdbData", 
function (vwr, type, ctype, isDraw, bsSelected, out, tokens, pdbCONECT, bsWritten) {
}, "JV.Viewer,~S,~S,~B,JU.BS,JU.OC,~A,JU.SB,JU.BS");
Clazz_defineMethod (c$, "getBioBranches", 
function (bioBranches) {
return bioBranches;
}, "JU.Lst");
Clazz_defineMethod (c$, "clearBioPolymers", 
function () {
});
Clazz_defineMethod (c$, "getAllPolymerInfo", 
function (bs, finalInfo, modelVector) {
}, "JU.BS,java.util.Map,JU.Lst");
Clazz_defineMethod (c$, "getBioPolymerCount", 
function () {
return 0;
});
Clazz_defineMethod (c$, "calculateStructures", 
function (asDSSP, doReport, dsspIgnoreHydrogen, setStructure, includeAlpha) {
return "";
}, "~B,~B,~B,~B,~B");
Clazz_defineMethod (c$, "setStructureList", 
function (structureList) {
}, "java.util.Map");
Clazz_defineMethod (c$, "getChimeInfo", 
function (sb, nHetero) {
this.getChimeInfoM (sb, nHetero);
}, "JU.SB,~N");
Clazz_defineMethod (c$, "getChimeInfoM", 
function (sb, nHetero) {
sb.append ("\nNumber of Atoms ..... " + (this.ms.ac - nHetero));
if (nHetero > 0) sb.append (" (" + nHetero + ")");
sb.append ("\nNumber of Bonds ..... " + this.ms.bondCount);
sb.append ("\nNumber of Models ...... " + this.ms.mc);
}, "JU.SB,~N");
Clazz_defineMethod (c$, "setConformation", 
function (bsConformation) {
}, "JU.BS");
Clazz_defineMethod (c$, "getPdbConformation", 
function (bsConformation, conformationIndex) {
return false;
}, "JU.BS,~N");
Clazz_defineMethod (c$, "getFullPDBHeader", 
function () {
return null;
});
Clazz_defineMethod (c$, "getSequenceBits", 
function (ms, specInfo, bs) {
return null;
}, "JM.ModelSet,~S,JU.BS");
Clazz_defineMethod (c$, "getBasePairBits", 
function (ms, specInfo) {
return null;
}, "JM.ModelSet,~S");
Clazz_defineMethod (c$, "resetRasmolBonds", 
function (model, bs) {
}, "JM.Model,JU.BS");
Clazz_defineMethod (c$, "calcRasmolHydrogenBonds", 
function (ms, bsA, bsB, vHBonds, nucleicOnly, nMax, dsspIgnoreHydrogens, bsHBonds) {
}, "JM.ModelSet,JU.BS,JU.BS,JU.Lst,~B,~N,~B,JU.BS");
Clazz_defineMethod (c$, "getFullProteinStructureState", 
function (modelSet, bsAtoms2, taintedOnly, needPhiPsi, mode) {
return null;
}, "JM.ModelSet,JU.BS,~B,~B,~N");
Clazz_defineMethod (c$, "calculateAllPolymers", 
function (ms, groups, groupCount2, baseGroupIndex, modelsExcluded) {
}, "JM.ModelSet,~A,~N,~N,JU.BS");
Clazz_defineMethod (c$, "getGroupsWithinAll", 
function (ms, nResidues, bs) {
return null;
}, "JM.ModelSet,~N,JU.BS");
Clazz_defineMethod (c$, "getSelectCodeRange", 
function (ms, specInfo) {
return null;
}, "JM.ModelSet,~A");
Clazz_defineMethod (c$, "calculateStruts", 
function (ms, bs1, bs2) {
return 0;
}, "JM.ModelSet,JU.BS,JU.BS");
Clazz_defineMethod (c$, "getPolymerPointsAndVectors", 
function (bs, vList, isTraceAlpha, sheetSmoothing) {
}, "JU.BS,JU.Lst,~B,~N");
Clazz_defineMethod (c$, "recalculatePoints", 
function (ms, modelIndex) {
}, "JM.ModelSet,~N");
Clazz_defineMethod (c$, "getDefaultLargePDBRendering", 
function (sb, maxAtoms) {
}, "JU.SB,~N");
Clazz_defineMethod (c$, "calcSelectedMonomersCount", 
function (bsSelected) {
}, "JU.BS");
Clazz_defineMethod (c$, "getBioPolymerCountInModel", 
function (ms, modelIndex) {
return 0;
}, "JM.ModelSet,~N");
Clazz_defineMethod (c$, "calculateStraightnessAll", 
function (ms) {
}, "JM.ModelSet");
});
Clazz_declarePackage ("JM");
Clazz_load (["java.util.Hashtable", "JU.BS"], "JM.ModelLoader", ["java.lang.Boolean", "$.Float", "$.NullPointerException", "java.util.Arrays", "JU.AU", "$.Lst", "$.P3", "$.PT", "$.SB", "$.V3", "J.api.Interface", "JM.Chain", "$.Group", "$.Model", "$.ModelSet", "JU.BSUtil", "$.Elements", "$.JmolMolecule", "$.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.ms = null;
this.mergeModelSet = null;
this.merging = false;
this.appendNew = false;
this.jmolData = null;
this.group3Lists = null;
this.group3Counts = null;
this.specialAtomIndexes = null;
this.someModelsHaveUnitcells = false;
this.someModelsAreModulated = false;
this.is2D = false;
this.isTrajectory = false;
this.isPyMOLsession = false;
this.doMinimize = false;
this.doAddHydrogens = false;
this.fileHeader = null;
this.jbr = null;
this.groups = null;
this.groupCount = 0;
this.modulationTUV = null;
this.htAtomMap = null;
this.chainOf = null;
this.group3Of = null;
this.seqcodes = null;
this.firstAtomIndexes = null;
this.iModel = 0;
this.model = null;
this.currentChainID = 0;
this.isNewChain = false;
this.currentChain = null;
this.currentGroupSequenceNumber = 0;
this.currentGroupInsertionCode = '\0';
this.currentGroup3 = null;
this.nullGroup = null;
this.baseModelIndex = 0;
this.baseModelCount = 0;
this.baseAtomIndex = 0;
this.baseGroupIndex = 0;
this.baseTrajectoryCount = 0;
this.adapterModelCount = 0;
this.adapterTrajectoryCount = 0;
this.noAutoBond = false;
this.modulationOn = false;
this.htGroup1 = null;
this.$mergeGroups = null;
this.iChain = 0;
this.vStereo = null;
this.structuresDefinedInFile = null;
Clazz_instantialize (this, arguments);
}, JM, "ModelLoader");
Clazz_prepareFields (c$, function () {
this.htAtomMap =  new java.util.Hashtable ();
this.structuresDefinedInFile =  new JU.BS ();
});
Clazz_makeConstructor (c$, 
function (vwr, modelSetName, loadScript, asc, mergeModelSet, bsNew) {
this.vwr = vwr;
this.ms =  new JM.ModelSet (vwr, modelSetName);
var adapter = vwr.getModelAdapter ();
this.mergeModelSet = mergeModelSet;
this.merging = (this.mergeModelSet != null && this.mergeModelSet.ac > 0);
if (this.merging) {
this.ms.canSkipLoad = false;
} else {
vwr.resetShapes (false);
}this.ms.preserveState = vwr.getPreserveState ();
this.ms.showRebondTimes = vwr.getBoolean (603979934);
if (bsNew == null) {
this.initializeInfo (modelSetName, null);
this.createModelSet (null, null, null);
vwr.setStringProperty ("_fileType", "");
return;
}if (!this.ms.preserveState) this.ms.canSkipLoad = false;
var info = adapter.getAtomSetCollectionAuxiliaryInfo (asc);
info.put ("loadScript", loadScript);
this.initializeInfo (adapter.getFileTypeName (asc).toLowerCase ().intern (), info);
this.createModelSet (adapter, asc, bsNew);
if (this.jbr != null) this.jbr.setLoader (null);
this.jbr = null;
}, "JV.Viewer,~S,JU.SB,~O,JM.ModelSet,JU.BS");
Clazz_defineMethod (c$, "initializeInfo", 
 function (name, info) {
this.ms.g3d = this.vwr.gdata;
this.ms.modelSetTypeName = name;
this.ms.isXYZ = (name === "xyz");
this.ms.msInfo = info;
this.ms.modelSetProperties = this.ms.getInfoM ("properties");
this.ms.haveBioModels = this.ms.getMSInfoB ("isPDB");
if (this.ms.haveBioModels) this.jbr = this.vwr.getJBR ().setLoader (this);
this.jmolData = this.ms.getInfoM ("jmolData");
this.fileHeader = this.ms.getInfoM ("fileHeader");
this.ms.trajectorySteps = this.ms.getInfoM ("trajectorySteps");
this.isTrajectory = (this.ms.trajectorySteps != null);
this.isPyMOLsession = this.ms.getMSInfoB ("isPyMOL");
this.doAddHydrogens = (this.jbr != null && !this.isTrajectory && !this.isPyMOLsession && !this.ms.getMSInfoB ("pdbNoHydrogens") && (this.ms.getMSInfoB ("pdbAddHydrogens") || this.vwr.getBooleanProperty ("pdbAddHydrogens")));
if (info != null) {
info.remove ("pdbNoHydrogens");
info.remove ("pdbAddHydrogens");
info.remove ("trajectorySteps");
if (this.isTrajectory) this.ms.vibrationSteps = info.remove ("vibrationSteps");
if (info.containsKey ("legacyJavaFloat")) {
this.vwr.setBooleanProperty ("legacyJavaFloat", true);
}}this.htGroup1 = this.ms.getInfoM ("htGroup1");
var mod = this.ms.getInfoM ("modulationOn");
if (mod != null) {
this.modulationOn = true;
this.modulationTUV = (mod === Boolean.TRUE ? null : mod);
}this.noAutoBond = this.ms.getMSInfoB ("noAutoBond");
this.is2D = this.ms.getMSInfoB ("is2D");
this.doMinimize = this.is2D && this.ms.getMSInfoB ("doMinimize");
this.adapterTrajectoryCount = (this.ms.trajectorySteps == null ? 0 : this.ms.trajectorySteps.size ());
this.ms.someModelsHaveSymmetry = this.ms.getMSInfoB ("someModelsHaveSymmetry");
this.someModelsHaveUnitcells = this.ms.getMSInfoB ("someModelsHaveUnitcells");
this.someModelsAreModulated = this.ms.getMSInfoB ("someModelsAreModulated");
this.ms.someModelsHaveFractionalCoordinates = this.ms.getMSInfoB ("someModelsHaveFractionalCoordinates");
if (this.merging) {
this.ms.haveBioModels = new Boolean (this.ms.haveBioModels | this.mergeModelSet.haveBioModels).valueOf ();
this.ms.bioModel = this.mergeModelSet.bioModel;
this.ms.someModelsHaveSymmetry = new Boolean (this.ms.someModelsHaveSymmetry | this.mergeModelSet.getMSInfoB ("someModelsHaveSymmetry")).valueOf ();
this.someModelsHaveUnitcells = new Boolean (this.someModelsHaveUnitcells | this.mergeModelSet.getMSInfoB ("someModelsHaveUnitcells")).valueOf ();
this.ms.someModelsHaveFractionalCoordinates = new Boolean (this.ms.someModelsHaveFractionalCoordinates | this.mergeModelSet.getMSInfoB ("someModelsHaveFractionalCoordinates")).valueOf ();
this.ms.someModelsHaveAromaticBonds = new Boolean (this.ms.someModelsHaveAromaticBonds | this.mergeModelSet.someModelsHaveAromaticBonds).valueOf ();
this.ms.msInfo.put ("someModelsHaveSymmetry", Boolean.$valueOf (this.ms.someModelsHaveSymmetry));
this.ms.msInfo.put ("someModelsHaveUnitcells", Boolean.$valueOf (this.someModelsHaveUnitcells));
this.ms.msInfo.put ("someModelsHaveFractionalCoordinates", Boolean.$valueOf (this.ms.someModelsHaveFractionalCoordinates));
this.ms.msInfo.put ("someModelsHaveAromaticBonds", Boolean.$valueOf (this.ms.someModelsHaveAromaticBonds));
}}, "~S,java.util.Map");
Clazz_defineMethod (c$, "getGroup3", 
function (iGroup) {
return (iGroup >= this.group3Of.length ? null : this.group3Of[iGroup]);
}, "~N");
Clazz_defineMethod (c$, "getFirstAtomIndex", 
function (iGroup) {
return this.firstAtomIndexes[iGroup];
}, "~N");
Clazz_defineMethod (c$, "getAtomCount", 
function () {
return this.ms.ac;
});
Clazz_defineMethod (c$, "createModelSet", 
 function (adapter, asc, bsNew) {
var nAtoms = (adapter == null ? 0 : adapter.getAtomCount (asc));
if (nAtoms > 0) JU.Logger.info ("reading " + nAtoms + " atoms");
this.adapterModelCount = (adapter == null ? 1 : adapter.getAtomSetCount (asc));
this.appendNew = (!this.merging || adapter == null || this.adapterModelCount > 1 || this.isTrajectory || this.vwr.getBoolean (603979792));
this.htAtomMap.clear ();
this.chainOf =  new Array (32);
this.group3Of =  new Array (32);
this.seqcodes =  Clazz_newIntArray (32, 0);
this.firstAtomIndexes =  Clazz_newIntArray (32, 0);
this.currentChainID = 2147483647;
this.currentChain = null;
this.currentGroupInsertionCode = '\uFFFF';
this.currentGroup3 = "xxxxx";
this.iModel = -1;
this.model = null;
if (this.merging) {
this.baseModelCount = this.mergeModelSet.mc;
this.baseTrajectoryCount = this.mergeModelSet.mergeTrajectories (this.isTrajectory);
if (this.baseTrajectoryCount > 0) {
if (this.isTrajectory) {
if (this.mergeModelSet.vibrationSteps == null) {
this.mergeModelSet.vibrationSteps =  new JU.Lst ();
for (var i = this.mergeModelSet.trajectorySteps.size (); --i >= 0; ) this.mergeModelSet.vibrationSteps.addLast (null);

}for (var i = 0; i < this.ms.trajectorySteps.size (); i++) {
this.mergeModelSet.trajectorySteps.addLast (this.ms.trajectorySteps.get (i));
this.mergeModelSet.vibrationSteps.addLast (this.ms.vibrationSteps == null ? null : this.ms.vibrationSteps.get (i));
}
}this.ms.trajectorySteps = this.mergeModelSet.trajectorySteps;
this.ms.vibrationSteps = this.mergeModelSet.vibrationSteps;
}}this.initializeAtomBondModelCounts (nAtoms);
if (bsNew != null && (this.doMinimize || this.is2D)) {
bsNew.setBits (this.baseAtomIndex, this.baseAtomIndex + nAtoms);
}if (adapter == null) {
this.setModelNameNumberProperties (0, -1, "", 1, null, null, null);
} else {
if (this.adapterModelCount > 0) {
JU.Logger.info ("ModelSet: haveSymmetry:" + this.ms.someModelsHaveSymmetry + " haveUnitcells:" + this.someModelsHaveUnitcells + " haveFractionalCoord:" + this.ms.someModelsHaveFractionalCoordinates);
JU.Logger.info (this.adapterModelCount + " model" + (this.ms.mc == 1 ? "" : "s") + " in this collection. Use getProperty \"modelInfo\" or" + " getProperty \"auxiliaryInfo\" to inspect them.");
}var q = this.ms.getInfoM ("defaultOrientationQuaternion");
if (q != null) {
JU.Logger.info ("defaultOrientationQuaternion = " + q);
JU.Logger.info ("Use \"set autoLoadOrientation TRUE\" before loading or \"restore orientation DEFAULT\" after loading to view this orientation.");
}this.iterateOverAllNewModels (adapter, asc);
this.iterateOverAllNewAtoms (adapter, asc);
this.iterateOverAllNewBonds (adapter, asc);
if (this.merging && !this.appendNew) {
var info = adapter.getAtomSetAuxiliaryInfo (asc, 0);
this.ms.setInfo (this.baseModelIndex, "initialAtomCount", info.get ("initialAtomCount"));
this.ms.setInfo (this.baseModelIndex, "initialBondCount", info.get ("initialBondCount"));
}this.initializeUnitCellAndSymmetry ();
this.initializeBonding ();
}this.finalizeGroupBuild ();
if (this.is2D && this.doMinimize) {
this.applyStereochemistry ();
}if (this.doAddHydrogens) this.jbr.finalizeHydrogens ();
if (adapter != null) {
this.ms.calculatePolymers (this.groups, this.groupCount, this.baseGroupIndex, null);
if (this.jbr != null) this.jbr.iterateOverAllNewStructures (adapter, asc);
}this.setDefaultRendering (this.vwr.getInt (553648170));
var rd = this.vwr.rd;
var ac = this.ms.ac;
var atoms = this.ms.at;
for (var i = this.baseAtomIndex; i < ac; i++) atoms[i].setMadAtom (this.vwr, rd);

var models = this.ms.am;
for (var i = models[this.baseModelIndex].firstAtomIndex; i < ac; i++) models[atoms[i].mi].bsAtoms.set (i);

this.freeze ();
this.finalizeShapes ();
this.vwr.setModelSet (this.ms);
this.setAtomProperties ();
if (adapter != null) adapter.finish (asc);
if (this.mergeModelSet != null) {
this.mergeModelSet.releaseModelSet ();
}this.mergeModelSet = null;
}, "J.api.JmolAdapter,~O,JU.BS");
Clazz_defineMethod (c$, "setDefaultRendering", 
 function (maxAtoms) {
if (this.isPyMOLsession) return;
var sb =  new JU.SB ();
var modelCount = this.ms.mc;
var models = this.ms.am;
for (var i = this.baseModelIndex; i < modelCount; i++) if (models[i].isBioModel) models[i].getDefaultLargePDBRendering (sb, maxAtoms);

if (sb.length () == 0) return;
sb.append ("select *;");
var script = this.ms.getInfoM ("jmolscript");
if (script == null) script = "";
sb.append (script);
this.ms.msInfo.put ("jmolscript", sb.toString ());
}, "~N");
Clazz_defineMethod (c$, "setAtomProperties", 
 function () {
var modelCount = this.ms.mc;
for (var i = this.baseModelIndex; i < modelCount; i++) {
var atomProperties = this.ms.getInfo (i, "atomProperties");
var groupList = this.ms.getInfo (i, "groupPropertyList");
if (atomProperties == null) continue;
for (var entry, $entry = atomProperties.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var key = entry.getKey ();
var value = entry.getValue ();
var bs = this.ms.getModelAtomBitSetIncludingDeleted (i, true);
if (this.doAddHydrogens) {
var isGroup = (groupList != null && JU.PT.isOneOf (key, groupList));
value = this.jbr.fixPropertyValue (bs, value, isGroup);
}key = "property_" + key.toLowerCase ();
JU.Logger.info ("creating " + key + " for model " + this.ms.getModelName (i));
this.vwr.setData (key, [key, value, bs, Integer.$valueOf (-1), Boolean.FALSE], this.ms.ac, 0, 0, 2147483647, 0);
}
}
});
Clazz_defineMethod (c$, "initializeAtomBondModelCounts", 
 function (nAtoms) {
var trajectoryCount = this.adapterTrajectoryCount;
if (this.merging) {
if (this.appendNew) {
this.baseModelIndex = this.baseModelCount;
this.ms.mc = this.baseModelCount + this.adapterModelCount;
} else {
this.baseModelIndex = this.vwr.am.cmi;
if (this.baseModelIndex < 0) this.baseModelIndex = this.baseModelCount - 1;
this.ms.mc = this.baseModelCount;
}this.ms.ac = this.baseAtomIndex = this.mergeModelSet.ac;
this.ms.bondCount = this.mergeModelSet.bondCount;
this.$mergeGroups = this.mergeModelSet.getGroups ();
this.groupCount = this.baseGroupIndex = this.$mergeGroups.length;
this.ms.mergeModelArrays (this.mergeModelSet);
this.ms.growAtomArrays (this.ms.ac + nAtoms);
} else {
this.ms.mc = this.adapterModelCount;
this.ms.ac = 0;
this.ms.bondCount = 0;
this.ms.at =  new Array (nAtoms);
this.ms.bo =  new Array (250 + nAtoms);
}if (this.doAddHydrogens) this.jbr.initializeHydrogenAddition ();
if (trajectoryCount > 1) this.ms.mc += trajectoryCount - 1;
this.ms.am = JU.AU.arrayCopyObject (this.ms.am, this.ms.mc);
this.ms.modelFileNumbers = JU.AU.arrayCopyI (this.ms.modelFileNumbers, this.ms.mc);
this.ms.modelNumbers = JU.AU.arrayCopyI (this.ms.modelNumbers, this.ms.mc);
this.ms.modelNumbersForAtomLabel = JU.AU.arrayCopyS (this.ms.modelNumbersForAtomLabel, this.ms.mc);
this.ms.modelNames = JU.AU.arrayCopyS (this.ms.modelNames, this.ms.mc);
this.ms.frameTitles = JU.AU.arrayCopyS (this.ms.frameTitles, this.ms.mc);
if (this.merging) for (var i = 0; i < this.mergeModelSet.mc; i++) (this.ms.am[i] = this.mergeModelSet.am[i]).ms = this.ms;

}, "~N");
Clazz_defineMethod (c$, "mergeGroups", 
 function () {
var info = this.mergeModelSet.getAuxiliaryInfo (null);
var mergeGroup3Lists = info.get ("group3Lists");
var mergeGroup3Counts = info.get ("group3Counts");
if (mergeGroup3Lists != null) {
for (var i = 0; i < this.baseModelCount; i++) {
this.group3Lists[i + 1] = mergeGroup3Lists[i + 1];
this.group3Counts[i + 1] = mergeGroup3Counts[i + 1];
this.structuresDefinedInFile.set (i);
}
this.group3Lists[0] = mergeGroup3Lists[0];
this.group3Counts[0] = mergeGroup3Counts[0];
}if (!this.appendNew && this.ms.haveBioModels) this.structuresDefinedInFile.clear (this.baseModelIndex);
});
Clazz_defineMethod (c$, "iterateOverAllNewModels", 
 function (adapter, asc) {
this.group3Lists =  new Array (this.ms.mc + 1);
this.group3Counts = JU.AU.newInt2 (this.ms.mc + 1);
this.structuresDefinedInFile =  new JU.BS ();
if (this.merging) this.mergeGroups ();
var iTrajectory = (this.isTrajectory ? this.baseTrajectoryCount : -1);
var ipt = this.baseModelIndex;
for (var i = 0; i < this.adapterModelCount; ++i, ++ipt) {
var modelNumber = adapter.getAtomSetNumber (asc, i);
var modelName = adapter.getAtomSetName (asc, i);
var modelAuxiliaryInfo = adapter.getAtomSetAuxiliaryInfo (asc, i);
if (modelAuxiliaryInfo.containsKey ("modelID")) modelAuxiliaryInfo.put ("modelID0", modelAuxiliaryInfo.get ("modelID"));
var modelProperties = modelAuxiliaryInfo.get ("modelProperties");
this.vwr.setStringProperty ("_fileType", modelAuxiliaryInfo.get ("fileType"));
if (modelName == null) modelName = (this.jmolData != null && this.jmolData.indexOf (";") > 2 ? this.jmolData.substring (this.jmolData.indexOf (":") + 2, this.jmolData.indexOf (";")) : this.appendNew ? "" + (modelNumber % 1000000) : "");
var isPDBModel = this.setModelNameNumberProperties (ipt, iTrajectory, modelName, modelNumber, modelProperties, modelAuxiliaryInfo, this.jmolData);
if (isPDBModel) this.jbr.setGroupLists (ipt);
if (this.ms.getInfo (ipt, "periodicOriginXyz") != null) this.ms.someModelsHaveSymmetry = true;
}
var m = this.ms.am[this.baseModelIndex];
this.vwr.setSmilesString (this.ms.msInfo.get ("smilesString"));
var loadState = this.ms.msInfo.remove ("loadState");
var loadScript = this.ms.msInfo.remove ("loadScript");
if (loadScript.indexOf ("Viewer.AddHydrogens") < 0 || !m.isModelKit) {
var lines = JU.PT.split (loadState, "\n");
var sb =  new JU.SB ();
for (var i = 0; i < lines.length; i++) {
var pt = m.loadState.indexOf (lines[i]);
if (pt < 0 || pt != m.loadState.lastIndexOf (lines[i])) sb.append (lines[i]).appendC ('\n');
}
m.loadState += m.loadScript.toString () + sb.toString ();
m.loadScript =  new JU.SB ();
m.loadScript.append ("  ").appendSB (loadScript).append (";\n");
}if (this.isTrajectory) {
var n = (this.ms.mc - ipt + 1);
JU.Logger.info (n + " trajectory steps read");
this.ms.setInfo (this.baseModelCount, "trajectoryStepCount", Integer.$valueOf (n));
for (var ia = this.adapterModelCount, i = ipt; i < this.ms.mc; i++, ia++) {
this.ms.am[i] = this.ms.am[this.baseModelCount];
this.ms.modelNumbers[i] = adapter.getAtomSetNumber (asc, ia);
this.ms.modelNames[i] = adapter.getAtomSetName (asc, ia);
this.structuresDefinedInFile.set (i);
}
}this.finalizeModels (this.baseModelCount);
}, "J.api.JmolAdapter,~O");
Clazz_defineMethod (c$, "setModelNameNumberProperties", 
 function (modelIndex, trajectoryBaseIndex, modelName, modelNumber, modelProperties, modelAuxiliaryInfo, jmolData) {
var modelIsPDB = (modelAuxiliaryInfo != null && Boolean.TRUE === modelAuxiliaryInfo.get ("isPDB"));
if (this.appendNew) {
this.ms.am[modelIndex] = (modelIsPDB ? this.jbr.getBioModel (modelIndex, trajectoryBaseIndex, jmolData, modelProperties, modelAuxiliaryInfo) :  new JM.Model ().set (this.ms, modelIndex, trajectoryBaseIndex, jmolData, modelProperties, modelAuxiliaryInfo));
this.ms.modelNumbers[modelIndex] = modelNumber;
this.ms.modelNames[modelIndex] = modelName;
} else {
var atomInfo = modelAuxiliaryInfo.get ("PDB_CONECT_firstAtom_count_max");
if (atomInfo != null) this.ms.setInfo (modelIndex, "PDB_CONECT_firstAtom_count_max", atomInfo);
}var models = this.ms.am;
var atoms = this.ms.at;
models[modelIndex].bsAtoms.set (atoms.length + 1);
models[modelIndex].bsAtoms.clear (atoms.length + 1);
var codes = this.ms.getInfo (modelIndex, "altLocs");
models[modelIndex].nAltLocs = (codes == null ? 0 : codes.length);
if (codes != null) {
var altlocs = codes.toCharArray ();
java.util.Arrays.sort (altlocs);
codes = String.valueOf (altlocs);
this.ms.setInfo (modelIndex, "altLocs", codes);
}codes = this.ms.getInfo (modelIndex, "insertionCodes");
models[modelIndex].nInsertions = (codes == null ? 0 : codes.length);
var isModelKit = (this.ms.modelSetName != null && this.ms.modelSetName.startsWith ("Jmol Model Kit") || modelName.startsWith ("Jmol Model Kit") || "Jme".equals (this.ms.getInfo (modelIndex, "fileType")));
models[modelIndex].isModelKit = isModelKit;
return modelIsPDB;
}, "~N,~N,~S,~N,java.util.Properties,java.util.Map,~S");
Clazz_defineMethod (c$, "finalizeModels", 
 function (baseModelCount) {
var modelCount = this.ms.mc;
if (modelCount == baseModelCount) return;
var sNum;
var modelnumber = 0;
var lastfilenumber = -1;
var modelNumbers = this.ms.modelNumbers;
var modelNames = this.ms.modelNames;
if (this.isTrajectory) for (var i = baseModelCount; ++i < this.ms.mc; ) modelNumbers[i] = modelNumbers[i - 1] + 1;

if (baseModelCount > 0) {
if (modelNumbers[0] < 1000000) {
for (var i = 0; i < baseModelCount; i++) {
if (modelNames[i].length == 0) modelNames[i] = "" + modelNumbers[i];
modelNumbers[i] += 1000000;
this.ms.modelNumbersForAtomLabel[i] = "1." + (i + 1);
}
}var filenumber = modelNumbers[baseModelCount - 1];
filenumber -= filenumber % 1000000;
if (modelNumbers[baseModelCount] < 1000000) filenumber += 1000000;
for (var i = baseModelCount; i < modelCount; i++) modelNumbers[i] += filenumber;

}var models = this.ms.am;
for (var i = baseModelCount; i < modelCount; ++i) {
this.ms.setInfo (i, "fileType", this.ms.modelSetTypeName);
if (this.fileHeader != null) this.ms.setInfo (i, "fileHeader", this.fileHeader);
var filenumber = Clazz_doubleToInt (modelNumbers[i] / 1000000);
if (filenumber != lastfilenumber) {
modelnumber = 0;
lastfilenumber = filenumber;
}modelnumber++;
if (filenumber == 0) {
sNum = "" + this.ms.getModelNumber (i);
filenumber = 1;
} else {
sNum = filenumber + "." + modelnumber;
}this.ms.modelNumbersForAtomLabel[i] = sNum;
models[i].fileIndex = filenumber - 1;
this.ms.modelFileNumbers[i] = filenumber * 1000000 + modelnumber;
if (modelNames[i] == null || modelNames[i].length == 0) modelNames[i] = sNum;
}
if (this.merging) for (var i = 0; i < baseModelCount; i++) models[i].ms = this.ms;

for (var i = 0; i < modelCount; i++) {
this.ms.setInfo (i, "modelName", modelNames[i]);
this.ms.setInfo (i, "modelNumber", Integer.$valueOf (modelNumbers[i] % 1000000));
this.ms.setInfo (i, "modelFileNumber", Integer.$valueOf (this.ms.modelFileNumbers[i]));
this.ms.setInfo (i, "modelNumberDotted", this.ms.getModelNumberDotted (i));
var codes = this.ms.getInfo (i, "altLocs");
if (codes != null) {
JU.Logger.info ("model " + this.ms.getModelNumberDotted (i) + " alternative locations: " + codes);
}}
}, "~N");
Clazz_defineMethod (c$, "iterateOverAllNewAtoms", 
 function (adapter, asc) {
var iLast = -1;
var isPdbThisModel = false;
var addH = false;
var isLegacyHAddition = false;
var iterAtom = adapter.getAtomIterator (asc);
var nRead = 0;
var models = this.ms.am;
if (this.ms.mc > 0) this.nullGroup =  new JM.Group ().setGroup ( new JM.Chain (this.ms.am[this.baseModelIndex], 32, -1), "", 0, -1, -1);
while (iterAtom.hasNext ()) {
nRead++;
var modelIndex = iterAtom.getAtomSetIndex () + this.baseModelIndex;
if (modelIndex != iLast) {
this.iChain = 0;
this.iModel = modelIndex;
this.model = models[modelIndex];
this.currentChainID = 2147483647;
this.isNewChain = true;
models[modelIndex].bsAtoms.clearAll ();
isPdbThisModel = models[modelIndex].isBioModel;
iLast = modelIndex;
addH = isPdbThisModel && this.doAddHydrogens;
if (this.jbr != null) this.jbr.setHaveHsAlready (false);
}var group3 = iterAtom.getGroup3 ();
var chainID = iterAtom.getChainID ();
this.checkNewGroup (adapter, chainID, group3, iterAtom.getSequenceNumber (), iterAtom.getInsertionCode (), addH, isLegacyHAddition);
var isotope = iterAtom.getElementNumber ();
if (addH && JU.Elements.getElementNumber (isotope) == 1) this.jbr.setHaveHsAlready (true);
var name = iterAtom.getAtomName ();
var charge = (addH ? this.getPdbCharge (group3, name) : iterAtom.getFormalCharge ());
this.addAtom (isPdbThisModel, iterAtom.getSymmetry (), iterAtom.getAtomSite (), iterAtom.getUniqueID (), isotope, name, charge, iterAtom.getPartialCharge (), iterAtom.getTensors (), iterAtom.getOccupancy (), iterAtom.getBfactor (), iterAtom.getXYZ (), iterAtom.getIsHetero (), iterAtom.getSerial (), iterAtom.getSeqID (), group3, iterAtom.getVib (), iterAtom.getAltLoc (), iterAtom.getRadius ());
}
if (this.groupCount > 0 && addH) {
this.jbr.addImplicitHydrogenAtoms (adapter, this.groupCount - 1, this.isNewChain && !isLegacyHAddition ? 1 : 0);
}iLast = -1;
var vdwtypeLast = null;
var atoms = this.ms.at;
for (var i = 0; i < this.ms.ac; i++) {
if (atoms[i].mi != iLast) {
iLast = atoms[i].mi;
models[iLast].firstAtomIndex = i;
var vdwtype = this.ms.getDefaultVdwType (iLast);
if (vdwtype !== vdwtypeLast) {
JU.Logger.info ("Default Van der Waals type for model" + " set to " + vdwtype.getVdwLabel ());
vdwtypeLast = vdwtype;
}}}
JU.Logger.info (nRead + " atoms created");
}, "J.api.JmolAdapter,~O");
Clazz_defineMethod (c$, "getPdbCharge", 
 function (group3, name) {
return (group3.equals ("ARG") && name.equals ("NH1") || group3.equals ("LYS") && name.equals ("NZ") || group3.equals ("HIS") && name.equals ("ND1") ? 1 : 0);
}, "~S,~S");
Clazz_defineMethod (c$, "addAtom", 
 function (isPDB, atomSymmetry, atomSite, atomUid, atomicAndIsotopeNumber, atomName, formalCharge, partialCharge, tensors, occupancy, bfactor, xyz, isHetero, atomSerial, atomSeqID, group3, vib, alternateLocationID, radius) {
var specialAtomID = 0;
var atomType = null;
if (atomName != null) {
var i;
if ((i = atomName.indexOf ('\0')) >= 0) {
atomType = atomName.substring (i + 1);
atomName = atomName.substring (0, i);
}if (isPDB) {
if (atomName.indexOf ('*') >= 0) atomName = atomName.$replace ('*', '\'');
specialAtomID = this.vwr.getJBR ().lookupSpecialAtomID (atomName);
if (specialAtomID == 2 && "CA".equalsIgnoreCase (group3)) specialAtomID = 0;
}}var atom = this.ms.addAtom (this.iModel, this.nullGroup, atomicAndIsotopeNumber, atomName, atomType, atomSerial, atomSeqID, atomSite, xyz, radius, vib, formalCharge, partialCharge, occupancy, bfactor, tensors, isHetero, specialAtomID, atomSymmetry);
atom.altloc = alternateLocationID;
this.htAtomMap.put (atomUid, atom);
}, "~B,JU.BS,~N,~O,~N,~S,~N,~N,JU.Lst,~N,~N,JU.P3,~B,~N,~N,~S,JU.V3,~S,~N");
Clazz_defineMethod (c$, "checkNewGroup", 
 function (adapter, chainID, group3, groupSequenceNumber, groupInsertionCode, addH, isLegacyHAddition) {
var group3i = (group3 == null ? null : group3.intern ());
if (chainID != this.currentChainID) {
this.currentChainID = chainID;
this.currentChain = this.getOrAllocateChain (this.model, chainID);
this.currentGroupInsertionCode = '\uFFFF';
this.currentGroupSequenceNumber = -1;
this.currentGroup3 = "xxxx";
this.isNewChain = true;
}if (groupSequenceNumber != this.currentGroupSequenceNumber || groupInsertionCode != this.currentGroupInsertionCode || group3i !== this.currentGroup3) {
if (this.groupCount > 0 && addH) {
this.jbr.addImplicitHydrogenAtoms (adapter, this.groupCount - 1, this.isNewChain && !isLegacyHAddition ? 1 : 0);
this.jbr.setHaveHsAlready (false);
}this.currentGroupSequenceNumber = groupSequenceNumber;
this.currentGroupInsertionCode = groupInsertionCode;
this.currentGroup3 = group3i;
while (this.groupCount >= this.group3Of.length) {
this.chainOf = JU.AU.doubleLength (this.chainOf);
this.group3Of = JU.AU.doubleLengthS (this.group3Of);
this.seqcodes = JU.AU.doubleLengthI (this.seqcodes);
this.firstAtomIndexes = JU.AU.doubleLengthI (this.firstAtomIndexes);
}
this.firstAtomIndexes[this.groupCount] = this.ms.ac;
this.chainOf[this.groupCount] = this.currentChain;
this.group3Of[this.groupCount] = group3;
this.seqcodes[this.groupCount] = JM.Group.getSeqcodeFor (groupSequenceNumber, groupInsertionCode);
++this.groupCount;
}}, "J.api.JmolAdapter,~N,~S,~N,~S,~B,~B");
Clazz_defineMethod (c$, "getOrAllocateChain", 
 function (model, chainID) {
var chain = model.getChain (chainID);
if (chain != null) return chain;
if (model.chainCount == model.chains.length) model.chains = JU.AU.doubleLength (model.chains);
return model.chains[model.chainCount++] =  new JM.Chain (model, chainID, (chainID == 0 || chainID == 32 ? -1 : this.iChain++));
}, "JM.Model,~N");
Clazz_defineMethod (c$, "iterateOverAllNewBonds", 
 function (adapter, asc) {
var iterBond = adapter.getBondIterator (asc);
if (iterBond == null) return;
var mad = this.vwr.getMadBond ();
this.ms.defaultCovalentMad = (this.jmolData == null ? mad : 0);
var haveMultipleBonds = false;
while (iterBond.hasNext ()) {
var iOrder = iterBond.getEncodedOrder ();
var order = iOrder;
var b = this.bondAtoms (iterBond.getAtomUniqueID1 (), iterBond.getAtomUniqueID2 (), order);
if (b != null) {
if (order > 1 && order != 1025 && order != 1041) haveMultipleBonds = true;
var radius = iterBond.getRadius ();
if (radius > 0) b.setMad (Clazz_floatToShort (radius * 2000));
var colix = iterBond.getColix ();
if (colix >= 0) b.colix = colix;
b.order |= (iOrder & 98304);
}}
if (haveMultipleBonds && this.ms.someModelsHaveSymmetry && !this.vwr.getBoolean (603979794)) JU.Logger.info ("ModelSet: use \"set appletSymmetryToBonds TRUE \" to apply the file-based multiple bonds to symmetry-generated atoms.");
this.ms.defaultCovalentMad = mad;
}, "J.api.JmolAdapter,~O");
Clazz_defineMethod (c$, "bondAtoms", 
 function (atomUid1, atomUid2, order) {
var atom1 = this.htAtomMap.get (atomUid1);
if (atom1 == null) {
JU.Logger.error ("bondAtoms cannot find atomUid1?:" + atomUid1);
return null;
}var atom2 = this.htAtomMap.get (atomUid2);
if (atom2 == null) {
JU.Logger.error ("bondAtoms cannot find atomUid2?:" + atomUid2);
return null;
}if (atom1.isBonded (atom2)) return null;
var isNear = (order == 1025);
var isFar = (order == 1041);
var bond;
if (isNear || isFar) {
bond = this.ms.bondMutually (atom1, atom2, (this.is2D ? order : 1), this.ms.getDefaultMadFromOrder (1), 0);
if (this.vStereo == null) {
this.vStereo =  new JU.Lst ();
}this.vStereo.addLast (bond);
} else {
bond = this.ms.bondMutually (atom1, atom2, order, this.ms.getDefaultMadFromOrder (order), 0);
if (bond.isAromatic ()) {
this.ms.someModelsHaveAromaticBonds = true;
}}if (this.ms.bondCount == this.ms.bo.length) {
this.ms.bo = JU.AU.arrayCopyObject (this.ms.bo, this.ms.bondCount + 250);
}this.ms.setBond (this.ms.bondCount++, bond);
return bond;
}, "~O,~O,~N");
Clazz_defineMethod (c$, "initializeUnitCellAndSymmetry", 
 function () {
if (this.someModelsAreModulated && this.ms.bsModulated == null) this.ms.bsModulated =  new JU.BS ();
if (this.someModelsHaveUnitcells) {
this.ms.unitCells =  new Array (this.ms.mc);
this.ms.haveUnitCells = true;
var haveMergeCells = (this.mergeModelSet != null && this.mergeModelSet.unitCells != null);
for (var i = 0, pt = 0; i < this.ms.mc; i++) {
if (haveMergeCells && i < this.baseModelCount) {
this.ms.unitCells[i] = this.mergeModelSet.unitCells[i];
} else {
this.ms.unitCells[i] = J.api.Interface.getSymmetry (this.vwr, "file");
var notionalCell = null;
if (this.isTrajectory) {
var lst = this.ms.getInfoM ("unitCells");
if (lst != null) notionalCell = lst.get (pt++);
}this.ms.unitCells[i].setSymmetryInfo (i, this.ms.getModelAuxiliaryInfo (i), notionalCell);
}}
}if (this.appendNew && this.ms.someModelsHaveSymmetry) {
this.ms.getAtoms (1089470478, null);
var atoms = this.ms.at;
for (var iAtom = this.baseAtomIndex, iModel = -1, i0 = 0; iAtom < this.ms.ac; iAtom++) {
if (atoms[iAtom].mi != iModel) {
iModel = atoms[iAtom].mi;
i0 = this.baseAtomIndex + this.ms.getInfoI (iModel, "presymmetryAtomIndex") + this.ms.getInfoI (iModel, "presymmetryAtomCount");
}if (iAtom >= i0) this.ms.bsSymmetry.set (iAtom);
}
}if (this.appendNew && this.ms.someModelsHaveFractionalCoordinates) {
var atoms = this.ms.at;
var modelIndex = -1;
var c = null;
var isFractional = false;
var roundCoords = !this.vwr.getBoolean (603979875);
for (var i = this.baseAtomIndex; i < this.ms.ac; i++) {
if (atoms[i].mi != modelIndex) {
modelIndex = atoms[i].mi;
c = this.ms.getUnitCell (modelIndex);
isFractional = (c != null && c.getCoordinatesAreFractional ());
}if (isFractional) {
c = atoms[i].getUnitCell ();
c.toCartesian (c.toSupercell (atoms[i]), false);
if (roundCoords) JU.PT.fixPtFloats (atoms[i], 10000.0);
}}
for (var imodel = this.baseModelIndex; imodel < this.ms.mc; imodel++) {
if (this.ms.isTrajectory (imodel)) {
c = this.ms.getUnitCell (imodel);
if (c != null && c.getCoordinatesAreFractional () && c.isSupercell ()) {
var list = this.ms.trajectorySteps.get (imodel);
for (var i = list.length; --i >= 0; ) if (list[i] != null) c.toSupercell (list[i]);

}}}
}});
Clazz_defineMethod (c$, "initializeBonding", 
 function () {
var bsExclude = (this.ms.getInfoM ("someModelsHaveCONECT") == null ? null :  new JU.BS ());
if (bsExclude != null) this.ms.setPdbConectBonding (this.baseAtomIndex, this.baseModelIndex, bsExclude);
var modelAtomCount = 0;
var symmetryAlreadyAppliedToBonds = this.vwr.getBoolean (603979794);
var doAutoBond = this.vwr.getBoolean (603979798);
var forceAutoBond = this.vwr.getBoolean (603979846);
var bs = null;
var autoBonding = false;
var modelCount = this.ms.mc;
var models = this.ms.am;
if (!this.noAutoBond) for (var i = this.baseModelIndex; i < modelCount; i++) {
modelAtomCount = models[i].bsAtoms.cardinality ();
var modelBondCount = this.ms.getInfoI (i, "initialBondCount");
var modelIsPDB = models[i].isBioModel;
if (modelBondCount < 0) {
modelBondCount = this.ms.bondCount;
}var modelHasSymmetry = this.ms.getInfoB (i, "hasSymmetry");
var doBond = (forceAutoBond || doAutoBond && (modelBondCount == 0 || modelIsPDB && this.jmolData == null && (this.ms.getMSInfoB ("havePDBHeaderName") || modelBondCount < Clazz_doubleToInt (modelAtomCount / 2)) || modelHasSymmetry && !symmetryAlreadyAppliedToBonds && !this.ms.getInfoB (i, "hasBonds")));
if (!doBond) continue;
autoBonding = true;
if (this.merging || modelCount > 1) {
if (bs == null) bs = JU.BS.newN (this.ms.ac);
if (i == this.baseModelIndex || !this.isTrajectory) bs.or (models[i].bsAtoms);
}}
if (this.modulationOn) this.ms.setModulation (null, true, this.modulationTUV, false);
if (autoBonding) {
this.ms.autoBondBs4 (bs, bs, bsExclude, null, this.ms.defaultCovalentMad, this.vwr.getBoolean (603979873));
JU.Logger.info ("ModelSet: autobonding; use  autobond=false  to not generate bonds automatically");
} else {
this.ms.initializeBspf ();
JU.Logger.info ("ModelSet: not autobonding; use  forceAutobond=true  to force automatic bond creation");
}});
Clazz_defineMethod (c$, "finalizeGroupBuild", 
 function () {
this.groups =  new Array (this.groupCount);
if (this.merging) for (var i = 0; i < this.$mergeGroups.length; i++) (this.groups[i] = this.$mergeGroups[i]).chain.model.ms = this.ms;

for (var i = this.baseGroupIndex; i < this.groupCount; ++i) this.distinguishAndPropagateGroup (i, this.chainOf[i], this.group3Of[i], this.seqcodes[i], this.firstAtomIndexes[i], (i == this.groupCount - 1 ? this.ms.ac : this.firstAtomIndexes[i + 1]));

if (this.group3Lists != null) if (this.ms.msInfo != null) {
this.ms.msInfo.put ("group3Lists", this.group3Lists);
this.ms.msInfo.put ("group3Counts", this.group3Counts);
for (var i = 0; i < this.group3Counts.length; i++) if (this.group3Counts[i] == null) this.group3Counts[i] =  Clazz_newIntArray (0, 0);

}});
Clazz_defineMethod (c$, "distinguishAndPropagateGroup", 
 function (groupIndex, chain, group3, seqcode, firstAtomIndex, maxAtomIndex) {
var lastAtomIndex = maxAtomIndex - 1;
if (lastAtomIndex < firstAtomIndex) throw  new NullPointerException ();
var modelIndex = this.ms.at[firstAtomIndex].mi;
var group = (group3 == null || this.jbr == null ? null : this.jbr.distinguishAndPropagateGroup (chain, group3, seqcode, firstAtomIndex, maxAtomIndex, modelIndex, this.specialAtomIndexes, this.ms.at));
var key;
if (group == null) {
group =  new JM.Group ().setGroup (chain, group3, seqcode, firstAtomIndex, lastAtomIndex);
if (this.jbr != null) group.groupID = this.jbr.getGroupID (group3);
key = "o>";
} else {
key = (group.isProtein () ? "p>" : group.isNucleic () ? "n>" : group.isCarbohydrate () ? "c>" : "o>");
}if (group3 != null) {
this.countGroup (modelIndex, key, group3);
if (group.isNucleic ()) {
var g1 = (this.htGroup1 == null ? null : this.htGroup1.get (group3));
if (g1 != null) group.group1 = g1.charAt (0);
}}this.addGroup (chain, group);
this.groups[groupIndex] = group;
group.groupIndex = groupIndex;
for (var i = maxAtomIndex; --i >= firstAtomIndex; ) this.ms.at[i].setGroup (group);

}, "~N,JM.Chain,~S,~N,~N,~N");
Clazz_defineMethod (c$, "addGroup", 
 function (chain, group) {
if (chain.groupCount == chain.groups.length) chain.groups = JU.AU.doubleLength (chain.groups);
chain.groups[chain.groupCount++] = group;
}, "JM.Chain,JM.Group");
Clazz_defineMethod (c$, "countGroup", 
 function (modelIndex, code, group3) {
var ptm = modelIndex + 1;
if (this.group3Lists == null || this.group3Lists[ptm] == null) return;
var g3code = (group3 + "   ").substring (0, 3);
var pt = this.group3Lists[ptm].indexOf (g3code);
if (pt < 0) {
this.group3Lists[ptm] += ",[" + g3code + "]";
pt = this.group3Lists[ptm].indexOf (g3code);
this.group3Counts[ptm] = JU.AU.arrayCopyI (this.group3Counts[ptm], this.group3Counts[ptm].length + 10);
}this.group3Counts[ptm][Clazz_doubleToInt (pt / 6)]++;
pt = this.group3Lists[ptm].indexOf (",[" + g3code);
if (pt >= 0) this.group3Lists[ptm] = this.group3Lists[ptm].substring (0, pt) + code + this.group3Lists[ptm].substring (pt + 2);
if (modelIndex >= 0) this.countGroup (-1, code, group3);
}, "~N,~S,~S");
Clazz_defineMethod (c$, "freeze", 
 function () {
this.htAtomMap.clear ();
if (this.ms.ac < this.ms.at.length) this.ms.growAtomArrays (this.ms.ac);
if (this.ms.bondCount < this.ms.bo.length) this.ms.bo = JU.AU.arrayCopyObject (this.ms.bo, this.ms.bondCount);
for (var i = 5; --i > 0; ) {
this.ms.numCached[i] = 0;
var bondsCache = this.ms.freeBonds[i];
for (var j = bondsCache.length; --j >= 0; ) bondsCache[j] = null;

}
this.ms.setAtomNamesAndNumbers (0, this.baseAtomIndex, this.mergeModelSet);
this.findElementsPresent ();
this.ms.resetMolecules ();
this.model = null;
this.currentChain = null;
if (!this.ms.haveBioModels || this.isPyMOLsession) {
this.ms.freezeModels ();
return;
}var asDSSP = this.vwr.getBoolean (603979826);
var ret = this.ms.calculateStructuresAllExcept (this.structuresDefinedInFile, asDSSP, false, true, true, asDSSP);
if (ret.length > 0) JU.Logger.info (ret);
});
Clazz_defineMethod (c$, "findElementsPresent", 
 function () {
this.ms.elementsPresent =  new Array (this.ms.mc);
for (var i = 0; i < this.ms.mc; i++) this.ms.elementsPresent[i] = JU.BS.newN (64);

for (var i = this.ms.ac; --i >= 0; ) {
var n = this.ms.at[i].getAtomicAndIsotopeNumber ();
if (n >= JU.Elements.elementNumberMax) n = JU.Elements.elementNumberMax + JU.Elements.altElementIndexFromNumber (n);
this.ms.elementsPresent[this.ms.at[i].mi].set (n);
}
});
Clazz_defineMethod (c$, "applyStereochemistry", 
 function () {
this.set2dZ (this.baseAtomIndex, this.ms.ac);
if (this.vStereo != null) {
var bsToTest =  new JU.BS ();
bsToTest.setBits (this.baseAtomIndex, this.ms.ac);
for (var i = this.vStereo.size (); --i >= 0; ) {
var b = this.vStereo.get (i);
var dz2 = (b.order == 1025 ? 3 : -3);
b.order = 1;
if (b.atom2.z != b.atom1.z && (dz2 < 0) == (b.atom2.z < b.atom1.z)) dz2 /= 3;
var bs = JU.JmolMolecule.getBranchBitSet (this.ms.at, b.atom2.i, bsToTest, null, b.atom1.i, false, true);
bs.set (b.atom2.i);
for (var j = bs.nextSetBit (0); j >= 0; j = bs.nextSetBit (j + 1)) this.ms.at[j].z += dz2;

b.atom2.x = (b.atom1.x + b.atom2.x) / 2;
b.atom2.y = (b.atom1.y + b.atom2.y) / 2;
}
this.vStereo = null;
}this.is2D = false;
});
Clazz_defineMethod (c$, "set2dZ", 
 function (iatom1, iatom2) {
var atomlist = JU.BS.newN (iatom2);
var bsBranch =  new JU.BS ();
var v =  new JU.V3 ();
var v0 = JU.V3.new3 (0, 1, 0);
var v1 =  new JU.V3 ();
var bs0 =  new JU.BS ();
bs0.setBits (iatom1, iatom2);
for (var i = iatom1; i < iatom2; i++) if (!atomlist.get (i) && !bsBranch.get (i)) {
bsBranch = this.getBranch2dZ (i, -1, bs0, bsBranch, v, v0, v1);
atomlist.or (bsBranch);
}
}, "~N,~N");
Clazz_defineMethod (c$, "getBranch2dZ", 
 function (atomIndex, atomIndexNot, bs0, bsBranch, v, v0, v1) {
var bs = JU.BS.newN (this.ms.ac);
if (atomIndex < 0) return bs;
var bsToTest =  new JU.BS ();
bsToTest.or (bs0);
if (atomIndexNot >= 0) bsToTest.clear (atomIndexNot);
JM.ModelLoader.setBranch2dZ (this.ms.at[atomIndex], bs, bsToTest, v, v0, v1);
return bs;
}, "~N,~N,JU.BS,JU.BS,JU.V3,JU.V3,JU.V3");
c$.setBranch2dZ = Clazz_defineMethod (c$, "setBranch2dZ", 
 function (atom, bs, bsToTest, v, v0, v1) {
var atomIndex = atom.i;
if (!bsToTest.get (atomIndex)) return;
bsToTest.clear (atomIndex);
bs.set (atomIndex);
if (atom.bonds == null) return;
for (var i = atom.bonds.length; --i >= 0; ) {
var bond = atom.bonds[i];
if (bond.isHydrogen ()) continue;
var atom2 = bond.getOtherAtom (atom);
JM.ModelLoader.setAtom2dZ (atom, atom2, v, v0, v1);
JM.ModelLoader.setBranch2dZ (atom2, bs, bsToTest, v, v0, v1);
}
}, "JM.Atom,JU.BS,JU.BS,JU.V3,JU.V3,JU.V3");
c$.setAtom2dZ = Clazz_defineMethod (c$, "setAtom2dZ", 
 function (atomRef, atom2, v, v0, v1) {
v.sub2 (atom2, atomRef);
v.z = 0;
v.normalize ();
v1.cross (v0, v);
var theta = Math.acos (v.dot (v0));
atom2.z = atomRef.z + (0.8 * Math.sin (4 * theta));
}, "JM.Atom,JM.Atom,JU.V3,JU.V3,JU.V3");
Clazz_defineMethod (c$, "finalizeShapes", 
 function () {
this.ms.sm = this.vwr.shm;
this.ms.sm.setModelSet (this.ms);
this.ms.setBsHidden (this.vwr.slm.getHiddenSet ());
if (!this.merging) this.ms.sm.resetShapes ();
this.ms.sm.loadDefaultShapes (this.ms);
if (this.ms.someModelsHaveAromaticBonds && this.vwr.getBoolean (603979944)) this.ms.assignAromaticBondsBs (false, null);
if (this.merging && this.baseModelCount == 1) this.ms.sm.setShapePropertyBs (6, "clearModelIndex", null, null);
});
Clazz_defineMethod (c$, "undeleteAtom", 
function (iAtom) {
this.ms.at[iAtom].valence = 0;
}, "~N");
c$.createAtomDataSet = Clazz_defineMethod (c$, "createAtomDataSet", 
function (vwr, modelSet, tokType, asc, bsSelected) {
if (asc == null) return null;
var adapter = vwr.getModelAdapter ();
var pt =  new JU.P3 ();
var atoms = modelSet.at;
var tolerance = vwr.getFloat (570425363);
if (modelSet.unitCells != null) for (var i = bsSelected.nextSetBit (0); i >= 0; i = bsSelected.nextSetBit (i + 1)) if (atoms[i].atomSymmetry != null) {
tolerance = -tolerance;
break;
}
var i = -1;
var n = 0;
var loadAllData = (JU.BSUtil.cardinalityOf (bsSelected) == vwr.ms.ac);
for (var iterAtom = adapter.getAtomIterator (asc); iterAtom.hasNext (); ) {
var xyz = iterAtom.getXYZ ();
if (Float.isNaN (xyz.x + xyz.y + xyz.z)) continue;
if (tokType == 1146095626) {
i = bsSelected.nextSetBit (i + 1);
if (i < 0) break;
n++;
if (JU.Logger.debugging) JU.Logger.debug ("atomIndex = " + i + ": " + atoms[i] + " --> (" + xyz.x + "," + xyz.y + "," + xyz.z);
modelSet.setAtomCoord (i, xyz.x, xyz.y, xyz.z);
continue;
}pt.setT (xyz);
var bs = JU.BS.newN (modelSet.ac);
modelSet.getAtomsWithin (tolerance, pt, bs, -1);
bs.and (bsSelected);
if (loadAllData) {
n = JU.BSUtil.cardinalityOf (bs);
if (n == 0) {
JU.Logger.warn ("createAtomDataSet: no atom found at position " + pt);
continue;
} else if (n > 1 && JU.Logger.debugging) {
JU.Logger.debug ("createAtomDataSet: " + n + " atoms found at position " + pt);
}}switch (tokType) {
case 1146095631:
var vib = iterAtom.getVib ();
if (vib == null) continue;
if (JU.Logger.debugging) JU.Logger.debug ("xyz: " + pt + " vib: " + vib);
modelSet.setAtomCoords (bs, 1146095631, vib);
break;
case 1129318401:
modelSet.setAtomProperty (bs, tokType, 0, iterAtom.getOccupancy (), null, null, null);
break;
case 1112541195:
modelSet.setAtomProperty (bs, tokType, 0, iterAtom.getPartialCharge (), null, null, null);
break;
case 1112541196:
modelSet.setAtomProperty (bs, tokType, 0, iterAtom.getBfactor (), null, null, null);
break;
}
}
switch (tokType) {
case 1146095631:
var vibName = adapter.getAtomSetName (asc, 0);
JU.Logger.info ("_vibrationName = " + vibName);
vwr.setStringProperty ("_vibrationName", vibName);
break;
case 1146095626:
JU.Logger.info (n + " atom positions read");
modelSet.recalculateLeadMidpointsAndWingVectors (-1);
if (n == modelSet.ac) return "boundbox {*};reset";
break;
}
return null;
}, "JV.Viewer,JM.ModelSet,~N,~O,JU.BS");
Clazz_defineStatics (c$,
"defaultGroupCount", 32);
});
Clazz_declarePackage ("JM");
Clazz_load (["JM.BondCollection"], "JM.ModelSet", ["java.lang.Boolean", "$.Float", "java.util.Hashtable", "JU.A4", "$.AU", "$.BS", "$.Lst", "$.M3", "$.M4", "$.Measure", "$.P3", "$.P4", "$.PT", "$.Quat", "$.SB", "$.V3", "J.api.Interface", "$.JmolModulationSet", "J.atomdata.RadiusData", "J.bspt.Bspf", "J.c.PAL", "$.VDW", "JM.Atom", "$.AtomIteratorWithinModel", "$.AtomIteratorWithinModelSet", "$.Bond", "$.BondSet", "$.HBond", "$.Model", "$.StateScript", "JS.SV", "JU.BSUtil", "$.BoxInfo", "$.Elements", "$.Escape", "$.JmolMolecule", "$.Logger", "$.SimpleUnitCell", "JV.JC"], function () {
c$ = Clazz_decorateAsClass (function () {
this.bsSymmetry = null;
this.modelSetName = null;
this.am = null;
this.mc = 0;
this.bioModel = null;
this.unitCells = null;
this.haveUnitCells = false;
this.closest = null;
this.modelNumbers = null;
this.modelFileNumbers = null;
this.modelNumbersForAtomLabel = null;
this.modelNames = null;
this.frameTitles = null;
this.elementsPresent = null;
this.isXYZ = false;
this.haveBioModels = false;
this.modelSetProperties = null;
this.msInfo = null;
this.someModelsHaveSymmetry = false;
this.someModelsHaveAromaticBonds = false;
this.someModelsHaveFractionalCoordinates = false;
this.isBbcageDefault = false;
this.bboxModels = null;
this.bboxAtoms = null;
this.boxInfo = null;
this.stateScripts = null;
this.thisStateModel = 0;
this.trajectorySteps = null;
this.vibrationSteps = null;
this.selectedMolecules = null;
this.showRebondTimes = true;
this.bsAll = null;
this.sm = null;
this.proteinStructureTainted = false;
this.symTemp = null;
this.htPeaks = null;
this.vOrientations = null;
this.triangulator = null;
this.ptTemp = null;
this.ptTemp1 = null;
this.ptTemp2 = null;
this.matTemp = null;
this.matInv = null;
this.mat4 = null;
this.mat4t = null;
this.vTemp = null;
this.selectionHaloEnabled = false;
this.echoShapeActive = false;
this.modelSetTypeName = null;
this.pointGroup = null;
this.maxBondWarned = false;
Clazz_instantialize (this, arguments);
}, JM, "ModelSet", JM.BondCollection);
Clazz_makeConstructor (c$, 
function (vwr, name) {
this.vwr = vwr;
this.modelSetName = name;
this.selectedMolecules =  new JU.BS ();
this.stateScripts =  new JU.Lst ();
this.boxInfo =  new JU.BoxInfo ();
this.boxInfo.addBoundBoxPoint (JU.P3.new3 (-10, -10, -10));
this.boxInfo.addBoundBoxPoint (JU.P3.new3 (10, 10, 10));
this.am =  new Array (1);
this.modelNumbers =  Clazz_newIntArray (1, 0);
this.modelFileNumbers =  Clazz_newIntArray (1, 0);
this.modelNumbersForAtomLabel =  new Array (1);
this.modelNames =  new Array (1);
this.frameTitles =  new Array (1);
this.closest =  new Array (1);
this.ptTemp =  new JU.P3 ();
this.ptTemp1 =  new JU.P3 ();
this.ptTemp2 =  new JU.P3 ();
this.matTemp =  new JU.M3 ();
this.matInv =  new JU.M3 ();
this.mat4 =  new JU.M4 ();
this.mat4t =  new JU.M4 ();
this.vTemp =  new JU.V3 ();
this.setupBC ();
}, "JV.Viewer,~S");
Clazz_overrideMethod (c$, "releaseModelSet", 
function () {
this.am = null;
this.closest[0] = null;
this.am = null;
this.bsSymmetry = null;
this.bsAll = null;
this.unitCells = null;
this.releaseModelSetBC ();
});
Clazz_defineMethod (c$, "setSelectionHaloEnabled", 
function (selectionHaloEnabled) {
this.selectionHaloEnabled = selectionHaloEnabled;
}, "~B");
Clazz_defineMethod (c$, "getSelectionHaloEnabled", 
function () {
return this.selectionHaloEnabled;
});
Clazz_defineMethod (c$, "getEchoStateActive", 
function () {
return this.echoShapeActive;
});
Clazz_defineMethod (c$, "setEchoStateActive", 
function (TF) {
this.echoShapeActive = TF;
}, "~B");
Clazz_defineMethod (c$, "getModelSetTypeName", 
function () {
return this.modelSetTypeName;
});
Clazz_defineMethod (c$, "getModelNumberIndex", 
function (modelNumber, useModelNumber, doSetTrajectory) {
if (useModelNumber) {
for (var i = 0; i < this.mc; i++) if (this.modelNumbers[i] == modelNumber || modelNumber < 1000000 && this.modelNumbers[i] == 1000000 + modelNumber) return i;

return -1;
}for (var i = 0; i < this.mc; i++) if (this.modelFileNumbers[i] == modelNumber) {
if (doSetTrajectory && this.isTrajectory (i)) this.setTrajectory (i);
return i;
}
return -1;
}, "~N,~B,~B");
Clazz_defineMethod (c$, "getBitSetTrajectories", 
function () {
if (this.trajectorySteps == null) return null;
var bsModels =  new JU.BS ();
for (var i = this.mc; --i >= 0; ) {
var t = this.am[i].selectedTrajectory;
if (t >= 0) {
bsModels.set (t);
i = this.am[i].trajectoryBaseIndex;
}}
return bsModels;
});
Clazz_defineMethod (c$, "setTrajectoryBs", 
function (bsModels) {
for (var i = 0; i < this.mc; i++) if (bsModels.get (i)) this.setTrajectory (i);

}, "JU.BS");
Clazz_defineMethod (c$, "setTrajectory", 
function (modelIndex) {
if (modelIndex < 0 || !this.isTrajectory (modelIndex)) return;
if (this.at[this.am[modelIndex].firstAtomIndex].mi == modelIndex) return;
var baseModelIndex = this.am[modelIndex].trajectoryBaseIndex;
this.am[baseModelIndex].selectedTrajectory = modelIndex;
this.setAtomPositions (baseModelIndex, modelIndex, this.trajectorySteps.get (modelIndex), null, 0, (this.vibrationSteps == null ? null : this.vibrationSteps.get (modelIndex)), true);
var m = this.vwr.am.cmi;
if (m >= 0 && m != modelIndex && this.am[m].fileIndex == this.am[modelIndex].fileIndex) this.vwr.setCurrentModelIndexClear (modelIndex, false);
}, "~N");
Clazz_defineMethod (c$, "morphTrajectories", 
function (m1, m2, f) {
if (m1 < 0 || m2 < 0 || !this.isTrajectory (m1) || !this.isTrajectory (m2)) return;
if (f == 0) {
this.setTrajectory (m1);
return;
}if (f == 1) {
this.setTrajectory (m2);
return;
}var baseModelIndex = this.am[m1].trajectoryBaseIndex;
this.am[baseModelIndex].selectedTrajectory = m1;
this.setAtomPositions (baseModelIndex, m1, this.trajectorySteps.get (m1), this.trajectorySteps.get (m2), f, (this.vibrationSteps == null ? null : this.vibrationSteps.get (m1)), true);
var m = this.vwr.am.cmi;
if (m >= 0 && m != m1 && this.am[m].fileIndex == this.am[m1].fileIndex) this.vwr.setCurrentModelIndexClear (m1, false);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setAtomPositions", 
 function (baseModelIndex, modelIndex, t1, t2, f, vibs, isFractional) {
var bs =  new JU.BS ();
var vib =  new JU.V3 ();
var iFirst = this.am[baseModelIndex].firstAtomIndex;
var iMax = iFirst + this.getAtomCountInModel (baseModelIndex);
if (f == 0) {
for (var pt = 0, i = iFirst; i < iMax && pt < t1.length; i++, pt++) {
this.at[i].mi = modelIndex;
if (t1[pt] == null) continue;
if (isFractional) this.at[i].setFractionalCoordTo (t1[pt], true);
 else this.at[i].setT (t1[pt]);
if (this.vibrationSteps != null) {
if (vibs != null && vibs[pt] != null) vib = vibs[pt];
this.setVibrationVector (i, vib);
}bs.set (i);
}
} else {
var p =  new JU.P3 ();
var n = Math.min (t1.length, t2.length);
for (var pt = 0, i = iFirst; i < iMax && pt < n; i++, pt++) {
this.at[i].mi = modelIndex;
if (t1[pt] == null || t2[pt] == null) continue;
p.sub2 (t2[pt], t1[pt]);
p.scaleAdd2 (f, p, t1[pt]);
if (isFractional) this.at[i].setFractionalCoordTo (p, true);
 else this.at[i].setT (p);
bs.set (i);
}
}this.initializeBspf ();
this.validateBspfForModel (baseModelIndex, false);
this.recalculateLeadMidpointsAndWingVectors (baseModelIndex);
this.sm.refreshShapeTrajectories (baseModelIndex, bs, null);
if (this.am[baseModelIndex].hasRasmolHBonds) this.bioModel.resetRasmolBonds (this.am[baseModelIndex], bs);
}, "~N,~N,~A,~A,~N,~A,~B");
Clazz_defineMethod (c$, "getFrameOffsets", 
function (bsAtoms) {
if (bsAtoms == null) return null;
var offsets =  new Array (this.mc);
for (var i = 0; i < this.mc; i++) offsets[i] =  new JU.P3 ();

var lastModel = 0;
var n = 0;
var offset = offsets[0];
var asTrajectory = (this.trajectorySteps != null && this.trajectorySteps.size () == this.mc);
var m1 = (asTrajectory ? this.mc : 1);
for (var m = 0; m < m1; m++) {
if (asTrajectory) this.setTrajectory (m);
for (var i = 0; i <= this.ac; i++) {
if (i == this.ac || this.at[i].mi != lastModel) {
if (n > 0) {
offset.scale (-1.0 / n);
if (lastModel != 0) offset.sub (offsets[0]);
n = 0;
}if (i == this.ac) break;
lastModel = this.at[i].mi;
offset = offsets[lastModel];
}if (!bsAtoms.get (i)) continue;
offset.add (this.at[i]);
n++;
}
}
offsets[0].set (0, 0, 0);
return offsets;
}, "JU.BS");
Clazz_defineMethod (c$, "getAtoms", 
function (tokType, specInfo) {
switch (tokType) {
default:
return JU.BSUtil.andNot (this.getAtomBitsMaybeDeleted (tokType, specInfo), this.vwr.slm.bsDeleted);
case 1048610:
var modelNumber = (specInfo).intValue ();
var modelIndex = this.getModelNumberIndex (modelNumber, true, true);
return (modelIndex < 0 && modelNumber > 0 ?  new JU.BS () : this.vwr.getModelUndeletedAtomsBitSet (modelIndex));
}
}, "~N,~O");
Clazz_defineMethod (c$, "findNearestAtomIndex", 
function (x, y, bsNot, min) {
if (this.ac == 0) return -1;
this.closest[0] = null;
if (this.g3d.isAntialiased ()) {
x <<= 1;
y <<= 1;
}this.findNearest2 (x, y, this.closest, bsNot, min);
this.sm.findNearestShapeAtomIndex (x, y, this.closest, bsNot);
var closestIndex = (this.closest[0] == null ? -1 : this.closest[0].i);
this.closest[0] = null;
return closestIndex;
}, "~N,~N,JU.BS,~N");
Clazz_defineMethod (c$, "calculatePointGroup", 
function (bsAtoms) {
return this.calculatePointGroupForFirstModel (bsAtoms, false, false, false, null, 0, 0);
}, "JU.BS");
Clazz_defineMethod (c$, "getPointGroupInfo", 
function (bsAtoms) {
return this.calculatePointGroupForFirstModel (bsAtoms, false, false, true, null, 0, 0);
}, "JU.BS");
Clazz_defineMethod (c$, "getPointGroupAsString", 
function (bsAtoms, asDraw, type, index, scale) {
return this.calculatePointGroupForFirstModel (bsAtoms, true, asDraw, false, type, index, scale);
}, "JU.BS,~B,~S,~N,~N");
Clazz_defineMethod (c$, "calculatePointGroupForFirstModel", 
 function (bsAtoms, doAll, asDraw, asInfo, type, index, scale) {
var modelIndex = this.vwr.am.cmi;
var iAtom = (bsAtoms == null ? -1 : bsAtoms.nextSetBit (0));
if (modelIndex < 0 && iAtom >= 0) modelIndex = this.at[iAtom].mi;
if (modelIndex < 0) {
modelIndex = this.vwr.getVisibleFramesBitSet ().nextSetBit (0);
bsAtoms = null;
}var bs = this.vwr.getModelUndeletedAtomsBitSet (modelIndex);
if (bsAtoms != null) bs.and (bsAtoms);
iAtom = bs.nextSetBit (0);
if (iAtom < 0) {
bs = this.vwr.getModelUndeletedAtomsBitSet (modelIndex);
iAtom = bs.nextSetBit (0);
}var obj = this.vwr.shm.getShapePropertyIndex (18, "mad", iAtom);
var haveVibration = (obj != null && (obj).intValue () != 0 || this.vwr.tm.vibrationOn);
var symmetry = J.api.Interface.getSymmetry (this.vwr, "ms");
this.pointGroup = symmetry.setPointGroup (this.pointGroup, this.at, bs, haveVibration, this.vwr.getFloat (570425382), this.vwr.getFloat (570425384));
if (!doAll && !asInfo) return this.pointGroup.getPointGroupName ();
var ret = this.pointGroup.getPointGroupInfo (modelIndex, asDraw, asInfo, type, index, scale);
return (asInfo ? ret : (this.mc > 1 ? "frame " + this.getModelNumberDotted (modelIndex) + "; " : "") + ret);
}, "JU.BS,~B,~B,~B,~S,~N,~N");
Clazz_defineMethod (c$, "modelsOf", 
 function (bsAtoms, bsAllAtoms) {
var bsModels = JU.BS.newN (this.mc);
var isAll = (bsAtoms == null);
var i0 = (isAll ? this.ac - 1 : bsAtoms.nextSetBit (0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bsAtoms.nextSetBit (i + 1))) {
var modelIndex = this.am[this.at[i].mi].trajectoryBaseIndex;
if (this.isJmolDataFrameForModel (modelIndex)) continue;
bsModels.set (modelIndex);
bsAllAtoms.set (i);
}
return bsModels;
}, "JU.BS,JU.BS");
Clazz_defineMethod (c$, "getDefaultStructure", 
function (bsAtoms, bsAllAtoms) {
var bsModels = this.modelsOf (bsAtoms, bsAllAtoms);
var ret =  new JU.SB ();
for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) if (this.am[i].isBioModel && this.am[i].defaultStructure != null) ret.append (this.am[i].defaultStructure);

return ret.toString ();
}, "JU.BS,JU.BS");
Clazz_defineMethod (c$, "makeConnections", 
function (minDistance, maxDistance, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy) {
if (connectOperation == 1073741852 && order != 2048) {
var stateScript = "connect ";
if (minDistance != 0.1) stateScript += minDistance + " ";
if (maxDistance != 1.0E8) stateScript += maxDistance + " ";
this.addStateScript (stateScript, (isBonds ? bsA : null), (isBonds ? null : bsA), (isBonds ? null : bsB), " auto", false, true);
}this.moleculeCount = 0;
return this.makeConnections2 (minDistance, maxDistance, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy);
}, "~N,~N,~N,~N,JU.BS,JU.BS,JU.BS,~B,~B,~N");
Clazz_defineMethod (c$, "setPdbConectBonding", 
function (baseAtomIndex, baseModelIndex, bsExclude) {
var mad = this.vwr.getMadBond ();
for (var i = baseModelIndex; i < this.mc; i++) {
var vConnect = this.getInfo (i, "PDB_CONECT_bonds");
if (vConnect == null) continue;
var nConnect = vConnect.size ();
this.setInfo (i, "initialBondCount", Integer.$valueOf (nConnect));
var atomInfo = this.getInfo (i, "PDB_CONECT_firstAtom_count_max");
var firstAtom = atomInfo[0] + baseAtomIndex;
var atomMax = firstAtom + atomInfo[1];
var max = atomInfo[2];
var serialMap =  Clazz_newIntArray (max + 1, 0);
var iSerial;
for (var iAtom = firstAtom; iAtom < atomMax; iAtom++) if ((iSerial = this.atomSerials[iAtom]) > 0) serialMap[iSerial] = iAtom + 1;

for (var iConnect = 0; iConnect < nConnect; iConnect++) {
var pair = vConnect.get (iConnect);
var sourceSerial = pair[0];
var targetSerial = pair[1];
var order = pair[2];
if (sourceSerial < 0 || targetSerial < 0 || sourceSerial > max || targetSerial > max) continue;
var sourceIndex = serialMap[sourceSerial] - 1;
var targetIndex = serialMap[targetSerial] - 1;
if (sourceIndex < 0 || targetIndex < 0) continue;
var atomA = this.at[sourceIndex];
var atomB = this.at[targetIndex];
if (bsExclude != null) {
if (atomA.isHetero ()) bsExclude.set (sourceIndex);
if (atomB.isHetero ()) bsExclude.set (targetIndex);
}if (atomA.altloc == atomB.altloc || atomA.altloc == '\0' || atomB.altloc == '\0') this.getOrAddBond (atomA, atomB, order, (order == 2048 ? 1 : mad), null, 0, false);
}
}
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "deleteAllBonds", 
function () {
this.moleculeCount = 0;
for (var i = this.stateScripts.size (); --i >= 0; ) {
if (this.stateScripts.get (i).isConnect ()) {
this.stateScripts.remove (i);
}}
this.deleteAllBonds2 ();
});
Clazz_defineMethod (c$, "includeAllRelatedFrames", 
 function (bsModels) {
var j;
for (var i = 0; i < this.mc; i++) {
if (bsModels.get (i)) {
if (this.isTrajectory (i) && !bsModels.get (j = this.am[i].trajectoryBaseIndex)) {
bsModels.set (j);
this.includeAllRelatedFrames (bsModels);
return;
}continue;
}if (this.isTrajectory (i) && bsModels.get (this.am[i].trajectoryBaseIndex) || this.isJmolDataFrameForModel (i) && bsModels.get (this.am[i].dataSourceFrame)) bsModels.set (i);
}
}, "JU.BS");
Clazz_defineMethod (c$, "deleteModels", 
function (bsModels) {
this.moleculeCount = 0;
this.includeAllRelatedFrames (bsModels);
var nModelsDeleted = JU.BSUtil.cardinalityOf (bsModels);
if (nModelsDeleted == 0) return null;
for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) this.clearDataFrameReference (i);

var bsDeleted;
if (nModelsDeleted == this.mc) {
bsDeleted = this.getModelAtomBitSetIncludingDeleted (-1, true);
this.vwr.zap (true, false, false);
return bsDeleted;
}this.validateBspf (false);
var newModels =  new Array (this.mc - nModelsDeleted);
var oldModels = this.am;
bsDeleted =  new JU.BS ();
for (var i = 0, mpt = 0; i < this.mc; i++) if (bsModels.get (i)) {
this.getAtomCountInModel (i);
bsDeleted.or (this.getModelAtomBitSetIncludingDeleted (i, false));
} else {
this.am[i].modelIndex = mpt;
newModels[mpt++] = this.am[i];
}
this.am = newModels;
var oldModelCount = this.mc;
var bsBonds = this.getBondsForSelectedAtoms (bsDeleted, true);
this.deleteBonds (bsBonds, true);
for (var i = 0, mpt = 0; i < oldModelCount; i++) {
if (!bsModels.get (i)) {
mpt++;
continue;
}var nAtoms = oldModels[i].ac;
if (nAtoms == 0) continue;
var bsModelAtoms = oldModels[i].bsAtoms;
var firstAtomIndex = oldModels[i].firstAtomIndex;
JU.BSUtil.deleteBits (this.bsSymmetry, bsModelAtoms);
this.deleteModel (mpt, firstAtomIndex, nAtoms, bsModelAtoms, bsBonds);
for (var j = oldModelCount; --j > i; ) oldModels[j].fixIndices (mpt, nAtoms, bsModelAtoms);

this.vwr.shm.deleteShapeAtoms ([newModels, this.at, [mpt, firstAtomIndex, nAtoms]], bsModelAtoms);
this.mc--;
}
this.deleteModel (-1, 0, 0, null, null);
return bsDeleted;
}, "JU.BS");
Clazz_defineMethod (c$, "setAtomProperty", 
function (bs, tok, iValue, fValue, sValue, values, list) {
switch (tok) {
case 1115297793:
case 1113200642:
case 1113200647:
case 1113200649:
case 1113200650:
case 1650071565:
case 1113200654:
if (fValue > 4.0) fValue = 4.0;
if (values != null) {
var newValues =  Clazz_newFloatArray (this.ac, 0);
try {
for (var i = bs.nextSetBit (0), ii = 0; i >= 0; i = bs.nextSetBit (i + 1)) newValues[i] = values[ii++];

} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return;
} else {
throw e;
}
}
values = newValues;
}case 1113200646:
case 1113200652:
var rd = null;
var mar = 0;
if (values == null) {
if (fValue > 16) fValue = 16.1;
if (fValue < 0) fValue = 0;
mar = Clazz_doubleToInt (Math.floor (fValue * 2000));
} else {
rd =  new J.atomdata.RadiusData (values, 0, null, null);
}this.sm.setShapeSizeBs (JV.JC.shapeTokenIndex (tok), mar, rd, bs);
return;
}
this.setAPm (bs, tok, iValue, fValue, sValue, values, list);
}, "JU.BS,~N,~N,~N,~S,~A,~A");
Clazz_defineMethod (c$, "getFileData", 
function (modelIndex) {
if (modelIndex < 0) return "";
var fileData = this.getInfo (modelIndex, "fileData");
if (fileData != null) return fileData;
if (!this.getInfoB (modelIndex, "isCIF")) return this.getPDBHeader (modelIndex);
fileData = this.vwr.getCifData (modelIndex);
this.setInfo (modelIndex, "fileData", fileData);
return fileData;
}, "~N");
Clazz_defineMethod (c$, "addHydrogens", 
function (vConnections, pts) {
var modelIndex = this.mc - 1;
var bs =  new JU.BS ();
if (this.isTrajectory (modelIndex) || this.am[modelIndex].getGroupCount () > 1) {
return bs;
}this.growAtomArrays (this.ac + pts.length);
var rd = this.vwr.rd;
var mad = this.getDefaultMadFromOrder (1);
this.am[modelIndex].dssrCache = null;
for (var i = 0, n = this.am[modelIndex].ac + 1; i < vConnections.size (); i++, n++) {
var atom1 = vConnections.get (i);
var atom2 = this.addAtom (modelIndex, atom1.group, 1, "H" + n, null, n, atom1.getSeqID (), n, pts[i], NaN, null, 0, 0, 100, NaN, null, false, 0, null);
atom2.setMadAtom (this.vwr, rd);
bs.set (atom2.i);
this.bondAtoms (atom1, atom2, 1, mad, null, 0, false, false);
}
this.sm.loadDefaultShapes (this);
return bs;
}, "JU.Lst,~A");
Clazz_defineMethod (c$, "mergeModelArrays", 
function (mergeModelSet) {
this.at = mergeModelSet.at;
this.bo = mergeModelSet.bo;
this.stateScripts = mergeModelSet.stateScripts;
this.proteinStructureTainted = mergeModelSet.proteinStructureTainted;
this.thisStateModel = -1;
this.bsSymmetry = mergeModelSet.bsSymmetry;
this.modelFileNumbers = mergeModelSet.modelFileNumbers;
this.modelNumbersForAtomLabel = mergeModelSet.modelNumbersForAtomLabel;
this.modelNames = mergeModelSet.modelNames;
this.modelNumbers = mergeModelSet.modelNumbers;
this.frameTitles = mergeModelSet.frameTitles;
this.mergeAtomArrays (mergeModelSet);
}, "JM.ModelSet");
Clazz_defineMethod (c$, "getUnitCell", 
function (modelIndex) {
if (!this.haveUnitCells || modelIndex < 0 || modelIndex >= this.mc) return null;
if (this.am[modelIndex].simpleCage != null) return this.am[modelIndex].simpleCage;
return (this.unitCells == null || modelIndex >= this.unitCells.length || !this.unitCells[modelIndex].haveUnitCell () ? null : this.unitCells[modelIndex]);
}, "~N");
Clazz_defineMethod (c$, "setModelCage", 
function (modelIndex, simpleCage) {
if (modelIndex < 0 || modelIndex >= this.mc) return;
this.am[modelIndex].simpleCage = simpleCage;
this.haveUnitCells = true;
}, "~N,J.api.SymmetryInterface");
Clazz_defineMethod (c$, "getPlaneIntersection", 
function (type, plane, scale, flags, uc) {
var pts = null;
switch (type) {
case 1614417948:
if (uc == null) return null;
pts = uc.getCanonicalCopy (scale, true);
break;
case 1679429641:
pts = this.boxInfo.getCanonicalCopy (scale);
break;
}
var v =  new JU.Lst ();
v.addLast (pts);
return this.intersectPlane (plane, v, flags);
}, "~N,JU.P4,~N,~N,J.api.SymmetryInterface");
Clazz_defineMethod (c$, "getModelName", 
function (modelIndex) {
return this.mc < 1 ? "" : modelIndex >= 0 ? this.modelNames[modelIndex] : this.modelNumbersForAtomLabel[-1 - modelIndex];
}, "~N");
Clazz_defineMethod (c$, "getModelTitle", 
function (modelIndex) {
return this.getInfo (modelIndex, "title");
}, "~N");
Clazz_defineMethod (c$, "getModelFileName", 
function (modelIndex) {
return this.getInfo (modelIndex, "fileName");
}, "~N");
Clazz_defineMethod (c$, "getModelFileType", 
function (modelIndex) {
return this.getInfo (modelIndex, "fileType");
}, "~N");
Clazz_defineMethod (c$, "setFrameTitle", 
function (bsFrames, title) {
if (Clazz_instanceOf (title, String)) {
for (var i = bsFrames.nextSetBit (0); i >= 0; i = bsFrames.nextSetBit (i + 1)) this.frameTitles[i] = title;

} else {
var list = title;
for (var i = bsFrames.nextSetBit (0), n = 0; i >= 0; i = bsFrames.nextSetBit (i + 1)) if (n < list.length) this.frameTitles[i] = list[n++];

}}, "JU.BS,~O");
Clazz_defineMethod (c$, "getFrameTitle", 
function (modelIndex) {
return (modelIndex >= 0 && modelIndex < this.mc ? this.frameTitles[modelIndex] : "");
}, "~N");
Clazz_defineMethod (c$, "getModelNumberForAtomLabel", 
function (modelIndex) {
return this.modelNumbersForAtomLabel[modelIndex];
}, "~N");
Clazz_defineMethod (c$, "getGroups", 
function () {
var n = 0;
for (var i = 0; i < this.mc; i++) n += this.am[i].getGroupCount ();

var groups =  new Array (n);
for (var i = 0, iGroup = 0; i < this.mc; i++) for (var j = 0; j < this.am[i].chainCount; j++) for (var k = 0; k < this.am[i].chains[j].groupCount; k++) {
groups[iGroup] = this.am[i].chains[j].groups[k];
groups[iGroup].groupIndex = iGroup;
iGroup++;
}


return groups;
});
Clazz_defineMethod (c$, "getNotionalUnitcell", 
function () {
var c = this.getUnitCell (0);
return (c == null ? null : c.getNotionalUnitCell ());
});
Clazz_defineMethod (c$, "setCrystallographicDefaults", 
function () {
return !this.haveBioModels && this.someModelsHaveSymmetry && this.someModelsHaveFractionalCoordinates;
});
Clazz_defineMethod (c$, "getBoundBoxCenter", 
function (modelIndex) {
if (this.isJmolDataFrameForModel (modelIndex)) return  new JU.P3 ();
return this.boxInfo.getBoundBoxCenter ();
}, "~N");
Clazz_defineMethod (c$, "getBoundBoxCornerVector", 
function () {
return this.boxInfo.getBoundBoxCornerVector ();
});
Clazz_defineMethod (c$, "getBBoxVertices", 
function () {
return this.boxInfo.getBoundBoxVertices ();
});
Clazz_defineMethod (c$, "setBoundBox", 
function (pt1, pt2, byCorner, scale) {
this.isBbcageDefault = false;
this.bboxModels = null;
this.bboxAtoms = null;
this.boxInfo.setBoundBox (pt1, pt2, byCorner, scale);
}, "JU.P3,JU.P3,~B,~N");
Clazz_defineMethod (c$, "getBoundBoxCommand", 
function (withOptions) {
if (!withOptions && this.bboxAtoms != null) return "boundbox " + JU.Escape.eBS (this.bboxAtoms);
this.ptTemp.setT (this.boxInfo.getBoundBoxCenter ());
var bbVector = this.boxInfo.getBoundBoxCornerVector ();
var s = (withOptions ? "boundbox " + JU.Escape.eP (this.ptTemp) + " " + JU.Escape.eP (bbVector) + "\n#or\n" : "");
this.ptTemp.sub (bbVector);
s += "boundbox corners " + JU.Escape.eP (this.ptTemp) + " ";
this.ptTemp.scaleAdd2 (2, bbVector, this.ptTemp);
var v = Math.abs (8 * bbVector.x * bbVector.y * bbVector.z);
s += JU.Escape.eP (this.ptTemp) + " # volume = " + v;
return s;
}, "~B");
Clazz_defineMethod (c$, "findAtomsInRectangle", 
function (rect) {
var bsModels = this.vwr.getVisibleFramesBitSet ();
var bs =  new JU.BS ();
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (!bsModels.get (atom.mi)) i = this.am[atom.mi].firstAtomIndex;
 else if (atom.checkVisible () && rect.contains (atom.sX, atom.sY)) bs.set (i);
}
return bs;
}, "JU.Rectangle");
Clazz_defineMethod (c$, "getDefaultVdwType", 
function (modelIndex) {
return (!this.am[modelIndex].isBioModel ? J.c.VDW.AUTO_BABEL : this.am[modelIndex].hydrogenCount == 0 ? J.c.VDW.AUTO_JMOL : J.c.VDW.AUTO_BABEL);
}, "~N");
Clazz_defineMethod (c$, "setRotationRadius", 
function (modelIndex, angstroms) {
if (this.isJmolDataFrameForModel (modelIndex)) {
this.am[modelIndex].defaultRotationRadius = angstroms;
return false;
}return true;
}, "~N,~N");
Clazz_defineMethod (c$, "calcRotationRadius", 
function (modelIndex, center) {
if (this.isJmolDataFrameForModel (modelIndex)) {
var r = this.am[modelIndex].defaultRotationRadius;
return (r == 0 ? 10 : r);
}var maxRadius = 0;
for (var i = this.ac; --i >= 0; ) {
if (this.isJmolDataFrameForAtom (this.at[i])) {
modelIndex = this.at[i].mi;
while (i >= 0 && this.at[i].mi == modelIndex) i--;

continue;
}var atom = this.at[i];
var distAtom = center.distance (atom);
var outerVdw = distAtom + this.getRadiusVdwJmol (atom);
if (outerVdw > maxRadius) maxRadius = outerVdw;
}
return (maxRadius == 0 ? 10 : maxRadius);
}, "~N,JU.P3");
Clazz_defineMethod (c$, "calcBoundBoxDimensions", 
function (bs, scale) {
if (bs != null && bs.nextSetBit (0) < 0) bs = null;
if (bs == null && this.isBbcageDefault || this.ac == 0) return;
this.bboxModels = this.getModelBS (this.bboxAtoms = JU.BSUtil.copy (bs), false);
if (this.calcAtomsMinMax (bs, this.boxInfo) == this.ac) this.isBbcageDefault = true;
if (bs == null) {
if (this.unitCells != null) this.calcUnitCellMinMax ();
}this.boxInfo.setBbcage (scale);
}, "JU.BS,~N");
Clazz_defineMethod (c$, "getBoxInfo", 
function (bs, scale) {
if (bs == null) return this.boxInfo;
var bi =  new JU.BoxInfo ();
this.calcAtomsMinMax (bs, bi);
bi.setBbcage (scale);
return bi;
}, "JU.BS,~N");
Clazz_defineMethod (c$, "calcAtomsMinMax", 
function (bs, boxInfo) {
boxInfo.reset ();
var nAtoms = 0;
var isAll = (bs == null);
var i0 = (isAll ? this.ac - 1 : bs.nextSetBit (0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bs.nextSetBit (i + 1))) {
nAtoms++;
if (!this.isJmolDataFrameForAtom (this.at[i])) boxInfo.addBoundBoxPoint (this.at[i]);
}
return nAtoms;
}, "JU.BS,JU.BoxInfo");
Clazz_defineMethod (c$, "calcUnitCellMinMax", 
 function () {
for (var i = 0; i < this.mc; i++) {
if (!this.unitCells[i].getCoordinatesAreFractional ()) continue;
var vertices = this.unitCells[i].getUnitCellVertices ();
for (var j = 0; j < 8; j++) this.boxInfo.addBoundBoxPoint (vertices[j]);

}
});
Clazz_defineMethod (c$, "calcRotationRadiusBs", 
function (bs) {
var center = this.getAtomSetCenter (bs);
var maxRadius = 0;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var atom = this.at[i];
var distAtom = center.distance (atom);
var outerVdw = distAtom + this.getRadiusVdwJmol (atom);
if (outerVdw > maxRadius) maxRadius = outerVdw;
}
return (maxRadius == 0 ? 10 : maxRadius);
}, "JU.BS");
Clazz_defineMethod (c$, "getCenterAndPoints", 
function (vAtomSets, addCenters) {
var bsAtoms1;
var bsAtoms2;
var n = (addCenters ? 1 : 0);
for (var ii = vAtomSets.size (); --ii >= 0; ) {
var bss = vAtomSets.get (ii);
bsAtoms1 = bss[0];
if (Clazz_instanceOf (bss[1], JU.BS)) {
bsAtoms2 = bss[1];
n += Math.min (bsAtoms1.cardinality (), bsAtoms2.cardinality ());
} else {
n += Math.min (bsAtoms1.cardinality (), (bss[1]).length);
}}
var points =  Clazz_newArray (2, n, null);
if (addCenters) {
points[0][0] =  new JU.P3 ();
points[1][0] =  new JU.P3 ();
}for (var ii = vAtomSets.size (); --ii >= 0; ) {
var bss = vAtomSets.get (ii);
bsAtoms1 = bss[0];
if (Clazz_instanceOf (bss[1], JU.BS)) {
bsAtoms2 = bss[1];
for (var i = bsAtoms1.nextSetBit (0), j = bsAtoms2.nextSetBit (0); i >= 0 && j >= 0; i = bsAtoms1.nextSetBit (i + 1), j = bsAtoms2.nextSetBit (j + 1)) {
points[0][--n] = this.at[i];
points[1][n] = this.at[j];
if (addCenters) {
points[0][0].add (this.at[i]);
points[1][0].add (this.at[j]);
}}
} else {
var coords = bss[1];
for (var i = bsAtoms1.nextSetBit (0), j = 0; i >= 0 && j < coords.length; i = bsAtoms1.nextSetBit (i + 1), j++) {
points[0][--n] = this.at[i];
points[1][n] = coords[j];
if (addCenters) {
points[0][0].add (this.at[i]);
points[1][0].add (coords[j]);
}}
}}
if (addCenters) {
points[0][0].scale (1 / (points[0].length - 1));
points[1][0].scale (1 / (points[1].length - 1));
}return points;
}, "JU.Lst,~B");
Clazz_defineMethod (c$, "getAtomSetCenter", 
function (bs) {
var ptCenter =  new JU.P3 ();
var nPoints = 0;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (!this.isJmolDataFrameForAtom (this.at[i])) {
nPoints++;
ptCenter.add (this.at[i]);
}}
if (nPoints > 0) ptCenter.scale (1.0 / nPoints);
return ptCenter;
}, "JU.BS");
Clazz_defineMethod (c$, "getAverageAtomPoint", 
function () {
if (this.averageAtomPoint == null) (this.averageAtomPoint =  new JU.P3 ()).setT (this.getAtomSetCenter (this.vwr.getAllAtoms ()));
return this.averageAtomPoint;
});
Clazz_defineMethod (c$, "setAPm", 
function (bs, tok, iValue, fValue, sValue, values, list) {
this.setAPa (bs, tok, iValue, fValue, sValue, values, list);
switch (tok) {
case 1095763991:
case 1632634891:
if (this.vwr.getBoolean (603979944)) this.assignAromaticBondsBs (true, null);
break;
}
}, "JU.BS,~N,~N,~N,~S,~A,~A");
Clazz_defineMethod (c$, "addStateScript", 
function (script1, bsBonds, bsAtoms1, bsAtoms2, script2, addFrameNumber, postDefinitions) {
var iModel = this.vwr.am.cmi;
if (addFrameNumber) {
if (this.thisStateModel != iModel) script1 = "frame " + (iModel < 0 ? "all #" + iModel : this.getModelNumberDotted (iModel)) + ";\n  " + script1;
this.thisStateModel = iModel;
} else {
this.thisStateModel = -1;
}var stateScript =  new JM.StateScript (this.thisStateModel, script1, bsBonds, bsAtoms1, bsAtoms2, script2, postDefinitions);
if (stateScript.isValid ()) {
this.stateScripts.addLast (stateScript);
}return stateScript;
}, "~S,JU.BS,JU.BS,JU.BS,~S,~B,~B");
Clazz_defineMethod (c$, "calculateStructuresAllExcept", 
function (alreadyDefined, asDSSP, doReport, dsspIgnoreHydrogen, setStructure, includeAlpha) {
this.freezeModels ();
var ret = "";
var bsModels = JU.BSUtil.copyInvert (alreadyDefined, this.mc);
if (setStructure) this.setDefaultStructure (bsModels);
for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) {
ret += this.am[i].calculateStructures (asDSSP, doReport, dsspIgnoreHydrogen, setStructure, includeAlpha);
}
if (setStructure) {
this.setStructureIndexes ();
}return ret;
}, "JU.BS,~B,~B,~B,~B,~B");
Clazz_defineMethod (c$, "setDefaultStructure", 
function (bsModels) {
for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) if (this.am[i].isBioModel && this.am[i].defaultStructure == null) this.am[i].defaultStructure = this.getProteinStructureState (this.am[i].bsAtoms, false, false, 0);

}, "JU.BS");
Clazz_defineMethod (c$, "setProteinType", 
function (bs, type) {
var monomerIndexCurrent = -1;
var iLast = -1;
var bsModels = this.getModelBS (bs, false);
this.setDefaultStructure (bsModels);
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (iLast != i - 1) monomerIndexCurrent = -1;
monomerIndexCurrent = this.at[i].group.setProteinStructureType (type, monomerIndexCurrent);
var modelIndex = this.at[i].mi;
this.proteinStructureTainted = this.am[modelIndex].structureTainted = true;
iLast = i = this.at[i].group.lastAtomIndex;
}
var lastStrucNo =  Clazz_newIntArray (this.mc, 0);
for (var i = 0; i < this.ac; ) {
var modelIndex = this.at[i].mi;
if (!bsModels.get (modelIndex)) {
i = this.am[modelIndex].firstAtomIndex + this.am[modelIndex].ac;
continue;
}iLast = this.at[i].getStrucNo ();
if (iLast < 1000 && iLast > lastStrucNo[modelIndex]) lastStrucNo[modelIndex] = iLast;
i = this.at[i].group.lastAtomIndex + 1;
}
for (var i = 0; i < this.ac; ) {
var modelIndex = this.at[i].mi;
if (!bsModels.get (modelIndex)) {
i = this.am[modelIndex].firstAtomIndex + this.am[modelIndex].ac;
continue;
}if (this.at[i].getStrucNo () > 1000) this.at[i].group.setStrucNo (++lastStrucNo[modelIndex]);
i = this.at[i].group.lastAtomIndex + 1;
}
}, "JU.BS,J.c.STR");
Clazz_defineMethod (c$, "freezeModels", 
function () {
for (var iModel = this.mc; --iModel >= 0; ) this.am[iModel].freeze ();

});
Clazz_defineMethod (c$, "getStructureList", 
function () {
return this.vwr.getStructureList ();
});
Clazz_defineMethod (c$, "setStructureList", 
function (structureList) {
for (var iModel = this.mc; --iModel >= 0; ) this.am[iModel].setStructureList (structureList);

}, "java.util.Map");
Clazz_defineMethod (c$, "setConformation", 
function (bsAtoms) {
var bsModels = this.getModelBS (bsAtoms, false);
for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) this.am[i].setConformation (bsAtoms);

return bsAtoms;
}, "JU.BS");
Clazz_defineMethod (c$, "getConformation", 
function (modelIndex, conformationIndex, doSet) {
var bs =  new JU.BS ();
for (var i = this.mc; --i >= 0; ) if (i == modelIndex || modelIndex < 0) {
var altLocs = this.getAltLocListInModel (i);
var nAltLocs = this.getAltLocCountInModel (i);
if (conformationIndex > 0 && conformationIndex >= nAltLocs) continue;
var bsConformation = this.vwr.getModelUndeletedAtomsBitSet (i);
if (conformationIndex >= 0) {
if (!this.am[i].getPdbConformation (bsConformation, conformationIndex)) for (var c = nAltLocs; --c >= 0; ) if (c != conformationIndex) bsConformation.andNot (this.getAtomBitsMDa (1048607, altLocs.substring (c, c + 1)));

}if (bsConformation.nextSetBit (0) >= 0) {
bs.or (bsConformation);
if (doSet) this.am[i].setConformation (bsConformation);
}}
return bs;
}, "~N,~N,~B");
Clazz_defineMethod (c$, "getHeteroList", 
function (modelIndex) {
var htFull =  new java.util.Hashtable ();
var ok = false;
for (var i = this.mc; --i >= 0; ) if (modelIndex < 0 || i == modelIndex) {
var ht = this.getInfo (i, "hetNames");
if (ht == null) continue;
ok = true;
for (var entry, $entry = ht.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var key = entry.getKey ();
htFull.put (key, entry.getValue ());
}
}
return (ok ? htFull : this.getInfoM ("hetNames"));
}, "~N");
Clazz_defineMethod (c$, "getInfoM", 
function (keyName) {
return (this.msInfo == null ? null : this.msInfo.get (keyName));
}, "~S");
Clazz_defineMethod (c$, "getMSInfoB", 
function (keyName) {
var val = this.getInfoM (keyName);
return (Clazz_instanceOf (val, Boolean) && (val).booleanValue ());
}, "~S");
Clazz_defineMethod (c$, "mergeTrajectories", 
function (isTrajectory) {
if (this.trajectorySteps == null) {
if (!isTrajectory) return 0;
this.trajectorySteps =  new JU.Lst ();
}for (var i = this.trajectorySteps.size (); i < this.mc; i++) this.trajectorySteps.addLast (null);

return this.mc;
}, "~B");
Clazz_defineMethod (c$, "getTrajectoryIndex", 
function (modelIndex) {
return this.am[modelIndex].trajectoryBaseIndex;
}, "~N");
Clazz_defineMethod (c$, "isTrajectory", 
function (modelIndex) {
return this.am[modelIndex].isTrajectory;
}, "~N");
Clazz_defineMethod (c$, "isTrajectoryMeasurement", 
function (countPlusIndices) {
if (countPlusIndices != null) {
var count = countPlusIndices[0];
var atomIndex;
for (var i = 1; i <= count; i++) if ((atomIndex = countPlusIndices[i]) >= 0 && this.am[this.at[atomIndex].mi].isTrajectory) return true;

}return false;
}, "~A");
Clazz_defineMethod (c$, "getModelBS", 
function (atomList, allTrajectories) {
var bs =  new JU.BS ();
var modelIndex = 0;
var isAll = (atomList == null);
var i0 = (isAll ? 0 : atomList.nextSetBit (0));
for (var i = i0; i >= 0 && i < this.ac; i = (isAll ? i + 1 : atomList.nextSetBit (i + 1))) {
bs.set (modelIndex = this.at[i].mi);
if (allTrajectories) {
var iBase = this.am[modelIndex].trajectoryBaseIndex;
for (var j = 0; j < this.mc; j++) if (this.am[j].trajectoryBaseIndex == iBase) bs.set (j);

}i = this.am[modelIndex].firstAtomIndex + this.am[modelIndex].ac - 1;
}
return bs;
}, "JU.BS,~B");
Clazz_defineMethod (c$, "getIterativeModels", 
function (allowJmolData) {
var bs =  new JU.BS ();
for (var i = 0; i < this.mc; i++) {
if (!allowJmolData && this.isJmolDataFrameForModel (i)) continue;
if (this.am[i].trajectoryBaseIndex == i) bs.set (i);
}
return bs;
}, "~B");
Clazz_defineMethod (c$, "isTrajectorySubFrame", 
function (i) {
return (this.am[i].isTrajectory && this.am[i].trajectoryBaseIndex != i);
}, "~N");
Clazz_defineMethod (c$, "selectDisplayedTrajectories", 
function (bs) {
for (var i = 0; i < this.mc; i++) {
if (this.am[i].isTrajectory && this.at[this.am[i].firstAtomIndex].mi != i) bs.clear (i);
}
return bs;
}, "JU.BS");
Clazz_defineMethod (c$, "fillAtomData", 
function (atomData, mode) {
if ((mode & 4) != 0) {
this.getMolecules ();
atomData.bsMolecules =  new Array (this.molecules.length);
atomData.atomMolecule =  Clazz_newIntArray (this.ac, 0);
var bs;
for (var i = 0; i < this.molecules.length; i++) {
bs = atomData.bsMolecules[i] = this.molecules[i].atomList;
for (var iAtom = bs.nextSetBit (0); iAtom >= 0; iAtom = bs.nextSetBit (iAtom + 1)) atomData.atomMolecule[iAtom] = i;

}
}if ((mode & 8) != 0) {
var nH =  Clazz_newIntArray (1, 0);
atomData.hAtomRadius = this.vwr.getVanderwaalsMar (1) / 1000;
atomData.hAtoms = this.calculateHydrogens (atomData.bsSelected, nH, false, true, null);
atomData.hydrogenAtomCount = nH[0];
return;
}if (atomData.modelIndex < 0) atomData.firstAtomIndex = (atomData.bsSelected == null ? 0 : Math.max (0, atomData.bsSelected.nextSetBit (0)));
 else atomData.firstAtomIndex = this.am[atomData.modelIndex].firstAtomIndex;
atomData.lastModelIndex = atomData.firstModelIndex = (this.ac == 0 ? 0 : this.at[atomData.firstAtomIndex].mi);
atomData.modelName = this.getModelNumberDotted (atomData.firstModelIndex);
this.fillADa (atomData, mode);
}, "J.atomdata.AtomData,~N");
Clazz_defineMethod (c$, "getModelNumberDotted", 
function (modelIndex) {
return (this.mc < 1 || modelIndex >= this.mc || modelIndex < 0 ? "" : JU.Escape.escapeModelFileNumber (this.modelFileNumbers[modelIndex]));
}, "~N");
Clazz_defineMethod (c$, "getModelNumber", 
function (modelIndex) {
return this.modelNumbers[modelIndex == 2147483647 ? this.mc - 1 : modelIndex];
}, "~N");
Clazz_defineMethod (c$, "getModelProperty", 
function (modelIndex, property) {
var props = this.am[modelIndex].properties;
return props == null ? null : props.getProperty (property);
}, "~N,~S");
Clazz_defineMethod (c$, "getModelAuxiliaryInfo", 
function (modelIndex) {
return (modelIndex < 0 ? null : this.am[modelIndex].auxiliaryInfo);
}, "~N");
Clazz_defineMethod (c$, "setInfo", 
function (modelIndex, key, value) {
this.am[modelIndex].auxiliaryInfo.put (key, value);
}, "~N,~O,~O");
Clazz_defineMethod (c$, "getInfo", 
function (modelIndex, key) {
return (modelIndex < 0 ? null : this.am[modelIndex].auxiliaryInfo.get (key));
}, "~N,~S");
Clazz_defineMethod (c$, "getInfoB", 
function (modelIndex, keyName) {
var info = this.am[modelIndex].auxiliaryInfo;
return (info != null && info.containsKey (keyName) && (info.get (keyName)).booleanValue ());
}, "~N,~S");
Clazz_defineMethod (c$, "getInfoI", 
function (modelIndex, keyName) {
var info = this.am[modelIndex].auxiliaryInfo;
if (info != null && info.containsKey (keyName)) {
return (info.get (keyName)).intValue ();
}return -2147483648;
}, "~N,~S");
Clazz_defineMethod (c$, "getInsertionCountInModel", 
function (modelIndex) {
return this.am[modelIndex].nInsertions;
}, "~N");
c$.modelFileNumberFromFloat = Clazz_defineMethod (c$, "modelFileNumberFromFloat", 
function (fDotM) {
var file = Clazz_doubleToInt (Math.floor (fDotM));
var model = Clazz_doubleToInt (Math.floor ((fDotM - file + 0.00001) * 10000));
while (model != 0 && model % 10 == 0) model /= 10;

return file * 1000000 + model;
}, "~N");
Clazz_defineMethod (c$, "getAltLocCountInModel", 
function (modelIndex) {
return this.am[modelIndex].nAltLocs;
}, "~N");
Clazz_defineMethod (c$, "getChainCountInModelWater", 
function (modelIndex, countWater) {
if (modelIndex < 0) {
var chainCount = 0;
for (var i = this.mc; --i >= 0; ) chainCount += this.am[i].getChainCount (countWater);

return chainCount;
}return this.am[modelIndex].getChainCount (countWater);
}, "~N,~B");
Clazz_defineMethod (c$, "getGroupCountInModel", 
function (modelIndex) {
if (modelIndex < 0) {
var groupCount = 0;
for (var i = this.mc; --i >= 0; ) groupCount += this.am[i].getGroupCount ();

return groupCount;
}return this.am[modelIndex].getGroupCount ();
}, "~N");
Clazz_defineMethod (c$, "calcSelectedGroupsCount", 
function () {
var bsSelected = this.vwr.bsA ();
for (var i = this.mc; --i >= 0; ) this.am[i].calcSelectedGroupsCount (bsSelected);

});
Clazz_defineMethod (c$, "calcSelectedMonomersCount", 
function () {
var bsSelected = this.vwr.bsA ();
for (var i = this.mc; --i >= 0; ) this.am[i].calcSelectedMonomersCount (bsSelected);

});
Clazz_defineMethod (c$, "isJmolDataFrameForModel", 
function (modelIndex) {
return (modelIndex >= 0 && modelIndex < this.mc && this.am[modelIndex].isJmolDataFrame);
}, "~N");
Clazz_defineMethod (c$, "isJmolDataFrameForAtom", 
 function (atom) {
return (this.am[atom.mi].isJmolDataFrame);
}, "JM.Atom");
Clazz_defineMethod (c$, "setJmolDataFrame", 
function (type, modelIndex, modelDataIndex) {
var model = this.am[type == null ? this.am[modelDataIndex].dataSourceFrame : modelIndex];
if (type == null) {
type = this.am[modelDataIndex].jmolFrameType;
}if (modelIndex >= 0) {
if (model.dataFrames == null) {
model.dataFrames =  new java.util.Hashtable ();
}this.am[modelDataIndex].dataSourceFrame = modelIndex;
this.am[modelDataIndex].jmolFrameType = type;
model.dataFrames.put (type, Integer.$valueOf (modelDataIndex));
}if (type.startsWith ("quaternion") && type.indexOf ("deriv") < 0) {
type = type.substring (0, type.indexOf (" "));
model.dataFrames.put (type, Integer.$valueOf (modelDataIndex));
}}, "~S,~N,~N");
Clazz_defineMethod (c$, "getJmolDataFrameIndex", 
function (modelIndex, type) {
if (this.am[modelIndex].dataFrames == null) {
return -1;
}var index = this.am[modelIndex].dataFrames.get (type);
return (index == null ? -1 : index.intValue ());
}, "~N,~S");
Clazz_defineMethod (c$, "clearDataFrameReference", 
function (modelIndex) {
for (var i = 0; i < this.mc; i++) {
var df = this.am[i].dataFrames;
if (df == null) {
continue;
}var e = df.values ().iterator ();
while (e.hasNext ()) {
if ((e.next ()).intValue () == modelIndex) {
e.remove ();
}}
}
}, "~N");
Clazz_defineMethod (c$, "getJmolFrameType", 
function (modelIndex) {
return (modelIndex >= 0 && modelIndex < this.mc ? this.am[modelIndex].jmolFrameType : "modelSet");
}, "~N");
Clazz_defineMethod (c$, "getJmolDataSourceFrame", 
function (modelIndex) {
return (modelIndex >= 0 && modelIndex < this.mc ? this.am[modelIndex].dataSourceFrame : -1);
}, "~N");
Clazz_defineMethod (c$, "saveModelOrientation", 
function (modelIndex, orientation) {
this.am[modelIndex].orientation = orientation;
}, "~N,JM.Orientation");
Clazz_defineMethod (c$, "getModelOrientation", 
function (modelIndex) {
return this.am[modelIndex].orientation;
}, "~N");
Clazz_defineMethod (c$, "getPDBHeader", 
function (modelIndex) {
return (this.am[modelIndex].isBioModel ? this.am[modelIndex].getFullPDBHeader () : this.getFileHeader (modelIndex));
}, "~N");
Clazz_defineMethod (c$, "getFileHeader", 
function (modelIndex) {
if (modelIndex < 0) return "";
if (this.am[modelIndex].isBioModel) return this.am[modelIndex].getFullPDBHeader ();
var info = this.getInfo (modelIndex, "fileHeader");
if (info == null) info = this.modelSetName;
if (info != null) return info;
return "no header information found";
}, "~N");
Clazz_defineMethod (c$, "getAltLocIndexInModel", 
function (modelIndex, alternateLocationID) {
if (alternateLocationID == '\0') {
return 0;
}var altLocList = this.getAltLocListInModel (modelIndex);
if (altLocList.length == 0) {
return 0;
}return altLocList.indexOf (alternateLocationID) + 1;
}, "~N,~S");
Clazz_defineMethod (c$, "getInsertionCodeIndexInModel", 
function (modelIndex, insertionCode) {
if (insertionCode == '\0') return 0;
var codeList = this.getInsertionListInModel (modelIndex);
if (codeList.length == 0) return 0;
return codeList.indexOf (insertionCode) + 1;
}, "~N,~S");
Clazz_defineMethod (c$, "getAltLocListInModel", 
function (modelIndex) {
var str = this.getInfo (modelIndex, "altLocs");
return (str == null ? "" : str);
}, "~N");
Clazz_defineMethod (c$, "getInsertionListInModel", 
 function (modelIndex) {
var str = this.getInfo (modelIndex, "insertionCodes");
return (str == null ? "" : str);
}, "~N");
Clazz_defineMethod (c$, "getModelSymmetryCount", 
function (modelIndex) {
return (this.am[modelIndex].biosymmetryCount > 0 ? this.am[modelIndex].biosymmetryCount : this.unitCells == null || this.unitCells[modelIndex] == null ? 0 : this.unitCells[modelIndex].getSpaceGroupOperationCount ());
}, "~N");
Clazz_defineMethod (c$, "getModelCellRange", 
function (modelIndex) {
if (this.unitCells == null) return null;
return this.unitCells[modelIndex].getCellRange ();
}, "~N");
Clazz_defineMethod (c$, "getLastVibrationVector", 
function (modelIndex, tok) {
if (this.vibrations != null) {
var v;
var a1 = (modelIndex < 0 || modelIndex >= this.mc - 1 ? this.ac : this.am[modelIndex + 1].firstAtomIndex);
var a0 = (modelIndex <= 0 ? 0 : this.am[modelIndex].firstAtomIndex);
for (var i = a1; --i >= a0; ) {
if ((modelIndex < 0 || this.at[i].mi == modelIndex) && ((tok == 1276121113 || tok == 0) && (v = this.getModulation (i)) != null || (tok == 4166 || tok == 0) && (v = this.getVibration (i, false)) != null) && v.isNonzero ()) return i;
}
}return -1;
}, "~N,~N");
Clazz_defineMethod (c$, "getModulationList", 
function (bs, type, t456) {
var list =  new JU.Lst ();
if (this.vibrations != null) for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) if (Clazz_instanceOf (this.vibrations[i], J.api.JmolModulationSet)) list.addLast ((this.vibrations[i]).getModulation (type, t456));
 else list.addLast (Float.$valueOf (type == 'O' ? NaN : -1));

return list;
}, "JU.BS,~S,JU.P3");
Clazz_defineMethod (c$, "getElementsPresentBitSet", 
function (modelIndex) {
if (modelIndex >= 0) return this.elementsPresent[modelIndex];
var bs =  new JU.BS ();
for (var i = 0; i < this.mc; i++) bs.or (this.elementsPresent[i]);

return bs;
}, "~N");
Clazz_defineMethod (c$, "getMoleculeIndex", 
function (atomIndex, inModel) {
if (this.moleculeCount == 0) this.getMolecules ();
for (var i = 0; i < this.moleculeCount; i++) {
if (this.molecules[i].atomList.get (atomIndex)) return (inModel ? this.molecules[i].indexInModel : i);
}
return 0;
}, "~N,~B");
Clazz_defineMethod (c$, "getMoleculeBitSet", 
function (bs) {
if (this.moleculeCount == 0) this.getMolecules ();
var bsResult = JU.BSUtil.copy (bs);
var bsInitial = JU.BSUtil.copy (bs);
var i = 0;
var bsTemp =  new JU.BS ();
while ((i = bsInitial.length () - 1) >= 0) {
bsTemp = this.getMoleculeBitSetForAtom (i);
if (bsTemp == null) {
bsInitial.clear (i);
bsResult.clear (i);
continue;
}bsInitial.andNot (bsTemp);
bsResult.or (bsTemp);
}
return bsResult;
}, "JU.BS");
Clazz_defineMethod (c$, "getMoleculeBitSetForAtom", 
function (atomIndex) {
if (this.moleculeCount == 0) this.getMolecules ();
for (var i = 0; i < this.moleculeCount; i++) if (this.molecules[i].atomList.get (atomIndex)) return this.molecules[i].atomList;

return null;
}, "~N");
Clazz_defineMethod (c$, "getModelDipole", 
function (modelIndex) {
if (modelIndex < 0) return null;
var dipole = this.getInfo (modelIndex, "dipole");
if (dipole == null) dipole = this.getInfo (modelIndex, "DIPOLE_VEC");
return dipole;
}, "~N");
Clazz_defineMethod (c$, "calculateMolecularDipole", 
function (modelIndex, bsAtoms) {
if (bsAtoms != null) {
var ia = bsAtoms.nextSetBit (0);
if (ia < 0) return null;
modelIndex = this.at[ia].mi;
}if (this.partialCharges == null || modelIndex < 0) return null;
var nPos = 0;
var nNeg = 0;
var cPos = 0;
var cNeg = 0;
var pos =  new JU.V3 ();
var neg =  new JU.V3 ();
if (bsAtoms == null) bsAtoms = this.getModelAtomBitSetIncludingDeleted (-1, false);
for (var i = bsAtoms.nextSetBit (0); i >= 0; i = bsAtoms.nextSetBit (i + 1)) {
if (this.at[i].mi != modelIndex || this.at[i].isDeleted ()) {
continue;
}var c = this.partialCharges[i];
if (c < 0) {
nNeg++;
cNeg += c;
neg.scaleAdd2 (c, this.at[i], neg);
} else if (c > 0) {
nPos++;
cPos += c;
pos.scaleAdd2 (c, this.at[i], pos);
}}
if (Math.abs (cPos + cNeg) > 0.01) {
JU.Logger.info ("Dipole calculation requires balanced charges: " + cPos + " " + cNeg);
return null;
}if (nNeg == 0 || nPos == 0) return null;
pos.add (neg);
pos.scale (4.8);
return pos;
}, "~N,JU.BS");
Clazz_defineMethod (c$, "getMoleculeCountInModel", 
function (modelIndex) {
var n = 0;
if (this.moleculeCount == 0) this.getMolecules ();
if (modelIndex < 0) return this.moleculeCount;
for (var i = 0; i < this.mc; i++) {
if (modelIndex == i) n += this.am[i].moleculeCount;
}
return n;
}, "~N");
Clazz_defineMethod (c$, "calcSelectedMoleculesCount", 
function () {
var bsSelected = this.vwr.bsA ();
if (this.moleculeCount == 0) this.getMolecules ();
this.selectedMolecules.xor (this.selectedMolecules);
var bsTemp =  new JU.BS ();
for (var i = 0; i < this.moleculeCount; i++) {
JU.BSUtil.copy2 (bsSelected, bsTemp);
bsTemp.and (this.molecules[i].atomList);
if (bsTemp.length () > 0) {
this.selectedMolecules.set (i);
}}
});
Clazz_defineMethod (c$, "setCentroid", 
function (bs, minmax) {
var bsDelete = this.getNotInCentroid (bs, minmax);
if (bsDelete != null && bsDelete.nextSetBit (0) >= 0) this.vwr.deleteAtoms (bsDelete, false);
}, "JU.BS,~A");
Clazz_defineMethod (c$, "getNotInCentroid", 
 function (bs, minmax) {
var iAtom0 = bs.nextSetBit (0);
if (iAtom0 < 0) return null;
var uc = this.getUnitCell (this.at[iAtom0].mi);
return (uc == null ? null : uc.notInCentroid (this, bs, minmax));
}, "JU.BS,~A");
Clazz_defineMethod (c$, "getMolecules", 
function () {
if (this.moleculeCount > 0) return this.molecules;
if (this.molecules == null) this.molecules =  new Array (4);
this.moleculeCount = 0;
var m = null;
var bsModelAtoms =  new Array (this.mc);
var biobranches = null;
for (var i = 0; i < this.mc; i++) {
bsModelAtoms[i] = this.vwr.getModelUndeletedAtomsBitSet (i);
m = this.am[i];
m.moleculeCount = 0;
biobranches = m.getBioBranches (biobranches);
}
this.molecules = JU.JmolMolecule.getMolecules (this.at, bsModelAtoms, biobranches, null);
this.moleculeCount = this.molecules.length;
for (var i = this.moleculeCount; --i >= 0; ) {
m = this.am[this.molecules[i].modelIndex];
m.firstMoleculeIndex = i;
m.moleculeCount++;
}
return this.molecules;
});
Clazz_defineMethod (c$, "initializeBspf", 
function () {
if (this.bspf != null && this.bspf.isValid) return;
if (this.showRebondTimes) JU.Logger.startTimer ("build bspf");
var bspf =  new J.bspt.Bspf (3);
if (JU.Logger.debugging) JU.Logger.debug ("sequential bspt order");
var bsNew = JU.BS.newN (this.mc);
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (!atom.isDeleted () && !this.isTrajectorySubFrame (atom.mi)) {
bspf.addTuple (this.am[atom.mi].trajectoryBaseIndex, atom);
bsNew.set (atom.mi);
}}
if (this.showRebondTimes) {
JU.Logger.checkTimer ("build bspf", false);
bspf.stats ();
}for (var i = bsNew.nextSetBit (0); i >= 0; i = bsNew.nextSetBit (i + 1)) bspf.validateModel (i, true);

bspf.isValid = true;
this.bspf = bspf;
});
Clazz_defineMethod (c$, "initializeBspt", 
function (modelIndex) {
this.initializeBspf ();
if (this.bspf.isInitializedIndex (modelIndex)) return;
this.bspf.initialize (modelIndex, this.at, this.vwr.getModelUndeletedAtomsBitSet (modelIndex));
}, "~N");
Clazz_defineMethod (c$, "setIteratorForPoint", 
function (iterator, modelIndex, pt, distance) {
if (modelIndex < 0) {
iterator.setCenter (pt, distance);
return;
}this.initializeBspt (modelIndex);
iterator.setModel (this, modelIndex, this.am[modelIndex].firstAtomIndex, 2147483647, pt, distance, null);
}, "J.api.AtomIndexIterator,~N,JU.T3,~N");
Clazz_defineMethod (c$, "setIteratorForAtom", 
function (iterator, modelIndex, atomIndex, distance, rd) {
if (modelIndex < 0) modelIndex = this.at[atomIndex].mi;
modelIndex = this.am[modelIndex].trajectoryBaseIndex;
this.initializeBspt (modelIndex);
iterator.setModel (this, modelIndex, this.am[modelIndex].firstAtomIndex, atomIndex, this.at[atomIndex], distance, rd);
}, "J.api.AtomIndexIterator,~N,~N,~N,J.atomdata.RadiusData");
Clazz_defineMethod (c$, "getSelectedAtomIterator", 
function (bsSelected, isGreaterOnly, modelZeroBased, hemisphereOnly, isMultiModel) {
this.initializeBspf ();
var iter;
if (isMultiModel) {
var bsModels = this.getModelBS (bsSelected, false);
for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) this.initializeBspt (i);

iter =  new JM.AtomIteratorWithinModelSet (bsModels);
} else {
iter =  new JM.AtomIteratorWithinModel ();
}iter.initialize (this.bspf, bsSelected, isGreaterOnly, modelZeroBased, hemisphereOnly, this.vwr.isParallel ());
return iter;
}, "JU.BS,~B,~B,~B,~B");
Clazz_overrideMethod (c$, "getBondCountInModel", 
function (modelIndex) {
return (modelIndex < 0 ? this.bondCount : this.am[modelIndex].getBondCount ());
}, "~N");
Clazz_defineMethod (c$, "getAtomCountInModel", 
function (modelIndex) {
return (modelIndex < 0 ? this.ac : this.am[modelIndex].ac);
}, "~N");
Clazz_defineMethod (c$, "getModelAtomBitSetIncludingDeletedBs", 
function (bsModels) {
var bs =  new JU.BS ();
if (bsModels == null && this.bsAll == null) this.bsAll = JU.BSUtil.setAll (this.ac);
if (bsModels == null) bs.or (this.bsAll);
 else for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) bs.or (this.getModelAtomBitSetIncludingDeleted (i, false));

return bs;
}, "JU.BS");
Clazz_defineMethod (c$, "getModelAtomBitSetIncludingDeleted", 
function (modelIndex, asCopy) {
var bs = (modelIndex < 0 ? this.bsAll : this.am[modelIndex].bsAtoms);
if (bs == null) bs = this.bsAll = JU.BSUtil.setAll (this.ac);
return (asCopy ? JU.BSUtil.copy (bs) : bs);
}, "~N,~B");
Clazz_defineMethod (c$, "getAtomBitsMaybeDeleted", 
function (tokType, specInfo) {
var info;
var bs;
switch (tokType) {
default:
return this.getAtomBitsMDa (tokType, specInfo);
case 1073741925:
return this.getAnnotationBits ("domains", 1073741925, specInfo);
case 1073742189:
return this.getAnnotationBits ("validation", 1073742189, specInfo);
case 1073741916:
return this.getAnnotationBits ("dssr", 1073741916, specInfo);
case 1073742128:
return this.getAnnotationBits ("rna3d", 1073742128, specInfo);
case 1678770178:
case 1048585:
return this.getAtomBitsMDb (tokType, specInfo);
case 1073741864:
var s = specInfo;
bs =  new JU.BS ();
return (!this.haveBioModels || s.length % 2 != 0 ? bs : this.getAtomBitsMDa (1087373318, this.bioModel.getBasePairBits (this, s)));
case 1679429641:
var boxInfo = this.getBoxInfo (specInfo, 1);
bs = this.getAtomsWithin (boxInfo.getBoundBoxCornerVector ().length () + 0.0001, boxInfo.getBoundBoxCenter (), null, -1);
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) if (!boxInfo.isWithin (this.at[i])) bs.clear (i);

return bs;
case 1095761925:
bs =  new JU.BS ();
info = specInfo;
this.ptTemp1.set (info[0] / 1000, info[1] / 1000, info[2] / 1000);
var ignoreOffset = false;
for (var i = this.ac; --i >= 0; ) if (this.isInLatticeCell (i, this.ptTemp1, this.ptTemp2, ignoreOffset)) bs.set (i);

return bs;
case 1095761926:
bs = JU.BSUtil.newBitSet2 (0, this.ac);
info = specInfo;
var minmax = [Clazz_doubleToInt (info[0] / 1000) - 1, Clazz_doubleToInt (info[1] / 1000) - 1, Clazz_doubleToInt (info[2] / 1000) - 1, Clazz_doubleToInt (info[0] / 1000), Clazz_doubleToInt (info[1] / 1000), Clazz_doubleToInt (info[2] / 1000), 0];
for (var i = this.mc; --i >= 0; ) {
var uc = this.getUnitCell (i);
if (uc == null) {
JU.BSUtil.andNot (bs, this.am[i].bsAtoms);
continue;
}bs.andNot (uc.notInCentroid (this, this.am[i].bsAtoms, minmax));
}
return bs;
case 1095761936:
return this.getMoleculeBitSet (specInfo);
case 1087373320:
return this.getSequenceBits (specInfo, null);
case 1048615:
return (this.haveBioModels ? this.bioModel.getSelectCodeRange (this, specInfo) :  new JU.BS ());
case 3145772:
bs = JU.BS.newN (this.ac);
var modelIndex = -1;
var nOps = 0;
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
var bsSym = atom.atomSymmetry;
if (bsSym != null) {
if (atom.mi != modelIndex) {
modelIndex = atom.mi;
if (this.getModelCellRange (modelIndex) == null) continue;
nOps = this.getModelSymmetryCount (modelIndex);
}var n = 0;
for (var j = nOps; --j >= 0; ) if (bsSym.get (j)) if (++n > 1) {
bs.set (i);
break;
}
}}
return bs;
case 1089470478:
return JU.BSUtil.copy (this.bsSymmetry == null ? this.bsSymmetry = JU.BS.newN (this.ac) : this.bsSymmetry);
case 1614417948:
bs =  new JU.BS ();
var unitcell = this.vwr.getCurrentUnitCell ();
if (unitcell == null) return bs;
this.ptTemp1.set (1, 1, 1);
for (var i = this.ac; --i >= 0; ) if (this.isInLatticeCell (i, this.ptTemp1, this.ptTemp2, false)) bs.set (i);

return bs;
}
}, "~N,~O");
Clazz_defineMethod (c$, "getAnnotationBits", 
 function (name, tok, specInfo) {
var bs =  new JU.BS ();
var pa = this.vwr.getAnnotationParser ();
var ann;
for (var i = this.mc; --i >= 0; ) if ((ann = this.getInfo (i, name)) != null) bs.or (pa.getAtomBits (this.vwr, specInfo, this.getCachedAnnotationMap (i, name + " V ", ann), this.am[i].dssrCache, tok, i, this.am[i].bsAtoms));

return bs;
}, "~S,~N,~S");
Clazz_defineMethod (c$, "getCachedAnnotationMap", 
function (i, key, ann) {
var cache = (this.am[i].dssrCache == null && ann != null ? this.am[i].dssrCache =  new java.util.Hashtable () : this.am[i].dssrCache);
if (cache == null) return null;
var annotv = cache.get (key);
if (annotv == null && ann != null) {
annotv = (Clazz_instanceOf (ann, JS.SV) || Clazz_instanceOf (ann, java.util.Hashtable) ? ann : this.vwr.evaluateExpressionAsVariable (ann));
cache.put (key, annotv);
}return (Clazz_instanceOf (annotv, JS.SV) || Clazz_instanceOf (annotv, java.util.Hashtable) ? annotv : null);
}, "~N,~S,~O");
Clazz_defineMethod (c$, "isInLatticeCell", 
 function (i, cell, ptTemp, isAbsolute) {
var iModel = this.at[i].mi;
var uc = this.getUnitCell (iModel);
ptTemp.setT (this.at[i]);
return (uc != null && uc.checkUnitCell (uc, cell, ptTemp, isAbsolute));
}, "~N,JU.P3,JU.P3,~B");
Clazz_defineMethod (c$, "getAtomsWithinRadius", 
function (distance, bs, withinAllModels, rd) {
var bsResult =  new JU.BS ();
var bsCheck = this.getIterativeModels (false);
bs = JU.BSUtil.andNot (bs, this.vwr.slm.bsDeleted);
var iter = this.getSelectedAtomIterator (null, false, false, false, false);
if (withinAllModels) {
var fixJavaFloat = !this.vwr.g.legacyJavaFloat;
var ptTemp =  new JU.P3 ();
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) for (var iModel = this.mc; --iModel >= 0; ) {
if (!bsCheck.get (iModel)) continue;
if (distance < 0) {
this.getAtomsWithin (distance, this.at[i].getFractionalUnitCoordPt (fixJavaFloat, true, ptTemp), bsResult, -1);
continue;
}this.setIteratorForAtom (iter, iModel, i, distance, rd);
iter.addAtoms (bsResult);
}

} else {
bsResult.or (bs);
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (distance < 0) {
this.getAtomsWithin (distance, this.at[i], bsResult, this.at[i].mi);
continue;
}this.setIteratorForAtom (iter, -1, i, distance, rd);
iter.addAtoms (bsResult);
}
}iter.release ();
return bsResult;
}, "~N,JU.BS,~B,J.atomdata.RadiusData");
Clazz_defineMethod (c$, "getAtomsWithin", 
function (distance, coord, bsResult, modelIndex) {
if (bsResult == null) bsResult =  new JU.BS ();
if (distance < 0) {
distance = -distance;
for (var i = this.ac; --i >= 0; ) {
var atom = this.at[i];
if (modelIndex >= 0 && this.at[i].mi != modelIndex) continue;
if (!bsResult.get (i) && atom.getFractionalUnitDistance (coord, this.ptTemp1, this.ptTemp2) <= distance) bsResult.set (atom.i);
}
return bsResult;
}var bsCheck = this.getIterativeModels (true);
var iter = this.getSelectedAtomIterator (null, false, false, false, false);
for (var iModel = this.mc; --iModel >= 0; ) {
if (!bsCheck.get (iModel)) continue;
this.setIteratorForAtom (iter, -1, this.am[iModel].firstAtomIndex, -1, null);
iter.setCenter (coord, distance);
iter.addAtoms (bsResult);
}
iter.release ();
return bsResult;
}, "~N,JU.P3,JU.BS,~N");
Clazz_defineMethod (c$, "deleteBonds", 
function (bsBonds, isFullModel) {
if (!isFullModel) {
var bsA =  new JU.BS ();
var bsB =  new JU.BS ();
for (var i = bsBonds.nextSetBit (0); i >= 0; i = bsBonds.nextSetBit (i + 1)) {
var atom1 = this.bo[i].atom1;
if (this.am[atom1.mi].isModelKit) continue;
bsA.clearAll ();
bsB.clearAll ();
bsA.set (atom1.i);
bsB.set (this.bo[i].getAtomIndex2 ());
this.addStateScript ("connect ", null, bsA, bsB, "delete", false, true);
}
}this.dBb (bsBonds, isFullModel);
}, "JU.BS,~B");
Clazz_defineMethod (c$, "makeConnections2", 
function (minD, maxD, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy) {
if (bsBonds == null) bsBonds =  new JU.BS ();
var matchAny = (order == 65535);
var matchNull = (order == 131071);
if (matchNull) order = 1;
var matchHbond = JM.Bond.isOrderH (order);
var identifyOnly = false;
var idOrModifyOnly = false;
var createOnly = false;
var autoAromatize = false;
switch (connectOperation) {
case 12291:
return this.deleteConnections (minD, maxD, order, bsA, bsB, isBonds, matchNull);
case 603979873:
case 1073741852:
if (order != 515) return this.autoBond (bsA, bsB, bsBonds, isBonds, matchHbond, connectOperation == 603979873);
idOrModifyOnly = autoAromatize = true;
break;
case 1087373321:
identifyOnly = idOrModifyOnly = true;
break;
case 1073742025:
idOrModifyOnly = true;
break;
case 1073741904:
createOnly = true;
break;
}
var anyOrNoId = (!identifyOnly || matchAny);
var notAnyAndNoId = (!identifyOnly && !matchAny);
this.defaultCovalentMad = this.vwr.getMadBond ();
var minDIsFrac = (minD < 0);
var maxDIsFrac = (maxD < 0);
var isFractional = (minDIsFrac || maxDIsFrac);
var checkDistance = (!isBonds || minD != 0.1 || maxD != 1.0E8);
if (checkDistance) {
minD = this.fixD (minD, minDIsFrac);
maxD = this.fixD (maxD, maxDIsFrac);
}var mad = this.getDefaultMadFromOrder (order);
var nNew = 0;
var nModified = 0;
var bondAB = null;
var atomA = null;
var atomB = null;
var altloc = '\u0000';
var newOrder = (order | 131072);
try {
for (var i = bsA.nextSetBit (0); i >= 0; i = bsA.nextSetBit (i + 1)) {
if (isBonds) {
bondAB = this.bo[i];
atomA = bondAB.atom1;
atomB = bondAB.atom2;
} else {
atomA = this.at[i];
if (atomA.isDeleted ()) continue;
altloc = (this.isModulated (i) ? '\0' : atomA.altloc);
}for (var j = (isBonds ? 0 : bsB.nextSetBit (0)); j >= 0; j = bsB.nextSetBit (j + 1)) {
if (isBonds) {
j = 2147483646;
} else {
if (j == i) continue;
atomB = this.at[j];
if (atomA.mi != atomB.mi || atomB.isDeleted ()) continue;
if (altloc != '\0' && altloc != atomB.altloc && atomB.altloc != '\0') continue;
bondAB = atomA.getBond (atomB);
}if ((bondAB == null ? idOrModifyOnly : createOnly) || checkDistance && !this.isInRange (atomA, atomB, minD, maxD, minDIsFrac, maxDIsFrac, isFractional)) continue;
if (bondAB == null) {
bsBonds.set (this.bondAtoms (atomA, atomB, order, mad, bsBonds, energy, addGroup, true).index);
nNew++;
} else {
if (notAnyAndNoId) {
bondAB.setOrder (order);
this.bsAromatic.clear (bondAB.index);
}if (anyOrNoId || order == bondAB.order || newOrder == bondAB.order || matchHbond && bondAB.isHydrogen ()) {
bsBonds.set (bondAB.index);
nModified++;
}}}
}
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
if (autoAromatize) this.assignAromaticBondsBs (true, bsBonds);
if (!identifyOnly) this.sm.setShapeSizeBs (1, -2147483648, null, bsBonds);
return [nNew, nModified];
}, "~N,~N,~N,~N,JU.BS,JU.BS,JU.BS,~B,~B,~N");
Clazz_defineMethod (c$, "autoBondBs4", 
function (bsA, bsB, bsExclude, bsBonds, mad, preJmol11_9_24) {
if (preJmol11_9_24) return this.autoBond_Pre_11_9_24 (bsA, bsB, bsExclude, bsBonds, mad);
if (this.ac == 0) return 0;
if (mad == 0) mad = 1;
if (this.maxBondingRadius == 1.4E-45) this.findMaxRadii ();
var bondTolerance = this.vwr.getFloat (570425348);
var minBondDistance = this.vwr.getFloat (570425364);
var minBondDistance2 = minBondDistance * minBondDistance;
var nNew = 0;
if (this.showRebondTimes) JU.Logger.startTimer ("autobond");
var lastModelIndex = -1;
var isAll = (bsA == null);
var bsCheck;
var i0;
if (isAll) {
i0 = 0;
bsCheck = null;
} else {
if (bsA.equals (bsB)) {
bsCheck = bsA;
} else {
bsCheck = JU.BSUtil.copy (bsA);
bsCheck.or (bsB);
}i0 = bsCheck.nextSetBit (0);
}var iter = this.getSelectedAtomIterator (null, false, false, true, false);
var useOccupation = false;
for (var i = i0; i >= 0 && i < this.ac; i = (isAll ? i + 1 : bsCheck.nextSetBit (i + 1))) {
var isAtomInSetA = (isAll || bsA.get (i));
var isAtomInSetB = (isAll || bsB.get (i));
var atom = this.at[i];
if (atom.isDeleted ()) continue;
var modelIndex = atom.mi;
if (modelIndex != lastModelIndex) {
lastModelIndex = modelIndex;
if (this.isJmolDataFrameForModel (modelIndex)) {
i = this.am[modelIndex].firstAtomIndex + this.am[modelIndex].ac - 1;
continue;
}useOccupation = this.getInfoB (modelIndex, "autoBondUsingOccupation");
}var myBondingRadius = atom.getBondingRadius ();
if (myBondingRadius == 0) continue;
var isFirstExcluded = (bsExclude != null && bsExclude.get (i));
var searchRadius = myBondingRadius + this.maxBondingRadius + bondTolerance;
this.setIteratorForAtom (iter, -1, i, searchRadius, null);
while (iter.hasNext ()) {
var atomNear = this.at[iter.next ()];
if (atomNear.isDeleted ()) continue;
var j = atomNear.i;
var isNearInSetA = (isAll || bsA.get (j));
var isNearInSetB = (isAll || bsB.get (j));
if (!isNearInSetA && !isNearInSetB || !(isAtomInSetA && isNearInSetB || isAtomInSetB && isNearInSetA) || isFirstExcluded && bsExclude.get (j) || useOccupation && this.occupancies != null && (this.occupancies[i] < 50) != (this.occupancies[j] < 50)) continue;
var order = JM.BondCollection.getBondOrderFull (myBondingRadius, atomNear.getBondingRadius (), iter.foundDistance2 (), minBondDistance2, bondTolerance);
if (order > 0 && this.autoBondCheck (atom, atomNear, order, mad, bsBonds)) nNew++;
}
iter.release ();
}
if (this.showRebondTimes) JU.Logger.checkTimer ("autoBond", false);
return nNew;
}, "JU.BS,JU.BS,JU.BS,JU.BS,~N,~B");
Clazz_defineMethod (c$, "autoBondCheck", 
 function (atomA, atomB, order, mad, bsBonds) {
if (atomA.getCurrentBondCount () > 20 || atomB.getCurrentBondCount () > 20) {
if (!this.maxBondWarned) JU.Logger.warn ("maximum auto bond count reached");
this.maxBondWarned = true;
return false;
}var formalChargeA = atomA.getFormalCharge ();
if (formalChargeA != 0) {
var formalChargeB = atomB.getFormalCharge ();
if ((formalChargeA < 0 && formalChargeB < 0) || (formalChargeA > 0 && formalChargeB > 0)) return false;
}if (atomA.altloc != atomB.altloc && atomA.altloc != '\0' && atomB.altloc != '\0' && this.getModulation (atomA.i) == null) return false;
this.getOrAddBond (atomA, atomB, order, mad, bsBonds, 0, false);
return true;
}, "JM.Atom,JM.Atom,~N,~N,JU.BS");
Clazz_defineMethod (c$, "autoBond_Pre_11_9_24", 
 function (bsA, bsB, bsExclude, bsBonds, mad) {
if (this.ac == 0) return 0;
if (mad == 0) mad = 1;
if (this.maxBondingRadius == 1.4E-45) this.findMaxRadii ();
var bondTolerance = this.vwr.getFloat (570425348);
var minBondDistance = this.vwr.getFloat (570425364);
var minBondDistance2 = minBondDistance * minBondDistance;
var nNew = 0;
this.initializeBspf ();
var lastModelIndex = -1;
for (var i = this.ac; --i >= 0; ) {
var isAtomInSetA = (bsA == null || bsA.get (i));
var isAtomInSetB = (bsB == null || bsB.get (i));
if (!isAtomInSetA && !isAtomInSetB) continue;
var atom = this.at[i];
if (atom.isDeleted ()) continue;
var modelIndex = atom.mi;
if (modelIndex != lastModelIndex) {
lastModelIndex = modelIndex;
if (this.isJmolDataFrameForModel (modelIndex)) {
for (; --i >= 0; ) if (this.at[i].mi != modelIndex) break;

i++;
continue;
}}var myBondingRadius = atom.getBondingRadius ();
if (myBondingRadius == 0) continue;
var searchRadius = myBondingRadius + this.maxBondingRadius + bondTolerance;
this.initializeBspt (modelIndex);
var iter = this.bspf.getCubeIterator (modelIndex);
iter.initialize (atom, searchRadius, true);
while (iter.hasMoreElements ()) {
var atomNear = iter.nextElement ();
if (atomNear === atom || atomNear.isDeleted ()) continue;
var atomIndexNear = atomNear.i;
var isNearInSetA = (bsA == null || bsA.get (atomIndexNear));
var isNearInSetB = (bsB == null || bsB.get (atomIndexNear));
if (!isNearInSetA && !isNearInSetB || bsExclude != null && bsExclude.get (atomIndexNear) && bsExclude.get (i)) continue;
if (!(isAtomInSetA && isNearInSetB || isAtomInSetB && isNearInSetA)) continue;
var order = JM.BondCollection.getBondOrderFull (myBondingRadius, atomNear.getBondingRadius (), iter.foundDistance2 (), minBondDistance2, bondTolerance);
if (order > 0) {
if (this.autoBondCheck (atom, atomNear, order, mad, bsBonds)) nNew++;
}}
iter.release ();
}
return nNew;
}, "JU.BS,JU.BS,JU.BS,JU.BS,~N");
Clazz_defineMethod (c$, "autoBond", 
 function (bsA, bsB, bsBonds, isBonds, matchHbond, legacyAutoBond) {
if (isBonds) {
var bs = bsA;
bsA =  new JU.BS ();
bsB =  new JU.BS ();
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
bsA.set (this.bo[i].atom1.i);
bsB.set (this.bo[i].atom2.i);
}
}return [matchHbond ? this.autoHbond (bsA, bsB, false) : this.autoBondBs4 (bsA, bsB, null, bsBonds, this.vwr.getMadBond (), legacyAutoBond), 0];
}, "JU.BS,JU.BS,JU.BS,~B,~B,~B");
Clazz_defineMethod (c$, "autoHbond", 
function (bsA, bsB, onlyIfHaveCalculated) {
if (onlyIfHaveCalculated) {
var bsModels = this.getModelBS (bsA, false);
for (var i = bsModels.nextSetBit (0); i >= 0 && onlyIfHaveCalculated; i = bsModels.nextSetBit (i + 1)) onlyIfHaveCalculated = !this.am[i].hasRasmolHBonds;

if (onlyIfHaveCalculated) return 0;
}var haveHAtoms = false;
for (var i = bsA.nextSetBit (0); i >= 0; i = bsA.nextSetBit (i + 1)) if (this.at[i].getElementNumber () == 1) {
haveHAtoms = true;
break;
}
var bsHBonds =  new JU.BS ();
var useRasMol = this.vwr.getBoolean (603979853);
if (bsB == null || useRasMol && !haveHAtoms) {
JU.Logger.info ((bsB == null ? "DSSP/DSSR " : "RasMol") + " pseudo-hbond calculation");
this.calcRasmolHydrogenBonds (bsA, bsB, null, false, 2147483647, false, bsHBonds);
return -JU.BSUtil.cardinalityOf (bsHBonds);
}JU.Logger.info (haveHAtoms ? "Standard Hbond calculation" : "Jmol pseudo-hbond calculation");
var bsCO = null;
if (!haveHAtoms) {
bsCO =  new JU.BS ();
for (var i = bsA.nextSetBit (0); i >= 0; i = bsA.nextSetBit (i + 1)) {
var atomID = this.at[i].atomID;
switch (atomID) {
case 64:
case 4:
case 14:
case 15:
case 16:
case 17:
bsCO.set (i);
break;
}
}
}var maxXYDistance = this.vwr.getFloat (570425361);
var minAttachedAngle = (this.vwr.getFloat (570425360) * 3.141592653589793 / 180);
var hbondMax2 = maxXYDistance * maxXYDistance;
var hbondMin2 = JM.ModelSet.hbondMin * JM.ModelSet.hbondMin;
var hxbondMin2 = 1;
var hxbondMax2 = (maxXYDistance > JM.ModelSet.hbondMin ? hbondMin2 : hbondMax2);
var hxbondMax = (maxXYDistance > JM.ModelSet.hbondMin ? JM.ModelSet.hbondMin : maxXYDistance);
var nNew = 0;
var d2 = 0;
var v1 =  new JU.V3 ();
var v2 =  new JU.V3 ();
if (this.showRebondTimes && JU.Logger.debugging) JU.Logger.startTimer ("hbond");
var C = null;
var D = null;
var iter = this.getSelectedAtomIterator (bsB, false, false, false, false);
for (var i = bsA.nextSetBit (0); i >= 0; i = bsA.nextSetBit (i + 1)) {
var atom = this.at[i];
var elementNumber = atom.getElementNumber ();
var isH = (elementNumber == 1);
if (!isH && (haveHAtoms || elementNumber != 7 && elementNumber != 8) || isH && !haveHAtoms) continue;
var min2;
var max2;
var dmax;
var firstIsCO;
if (isH) {
var b = atom.bonds;
if (b == null) continue;
var isOK = false;
for (var j = 0; j < b.length && !isOK; j++) {
var a2 = b[j].getOtherAtom (atom);
var element = a2.getElementNumber ();
isOK = (element == 7 || element == 8);
}
if (!isOK) continue;
dmax = hxbondMax;
min2 = hxbondMin2;
max2 = hxbondMax2;
firstIsCO = false;
} else {
dmax = maxXYDistance;
min2 = hbondMin2;
max2 = hbondMax2;
firstIsCO = bsCO.get (i);
}this.setIteratorForAtom (iter, -1, atom.i, dmax, null);
while (iter.hasNext ()) {
var atomNear = this.at[iter.next ()];
var elementNumberNear = atomNear.getElementNumber ();
if (atomNear === atom || !isH && elementNumberNear != 7 && elementNumberNear != 8 || isH && elementNumberNear == 1 || (d2 = iter.foundDistance2 ()) < min2 || d2 > max2 || firstIsCO && bsCO.get (atomNear.i) || atom.isBonded (atomNear)) {
continue;
}if (minAttachedAngle > 0) {
v1.sub2 (atom, atomNear);
if ((D = JM.ModelSet.checkMinAttachedAngle (atom, minAttachedAngle, v1, v2, haveHAtoms)) == null) continue;
v1.scale (-1);
if ((C = JM.ModelSet.checkMinAttachedAngle (atomNear, minAttachedAngle, v1, v2, haveHAtoms)) == null) continue;
}var energy = 0;
var bo;
if (isH && !Float.isNaN (C.x) && !Float.isNaN (D.x)) {
bo = 4096;
energy = JM.HBond.getEnergy (Math.sqrt (d2), C.distance (atom), C.distance (D), atomNear.distance (D)) / 1000;
} else {
bo = 2048;
}bsHBonds.set (this.addHBond (atom, atomNear, bo, energy));
nNew++;
}
}
iter.release ();
this.sm.setShapeSizeBs (1, -2147483648, null, bsHBonds);
if (this.showRebondTimes) JU.Logger.checkTimer ("hbond", false);
return (haveHAtoms ? nNew : -nNew);
}, "JU.BS,JU.BS,~B");
c$.checkMinAttachedAngle = Clazz_defineMethod (c$, "checkMinAttachedAngle", 
 function (atom1, minAngle, v1, v2, haveHAtoms) {
var bonds = atom1.bonds;
if (bonds == null || bonds.length == 0) return JU.P3.new3 (NaN, 0, 0);
var X = null;
var dMin = 3.4028235E38;
for (var i = bonds.length; --i >= 0; ) if (bonds[i].isCovalent ()) {
var atomA = bonds[i].getOtherAtom (atom1);
if (!haveHAtoms && atomA.getElementNumber () == 1) continue;
v2.sub2 (atom1, atomA);
var d = v2.angle (v1);
if (d < minAngle) return null;
if (d < dMin) {
X = atomA;
dMin = d;
}}
return X;
}, "JM.Atom,~N,JU.V3,JU.V3,~B");
Clazz_defineMethod (c$, "setStructureIndexes", 
function () {
var id;
var idnew = 0;
var lastid = -1;
var imodel = -1;
var lastmodel = -1;
for (var i = 0; i < this.ac; i++) {
if ((imodel = this.at[i].mi) != lastmodel) {
idnew = 0;
lastmodel = imodel;
lastid = -1;
}if ((id = this.at[i].getStrucNo ()) != lastid && id != 0) {
this.at[i].group.setStrucNo (++idnew);
lastid = idnew;
}}
});
Clazz_defineMethod (c$, "getModelInfoAsString", 
function () {
var sb =  new JU.SB ().append ("<models count=\"");
sb.appendI (this.mc).append ("\" modelSetHasVibrationVectors=\"").append (this.modelSetHasVibrationVectors () + "\">\n<properties>");
if (this.modelSetProperties != null) {
var e = this.modelSetProperties.propertyNames ();
while (e.hasMoreElements ()) {
var propertyName = e.nextElement ();
sb.append ("\n <property name=\"").append (propertyName).append ("\" value=").append (JU.PT.esc (this.modelSetProperties.getProperty (propertyName))).append (" />");
}
sb.append ("\n</properties>");
}for (var i = 0; i < this.mc; ++i) {
sb.append ("\n<model index=\"").appendI (i).append ("\" n=\"").append (this.getModelNumberDotted (i)).append ("\" id=").append (JU.PT.esc ("" + this.getInfo (i, "modelID")));
var ib = this.vwr.getJDXBaseModelIndex (i);
if (ib != i) sb.append (" baseModelId=").append (JU.PT.esc (this.getInfo (ib, "jdxModelID")));
sb.append (" name=").append (JU.PT.esc (this.getModelName (i))).append (" title=").append (JU.PT.esc (this.getModelTitle (i))).append (" hasVibrationVectors=\"").appendB (this.vwr.modelHasVibrationVectors (i)).append ("\" />");
}
sb.append ("\n</models>");
return sb.toString ();
});
Clazz_defineMethod (c$, "getSymmetryInfoAsString", 
function () {
var sb =  new JU.SB ().append ("Symmetry Information:");
for (var i = 0; i < this.mc; ++i) {
sb.append ("\nmodel #").append (this.getModelNumberDotted (i)).append ("; name=").append (this.getModelName (i)).append ("\n");
var unitCell = this.getUnitCell (i);
sb.append (unitCell == null ? "no symmetry information" : unitCell.getSymmetryInfoStr ());
}
return sb.toString ();
});
Clazz_defineMethod (c$, "getAtomsConnected", 
function (min, max, intType, bs) {
var isBonds = Clazz_instanceOf (bs, JM.BondSet);
var bsResult = (isBonds ?  new JM.BondSet () :  new JU.BS ());
var nBonded =  Clazz_newIntArray (this.ac, 0);
var i;
var ishbond = (intType == 30720);
var isall = (intType == 65535);
for (var ibond = 0; ibond < this.bondCount; ibond++) {
var bond = this.bo[ibond];
if (isall || bond.is (intType) || ishbond && bond.isHydrogen ()) {
if (isBonds) {
bsResult.set (ibond);
} else {
if (bs.get (bond.atom1.i)) {
nBonded[i = bond.atom2.i]++;
bsResult.set (i);
}if (bs.get (bond.atom2.i)) {
nBonded[i = bond.atom1.i]++;
bsResult.set (i);
}}}}
if (isBonds) return bsResult;
var nonbonded = (min == 0);
for (i = this.ac; --i >= 0; ) {
var n = nBonded[i];
if (n < min || n > max) bsResult.clear (i);
 else if (nonbonded && n == 0) bsResult.set (i);
}
return bsResult;
}, "~N,~N,~N,JU.BS");
Clazz_defineMethod (c$, "getSymTemp", 
function (forceNew) {
return (this.symTemp == null || forceNew ? (this.symTemp = J.api.Interface.getSymmetry (this.vwr, "ms")) : this.symTemp);
}, "~B");
Clazz_defineMethod (c$, "createModels", 
function (n) {
var newModelCount = this.mc + n;
var newModels = JU.AU.arrayCopyObject (this.am, newModelCount);
this.validateBspf (false);
this.modelNumbers = JU.AU.arrayCopyI (this.modelNumbers, newModelCount);
this.modelFileNumbers = JU.AU.arrayCopyI (this.modelFileNumbers, newModelCount);
this.modelNumbersForAtomLabel = JU.AU.arrayCopyS (this.modelNumbersForAtomLabel, newModelCount);
this.modelNames = JU.AU.arrayCopyS (this.modelNames, newModelCount);
this.frameTitles = JU.AU.arrayCopyS (this.frameTitles, newModelCount);
var f = Clazz_doubleToInt (this.modelFileNumbers[this.mc - 1] / 1000000) + 1;
for (var i = this.mc, pt = 0; i < newModelCount; i++) {
this.modelNumbers[i] = i + this.mc;
this.modelFileNumbers[i] = f * 1000000 + (++pt);
this.modelNumbersForAtomLabel[i] = this.modelNames[i] = f + "." + pt;
}
this.thisStateModel = -1;
var group3Lists = this.getInfoM ("group3Lists");
if (group3Lists != null) {
var group3Counts = this.getInfoM ("group3Counts");
group3Lists = JU.AU.arrayCopyS (group3Lists, newModelCount);
group3Counts = JU.AU.arrayCopyII (group3Counts, newModelCount);
this.msInfo.put ("group3Lists", group3Lists);
this.msInfo.put ("group3Counts", group3Counts);
}this.unitCells = JU.AU.arrayCopyObject (this.unitCells, newModelCount);
for (var i = this.mc; i < newModelCount; i++) {
newModels[i] =  new JM.Model ().set (this, i, -1, null, null, null);
newModels[i].loadState = " model create #" + i + ";";
}
this.am = newModels;
this.mc = newModelCount;
}, "~N");
Clazz_defineMethod (c$, "deleteModel", 
function (modelIndex, firstAtomIndex, nAtoms, bsModelAtoms, bsBonds) {
if (modelIndex < 0) {
this.validateBspf (false);
this.bsAll = null;
this.resetMolecules ();
this.isBbcageDefault = false;
this.calcBoundBoxDimensions (null, 1);
return;
}this.modelNumbers = JU.AU.deleteElements (this.modelNumbers, modelIndex, 1);
this.modelFileNumbers = JU.AU.deleteElements (this.modelFileNumbers, modelIndex, 1);
this.modelNumbersForAtomLabel = JU.AU.deleteElements (this.modelNumbersForAtomLabel, modelIndex, 1);
this.modelNames = JU.AU.deleteElements (this.modelNames, modelIndex, 1);
this.frameTitles = JU.AU.deleteElements (this.frameTitles, modelIndex, 1);
this.thisStateModel = -1;
var group3Lists = this.getInfoM ("group3Lists");
var group3Counts = this.getInfoM ("group3Counts");
var ptm = modelIndex + 1;
if (group3Lists != null && group3Lists[ptm] != null) {
for (var i = Clazz_doubleToInt (group3Lists[ptm].length / 6); --i >= 0; ) if (group3Counts[ptm][i] > 0) {
group3Counts[0][i] -= group3Counts[ptm][i];
if (group3Counts[0][i] == 0) group3Lists[0] = group3Lists[0].substring (0, i * 6) + ",[" + group3Lists[0].substring (i * 6 + 2);
}
}if (group3Lists != null) {
this.msInfo.put ("group3Lists", JU.AU.deleteElements (group3Lists, modelIndex, 1));
this.msInfo.put ("group3Counts", JU.AU.deleteElements (group3Counts, modelIndex, 1));
}if (this.unitCells != null) {
this.unitCells = JU.AU.deleteElements (this.unitCells, modelIndex, 1);
}for (var i = this.stateScripts.size (); --i >= 0; ) {
if (!this.stateScripts.get (i).deleteAtoms (modelIndex, bsBonds, bsModelAtoms)) {
this.stateScripts.remove (i);
}}
this.deleteModelAtoms (firstAtomIndex, nAtoms, bsModelAtoms);
this.vwr.deleteModelAtoms (modelIndex, firstAtomIndex, nAtoms, bsModelAtoms);
}, "~N,~N,~N,JU.BS,JU.BS");
Clazz_defineMethod (c$, "assignAtom", 
function (atomIndex, type, autoBond) {
if (type == null) type = "C";
var atom = this.at[atomIndex];
var bs =  new JU.BS ();
var wasH = (atom.getElementNumber () == 1);
var atomicNumber = JU.Elements.elementNumberFromSymbol (type, true);
var isDelete = false;
if (atomicNumber > 0) {
this.setElement (atom, atomicNumber);
this.vwr.shm.setShapeSizeBs (0, 0, this.vwr.rd, JU.BSUtil.newAndSetBit (atomIndex));
this.setAtomName (atomIndex, type + atom.getAtomNumber ());
if (!this.am[atom.mi].isModelKit) this.taintAtom (atomIndex, 0);
} else if (type.equals ("Pl")) {
atom.setFormalCharge (atom.getFormalCharge () + 1);
} else if (type.equals ("Mi")) {
atom.setFormalCharge (atom.getFormalCharge () - 1);
} else if (type.equals ("X")) {
isDelete = true;
} else if (!type.equals (".")) {
return;
}this.removeUnnecessaryBonds (atom, isDelete);
var dx = 0;
if (atom.getCovalentBondCount () == 1) if (wasH) {
dx = 1.50;
} else if (!wasH && atomicNumber == 1) {
dx = 1.0;
}if (dx != 0) {
var v = JU.V3.newVsub (atom, this.at[atom.getBondedAtomIndex (0)]);
var d = v.length ();
v.normalize ();
v.scale (dx - d);
this.setAtomCoordRelative (atomIndex, v.x, v.y, v.z);
}var bsA = JU.BSUtil.newAndSetBit (atomIndex);
if (atomicNumber != 1 && autoBond) {
this.validateBspf (false);
bs = this.getAtomsWithinRadius (1.0, bsA, false, null);
bs.andNot (bsA);
if (bs.nextSetBit (0) >= 0) this.vwr.deleteAtoms (bs, false);
bs = this.vwr.getModelUndeletedAtomsBitSet (atom.mi);
bs.andNot (this.getAtomBitsMDa (1613758476, null));
this.makeConnections2 (0.1, 1.8, 1, 1073741904, bsA, bs, null, false, false, 0);
}this.vwr.addHydrogens (bsA, false, true);
}, "~N,~S,~B");
Clazz_defineMethod (c$, "deleteAtoms", 
function (bs) {
this.averageAtomPoint = null;
if (bs == null) return;
var bsBonds =  new JU.BS ();
for (var i = bs.nextSetBit (0); i >= 0 && i < this.ac; i = bs.nextSetBit (i + 1)) this.at[i].deleteBonds (bsBonds);

for (var i = 0; i < this.mc; i++) {
this.am[i].bsAtomsDeleted.or (bs);
this.am[i].bsAtomsDeleted.and (this.am[i].bsAtoms);
this.am[i].dssrCache = null;
}
this.deleteBonds (bsBonds, false);
}, "JU.BS");
Clazz_defineMethod (c$, "adjustAtomArrays", 
function (map, i0, ac) {
this.ac = ac;
for (var i = i0; i < ac; i++) {
this.at[i] = this.at[map[i]];
this.at[i].i = i;
var m = this.am[this.at[i].mi];
if (m.firstAtomIndex == map[i]) m.firstAtomIndex = i;
m.bsAtoms.set (i);
}
if (this.vibrations != null) for (var i = i0; i < ac; i++) this.vibrations[i] = this.vibrations[map[i]];

if (this.occupancies != null) for (var i = i0; i < ac; i++) this.occupancies[i] = this.occupancies[map[i]];

if (this.bfactor100s != null) for (var i = i0; i < ac; i++) this.bfactor100s[i] = this.bfactor100s[map[i]];

if (this.partialCharges != null) for (var i = i0; i < ac; i++) this.partialCharges[i] = this.partialCharges[map[i]];

if (this.atomTensorList != null) {
for (var i = i0; i < ac; i++) {
var list = this.atomTensorList[i] = this.atomTensorList[map[i]];
if (list != null) for (var j = list.length; --j >= 0; ) {
var t = list[j];
if (t != null) {
t.atomIndex1 = i;
}}
}
}if (this.atomNames != null) for (var i = i0; i < ac; i++) this.atomNames[i] = this.atomNames[map[i]];

if (this.atomTypes != null) for (var i = i0; i < ac; i++) this.atomTypes[i] = this.atomTypes[map[i]];

if (this.atomSerials != null) for (var i = i0; i < ac; i++) this.atomSerials[i] = this.atomSerials[map[i]];

if (this.atomSeqIDs != null) for (var i = i0; i < ac; i++) this.atomSeqIDs[i] = this.atomSeqIDs[map[i]];

}, "~A,~N,~N");
Clazz_defineMethod (c$, "growAtomArrays", 
function (newLength) {
this.at = JU.AU.arrayCopyObject (this.at, newLength);
if (this.vibrations != null) this.vibrations = JU.AU.arrayCopyObject (this.vibrations, newLength);
if (this.occupancies != null) this.occupancies = JU.AU.arrayCopyF (this.occupancies, newLength);
if (this.bfactor100s != null) this.bfactor100s = JU.AU.arrayCopyShort (this.bfactor100s, newLength);
if (this.partialCharges != null) this.partialCharges = JU.AU.arrayCopyF (this.partialCharges, newLength);
if (this.atomTensorList != null) this.atomTensorList = JU.AU.arrayCopyObject (this.atomTensorList, newLength);
if (this.atomNames != null) this.atomNames = JU.AU.arrayCopyS (this.atomNames, newLength);
if (this.atomTypes != null) this.atomTypes = JU.AU.arrayCopyS (this.atomTypes, newLength);
if (this.atomSerials != null) this.atomSerials = JU.AU.arrayCopyI (this.atomSerials, newLength);
if (this.atomSeqIDs != null) this.atomSeqIDs = JU.AU.arrayCopyI (this.atomSeqIDs, newLength);
}, "~N");
Clazz_defineMethod (c$, "addAtom", 
function (modelIndex, group, atomicAndIsotopeNumber, atomName, atomType, atomSerial, atomSeqID, atomSite, xyz, radius, vib, formalCharge, partialCharge, occupancy, bfactor, tensors, isHetero, specialAtomID, atomSymmetry) {
var atom =  new JM.Atom ().setAtom (modelIndex, this.ac, xyz, radius, atomSymmetry, atomSite, atomicAndIsotopeNumber, formalCharge, isHetero);
this.am[modelIndex].ac++;
this.am[modelIndex].bsAtoms.set (this.ac);
if (JU.Elements.isElement (atomicAndIsotopeNumber, 1)) this.am[modelIndex].hydrogenCount++;
if (this.ac >= this.at.length) this.growAtomArrays (this.ac + 100);
this.at[this.ac] = atom;
this.setBFactor (this.ac, bfactor);
this.setOccupancy (this.ac, occupancy);
this.setPartialCharge (this.ac, partialCharge);
if (tensors != null) this.setAtomTensors (this.ac, tensors);
atom.group = group;
atom.colixAtom = this.vwr.cm.getColixAtomPalette (atom, J.c.PAL.CPK.id);
if (atomName != null) {
if (atomType != null) {
if (this.atomTypes == null) this.atomTypes =  new Array (this.at.length);
this.atomTypes[this.ac] = atomType;
}atom.atomID = specialAtomID;
if (specialAtomID == 0) {
if (this.atomNames == null) this.atomNames =  new Array (this.at.length);
this.atomNames[this.ac] = atomName.intern ();
}}if (atomSerial != -2147483648) {
if (this.atomSerials == null) this.atomSerials =  Clazz_newIntArray (this.at.length, 0);
this.atomSerials[this.ac] = atomSerial;
}if (atomSeqID != 0) {
if (this.atomSeqIDs == null) this.atomSeqIDs =  Clazz_newIntArray (this.at.length, 0);
this.atomSeqIDs[this.ac] = atomSeqID;
}if (vib != null) this.setVibrationVector (this.ac, vib);
this.ac++;
return atom;
}, "~N,JM.Group,~N,~S,~S,~N,~N,~N,JU.P3,~N,JU.V3,~N,~N,~N,~N,JU.Lst,~B,~N,JU.BS");
Clazz_defineMethod (c$, "getInlineData", 
function (modelIndex) {
var data = null;
if (modelIndex >= 0) data = this.am[modelIndex].loadScript;
 else for (modelIndex = this.mc; --modelIndex >= 0; ) if ((data = this.am[modelIndex].loadScript).length () > 0) break;

var pt = data.lastIndexOf ("data \"");
if (pt < 0) return null;
pt = data.indexOf2 ("\"", pt + 7);
var pt2 = data.lastIndexOf ("end \"");
if (pt2 < pt || pt < 0) return null;
return data.substring2 (pt + 2, pt2);
}, "~N");
Clazz_defineMethod (c$, "isAtomPDB", 
function (i) {
return i >= 0 && this.am[this.at[i].mi].isBioModel;
}, "~N");
Clazz_defineMethod (c$, "isAtomAssignable", 
function (i) {
return i >= 0 && this.at[i].mi == this.mc - 1;
}, "~N");
Clazz_defineMethod (c$, "haveModelKit", 
function () {
for (var i = 0; i < this.mc; i++) if (this.am[i].isModelKit) return true;

return false;
});
Clazz_defineMethod (c$, "getModelKitStateBitset", 
function (bs, bsDeleted) {
var bs1 = JU.BSUtil.copy (bsDeleted);
for (var i = 0; i < this.mc; i++) if (!this.am[i].isModelKit) bs1.andNot (this.am[i].bsAtoms);

return JU.BSUtil.deleteBits (bs, bs1);
}, "JU.BS,JU.BS");
Clazz_defineMethod (c$, "setAtomNamesAndNumbers", 
function (iFirst, baseAtomIndex, mergeSet) {
if (baseAtomIndex < 0) iFirst = this.am[this.at[iFirst].mi].firstAtomIndex;
if (this.atomSerials == null) this.atomSerials =  Clazz_newIntArray (this.ac, 0);
if (this.atomNames == null) this.atomNames =  new Array (this.ac);
var isZeroBased = this.isXYZ && this.vwr.getBoolean (603979978);
var lastModelIndex = 2147483647;
var atomNo = 1;
for (var i = iFirst; i < this.ac; ++i) {
var atom = this.at[i];
if (atom.mi != lastModelIndex) {
lastModelIndex = atom.mi;
atomNo = (isZeroBased ? 0 : 1);
}if (i >= -baseAtomIndex) {
if (this.atomSerials[i] == 0 || baseAtomIndex < 0) this.atomSerials[i] = (i < baseAtomIndex ? mergeSet.atomSerials[i] : atomNo);
if (this.atomNames[i] == null || baseAtomIndex < 0) this.atomNames[i] = (atom.getElementSymbol () + this.atomSerials[i]).intern ();
}if (!this.am[lastModelIndex].isModelKit || atom.getElementNumber () > 0 && !atom.isDeleted ()) atomNo++;
}
}, "~N,~N,JM.AtomCollection");
Clazz_defineMethod (c$, "setUnitCellOffset", 
function (unitCell, pt, ijk) {
if (unitCell == null) return;
if (pt == null) unitCell.setOffset (ijk);
 else unitCell.setOffsetPt (pt);
}, "J.api.SymmetryInterface,JU.T3,~N");
Clazz_defineMethod (c$, "connect", 
function (connections) {
this.resetMolecules ();
var bsDelete =  new JU.BS ();
for (var i = 0; i < connections.length; i++) {
var f = connections[i];
if (f == null || f.length < 2) continue;
var index1 = Clazz_floatToInt (f[0]);
var addGroup = (index1 < 0);
if (addGroup) index1 = -1 - index1;
var index2 = Clazz_floatToInt (f[1]);
if (index2 < 0 || index1 >= this.ac || index2 >= this.ac) continue;
var order = (f.length > 2 ? Clazz_floatToInt (f[2]) : 1);
if (order < 0) order &= 0xFFFF;
var mad = (f.length > 3 ? Clazz_floatToShort (1000 * connections[i][3]) : this.getDefaultMadFromOrder (order));
if (order == 0 || mad == 0 && order != 32768 && !JM.Bond.isOrderH (order)) {
var b = this.at[index1].getBond (this.at[index2]);
if (b != null) bsDelete.set (b.index);
continue;
}var energy = (f.length > 4 ? f[4] : 0);
this.bondAtoms (this.at[index1], this.at[index2], order, mad, null, energy, addGroup, true);
}
if (bsDelete.nextSetBit (0) >= 0) this.deleteBonds (bsDelete, false);
}, "~A");
Clazz_defineMethod (c$, "allowSpecAtom", 
function () {
return this.mc != 1 || this.am[0].isBioModel;
});
Clazz_defineMethod (c$, "setFrameDelayMs", 
function (millis, bsModels) {
for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) this.am[this.am[i].trajectoryBaseIndex].frameDelay = millis;

}, "~N,JU.BS");
Clazz_defineMethod (c$, "getFrameDelayMs", 
function (i) {
return (i < this.am.length && i >= 0 ? this.am[this.am[i].trajectoryBaseIndex].frameDelay : 0);
}, "~N");
Clazz_defineMethod (c$, "getModelIndexFromId", 
function (id) {
var haveFile = (id.indexOf ("#") >= 0);
var isBaseModel = id.toLowerCase ().endsWith (".basemodel");
if (isBaseModel) id = id.substring (0, id.length - 10);
var errCode = -1;
var fname = null;
for (var i = 0; i < this.mc; i++) {
var mid = this.getInfo (i, "modelID");
var mnum = (id.startsWith ("~") ? "~" + this.getModelNumberDotted (i) : null);
if (mnum == null && mid == null && (mid = this.getModelTitle (i)) == null) continue;
if (haveFile) {
fname = this.getModelFileName (i);
if (fname.endsWith ("#molfile")) {
mid = fname;
} else {
fname += "#";
mid = fname + mid;
}}if (id.equalsIgnoreCase (mid) || id.equalsIgnoreCase (mnum)) return (isBaseModel ? this.vwr.getJDXBaseModelIndex (i) : i);
if (fname != null && id.startsWith (fname)) errCode = -2;
}
return (fname == null && !haveFile ? -2 : errCode);
}, "~S");
Clazz_defineMethod (c$, "getAuxiliaryInfo", 
function (bsModels) {
var info = this.msInfo;
if (info == null) return null;
var minfo =  new JU.Lst ();
for (var i = 0; i < this.mc; ++i) if (bsModels == null || bsModels.get (i)) minfo.addLast (this.getModelAuxiliaryInfo (i));

info.put ("models", minfo);
return info;
}, "JU.BS");
Clazz_defineMethod (c$, "getDihedralMap", 
function (alist) {
var list =  new JU.Lst ();
var n = alist.length;
var ai = null;
var aj = null;
var ak = null;
var al = null;
for (var i = n - 1; --i >= 0; ) for (var j = n; --j > i; ) {
ai = this.at[alist[i]];
aj = this.at[alist[j]];
if (ai.isBonded (aj)) {
for (var k = n; --k >= 0; ) if (k != i && k != j && (ak = this.at[alist[k]]).isBonded (ai)) for (var l = n; --l >= 0; ) if (l != i && l != j && l != k && (al = this.at[alist[l]]).isBonded (aj)) {
var a =  Clazz_newIntArray (4, 0);
a[0] = ak.i;
a[1] = ai.i;
a[2] = aj.i;
a[3] = al.i;
list.addLast (a);
}

}}

n = list.size ();
var ilist = JU.AU.newInt2 (n);
for (var i = n; --i >= 0; ) ilist[n - i - 1] = list.get (i);

return ilist;
}, "~A");
Clazz_defineMethod (c$, "setModulation", 
function (bs, isOn, qtOffset, isQ) {
if (this.bsModulated == null) {
if (isOn) this.bsModulated =  new JU.BS ();
 else if (bs == null) return;
}if (bs == null) bs = this.getModelAtomBitSetIncludingDeleted (-1, false);
var scale = this.vwr.getFloat (1276121113);
var haveMods = false;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var ms = this.getModulation (i);
if (ms == null) continue;
ms.setModTQ (this.at[i], isOn, qtOffset, isQ, scale);
if (this.bsModulated != null) this.bsModulated.setBitTo (i, isOn);
haveMods = true;
}
if (!haveMods) this.bsModulated = null;
}, "JU.BS,~B,JU.P3,~B");
Clazz_defineMethod (c$, "getBoundBoxOrientation", 
function (type, bsAtoms) {
var j0 = bsAtoms.nextSetBit (0);
if (j0 < 0) return "{0 0 0 1}";
var n = (this.vOrientations == null ? 0 : this.vOrientations.length);
if (n == 0) {
var av =  new Array (3375);
n = 0;
var p4 =  new JU.P4 ();
for (var i = -7; i <= 7; i++) for (var j = -7; j <= 7; j++) for (var k = 0; k <= 14; k++, n++) if ((av[n] = JU.V3.new3 (i / 7, j / 7, k / 14)).length () > 1) --n;



this.vOrientations =  new Array (n);
for (var i = n; --i >= 0; ) {
var cos = Math.sqrt (1 - av[i].lengthSquared ());
if (Float.isNaN (cos)) cos = 0;
p4.set4 (av[i].x, av[i].y, av[i].z, cos);
this.vOrientations[i] = JU.Quat.newP4 (p4);
}
}var pt =  new JU.P3 ();
var vMin = 3.4028235E38;
var q;
var qBest = null;
var bBest = null;
var v;
for (var i = 0; i < n; i++) {
q = this.vOrientations[i];
var b =  new JU.BoxInfo ();
b.setMargin (0);
for (var j = j0; j >= 0; j = bsAtoms.nextSetBit (j + 1)) b.addBoundBoxPoint (q.transform2 (this.at[j], pt));

switch (type) {
default:
case 1313866249:
case 1073741863:
v = (b.bbCorner1.x - b.bbCorner0.x) * (b.bbCorner1.y - b.bbCorner0.y) * (b.bbCorner1.z - b.bbCorner0.z);
break;
case 1112541205:
v = b.bbCorner1.x - b.bbCorner0.x;
break;
case 1112541206:
v = b.bbCorner1.y - b.bbCorner0.y;
break;
case 1112541207:
v = b.bbCorner1.z - b.bbCorner0.z;
break;
}
if (v < vMin) {
qBest = q;
bBest = b;
vMin = v;
}}
if (type != 1313866249 && type != 1073741863) return qBest.toString ();
q = JU.Quat.newQ (qBest);
var dx = bBest.bbCorner1.x - bBest.bbCorner0.x;
var dy = bBest.bbCorner1.y - bBest.bbCorner0.y;
var dz = bBest.bbCorner1.z - bBest.bbCorner0.z;
if (dx < dy) {
pt.set (0, 0, 1);
q = JU.Quat.newVA (pt, 90).mulQ (q);
var f = dx;
dx = dy;
dy = f;
}if (dy < dz) {
if (dz > dx) {
pt.set (0, 1, 0);
q = JU.Quat.newVA (pt, 90).mulQ (q);
var f = dx;
dx = dz;
dz = f;
}pt.set (1, 0, 0);
q = JU.Quat.newVA (pt, 90).mulQ (q);
var f = dy;
dy = dz;
dz = f;
}return (type == 1313866249 ? vMin + "\t{" + dx + " " + dy + " " + dz + "}" : q.getTheta () == 0 ? "{0 0 0 1}" : q.toString ());
}, "~N,JU.BS");
Clazz_defineMethod (c$, "intersectPlane", 
function (plane, v, i) {
return (this.triangulator == null ? (this.triangulator = J.api.Interface.getUtil ("TriangleData", this.vwr, "ms")) : this.triangulator).intersectPlane (plane, v, i);
}, "JU.P4,JU.Lst,~N");
Clazz_defineMethod (c$, "getUnitCellForAtom", 
function (index) {
if (index < 0 || index > this.ac) return null;
if (this.bsModulated != null) {
var ms = this.getModulation (index);
var uc = (ms == null ? null : ms.getSubSystemUnitCell ());
if (uc != null) return uc;
}return this.getUnitCell (this.at[index].mi);
}, "~N");
Clazz_defineMethod (c$, "clearCache", 
function () {
for (var i = this.mc; --i >= 0; ) this.am[i].dssrCache = null;

});
Clazz_defineMethod (c$, "getSymMatrices", 
function (modelIndex) {
var n = this.getModelSymmetryCount (modelIndex);
if (n == 0) return null;
var ops =  new Array (n);
var unitcell = this.am[modelIndex].biosymmetry;
if (unitcell == null) unitcell = this.getUnitCell (modelIndex);
for (var i = n; --i >= 0; ) ops[i] = unitcell.getSpaceGroupOperation (i);

return ops;
}, "~N");
Clazz_defineMethod (c$, "getBsBranches", 
function (dihedralList) {
var n = Clazz_doubleToInt (dihedralList.length / 6);
var bsBranches =  new Array (n);
var map =  new java.util.Hashtable ();
for (var i = 0, pt = 0; i < n; i++, pt += 6) {
var dv = dihedralList[pt + 5] - dihedralList[pt + 4];
if (Math.abs (dv) < 1) continue;
var i0 = Clazz_floatToInt (dihedralList[pt + 1]);
var i1 = Clazz_floatToInt (dihedralList[pt + 2]);
var s = "" + i0 + "_" + i1;
if (map.containsKey (s)) continue;
map.put (s, Boolean.TRUE);
var bs = this.vwr.getBranchBitSet (i1, i0, true);
var bonds = this.at[i0].bonds;
var a0 = this.at[i0];
for (var j = 0; j < bonds.length; j++) {
var b = bonds[j];
if (!b.isCovalent ()) continue;
var i2 = b.getOtherAtom (a0).i;
if (i2 == i1) continue;
if (bs.get (i2)) {
bs = null;
break;
}}
bsBranches[i] = bs;
}
return bsBranches;
}, "~A");
Clazz_defineMethod (c$, "recalculatePositionDependentQuantities", 
function (bs, mat) {
if (this.haveStraightness) this.calculateStraightness ();
this.recalculateLeadMidpointsAndWingVectors (-1);
var bsModels = this.getModelBS (bs, false);
for (var i = bsModels.nextSetBit (0); i >= 0; i = bsModels.nextSetBit (i + 1)) this.sm.refreshShapeTrajectories (i, bs, mat);

this.averageAtomPoint = null;
}, "JU.BS,JU.M4");
Clazz_defineMethod (c$, "moveAtoms", 
function (m4, mNew, rotation, translation, bs, center, isInternal, translationOnly) {
if (m4 != null) {
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) m4.rotTrans (this.at[i]);

this.mat4.setM4 (m4);
translation = null;
} else if (!translationOnly) {
if (mNew == null) {
this.matTemp.setM3 (rotation);
} else {
this.ptTemp.set (0, 0, 0);
this.matInv.setM3 (rotation);
this.matInv.invert ();
this.matTemp.mul2 (mNew, rotation);
this.matTemp.mul2 (this.matInv, this.matTemp);
}if (isInternal) {
this.vTemp.setT (center);
this.mat4.setIdentity ();
this.mat4.setTranslation (this.vTemp);
this.mat4t.setToM3 (this.matTemp);
this.mat4.mul (this.mat4t);
this.mat4t.setIdentity ();
this.vTemp.scale (-1);
this.mat4t.setTranslation (this.vTemp);
this.mat4.mul (this.mat4t);
} else {
this.mat4.setToM3 (this.matTemp);
}for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
if (isInternal) {
this.mat4.rotTrans (this.at[i]);
} else {
this.ptTemp.add (this.at[i]);
this.mat4.rotTrans (this.at[i]);
this.ptTemp.sub (this.at[i]);
}this.taintAtom (i, 2);
}
if (!isInternal) {
this.ptTemp.scale (1 / bs.cardinality ());
if (translation == null) translation =  new JU.V3 ();
translation.add (this.ptTemp);
}}if (translation != null) {
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) this.at[i].add (translation);

if (!translationOnly) {
this.mat4t.setIdentity ();
this.mat4t.setTranslation (translation);
this.mat4.mul2 (this.mat4t, this.mat4);
}}this.recalculatePositionDependentQuantities (bs, this.mat4);
}, "JU.M4,JU.M3,JU.M3,JU.V3,JU.BS,JU.P3,~B,~B");
Clazz_defineMethod (c$, "setDihedrals", 
function (dihedralList, bsBranches, f) {
var n = Clazz_doubleToInt (dihedralList.length / 6);
if (f > 1) f = 1;
for (var j = 0, pt = 0; j < n; j++, pt += 6) {
var bs = bsBranches[j];
if (bs == null || bs.isEmpty ()) continue;
var a1 = this.at[Clazz_floatToInt (dihedralList[pt + 1])];
var v = JU.V3.newVsub (this.at[Clazz_floatToInt (dihedralList[pt + 2])], a1);
var angle = (dihedralList[pt + 5] - dihedralList[pt + 4]) * f;
var aa = JU.A4.newVA (v, (-angle / 57.29577951308232));
this.matTemp.setAA (aa);
this.ptTemp.setT (a1);
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
this.at[i].sub (this.ptTemp);
this.matTemp.rotate (this.at[i]);
this.at[i].add (this.ptTemp);
this.taintAtom (i, 2);
}
}
}, "~A,~A,~N");
Clazz_defineMethod (c$, "setAtomCoordsRelative", 
function (offset, bs) {
this.setAtomsCoordRelative (bs, offset.x, offset.y, offset.z);
this.mat4.setIdentity ();
this.vTemp.setT (offset);
this.mat4.setTranslation (this.vTemp);
this.recalculatePositionDependentQuantities (bs, this.mat4);
}, "JU.T3,JU.BS");
Clazz_defineMethod (c$, "setAtomCoords", 
function (bs, tokType, xyzValues) {
this.setAtomCoord2 (bs, tokType, xyzValues);
switch (tokType) {
case 1112541202:
case 1112541203:
case 1112541204:
case 1146095631:
break;
default:
this.recalculatePositionDependentQuantities (bs, null);
}
}, "JU.BS,~N,~O");
Clazz_defineMethod (c$, "invertSelected", 
function (pt, plane, iAtom, invAtoms, bs) {
if (pt != null) {
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var x = (pt.x - this.at[i].x) * 2;
var y = (pt.y - this.at[i].y) * 2;
var z = (pt.z - this.at[i].z) * 2;
this.setAtomCoordRelative (i, x, y, z);
}
return;
}if (plane != null) {
var norm = JU.V3.new3 (plane.x, plane.y, plane.z);
norm.normalize ();
var d = Math.sqrt (plane.x * plane.x + plane.y * plane.y + plane.z * plane.z);
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var twoD = -JU.Measure.distanceToPlaneD (plane, d, this.at[i]) * 2;
var x = norm.x * twoD;
var y = norm.y * twoD;
var z = norm.z * twoD;
this.setAtomCoordRelative (i, x, y, z);
}
return;
}if (iAtom >= 0) {
var thisAtom = this.at[iAtom];
var bonds = thisAtom.bonds;
if (bonds == null) return;
var bsAtoms =  new JU.BS ();
var vNot =  new JU.Lst ();
var bsModel = this.vwr.getModelUndeletedAtomsBitSet (thisAtom.mi);
for (var i = 0; i < bonds.length; i++) {
var a = bonds[i].getOtherAtom (thisAtom);
if (invAtoms.get (a.i)) {
bsAtoms.or (JU.JmolMolecule.getBranchBitSet (this.at, a.i, bsModel, null, iAtom, true, true));
} else {
vNot.addLast (a);
}}
if (vNot.size () == 0) return;
pt = JU.Measure.getCenterAndPoints (vNot)[0];
var v = JU.V3.newVsub (thisAtom, pt);
var q = JU.Quat.newVA (v, 180);
this.moveAtoms (null, null, q.getMatrix (), null, bsAtoms, thisAtom, true, false);
}}, "JU.P3,JU.P4,~N,JU.BS,JU.BS");
Clazz_defineMethod (c$, "getCellWeights", 
function (bsAtoms) {
var wts = null;
var i = bsAtoms.nextSetBit (0);
var iModel = -1;
if (i >= 0 && this.getUnitCell (iModel = this.at[i].mi) != null) {
var pt =  new JU.P3 ();
var bs = this.getModelAtomBitSetIncludingDeleted (iModel, true);
bs.and (bsAtoms);
wts =  Clazz_newFloatArray (bsAtoms.cardinality (), 0);
for (var p = 0; i >= 0; i = bsAtoms.nextSetBit (i + 1)) wts[p++] = JU.SimpleUnitCell.getCellWeight (this.at[i].getFractionalUnitCoordPt (true, false, pt));

}return wts;
}, "JU.BS");
Clazz_defineMethod (c$, "getAtomGroupQuaternions", 
function (bsAtoms, nMax, qtype) {
var n = 0;
var v =  new JU.Lst ();
for (var i = bsAtoms.nextSetBit (0); i >= 0 && n < nMax; i = bsAtoms.nextSetBit (i + 1)) {
var g = this.at[i].group;
var q = g.getQuaternion (qtype);
if (q == null) {
if (g.seqcode == -2147483648) q = g.getQuaternionFrame (this.at);
if (q == null) continue;
}n++;
v.addLast (q);
i = g.lastAtomIndex;
}
return v.toArray ( new Array (v.size ()));
}, "JU.BS,~N,~S");
Clazz_defineMethod (c$, "getSequenceBits", 
function (specInfo, bs) {
return (this.haveBioModels && specInfo.length > 0 ? this.bioModel.getSequenceBits (this, specInfo, bs) :  new JU.BS ());
}, "~S,JU.BS");
Clazz_defineMethod (c$, "calculatePolymers", 
function (groups, groupCount, baseGroupIndex, modelsExcluded) {
if (this.haveBioModels) this.bioModel.calculateAllPolymers (this, groups, groupCount, baseGroupIndex, modelsExcluded);
}, "~A,~N,~N,JU.BS");
Clazz_defineMethod (c$, "getBioPolymerCountInModel", 
function (modelIndex) {
return (this.haveBioModels ? this.bioModel.getBioPolymerCountInModel (this, modelIndex) : 0);
}, "~N");
Clazz_defineMethod (c$, "getPolymerPointsAndVectors", 
function (bs, vList, isTraceAlpha, sheetSmoothing) {
if (this.haveBioModels) for (var i = 0; i < this.mc; ++i) this.am[i].getPolymerPointsAndVectors (bs, vList, isTraceAlpha, sheetSmoothing);

}, "JU.BS,JU.Lst,~B,~N");
Clazz_defineMethod (c$, "recalculateLeadMidpointsAndWingVectors", 
function (modelIndex) {
if (this.haveBioModels) this.bioModel.recalculatePoints (this, modelIndex);
}, "~N");
Clazz_defineMethod (c$, "calcRasmolHydrogenBonds", 
function (bsA, bsB, vHBonds, nucleicOnly, nMax, dsspIgnoreHydrogens, bsHBonds) {
if (this.haveBioModels) this.bioModel.calcRasmolHydrogenBonds (this, bsA, bsB, vHBonds, nucleicOnly, nMax, dsspIgnoreHydrogens, bsHBonds);
}, "JU.BS,JU.BS,JU.Lst,~B,~N,~B,JU.BS");
Clazz_defineMethod (c$, "calculateStraightness", 
function () {
if (this.haveBioModels && !this.haveStraightness) this.bioModel.calculateStraightnessAll (this);
});
Clazz_defineMethod (c$, "calculateStruts", 
function (bs1, bs2) {
return (this.haveBioModels ? this.bioModel.calculateStruts (this, bs1, bs2) : 0);
}, "JU.BS,JU.BS");
Clazz_defineMethod (c$, "getGroupsWithin", 
function (nResidues, bs) {
return (this.haveBioModels ? this.bioModel.getGroupsWithinAll (this, nResidues, bs) :  new JU.BS ());
}, "~N,JU.BS");
Clazz_defineMethod (c$, "getProteinStructureState", 
function (bsAtoms, taintedOnly, needPhiPsi, mode) {
return (this.haveBioModels ? this.bioModel.getFullProteinStructureState (this, bsAtoms, taintedOnly, needPhiPsi, mode) : "");
}, "JU.BS,~B,~B,~N");
Clazz_defineMethod (c$, "calculateStructures", 
function (bsAtoms, asDSSP, doReport, dsspIgnoreHydrogen, setStructure) {
if (!this.haveBioModels) return "";
var bsAllAtoms =  new JU.BS ();
var bsModelsExcluded = JU.BSUtil.copyInvert (this.modelsOf (bsAtoms, bsAllAtoms), this.mc);
if (!setStructure) return this.calculateStructuresAllExcept (bsModelsExcluded, asDSSP, doReport, dsspIgnoreHydrogen, false, false);
for (var i = 0; i < this.mc; i++) if (!bsModelsExcluded.get (i)) this.am[i].clearBioPolymers ();

this.calculatePolymers (null, 0, 0, bsModelsExcluded);
var ret = this.calculateStructuresAllExcept (bsModelsExcluded, asDSSP, doReport, dsspIgnoreHydrogen, true, false);
this.vwr.shm.resetBioshapes (bsAllAtoms);
this.setStructureIndexes ();
return ret;
}, "JU.BS,~B,~B,~B,~B");
Clazz_defineStatics (c$,
"hbondMin", 2.5);
});
Clazz_declarePackage ("JM");
Clazz_load (["JU.M3", "$.P3"], "JM.Orientation", ["JU.PT", "JU.Escape"], function () {
c$ = Clazz_decorateAsClass (function () {
this.saveName = null;
this.rotationMatrix = null;
this.xTrans = 0;
this.yTrans = 0;
this.zoom = 0;
this.rotationRadius = 0;
this.center = null;
this.navCenter = null;
this.xNav = NaN;
this.yNav = NaN;
this.navDepth = NaN;
this.cameraDepth = NaN;
this.cameraX = NaN;
this.cameraY = NaN;
this.windowCenteredFlag = false;
this.navigationMode = false;
this.moveToText = null;
this.pymolView = null;
this.vwr = null;
Clazz_instantialize (this, arguments);
}, JM, "Orientation");
Clazz_prepareFields (c$, function () {
this.rotationMatrix =  new JU.M3 ();
this.center =  new JU.P3 ();
this.navCenter =  new JU.P3 ();
});
Clazz_makeConstructor (c$, 
function (vwr, asDefault, pymolView) {
this.vwr = vwr;
if (pymolView != null) {
this.pymolView = pymolView;
this.moveToText = "moveTo -1.0 PyMOL " + JU.Escape.eAF (pymolView);
return;
}vwr.finalizeTransformParameters ();
if (asDefault) {
var rot = vwr.ms.getInfoM ("defaultOrientationMatrix");
if (rot == null) this.rotationMatrix.setScale (1);
 else this.rotationMatrix.setM3 (rot);
} else {
vwr.tm.getRotation (this.rotationMatrix);
}this.xTrans = vwr.tm.getTranslationXPercent ();
this.yTrans = vwr.tm.getTranslationYPercent ();
this.zoom = vwr.tm.getZoomSetting ();
this.center.setT (vwr.tm.fixedRotationCenter);
this.windowCenteredFlag = vwr.tm.isWindowCentered ();
this.rotationRadius = vwr.getFloat (570425388);
this.navigationMode = vwr.getBoolean (603979887);
this.moveToText = vwr.tm.getMoveToText (-1, false);
if (this.navigationMode) {
this.xNav = vwr.tm.getNavigationOffsetPercent ('X');
this.yNav = vwr.tm.getNavigationOffsetPercent ('Y');
this.navDepth = vwr.tm.navigationDepthPercent;
this.navCenter = JU.P3.newP (vwr.tm.navigationCenter);
}if (vwr.tm.camera.z != 0) {
this.cameraDepth = vwr.tm.getCameraDepth ();
this.cameraX = vwr.tm.camera.x;
this.cameraY = vwr.tm.camera.y;
}}, "JV.Viewer,~B,~A");
Clazz_defineMethod (c$, "getMoveToText", 
function (asCommand) {
return (asCommand ? "   " + this.moveToText + "\n  save orientation " + JU.PT.esc (this.saveName.substring (12)) + ";\n" : this.moveToText);
}, "~B");
Clazz_defineMethod (c$, "restore", 
function (timeSeconds, isAll) {
if (isAll) {
this.vwr.setBooleanProperty ("windowCentered", this.windowCenteredFlag);
this.vwr.setBooleanProperty ("navigationMode", this.navigationMode);
if (this.pymolView == null) this.vwr.moveTo (this.vwr.eval, timeSeconds, this.center, null, NaN, this.rotationMatrix, this.zoom, this.xTrans, this.yTrans, this.rotationRadius, this.navCenter, this.xNav, this.yNav, this.navDepth, this.cameraDepth, this.cameraX, this.cameraY);
 else this.vwr.tm.moveToPyMOL (this.vwr.eval, timeSeconds, this.pymolView);
} else {
this.vwr.tm.setRotation (this.rotationMatrix);
}return true;
}, "~N,~B");
});
Clazz_declarePackage ("JM");
Clazz_load (null, "JM.StateScript", ["JU.SB", "JU.BSUtil", "$.Escape"], function () {
c$ = Clazz_decorateAsClass (function () {
this.modelIndex = 0;
this.bsBonds = null;
this.bsAtoms1 = null;
this.bsAtoms2 = null;
this.script1 = null;
this.script2 = null;
this.inDefinedStateBlock = false;
Clazz_instantialize (this, arguments);
}, JM, "StateScript");
Clazz_makeConstructor (c$, 
function (modelIndex, script1, bsBonds, bsAtoms1, bsAtoms2, script2, inDefinedStateBlock) {
this.modelIndex = modelIndex;
this.script1 = script1;
this.bsBonds = JU.BSUtil.copy (bsBonds);
this.bsAtoms1 = JU.BSUtil.copy (bsAtoms1);
this.bsAtoms2 = JU.BSUtil.copy (bsAtoms2);
this.script2 = script2;
this.inDefinedStateBlock = inDefinedStateBlock;
}, "~N,~S,JU.BS,JU.BS,JU.BS,~S,~B");
Clazz_defineMethod (c$, "isValid", 
function () {
return this.script1 != null && this.script1.length > 0 && (this.bsBonds == null || this.bsBonds.nextSetBit (0) >= 0) && (this.bsAtoms1 == null || this.bsAtoms1.nextSetBit (0) >= 0) && (this.bsAtoms2 == null || this.bsAtoms2.nextSetBit (0) >= 0);
});
Clazz_overrideMethod (c$, "toString", 
function () {
if (!this.isValid ()) return "";
var sb = JU.SB.newS (this.script1);
if (this.bsBonds != null) sb.append (" ").append (JU.Escape.eBond (this.bsBonds));
if (this.bsAtoms1 != null) sb.append (" ").append (JU.Escape.eBS (this.bsAtoms1));
if (this.bsAtoms2 != null) sb.append (" ").append (JU.Escape.eBS (this.bsAtoms2));
if (this.script2 != null) sb.append (" ").append (this.script2);
var s = sb.toString ();
if (!s.endsWith (";")) s += ";";
return s;
});
Clazz_defineMethod (c$, "isConnect", 
function () {
return (this.script1.indexOf ("connect") >= 0);
});
Clazz_defineMethod (c$, "deleteAtoms", 
function (modelIndex, bsBonds, bsAtoms) {
if (modelIndex == this.modelIndex) return false;
if (modelIndex > this.modelIndex) {
return true;
}JU.BSUtil.deleteBits (this.bsBonds, bsBonds);
JU.BSUtil.deleteBits (this.bsAtoms1, bsAtoms);
JU.BSUtil.deleteBits (this.bsAtoms2, bsAtoms);
return this.isValid ();
}, "~N,JU.BS,JU.BS");
Clazz_defineMethod (c$, "setModelIndex", 
function (index) {
this.modelIndex = index;
}, "~N");
});
Clazz_declarePackage ("JM");
c$ = Clazz_decorateAsClass (function () {
this.id = "";
this.type = " ";
this.ticks = null;
this.tickLabelFormats = null;
this.scale = null;
this.first = 0;
this.signFactor = 1;
this.reference = null;
Clazz_instantialize (this, arguments);
}, JM, "TickInfo");
Clazz_makeConstructor (c$, 
function (ticks) {
this.ticks = ticks;
}, "JU.P3");
Clazz_declarePackage ("JU");
Clazz_load (["JU.P3", "$.P3i", "$.V3"], "JU.BoxInfo", ["JU.Lst", "$.Measure", "$.P4", "JU.Point3fi"], function () {
c$ = Clazz_decorateAsClass (function () {
this.bbCorner0 = null;
this.bbCorner1 = null;
this.bbCenter = null;
this.bbVector = null;
this.bbVertices = null;
this.isScaleSet = false;
this.margin = 0;
Clazz_instantialize (this, arguments);
}, JU, "BoxInfo");
Clazz_prepareFields (c$, function () {
this.bbCorner0 =  new JU.P3 ();
this.bbCorner1 =  new JU.P3 ();
this.bbCenter =  new JU.P3 ();
this.bbVector =  new JU.V3 ();
this.bbVertices =  new Array (8);
{
for (var i = 8; --i >= 0; ) this.bbVertices[i] =  new JU.Point3fi ();

}{
for (var i = 0; i < 8; i++) {
JU.BoxInfo.unitBboxPoints[i] = JU.P3.new3 (-1, -1, -1);
JU.BoxInfo.unitBboxPoints[i].scaleAdd2 (2, JU.BoxInfo.unitCubePoints[i], JU.BoxInfo.unitBboxPoints[i]);
}
}});
Clazz_makeConstructor (c$, 
function () {
this.reset ();
});
Clazz_defineMethod (c$, "intersectPlane", 
function (modelSet, plane, scale, flags) {
var v =  new JU.Lst ();
v.addLast (this.getCanonicalCopy (scale));
return modelSet.intersectPlane (plane, v, flags);
}, "JM.ModelSet,JU.P4,~N,~N");
Clazz_defineMethod (c$, "getCanonicalCopy", 
function (scale) {
return JU.BoxInfo.getCanonicalCopy (this.bbVertices, scale);
}, "~N");
c$.getCanonicalCopy = Clazz_defineMethod (c$, "getCanonicalCopy", 
function (bbUcPoints, scale) {
var pts =  new Array (8);
for (var i = 0; i < 8; i++) pts[JU.BoxInfo.toCanonical[i]] = JU.P3.newP (bbUcPoints[i]);

JU.BoxInfo.scaleBox (pts, scale);
return pts;
}, "~A,~N");
c$.scaleBox = Clazz_defineMethod (c$, "scaleBox", 
function (pts, scale) {
if (scale == 0 || scale == 1) return;
var center =  new JU.P3 ();
var v =  new JU.V3 ();
for (var i = 0; i < 8; i++) center.add (pts[i]);

center.scale (0.125);
for (var i = 0; i < 8; i++) {
v.sub2 (pts[i], center);
v.scale (scale);
pts[i].add2 (center, v);
}
}, "~A,~N");
c$.getFacesFromCriticalPoints = Clazz_defineMethod (c$, "getFacesFromCriticalPoints", 
function (points) {
var faces =  new Array (6);
var vNorm =  new JU.V3 ();
var vAB =  new JU.V3 ();
var va =  new JU.P3 ();
var vb =  new JU.P3 ();
var vc =  new JU.P3 ();
var vertices =  new Array (8);
for (var i = 0; i < 8; i++) {
vertices[i] = JU.P3.newP (points[0]);
if ((i & 1) == 1) vertices[i].add (points[1]);
if ((i & 2) == 2) vertices[i].add (points[2]);
if ((i & 4) == 4) vertices[i].add (points[3]);
}
for (var i = 0; i < 6; i++) {
va.setT (vertices[JU.BoxInfo.facePoints[i].x]);
vb.setT (vertices[JU.BoxInfo.facePoints[i].y]);
vc.setT (vertices[JU.BoxInfo.facePoints[i].z]);
faces[i] = JU.Measure.getPlaneThroughPoints (va, vb, vc, vNorm, vAB,  new JU.P4 ());
}
return faces;
}, "~A");
c$.getCriticalPoints = Clazz_defineMethod (c$, "getCriticalPoints", 
function (bbVertices, offset) {
var center = JU.P3.newP (bbVertices[0]);
var a = JU.P3.newP (bbVertices[1]);
var b = JU.P3.newP (bbVertices[2]);
var c = JU.P3.newP (bbVertices[4]);
a.sub (center);
b.sub (center);
c.sub (center);
if (offset != null) center.add (offset);
return [center, a, b, c];
}, "~A,JU.T3");
Clazz_defineMethod (c$, "getBoundBoxCenter", 
function () {
if (!this.isScaleSet) this.setBbcage (1);
return this.bbCenter;
});
Clazz_defineMethod (c$, "getBoundBoxCornerVector", 
function () {
if (!this.isScaleSet) this.setBbcage (1);
return this.bbVector;
});
Clazz_defineMethod (c$, "getBoundBoxPoints", 
function (isAll) {
if (!this.isScaleSet) this.setBbcage (1);
return (isAll ? [this.bbCenter, JU.P3.newP (this.bbVector), this.bbCorner0, this.bbCorner1] : [this.bbCorner0, this.bbCorner1]);
}, "~B");
Clazz_defineMethod (c$, "getBoundBoxVertices", 
function () {
if (!this.isScaleSet) this.setBbcage (1);
return this.bbVertices;
});
Clazz_defineMethod (c$, "setBoundBox", 
function (pt1, pt2, byCorner, scale) {
if (pt1 != null) {
if (scale == 0) return;
if (byCorner) {
if (pt1.distance (pt2) == 0) return;
this.bbCorner0.set (Math.min (pt1.x, pt2.x), Math.min (pt1.y, pt2.y), Math.min (pt1.z, pt2.z));
this.bbCorner1.set (Math.max (pt1.x, pt2.x), Math.max (pt1.y, pt2.y), Math.max (pt1.z, pt2.z));
} else {
if (pt2.x == 0 || pt2.y == 0 && pt2.z == 0) return;
this.bbCorner0.set (pt1.x - pt2.x, pt1.y - pt2.y, pt1.z - pt2.z);
this.bbCorner1.set (pt1.x + pt2.x, pt1.y + pt2.y, pt1.z + pt2.z);
}}this.setBbcage (scale);
}, "JU.P3,JU.P3,~B,~N");
Clazz_defineMethod (c$, "reset", 
function () {
this.isScaleSet = false;
this.bbCorner0.set (3.4028235E38, 3.4028235E38, 3.4028235E38);
this.bbCorner1.set (-3.4028235E38, -3.4028235E38, -3.4028235E38);
});
Clazz_defineMethod (c$, "setMargin", 
function (m) {
this.margin = m;
}, "~N");
Clazz_defineMethod (c$, "addBoundBoxPoint", 
function (pt) {
this.isScaleSet = false;
JU.BoxInfo.addPoint (pt, this.bbCorner0, this.bbCorner1, this.margin);
}, "JU.T3");
c$.addPoint = Clazz_defineMethod (c$, "addPoint", 
function (pt, xyzMin, xyzMax, margin) {
if (pt.x - margin < xyzMin.x) xyzMin.x = pt.x - margin;
if (pt.x + margin > xyzMax.x) xyzMax.x = pt.x + margin;
if (pt.y - margin < xyzMin.y) xyzMin.y = pt.y - margin;
if (pt.y + margin > xyzMax.y) xyzMax.y = pt.y + margin;
if (pt.z - margin < xyzMin.z) xyzMin.z = pt.z - margin;
if (pt.z + margin > xyzMax.z) xyzMax.z = pt.z + margin;
}, "JU.T3,JU.T3,JU.T3,~N");
c$.addPointXYZ = Clazz_defineMethod (c$, "addPointXYZ", 
function (x, y, z, xyzMin, xyzMax, margin) {
if (x - margin < xyzMin.x) xyzMin.x = x - margin;
if (x + margin > xyzMax.x) xyzMax.x = x + margin;
if (y - margin < xyzMin.y) xyzMin.y = y - margin;
if (y + margin > xyzMax.y) xyzMax.y = y + margin;
if (z - margin < xyzMin.z) xyzMin.z = z - margin;
if (z + margin > xyzMax.z) xyzMax.z = z + margin;
}, "~N,~N,~N,JU.P3,JU.P3,~N");
Clazz_defineMethod (c$, "setBbcage", 
function (scale) {
this.isScaleSet = true;
this.bbCenter.add2 (this.bbCorner0, this.bbCorner1);
this.bbCenter.scale (0.5);
this.bbVector.sub2 (this.bbCorner1, this.bbCenter);
if (scale > 0) {
this.bbVector.scale (scale);
} else {
this.bbVector.x -= scale / 2;
this.bbVector.y -= scale / 2;
this.bbVector.z -= scale / 2;
}for (var i = 8; --i >= 0; ) {
var pt = this.bbVertices[i];
pt.setT (JU.BoxInfo.unitBboxPoints[i]);
pt.x *= this.bbVector.x;
pt.y *= this.bbVector.y;
pt.z *= this.bbVector.z;
pt.add (this.bbCenter);
}
this.bbCorner0.setT (this.bbVertices[0]);
this.bbCorner1.setT (this.bbVertices[7]);
}, "~N");
Clazz_defineMethod (c$, "isWithin", 
function (pt) {
if (!this.isScaleSet) this.setBbcage (1);
return (pt.x >= this.bbCorner0.x && pt.x <= this.bbCorner1.x && pt.y >= this.bbCorner0.y && pt.y <= this.bbCorner1.y && pt.z >= this.bbCorner0.z && pt.z <= this.bbCorner1.z);
}, "JU.P3");
Clazz_defineStatics (c$,
"bbcageTickEdges", ['z', '\0', '\0', 'y', 'x', '\0', '\0', '\0', '\0', '\0', '\0', '\0'],
"uccageTickEdges", ['z', 'y', 'x', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'],
"edges", [0, 1, 0, 2, 0, 4, 1, 3, 1, 5, 2, 3, 2, 6, 3, 7, 4, 5, 4, 6, 5, 7, 6, 7]);
c$.unitCubePoints = c$.prototype.unitCubePoints = [JU.P3.new3 (0, 0, 0), JU.P3.new3 (0, 0, 1), JU.P3.new3 (0, 1, 0), JU.P3.new3 (0, 1, 1), JU.P3.new3 (1, 0, 0), JU.P3.new3 (1, 0, 1), JU.P3.new3 (1, 1, 0), JU.P3.new3 (1, 1, 1)];
c$.facePoints = c$.prototype.facePoints = [JU.P3i.new3 (4, 0, 6), JU.P3i.new3 (4, 6, 5), JU.P3i.new3 (5, 7, 1), JU.P3i.new3 (1, 3, 0), JU.P3i.new3 (6, 2, 7), JU.P3i.new3 (1, 0, 5)];
Clazz_defineStatics (c$,
"toCanonical", [0, 3, 4, 7, 1, 2, 5, 6]);
c$.cubeVertexOffsets = c$.prototype.cubeVertexOffsets = [JU.P3i.new3 (0, 0, 0), JU.P3i.new3 (1, 0, 0), JU.P3i.new3 (1, 0, 1), JU.P3i.new3 (0, 0, 1), JU.P3i.new3 (0, 1, 0), JU.P3i.new3 (1, 1, 0), JU.P3i.new3 (1, 1, 1), JU.P3i.new3 (0, 1, 1)];
c$.unitBboxPoints = c$.prototype.unitBboxPoints =  new Array (8);
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.BS"], "JU.BSUtil", null, function () {
c$ = Clazz_declareType (JU, "BSUtil");
c$.newAndSetBit = Clazz_defineMethod (c$, "newAndSetBit", 
function (i) {
var bs = JU.BS.newN (i + 1);
bs.set (i);
return bs;
}, "~N");
c$.areEqual = Clazz_defineMethod (c$, "areEqual", 
function (a, b) {
return (a == null || b == null ? a == null && b == null : a.equals (b));
}, "JU.BS,JU.BS");
c$.haveCommon = Clazz_defineMethod (c$, "haveCommon", 
function (a, b) {
return (a == null || b == null ? false : a.intersects (b));
}, "JU.BS,JU.BS");
c$.cardinalityOf = Clazz_defineMethod (c$, "cardinalityOf", 
function (bs) {
return (bs == null ? 0 : bs.cardinality ());
}, "JU.BS");
c$.newBitSet2 = Clazz_defineMethod (c$, "newBitSet2", 
function (i0, i1) {
var bs = JU.BS.newN (i1);
bs.setBits (i0, i1);
return bs;
}, "~N,~N");
c$.setAll = Clazz_defineMethod (c$, "setAll", 
function (n) {
var bs = JU.BS.newN (n);
bs.setBits (0, n);
return bs;
}, "~N");
c$.andNot = Clazz_defineMethod (c$, "andNot", 
function (a, b) {
if (b != null && a != null) a.andNot (b);
return a;
}, "JU.BS,JU.BS");
c$.copy = Clazz_defineMethod (c$, "copy", 
function (bs) {
return bs == null ? null : bs.clone ();
}, "JU.BS");
c$.copy2 = Clazz_defineMethod (c$, "copy2", 
function (a, b) {
if (a == null || b == null) return null;
b.clearAll ();
b.or (a);
return b;
}, "JU.BS,JU.BS");
c$.copyInvert = Clazz_defineMethod (c$, "copyInvert", 
function (bs, n) {
return (bs == null ? null : JU.BSUtil.andNot (JU.BSUtil.setAll (n), bs));
}, "JU.BS,~N");
c$.invertInPlace = Clazz_defineMethod (c$, "invertInPlace", 
function (bs, n) {
return JU.BSUtil.copy2 (JU.BSUtil.copyInvert (bs, n), bs);
}, "JU.BS,~N");
c$.toggleInPlace = Clazz_defineMethod (c$, "toggleInPlace", 
function (a, b) {
if (a.equals (b)) {
a.clearAll ();
} else if (JU.BSUtil.andNot (JU.BSUtil.copy (b), a).length () == 0) {
JU.BSUtil.andNot (a, b);
} else {
a.or (b);
}return a;
}, "JU.BS,JU.BS");
c$.deleteBits = Clazz_defineMethod (c$, "deleteBits", 
function (bs, bsDelete) {
if (bs == null || bsDelete == null) return bs;
var ipt = bsDelete.nextSetBit (0);
if (ipt < 0) return bs;
var len = bs.length ();
var lend = Math.min (len, bsDelete.length ());
var i;
for (i = bsDelete.nextClearBit (ipt); i < lend && i >= 0; i = bsDelete.nextClearBit (i + 1)) bs.setBitTo (ipt++, bs.get (i));

for (i = lend; i < len; i++) bs.setBitTo (ipt++, bs.get (i));

if (ipt < len) bs.clearBits (ipt, len);
return bs;
}, "JU.BS,JU.BS");
c$.shiftBits = Clazz_defineMethod (c$, "shiftBits", 
function (bs, bsAdded, setIfFound, iLast) {
if (bs == null || bsAdded == null) return;
var n = bsAdded.length ();
var bsNew = JU.BS.newN (n);
var isFound = false;
var doSet = false;
var checkFound = setIfFound;
for (var j = 0, i = 0; j < n && i < iLast; j++) {
if (bsAdded.get (j)) {
if (doSet) bsNew.set (j);
checkFound = setIfFound;
isFound = false;
} else if (bs.get (i++)) {
bsNew.set (j);
if (checkFound) {
checkFound = false;
isFound = true;
doSet = true;
}} else if (checkFound && !isFound) {
doSet = false;
}}
bs.clearAll ();
bs.or (bsNew);
}, "JU.BS,JU.BS,~B,~N");
c$.offset = Clazz_defineMethod (c$, "offset", 
function (bs0, pos, offset) {
if (bs0 == null) return;
var bsTemp = JU.BS.newN (bs0.length () + offset);
for (var i = bs0.nextSetBit (0); i >= pos; i = bs0.nextSetBit (i + 1)) bsTemp.set (i + offset);

JU.BSUtil.copy2 (bsTemp, bs0);
}, "JU.BS,~N,~N");
c$.setMapBitSet = Clazz_defineMethod (c$, "setMapBitSet", 
function (ht, i1, i2, key) {
var bs;
if (ht.containsKey (key)) bs = ht.get (key);
 else ht.put (key, bs =  new JU.BS ());
bs.setBits (i1, i2 + 1);
}, "java.util.Map,~N,~N,~S");
c$.emptySet = c$.prototype.emptySet =  new JU.BS ();
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.Int2IntHash"], "JU.C", ["java.lang.Byte", "$.Float", "JU.AU", "$.CU", "$.PT", "$.SB", "J.c.PAL", "JU.Escape", "$.Logger"], function () {
c$ = Clazz_declareType (JU, "C");
Clazz_makeConstructor (c$, 
function () {
});
c$.getColix = Clazz_defineMethod (c$, "getColix", 
function (argb) {
if (argb == 0) return 0;
var translucentFlag = 0;
if ((argb & 0xFF000000) != (-16777216)) {
translucentFlag = JU.C.getTranslucentFlag ((argb >> 24) & 0xFF);
argb |= 0xFF000000;
}var c = JU.C.colixHash.get (argb);
if ((c & 3) == 3) translucentFlag = 0;
return ((c > 0 ? c : JU.C.allocateColix (argb, false)) | translucentFlag);
}, "~N");
c$.allocateColix = Clazz_defineMethod (c$, "allocateColix", 
function (argb, forceLast) {
var n;
if (forceLast) {
n = 2047;
} else {
for (var i = JU.C.colixMax; --i >= 4; ) if ((argb & 0xFFFFFF) == (JU.C.argbs[i] & 0xFFFFFF)) return i;

n = JU.C.colixMax;
}if (n >= JU.C.argbs.length) {
var newSize = (forceLast ? n + 1 : JU.C.colixMax * 2);
if (newSize > 2048) newSize = 2048;
JU.C.argbs = JU.AU.arrayCopyI (JU.C.argbs, newSize);
if (JU.C.argbsGreyscale != null) JU.C.argbsGreyscale = JU.AU.arrayCopyI (JU.C.argbsGreyscale, newSize);
}JU.C.argbs[n] = argb;
if (JU.C.argbsGreyscale != null) JU.C.argbsGreyscale[n] = JU.CU.toFFGGGfromRGB (argb);
JU.C.colixHash.put (argb, n);
return (n < 2047 ? JU.C.colixMax++ : JU.C.colixMax);
}, "~N,~B");
c$.setLastGrey = Clazz_defineMethod (c$, "setLastGrey", 
function (argb) {
JU.C.calcArgbsGreyscale ();
JU.C.argbsGreyscale[2047] = JU.CU.toFFGGGfromRGB (argb);
}, "~N");
c$.calcArgbsGreyscale = Clazz_defineMethod (c$, "calcArgbsGreyscale", 
function () {
if (JU.C.argbsGreyscale != null) return;
var a =  Clazz_newIntArray (JU.C.argbs.length, 0);
for (var i = JU.C.argbs.length; --i >= 4; ) a[i] = JU.CU.toFFGGGfromRGB (JU.C.argbs[i]);

JU.C.argbsGreyscale = a;
});
c$.getArgbGreyscale = Clazz_defineMethod (c$, "getArgbGreyscale", 
function (colix) {
if (JU.C.argbsGreyscale == null) JU.C.calcArgbsGreyscale ();
return JU.C.argbsGreyscale[colix & -30721];
}, "~N");
c$.getColixO = Clazz_defineMethod (c$, "getColixO", 
function (obj) {
if (obj == null) return 0;
if (Clazz_instanceOf (obj, J.c.PAL)) return ((obj) === J.c.PAL.NONE ? 0 : 2);
if (Clazz_instanceOf (obj, Integer)) return JU.C.getColix ((obj).intValue ());
if (Clazz_instanceOf (obj, String)) return JU.C.getColixS (obj);
if (Clazz_instanceOf (obj, Byte)) return ((obj).byteValue () == 0 ? 0 : 2);
if (JU.Logger.debugging) {
JU.Logger.debug ("?? getColix(" + obj + ")");
}return 22;
}, "~O");
c$.getTranslucentFlag = Clazz_defineMethod (c$, "getTranslucentFlag", 
 function (translucentLevel) {
if (translucentLevel == 0) return 0;
if (translucentLevel < 0) translucentLevel = 128;
if (Float.isNaN (translucentLevel) || translucentLevel >= 255 || translucentLevel == 1.0) return 16384;
var iLevel = Clazz_doubleToInt (Math.floor (translucentLevel < 1 ? translucentLevel * 256 : translucentLevel >= 15 ? translucentLevel : translucentLevel <= 9 ? (Clazz_doubleToInt (Math.floor (translucentLevel - 1))) << 5 : 256));
return (((iLevel >> 5) & 0xF) << 11);
}, "~N");
c$.isColixLastAvailable = Clazz_defineMethod (c$, "isColixLastAvailable", 
function (colix) {
return (colix > 0 && (colix & 2047) == 2047);
}, "~N");
c$.getArgb = Clazz_defineMethod (c$, "getArgb", 
function (colix) {
return JU.C.argbs[colix & -30721];
}, "~N");
c$.isColixColorInherited = Clazz_defineMethod (c$, "isColixColorInherited", 
function (colix) {
switch (colix) {
case 0:
case 1:
return true;
default:
return (colix & -30721) == 1;
}
}, "~N");
c$.getColixInherited = Clazz_defineMethod (c$, "getColixInherited", 
function (myColix, parentColix) {
switch (myColix) {
case 0:
return parentColix;
case 1:
return (parentColix & -30721);
default:
return ((myColix & -30721) == 1 ? (parentColix & -30721 | myColix & 30720) : myColix);
}
}, "~N,~N");
c$.isColixTranslucent = Clazz_defineMethod (c$, "isColixTranslucent", 
function (colix) {
return ((colix & 30720) != 0);
}, "~N");
c$.getChangeableColixIndex = Clazz_defineMethod (c$, "getChangeableColixIndex", 
function (colix) {
return (colix >= 0 ? -1 : (colix & 2047));
}, "~N");
c$.getColixTranslucent3 = Clazz_defineMethod (c$, "getColixTranslucent3", 
function (colix, isTranslucent, translucentLevel) {
colix &= -30721;
if (colix == 0) colix = 1;
return (isTranslucent ? (colix | JU.C.getTranslucentFlag (translucentLevel)) : colix);
}, "~N,~B,~N");
c$.copyColixTranslucency = Clazz_defineMethod (c$, "copyColixTranslucency", 
function (colixFrom, colixTo) {
return JU.C.getColixTranslucent3 (colixTo, JU.C.isColixTranslucent (colixFrom), JU.C.getColixTranslucencyLevel (colixFrom));
}, "~N,~N");
c$.getColixTranslucencyFractional = Clazz_defineMethod (c$, "getColixTranslucencyFractional", 
function (colix) {
var translevel = JU.C.getColixTranslucencyLevel (colix);
return (translevel == -1 ? 0.5 : translevel == 0 ? 0 : translevel == 255 ? 1 : translevel / 256);
}, "~N");
c$.getColixTranslucencyLevel = Clazz_defineMethod (c$, "getColixTranslucencyLevel", 
function (colix) {
var logAlpha = (colix >> 11) & 0xF;
switch (logAlpha) {
case 0:
return 0;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
return logAlpha << 5;
case 15:
return -1;
default:
return 255;
}
}, "~N");
c$.getColixS = Clazz_defineMethod (c$, "getColixS", 
function (colorName) {
var argb = JU.CU.getArgbFromString (colorName);
if (argb != 0) return JU.C.getColix (argb);
if ("none".equalsIgnoreCase (colorName)) return 0;
if ("opaque".equalsIgnoreCase (colorName)) return 1;
return 2;
}, "~S");
c$.getColixArray = Clazz_defineMethod (c$, "getColixArray", 
function (colorNames) {
if (colorNames == null || colorNames.length == 0) return null;
var colors = JU.PT.getTokens (colorNames);
var colixes =  Clazz_newShortArray (colors.length, 0);
for (var j = 0; j < colors.length; j++) {
colixes[j] = JU.C.getColix (JU.CU.getArgbFromString (colors[j]));
if (colixes[j] == 0) return null;
}
return colixes;
}, "~S");
c$.getHexCode = Clazz_defineMethod (c$, "getHexCode", 
function (colix) {
return JU.Escape.escapeColor (JU.C.getArgb (colix));
}, "~N");
c$.getHexCodes = Clazz_defineMethod (c$, "getHexCodes", 
function (colixes) {
if (colixes == null) return null;
var s =  new JU.SB ();
for (var i = 0; i < colixes.length; i++) s.append (i == 0 ? "" : " ").append (JU.C.getHexCode (colixes[i]));

return s.toString ();
}, "~A");
c$.getColixTranslucent = Clazz_defineMethod (c$, "getColixTranslucent", 
function (argb) {
var a = (argb >> 24) & 0xFF;
return (a == 0xFF ? JU.C.getColix (argb) : JU.C.getColixTranslucent3 (JU.C.getColix (argb), true, a / 255));
}, "~N");
c$.getBgContrast = Clazz_defineMethod (c$, "getBgContrast", 
function (argb) {
return ((JU.CU.toFFGGGfromRGB (argb) & 0xFF) < 128 ? 8 : 4);
}, "~N");
Clazz_defineStatics (c$,
"INHERIT_ALL", 0,
"INHERIT_COLOR", 1,
"USE_PALETTE", 2,
"RAW_RGB", 3,
"SPECIAL_COLIX_MAX", 4,
"colixMax", 4,
"argbs",  Clazz_newIntArray (128, 0),
"argbsGreyscale", null);
c$.colixHash = c$.prototype.colixHash =  new JU.Int2IntHash (256);
Clazz_defineStatics (c$,
"RAW_RGB_INT", 3,
"UNMASK_CHANGEABLE_TRANSLUCENT", 0x07FF,
"CHANGEABLE_MASK", 0x8000,
"LAST_AVAILABLE_COLIX", 2047,
"TRANSLUCENT_SHIFT", 11,
"ALPHA_SHIFT", 13,
"TRANSLUCENT_MASK", 30720,
"TRANSPARENT", 16384,
"OPAQUE_MASK", -30721,
"BLACK", 4,
"ORANGE", 5,
"PINK", 6,
"BLUE", 7,
"WHITE", 8,
"CYAN", 9,
"RED", 10,
"GREEN", 11,
"GRAY", 12,
"SILVER", 13,
"LIME", 14,
"MAROON", 15,
"NAVY", 16,
"OLIVE", 17,
"PURPLE", 18,
"TEAL", 19,
"MAGENTA", 20,
"YELLOW", 21,
"HOTPINK", 22,
"GOLD", 23);
{
var predefinedArgbs = [0xFF000000, 0xFFFFA500, 0xFFFFC0CB, 0xFF0000FF, 0xFFFFFFFF, 0xFF00FFFF, 0xFFFF0000, 0xFF008000, 0xFF808080, 0xFFC0C0C0, 0xFF00FF00, 0xFF800000, 0xFF000080, 0xFF808000, 0xFF800080, 0xFF008080, 0xFFFF00FF, 0xFFFFFF00, 0xFFFF69B4, 0xFFFFD700];
for (var i = 0; i < predefinedArgbs.length; ++i) JU.C.getColix (predefinedArgbs[i]);

}});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.ColorEncoder", ["java.lang.Boolean", "$.Float", "java.util.Hashtable", "JU.AU", "$.CU", "$.Lst", "$.PT", "J.c.PAL", "JU.C", "$.Escape", "$.Logger", "JV.JC"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.paletteBW = null;
this.paletteWB = null;
this.paletteFriendly = null;
this.argbsCpk = null;
this.argbsRoygb = null;
this.argbsRwb = null;
this.argbsShapely = null;
this.argbsAmino = null;
this.ihalf = 0;
this.schemes = null;
this.currentPalette = 0;
this.currentSegmentCount = 1;
this.isTranslucent = false;
this.lo = 0;
this.hi = 0;
this.isReversed = false;
this.userScale = null;
this.thisScale = null;
this.thisName = "scheme";
this.isColorIndex = false;
this.ce = null;
Clazz_instantialize (this, arguments);
}, JU, "ColorEncoder");
Clazz_prepareFields (c$, function () {
this.userScale = [-8355712];
this.thisScale = [-8355712];
});
Clazz_makeConstructor (c$, 
function (ce, vwr) {
if (ce == null) {
this.vwr = vwr;
this.schemes =  new java.util.Hashtable ();
this.argbsCpk = J.c.PAL.argbsCpk;
this.argbsRoygb = JV.JC.argbsRoygbScale;
this.argbsRwb = JV.JC.argbsRwbScale;
this.argbsAmino = null;
this.argbsShapely = null;
this.ihalf = Clazz_doubleToInt (JV.JC.argbsRoygbScale.length / 3);
this.ce = this;
} else {
this.ce = ce;
this.vwr = ce.vwr;
this.schemes = ce.schemes;
}}, "JU.ColorEncoder,JV.Viewer");
c$.getSchemeIndex = Clazz_defineMethod (c$, "getSchemeIndex", 
 function (colorScheme) {
for (var i = 0; i < JU.ColorEncoder.colorSchemes.length; i++) if (JU.ColorEncoder.colorSchemes[i].equalsIgnoreCase (colorScheme)) return (i >= 16 ? i - 16 : i < 13 ? i : -i);

return -1;
}, "~S");
c$.fixName = Clazz_defineMethod (c$, "fixName", 
 function (name) {
if (name.equalsIgnoreCase ("byelement")) return "byelement_jmol";
var ipt = JU.ColorEncoder.getSchemeIndex (name);
return (ipt >= 0 ? JU.ColorEncoder.colorSchemes[ipt] : name.toLowerCase ());
}, "~S");
Clazz_defineMethod (c$, "makeColorScheme", 
 function (name, scale, isOverloaded) {
name = JU.ColorEncoder.fixName (name);
if (scale == null) {
this.schemes.remove (name);
var iScheme = this.createColorScheme (name, false, isOverloaded);
if (isOverloaded) switch (iScheme) {
case 2147483647:
return 0;
case 12:
this.paletteFriendly = this.getPaletteAC ();
break;
case 10:
this.paletteBW = this.getPaletteBW ();
break;
case 11:
this.paletteWB = this.getPaletteWB ();
break;
case 0:
case 1:
this.argbsRoygb = JV.JC.argbsRoygbScale;
break;
case 6:
case 7:
this.argbsRwb = JV.JC.argbsRwbScale;
break;
case 2:
this.argbsCpk = J.c.PAL.argbsCpk;
break;
case 3:
JU.ColorEncoder.getRasmolScale ();
break;
case 5:
this.getAmino ();
break;
case 4:
this.getShapely ();
break;
}
return iScheme;
}this.schemes.put (name, scale);
this.setThisScheme (name, scale);
var iScheme = this.createColorScheme (name, false, isOverloaded);
if (isOverloaded) switch (iScheme) {
case 10:
this.paletteBW = this.thisScale;
break;
case 11:
this.paletteWB = this.thisScale;
break;
case 0:
case 1:
this.argbsRoygb = this.thisScale;
this.ihalf = Clazz_doubleToInt (this.argbsRoygb.length / 3);
break;
case 6:
case 7:
this.argbsRwb = this.thisScale;
break;
case 2:
this.argbsCpk = this.thisScale;
break;
case 3:
break;
case 5:
this.argbsAmino = this.thisScale;
break;
case 4:
this.argbsShapely = this.thisScale;
break;
}
return -1;
}, "~S,~A,~B");
Clazz_defineMethod (c$, "getShapely", 
 function () {
return (this.argbsShapely == null ? this.argbsShapely = this.vwr.getJBR ().getArgbs (1073742144) : this.argbsShapely);
});
Clazz_defineMethod (c$, "getAmino", 
 function () {
return (this.argbsAmino == null ? this.argbsAmino = this.vwr.getJBR ().getArgbs (3145730) : this.argbsAmino);
});
Clazz_defineMethod (c$, "createColorScheme", 
function (colorScheme, defaultToRoygb, isOverloaded) {
colorScheme = colorScheme.toLowerCase ();
if (colorScheme.equals ("inherit")) return 15;
var pt = Math.max (colorScheme.indexOf ("="), colorScheme.indexOf ("["));
if (pt >= 0) {
var name = JU.PT.replaceAllCharacters (colorScheme.substring (0, pt), " =", "");
if (name.length > 0) isOverloaded = true;
var n = 0;
if (colorScheme.length > pt + 1 && !colorScheme.contains ("[")) {
colorScheme = "[" + colorScheme.substring (pt + 1).trim () + "]";
colorScheme = JU.PT.rep (colorScheme.$replace ('\n', ' '), "  ", " ");
colorScheme = JU.PT.rep (colorScheme, ", ", ",").$replace (' ', ',');
colorScheme = JU.PT.rep (colorScheme, ",", "][");
}pt = -1;
while ((pt = colorScheme.indexOf ("[", pt + 1)) >= 0) n++;

if (n == 0) return this.makeColorScheme (name, null, isOverloaded);
var scale =  Clazz_newIntArray (n, 0);
n = 0;
while ((pt = colorScheme.indexOf ("[", pt + 1)) >= 0) {
var pt2 = colorScheme.indexOf ("]", pt);
if (pt2 < 0) pt2 = colorScheme.length - 1;
var c = JU.CU.getArgbFromString (colorScheme.substring (pt, pt2 + 1));
if (c == 0) c = JU.CU.getArgbFromString (colorScheme.substring (pt + 1, pt2).trim ());
if (c == 0) {
JU.Logger.error ("error in color value: " + colorScheme.substring (pt, pt2 + 1));
return 0;
}scale[n++] = c;
}
if (name.equals ("user")) {
this.setUserScale (scale);
return -13;
}return this.makeColorScheme (name, scale, isOverloaded);
}colorScheme = JU.ColorEncoder.fixName (colorScheme);
var ipt = JU.ColorEncoder.getSchemeIndex (colorScheme);
if (this.schemes.containsKey (colorScheme)) {
this.setThisScheme (colorScheme, this.schemes.get (colorScheme));
return ipt;
}return (ipt != -1 ? ipt : defaultToRoygb ? 0 : 2147483647);
}, "~S,~B,~B");
Clazz_defineMethod (c$, "setUserScale", 
function (scale) {
this.ce.userScale = scale;
this.makeColorScheme ("user", scale, false);
}, "~A");
Clazz_defineMethod (c$, "getColorSchemeArray", 
function (palette) {
var b;
switch (palette) {
case -1:
return this.thisScale;
case 0:
return this.ce.argbsRoygb;
case 1:
return JU.AU.arrayCopyRangeRevI (this.ce.argbsRoygb, 0, -1);
case 8:
return JU.AU.arrayCopyRangeI (this.ce.argbsRoygb, 0, this.ce.ihalf);
case 9:
var a = JU.AU.arrayCopyRangeI (this.ce.argbsRoygb, this.ce.argbsRoygb.length - 2 * this.ce.ihalf, -1);
b =  Clazz_newIntArray (this.ce.ihalf, 0);
for (var i = b.length, j = a.length; --i >= 0 && --j >= 0; ) b[i] = a[j--];

return b;
case 12:
return this.getPaletteAC ();
case 10:
return this.getPaletteBW ();
case 11:
return this.getPaletteWB ();
case 6:
return this.ce.argbsRwb;
case 7:
return JU.AU.arrayCopyRangeRevI (this.ce.argbsRwb, 0, -1);
case 2:
return this.ce.argbsCpk;
case 3:
return JU.ColorEncoder.getRasmolScale ();
case 4:
return this.ce.getShapely ();
case 5:
return this.ce.getAmino ();
case -13:
return this.ce.userScale;
case -14:
return JU.AU.arrayCopyRangeRevI (this.ce.userScale, 0, -1);
default:
return null;
}
}, "~N");
Clazz_defineMethod (c$, "getColorIndexFromPalette", 
function (val, lo, hi, palette, isTranslucent) {
var colix = JU.C.getColix (this.getArgbFromPalette (val, lo, hi, palette));
if (isTranslucent) {
var f = (hi - val) / (hi - lo);
if (f > 1) f = 1;
 else if (f < 0.125) f = 0.125;
colix = JU.C.getColixTranslucent3 (colix, true, f);
}return colix;
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "getPaletteColorCount", 
function (palette) {
switch (palette) {
case -1:
return this.thisScale.length;
case 10:
case 11:
return this.getPaletteBW ().length;
case 0:
case 1:
return this.ce.argbsRoygb.length;
case 8:
case 9:
return this.ce.ihalf;
case 6:
case 7:
return this.ce.argbsRwb.length;
case -13:
case -14:
return this.ce.userScale.length;
case 2:
return this.argbsCpk.length;
case 3:
return JU.ColorEncoder.getRasmolScale ().length;
case 4:
return this.ce.getShapely ().length;
case 5:
return this.ce.getAmino ().length;
case 12:
return this.getPaletteAC ().length;
default:
return 0;
}
}, "~N");
Clazz_defineMethod (c$, "getArgbFromPalette", 
function (val, lo, hi, palette) {
if (Float.isNaN (val)) return -8355712;
var n = this.getPaletteColorCount (palette);
switch (palette) {
case -1:
if (this.isColorIndex) {
lo = 0;
hi = this.thisScale.length;
}return this.thisScale[JU.ColorEncoder.quantize4 (val, lo, hi, n)];
case 10:
return this.getPaletteBW ()[JU.ColorEncoder.quantize4 (val, lo, hi, n)];
case 11:
return this.getPaletteWB ()[JU.ColorEncoder.quantize4 (val, lo, hi, n)];
case 0:
return this.ce.argbsRoygb[JU.ColorEncoder.quantize4 (val, lo, hi, n)];
case 1:
return this.ce.argbsRoygb[JU.ColorEncoder.quantize4 (-val, -hi, -lo, n)];
case 8:
return this.ce.argbsRoygb[JU.ColorEncoder.quantize4 (val, lo, hi, n)];
case 9:
return this.ce.argbsRoygb[this.ce.ihalf + JU.ColorEncoder.quantize4 (val, lo, hi, n) * 2];
case 6:
return this.ce.argbsRwb[JU.ColorEncoder.quantize4 (val, lo, hi, n)];
case 7:
return this.ce.argbsRwb[JU.ColorEncoder.quantize4 (-val, -hi, -lo, n)];
case -13:
return (this.ce.userScale.length == 0 ? -8355712 : this.ce.userScale[JU.ColorEncoder.quantize4 (val, lo, hi, n)]);
case -14:
return (this.ce.userScale.length == 0 ? -8355712 : this.ce.userScale[JU.ColorEncoder.quantize4 (-val, -hi, -lo, n)]);
case 2:
return this.ce.argbsCpk[JU.ColorEncoder.colorIndex (val, n)];
case 3:
return JU.ColorEncoder.getRasmolScale ()[JU.ColorEncoder.colorIndex (val, n)];
case 4:
return this.ce.getShapely ()[JU.ColorEncoder.colorIndex (val, n)];
case 5:
return this.ce.getAmino ()[JU.ColorEncoder.colorIndex (val, n)];
case 12:
return this.getPaletteAC ()[JU.ColorEncoder.colorIndexRepeat (val, n)];
default:
return -8355712;
}
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "setThisScheme", 
 function (name, scale) {
this.thisName = name;
this.thisScale = scale;
if (name.equals ("user")) this.userScale = scale;
this.isColorIndex = (name.indexOf ("byelement") == 0 || name.indexOf ("byresidue") == 0);
}, "~S,~A");
Clazz_defineMethod (c$, "getArgb", 
function (val) {
return (this.isReversed ? this.getArgbFromPalette (-val, -this.hi, -this.lo, this.currentPalette) : this.getArgbFromPalette (val, this.lo, this.hi, this.currentPalette));
}, "~N");
Clazz_defineMethod (c$, "getArgbMinMax", 
function (val, min, max) {
return (this.isReversed ? this.getArgbFromPalette (-val, -max, -min, this.currentPalette) : this.getArgbFromPalette (val, min, max, this.currentPalette));
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getColorIndex", 
function (val) {
return (this.isReversed ? this.getColorIndexFromPalette (-val, -this.hi, -this.lo, this.currentPalette, this.isTranslucent) : this.getColorIndexFromPalette (val, this.lo, this.hi, this.currentPalette, this.isTranslucent));
}, "~N");
Clazz_defineMethod (c$, "getColorKey", 
function () {
var info =  new java.util.Hashtable ();
var segmentCount = this.getPaletteColorCount (this.currentPalette);
var colors =  new JU.Lst ();
var values =  Clazz_newFloatArray (segmentCount + 1, 0);
var quantum = (this.hi - this.lo) / segmentCount;
var f = quantum * (this.isReversed ? -0.5 : 0.5);
for (var i = 0; i < segmentCount; i++) {
values[i] = (this.isReversed ? this.hi - i * quantum : this.lo + i * quantum);
colors.addLast (JU.CU.colorPtFromInt (this.getArgb (values[i] + f), null));
}
values[segmentCount] = (this.isReversed ? this.lo : this.hi);
info.put ("values", values);
info.put ("colors", colors);
info.put ("min", Float.$valueOf (this.lo));
info.put ("max", Float.$valueOf (this.hi));
info.put ("reversed", Boolean.$valueOf (this.isReversed));
info.put ("name", this.getCurrentColorSchemeName ());
return info;
});
Clazz_defineMethod (c$, "getColorScheme", 
function () {
return (this.isTranslucent ? "translucent " : "") + (this.currentPalette < 0 ? JU.ColorEncoder.getColorSchemeList (this.getColorSchemeArray (this.currentPalette)) : this.getColorSchemeName (this.currentPalette));
});
Clazz_defineMethod (c$, "setColorScheme", 
function (colorScheme, isTranslucent) {
this.isTranslucent = isTranslucent;
if (colorScheme != null) this.currentPalette = this.createColorScheme (colorScheme, true, false);
}, "~S,~B");
Clazz_defineMethod (c$, "setRange", 
function (lo, hi, isReversed) {
if (hi == 3.4028235E38) {
lo = 1;
hi = this.getPaletteColorCount (this.currentPalette) + 1;
}this.lo = Math.min (lo, hi);
this.hi = Math.max (lo, hi);
this.isReversed = isReversed;
}, "~N,~N,~B");
Clazz_defineMethod (c$, "getCurrentColorSchemeName", 
function () {
return this.getColorSchemeName (this.currentPalette);
});
Clazz_defineMethod (c$, "getColorSchemeName", 
function (i) {
var absi = Math.abs (i);
return (i == -1 ? this.thisName : absi < JU.ColorEncoder.colorSchemes.length && absi >= 0 ? JU.ColorEncoder.colorSchemes[absi] : null);
}, "~N");
c$.getColorSchemeList = Clazz_defineMethod (c$, "getColorSchemeList", 
function (scheme) {
if (scheme == null) return "";
var colors = "";
for (var i = 0; i < scheme.length; i++) colors += (i == 0 ? "" : " ") + JU.Escape.escapeColor (scheme[i]);

return colors;
}, "~A");
c$.getRasmolScale = Clazz_defineMethod (c$, "getRasmolScale", 
function () {
if (JU.ColorEncoder.rasmolScale != null) return JU.ColorEncoder.rasmolScale;
JU.ColorEncoder.rasmolScale =  Clazz_newIntArray (J.c.PAL.argbsCpk.length, 0);
var argb = J.c.PAL.argbsCpkRasmol[0] | 0xFF000000;
for (var i = JU.ColorEncoder.rasmolScale.length; --i >= 0; ) JU.ColorEncoder.rasmolScale[i] = argb;

for (var i = J.c.PAL.argbsCpkRasmol.length; --i >= 0; ) {
argb = J.c.PAL.argbsCpkRasmol[i];
JU.ColorEncoder.rasmolScale[argb >> 24] = argb | 0xFF000000;
}
return JU.ColorEncoder.rasmolScale;
});
Clazz_defineMethod (c$, "getPaletteAC", 
 function () {
return (this.ce.paletteFriendly == null ? this.ce.paletteFriendly = [0x808080, 0x104BA9, 0xAA00A2, 0xC9F600, 0xFFA200, 0x284A7E, 0x7F207B, 0x9FB82E, 0xBF8B30, 0x052D6E, 0x6E0069, 0x83A000, 0xA66A00, 0x447BD4, 0xD435CD, 0xD8FA3F, 0xFFBA40, 0x6A93D4, 0xD460CF, 0xE1FA71, 0xFFCC73] : this.ce.paletteFriendly);
});
Clazz_defineMethod (c$, "getPaletteWB", 
 function () {
if (this.ce.paletteWB != null) return this.ce.paletteWB;
var b =  Clazz_newIntArray (JV.JC.argbsRoygbScale.length, 0);
for (var i = 0; i < b.length; i++) {
var xff = (1 / b.length * (b.length - i));
b[i] = JU.CU.colorTriadToFFRGB (xff, xff, xff);
}
return this.ce.paletteWB = b;
});
c$.getPaletteAtoB = Clazz_defineMethod (c$, "getPaletteAtoB", 
function (color1, color2, n) {
if (n < 2) n = JV.JC.argbsRoygbScale.length;
var b =  Clazz_newIntArray (n, 0);
var rgb1 =  Clazz_newFloatArray (3, 0);
var rgb2 =  Clazz_newFloatArray (3, 0);
JU.CU.toRGB3f (color1, rgb1);
JU.CU.toRGB3f (color2, rgb2);
var dr = (rgb2[0] - rgb1[0]) / (n - 1);
var dg = (rgb2[1] - rgb1[1]) / (n - 1);
var db = (rgb2[2] - rgb1[2]) / (n - 1);
for (var i = 0; i < n; i++) b[i] = JU.CU.colorTriadToFFRGB (rgb1[0] + dr * i, rgb1[1] + dg * i, rgb1[2] + db * i);

return b;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getPaletteBW", 
 function () {
if (this.ce.paletteBW != null) return this.ce.paletteBW;
var b =  Clazz_newIntArray (JV.JC.argbsRoygbScale.length, 0);
for (var i = 0; i < b.length; i++) {
var xff = (1 / b.length * i);
b[i] = JU.CU.colorTriadToFFRGB (xff, xff, xff);
}
return this.ce.paletteBW = b;
});
Clazz_defineMethod (c$, "quantize", 
function (x, isLowEnd) {
var n = this.getPaletteColorCount (this.currentPalette);
x = ((Clazz_floatToInt (x * n)) + (isLowEnd ? 0 : 1)) / n;
return (x <= 0 ? this.lo : x >= 1 ? this.hi : this.lo + (this.hi - this.lo) * x);
}, "~N,~B");
c$.quantize4 = Clazz_defineMethod (c$, "quantize4", 
function (val, lo, hi, segmentCount) {
var range = hi - lo;
if (range <= 0 || Float.isNaN (val)) return Clazz_doubleToInt (segmentCount / 2);
var t = val - lo;
if (t <= 0) return 0;
var quanta = range / segmentCount;
var q = Clazz_floatToInt (t / quanta + 0.0001);
if (q >= segmentCount) q = segmentCount - 1;
return q;
}, "~N,~N,~N,~N");
c$.colorIndex = Clazz_defineMethod (c$, "colorIndex", 
 function (q, segmentCount) {
return Clazz_doubleToInt (Math.floor (q <= 0 || q >= segmentCount ? 0 : q));
}, "~N,~N");
c$.colorIndexRepeat = Clazz_defineMethod (c$, "colorIndexRepeat", 
 function (q, segmentCount) {
var i = Clazz_doubleToInt (Math.floor (q <= 0 ? 0 : q));
return i % segmentCount;
}, "~N,~N");
Clazz_defineStatics (c$,
"GRAY", 0xFF808080,
"BYELEMENT_PREFIX", "byelement",
"BYRESIDUE_PREFIX", "byresidue");
c$.BYELEMENT_JMOL = c$.prototype.BYELEMENT_JMOL = "byelement_jmol";
c$.BYELEMENT_RASMOL = c$.prototype.BYELEMENT_RASMOL = "byelement_rasmol";
c$.BYRESIDUE_SHAPELY = c$.prototype.BYRESIDUE_SHAPELY = "byresidue_shapely";
c$.BYRESIDUE_AMINO = c$.prototype.BYRESIDUE_AMINO = "byresidue_amino";
Clazz_defineStatics (c$,
"CUSTOM", -1,
"ROYGB", 0,
"BGYOR", 1,
"JMOL", 2,
"RASMOL", 3,
"SHAPELY", 4,
"AMINO", 5,
"RWB", 6,
"BWR", 7,
"LOW", 8,
"HIGH", 9,
"BW", 10,
"WB", 11,
"FRIENDLY", 12,
"USER", -13,
"RESU", -14,
"INHERIT", 15,
"ALT", 16);
c$.colorSchemes = c$.prototype.colorSchemes = ["roygb", "bgyor", "byelement_jmol", "byelement_rasmol", "byresidue_shapely", "byresidue_amino", "rwb", "bwr", "low", "high", "bw", "wb", "friendly", "user", "resu", "inherit", "rgb", "bgr", "jmol", "rasmol", "byresidue"];
Clazz_defineStatics (c$,
"rasmolScale", null,
"argbsChainAtom", null,
"argbsChainHetero", null);
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.CommandHistory", ["JU.Lst"], function () {
c$ = Clazz_decorateAsClass (function () {
this.commandList = null;
this.maxSize = 100;
this.nextCommand = 0;
this.cursorPos = 0;
this.isOn = true;
Clazz_instantialize (this, arguments);
}, JU, "CommandHistory");
Clazz_makeConstructor (c$, 
function () {
this.reset (100);
});
Clazz_defineMethod (c$, "clear", 
function () {
this.reset (this.maxSize);
});
Clazz_defineMethod (c$, "reset", 
function (maxSize) {
this.maxSize = maxSize;
this.commandList =  new JU.Lst ();
this.nextCommand = 0;
this.commandList.addLast ("");
this.cursorPos = 0;
}, "~N");
Clazz_defineMethod (c$, "setMaxSize", 
function (maxSize) {
if (maxSize == this.maxSize) return;
if (maxSize < 2) maxSize = 2;
while (this.nextCommand > maxSize) {
this.commandList.remove (0);
this.nextCommand--;
}
if (this.nextCommand > maxSize) this.nextCommand = maxSize - 1;
this.cursorPos = this.nextCommand;
this.maxSize = maxSize;
}, "~N");
Clazz_defineMethod (c$, "getCommandUp", 
function () {
if (this.cursorPos <= 0) return null;
this.cursorPos--;
var str = this.getCommand ();
if (str.endsWith ("#??")) this.removeCommand (this.cursorPos--);
if (this.cursorPos < 0) this.cursorPos = 0;
return str;
});
Clazz_defineMethod (c$, "getCommandDown", 
function () {
if (this.cursorPos >= this.nextCommand) return null;
this.cursorPos++;
return this.getCommand ();
});
Clazz_defineMethod (c$, "getCommand", 
 function () {
return this.commandList.get (this.cursorPos);
});
Clazz_defineMethod (c$, "addCommand", 
function (strCommand) {
if (!this.isOn && !strCommand.endsWith ("#??")) return;
if (strCommand.endsWith ("#----")) return;
var i;
while ((i = strCommand.indexOf ("\n")) >= 0) {
var str = strCommand.substring (0, i);
if (str.length > 0) this.addCommandLine (str);
strCommand = strCommand.substring (i + 1);
}
if (strCommand.length > 0) this.addCommandLine (strCommand);
}, "~S");
Clazz_defineMethod (c$, "getSetHistory", 
function (n) {
this.isOn = (n == -2 ? this.isOn : true);
switch (n) {
case 0:
this.isOn = false;
this.clear ();
return "";
case -2147483648:
case -2:
this.clear ();
return "";
case -1:
return this.getCommandUp ();
case 1:
return this.getCommandDown ();
default:
if (n < 0) {
this.setMaxSize (-2 - n);
return "";
}n = Math.max (this.nextCommand - n, 0);
}
var str = "";
for (var i = n; i < this.nextCommand; i++) if (!this.commandList.get (i).toUpperCase ().startsWith ("WRITE HISTORY")) str += this.commandList.get (i) + "\n";

return str;
}, "~N");
Clazz_defineMethod (c$, "find", 
function (cmd, dir) {
var cpos = this.cursorPos;
var c = cmd;
while (c != null) {
c = this.getSetHistory (dir);
if (c == null) break;
if (c.startsWith (cmd)) return c;
}
this.cursorPos = cpos;
return null;
}, "~S,~N");
Clazz_defineMethod (c$, "removeCommand", 
function () {
return this.removeCommand (this.nextCommand - 1);
});
Clazz_defineMethod (c$, "removeCommand", 
function (n) {
if (n < 0 || n >= this.nextCommand) return "";
var str = this.commandList.remove (n);
this.nextCommand--;
return str;
}, "~N");
Clazz_defineMethod (c$, "addCommandLine", 
 function (command) {
if (command == null || command.length == 0) return;
if (command.endsWith ("#--")) return;
if (this.nextCommand >= this.maxSize) {
this.commandList.remove (0);
this.nextCommand = this.maxSize - 1;
}this.commandList.add (this.nextCommand, command);
this.nextCommand++;
this.cursorPos = this.nextCommand;
this.commandList.add (this.nextCommand, "");
}, "~S");
Clazz_defineStatics (c$,
"ERROR_FLAG", "#??",
"NOHISTORYLINE_FLAG", "#--",
"NOHISTORYATALL_FLAG", "#----",
"DEFAULT_MAX_SIZE", 100);
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.LoggerInterface"], "JU.DefaultLogger", ["JU.Logger"], function () {
c$ = Clazz_declareType (JU, "DefaultLogger", null, JU.LoggerInterface);
Clazz_defineMethod (c$, "log", 
function (out, level, txt, e) {
if (out === System.err) System.out.flush ();
if ((out != null) && ((txt != null) || (e != null))) {
txt = (txt != null ? txt : "");
out.println ((JU.Logger.logLevel () ? "[" + JU.Logger.getLevel (level) + "] " : "") + txt + (e != null ? ": " + e.toString () : ""));
if (e != null) {
var elements = e.getStackTrace ();
if (elements != null) {
for (var i = 0; i < elements.length; i++) {
out.println (elements[i].getClassName () + " - " + elements[i].getLineNumber () + " - " + elements[i].getMethodName ());
}
}}}if (out === System.err) System.err.flush ();
}, "java.io.PrintStream,~N,~S,Throwable");
Clazz_overrideMethod (c$, "debug", 
function (txt) {
this.log (System.out, 5, txt, null);
}, "~S");
Clazz_overrideMethod (c$, "info", 
function (txt) {
this.log (System.out, 4, txt, null);
}, "~S");
Clazz_overrideMethod (c$, "warn", 
function (txt) {
this.log (System.out, 3, txt, null);
}, "~S");
Clazz_overrideMethod (c$, "warnEx", 
function (txt, e) {
this.log (System.out, 3, txt, e);
}, "~S,Throwable");
Clazz_overrideMethod (c$, "error", 
function (txt) {
this.log (System.err, 2, txt, null);
}, "~S");
Clazz_overrideMethod (c$, "errorEx", 
function (txt, e) {
this.log (System.err, 2, txt, e);
}, "~S,Throwable");
Clazz_overrideMethod (c$, "fatal", 
function (txt) {
this.log (System.err, 1, txt, null);
}, "~S");
Clazz_overrideMethod (c$, "fatalEx", 
function (txt, e) {
this.log (System.err, 1, txt, e);
}, "~S,Throwable");
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.BS"], "JU.Elements", ["java.util.Hashtable", "JU.PT", "JU.Logger"], function () {
c$ = Clazz_declareType (JU, "Elements");
c$.getAtomicMass = Clazz_defineMethod (c$, "getAtomicMass", 
function (i) {
return (i < 1 || i >= JU.Elements.atomicMass.length ? 0 : JU.Elements.atomicMass[i]);
}, "~N");
c$.elementNumberFromSymbol = Clazz_defineMethod (c$, "elementNumberFromSymbol", 
function (elementSymbol, isSilent) {
if (JU.Elements.htElementMap == null) {
var map =  new java.util.Hashtable ();
for (var elementNumber = JU.Elements.elementNumberMax; --elementNumber >= 0; ) {
var symbol = JU.Elements.elementSymbols[elementNumber];
var boxed = Integer.$valueOf (elementNumber);
map.put (symbol, boxed);
if (symbol.length == 2) map.put (symbol.toUpperCase (), boxed);
}
for (var i = JU.Elements.altElementMax; --i >= 4; ) {
var symbol = JU.Elements.altElementSymbols[i];
var boxed = Integer.$valueOf (JU.Elements.altElementNumbers[i]);
map.put (symbol, boxed);
if (symbol.length == 2) map.put (symbol.toUpperCase (), boxed);
}
JU.Elements.htElementMap = map;
}if (elementSymbol == null) return 0;
var boxedAtomicNumber = JU.Elements.htElementMap.get (elementSymbol);
if (boxedAtomicNumber != null) return boxedAtomicNumber.intValue ();
if (JU.PT.isDigit (elementSymbol.charAt (0))) {
var pt = elementSymbol.length - 2;
if (pt >= 0 && JU.PT.isDigit (elementSymbol.charAt (pt))) pt++;
var isotope = (pt > 0 ? JU.PT.parseInt (elementSymbol.substring (0, pt)) : 0);
if (isotope > 0) {
var n = JU.Elements.elementNumberFromSymbol (elementSymbol.substring (pt), true);
if (n > 0) {
isotope = JU.Elements.getAtomicAndIsotopeNumber (n, isotope);
JU.Elements.htElementMap.put (elementSymbol.toUpperCase (), Integer.$valueOf (isotope));
return isotope;
}}}if (!isSilent) JU.Logger.error ("'" + elementSymbol + "' is not a recognized symbol");
return 0;
}, "~S,~B");
c$.elementSymbolFromNumber = Clazz_defineMethod (c$, "elementSymbolFromNumber", 
function (elemNo) {
var isoNumber = 0;
if (elemNo >= JU.Elements.elementNumberMax) {
for (var j = JU.Elements.altElementMax; --j >= 0; ) if (elemNo == JU.Elements.altElementNumbers[j]) return JU.Elements.altElementSymbols[j];

isoNumber = JU.Elements.getIsotopeNumber (elemNo);
elemNo %= 128;
return "" + isoNumber + JU.Elements.getElementSymbol (elemNo);
}return JU.Elements.getElementSymbol (elemNo);
}, "~N");
c$.getElementSymbol = Clazz_defineMethod (c$, "getElementSymbol", 
 function (elemNo) {
if (elemNo < 0 || elemNo >= JU.Elements.elementNumberMax) elemNo = 0;
return JU.Elements.elementSymbols[elemNo];
}, "~N");
c$.elementNameFromNumber = Clazz_defineMethod (c$, "elementNameFromNumber", 
function (elementNumber) {
if (elementNumber >= JU.Elements.elementNumberMax) {
for (var j = JU.Elements.altElementMax; --j >= 0; ) if (elementNumber == JU.Elements.altElementNumbers[j]) return JU.Elements.altElementNames[j];

elementNumber %= 128;
}if (elementNumber < 0 || elementNumber >= JU.Elements.elementNumberMax) elementNumber = 0;
return JU.Elements.elementNames[elementNumber];
}, "~N");
c$.elementNumberFromName = Clazz_defineMethod (c$, "elementNumberFromName", 
function (name) {
for (var i = 1; i < JU.Elements.elementNumberMax; i++) if (JU.Elements.elementNames[i].equalsIgnoreCase (name)) return i;

return -1;
}, "~S");
c$.altElementNameFromIndex = Clazz_defineMethod (c$, "altElementNameFromIndex", 
function (i) {
return JU.Elements.altElementNames[i];
}, "~N");
c$.altElementNumberFromIndex = Clazz_defineMethod (c$, "altElementNumberFromIndex", 
function (i) {
return JU.Elements.altElementNumbers[i];
}, "~N");
c$.altElementSymbolFromIndex = Clazz_defineMethod (c$, "altElementSymbolFromIndex", 
function (i) {
return JU.Elements.altElementSymbols[i];
}, "~N");
c$.altIsotopeSymbolFromIndex = Clazz_defineMethod (c$, "altIsotopeSymbolFromIndex", 
function (i) {
var code = JU.Elements.altElementNumbers[i];
return (code >> 7) + JU.Elements.elementSymbolFromNumber (code & 127);
}, "~N");
c$.altIsotopeSymbolFromIndex2 = Clazz_defineMethod (c$, "altIsotopeSymbolFromIndex2", 
function (i) {
var code = JU.Elements.altElementNumbers[i];
return JU.Elements.elementSymbolFromNumber (code & 127) + (code >> 7);
}, "~N");
c$.getElementNumber = Clazz_defineMethod (c$, "getElementNumber", 
function (atomicAndIsotopeNumber) {
return atomicAndIsotopeNumber & 127;
}, "~N");
c$.getIsotopeNumber = Clazz_defineMethod (c$, "getIsotopeNumber", 
function (atomicAndIsotopeNumber) {
return atomicAndIsotopeNumber >> 7;
}, "~N");
c$.getAtomicAndIsotopeNumber = Clazz_defineMethod (c$, "getAtomicAndIsotopeNumber", 
function (n, mass) {
return ((n < 0 ? 0 : n) + (mass <= 0 ? 0 : mass << 7));
}, "~N,~N");
c$.altElementIndexFromNumber = Clazz_defineMethod (c$, "altElementIndexFromNumber", 
function (atomicAndIsotopeNumber) {
for (var i = 0; i < JU.Elements.altElementMax; i++) if (JU.Elements.altElementNumbers[i] == atomicAndIsotopeNumber) return i;

return 0;
}, "~N");
c$.getNaturalIsotope = Clazz_defineMethod (c$, "getNaturalIsotope", 
function (elementNumber) {
for (var i = 0; i < JU.Elements.naturalIsotopeMasses.length; i += 2) if (JU.Elements.naturalIsotopeMasses[i] == elementNumber) return JU.Elements.naturalIsotopeMasses[++i];

return 0;
}, "~N");
c$.isNaturalIsotope = Clazz_defineMethod (c$, "isNaturalIsotope", 
function (isotopeSymbol) {
return ("1H,12C,14N,".indexOf (isotopeSymbol + ",") >= 0);
}, "~S");
c$.getBondingRadius = Clazz_defineMethod (c$, "getBondingRadius", 
function (atomicNumberAndIsotope, charge) {
var atomicNumber = atomicNumberAndIsotope & 127;
return (charge > 0 && JU.Elements.bsCations.get (atomicNumber) ? JU.Elements.getBondingRadFromTable (atomicNumber, charge, JU.Elements.cationLookupTable) : charge < 0 && JU.Elements.bsAnions.get (atomicNumber) ? JU.Elements.getBondingRadFromTable (atomicNumber, charge, JU.Elements.anionLookupTable) : JU.Elements.defaultBondingMars[(atomicNumber << 1) + JU.Elements.bondingVersion] / 1000);
}, "~N,~N");
c$.getCovalentRadius = Clazz_defineMethod (c$, "getCovalentRadius", 
function (atomicNumberAndIsotope) {
return JU.Elements.defaultBondingMars[((atomicNumberAndIsotope & 127) << 1) + JU.Elements.covalentVersion] / 1000;
}, "~N");
c$.getBondingRadFromTable = Clazz_defineMethod (c$, "getBondingRadFromTable", 
function (atomicNumber, charge, table) {
var ionic = (atomicNumber << 4) + (charge + 4);
var iVal = 0;
var iMid = 0;
var iMin = 0;
var iMax = Clazz_doubleToInt (table.length / 2);
while (iMin != iMax) {
iMid = Clazz_doubleToInt ((iMin + iMax) / 2);
iVal = table[iMid << 1];
if (iVal > ionic) iMax = iMid;
 else if (iVal < ionic) iMin = iMid + 1;
 else return table[(iMid << 1) + 1] / 1000;
}
if (iVal > ionic) iMid--;
iVal = table[iMid << 1];
if (atomicNumber != (iVal >> 4)) iMid++;
return table[(iMid << 1) + 1] / 1000;
}, "~N,~N,~A");
c$.getVanderwaalsMar = Clazz_defineMethod (c$, "getVanderwaalsMar", 
function (atomicAndIsotopeNumber, type) {
return JU.Elements.vanderwaalsMars[((atomicAndIsotopeNumber & 127) << 2) + (type.pt % 4)];
}, "~N,J.c.VDW");
c$.getHydrophobicity = Clazz_defineMethod (c$, "getHydrophobicity", 
function (i) {
return (i < 1 || i >= JU.Elements.hydrophobicities.length ? 0 : JU.Elements.hydrophobicities[i]);
}, "~N");
c$.getAllredRochowElectroNeg = Clazz_defineMethod (c$, "getAllredRochowElectroNeg", 
function (elemno) {
return (elemno > 0 && elemno < JU.Elements.electroNegativities.length ? JU.Elements.electroNegativities[elemno] : 0);
}, "~N");
c$.isElement = Clazz_defineMethod (c$, "isElement", 
function (atomicAndIsotopeNumber, elemNo) {
return ((atomicAndIsotopeNumber & 127) == elemNo);
}, "~N,~N");
Clazz_defineStatics (c$,
"elementSymbols", ["Xx", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt"],
"atomicMass", [0, 1.008, 4.003, 6.941, 9.012, 10.81, 12.011, 14.007, 15.999, 18.998, 20.18, 22.99, 24.305, 26.981, 28.086, 30.974, 32.07, 35.453, 39.948, 39.1, 40.08, 44.956, 47.88, 50.941, 52, 54.938, 55.847, 58.93, 58.69, 63.55, 65.39, 69.72, 72.61, 74.92, 78.96, 79.9, 83.8, 85.47, 87.62, 88.91, 91.22, 92.91, 95.94, 98.91, 101.07, 102.91, 106.42, 107.87, 112.41, 114.82, 118.71, 121.75, 127.6, 126.91, 131.29, 132.91, 137.33, 138.91, 140.12, 140.91, 144.24, 144.9, 150.36, 151.96, 157.25, 158.93, 162.5, 164.93, 167.26, 168.93, 173.04, 174.97, 178.49, 180.95, 183.85, 186.21, 190.2, 192.22, 195.08, 196.97, 200.59, 204.38, 207.2, 208.98, 210, 210, 222, 223, 226.03, 227.03, 232.04, 231.04, 238.03, 237.05, 239.1, 243.1, 247.1, 247.1, 252.1, 252.1, 257.1, 256.1, 259.1, 260.1, 261, 262, 263, 262, 265, 268]);
c$.elementNumberMax = c$.prototype.elementNumberMax = JU.Elements.elementSymbols.length;
Clazz_defineStatics (c$,
"htElementMap", null,
"elementNames", ["unknown", "hydrogen", "helium", "lithium", "beryllium", "boron", "carbon", "nitrogen", "oxygen", "fluorine", "neon", "sodium", "magnesium", "aluminum", "silicon", "phosphorus", "sulfur", "chlorine", "argon", "potassium", "calcium", "scandium", "titanium", "vanadium", "chromium", "manganese", "iron", "cobalt", "nickel", "copper", "zinc", "gallium", "germanium", "arsenic", "selenium", "bromine", "krypton", "rubidium", "strontium", "yttrium", "zirconium", "niobium", "molybdenum", "technetium", "ruthenium", "rhodium", "palladium", "silver", "cadmium", "indium", "tin", "antimony", "tellurium", "iodine", "xenon", "cesium", "barium", "lanthanum", "cerium", "praseodymium", "neodymium", "promethium", "samarium", "europium", "gadolinium", "terbium", "dysprosium", "holmium", "erbium", "thulium", "ytterbium", "lutetium", "hafnium", "tantalum", "tungsten", "rhenium", "osmium", "iridium", "platinum", "gold", "mercury", "thallium", "lead", "bismuth", "polonium", "astatine", "radon", "francium", "radium", "actinium", "thorium", "protactinium", "uranium", "neptunium", "plutonium", "americium", "curium", "berkelium", "californium", "einsteinium", "fermium", "mendelevium", "nobelium", "lawrencium", "rutherfordium", "dubnium", "seaborgium", "bohrium", "hassium", "meitnerium"],
"naturalIsotopeMasses", [1, 1, 6, 12, 7, 14, 8, 16],
"naturalIsotopes", "1H,12C,14N,",
"firstIsotope", 4,
"altElementNumbers", [0, 13, 16, 55, 257, 385, 1414, 1670, 1798, 1927]);
c$.altElementMax = c$.prototype.altElementMax = JU.Elements.altElementNumbers.length;
Clazz_defineStatics (c$,
"altElementSymbols", ["Xx", "Al", "S", "Cs", "D", "T", "11C", "13C", "14C", "15N"],
"altElementNames", ["dummy", "aluminium", "sulphur", "caesium", "deuterium", "tritium", "", "", "", ""],
"VdwPROBE", "#VDW radii for PROBE;{_H}.vdw = 1.0;{_H and connected(_C) and not connected(within(smiles,\'[a]\'))}.vdw = 1.17;{_C}.vdw = 1.75;{_C and connected(3) and connected(_O)}.vdw = 1.65;{_N}.vdw = 1.55;{_O}.vdw = 1.4;{_P}.vdw = 1.8;{_S}.vdw = 1.8;message VDW radii for H, C, N, O, P, and S set according to Word, et al., J. Mol. Biol. (1999) 285, 1711-1733",
"vanderwaalsMars", [1000, 1000, 1000, 1000, 1200, 1100, 1100, 1200, 1400, 1400, 2200, 1400, 1820, 1810, 1220, 2200, 1700, 1530, 628, 1900, 2080, 1920, 1548, 1800, 1950, 1700, 1548, 1700, 1850, 1550, 1400, 1600, 1700, 1520, 1348, 1550, 1730, 1470, 1300, 1500, 1540, 1540, 2020, 1540, 2270, 2270, 2200, 2400, 1730, 1730, 1500, 2200, 2050, 1840, 1500, 2100, 2100, 2100, 2200, 2100, 2080, 1800, 1880, 1950, 2000, 1800, 1808, 1800, 1970, 1750, 1748, 1800, 1880, 1880, 2768, 1880, 2750, 2750, 2388, 2800, 1973, 2310, 1948, 2400, 1700, 2300, 1320, 2300, 1700, 2150, 1948, 2150, 1700, 2050, 1060, 2050, 1700, 2050, 1128, 2050, 1700, 2050, 1188, 2050, 1700, 2050, 1948, 2050, 1700, 2000, 1128, 2000, 1630, 2000, 1240, 2000, 1400, 2000, 1148, 2000, 1390, 2100, 1148, 2100, 1870, 1870, 1548, 2100, 1700, 2110, 3996, 2100, 1850, 1850, 828, 2050, 1900, 1900, 900, 1900, 2100, 1830, 1748, 1900, 2020, 2020, 1900, 2020, 1700, 3030, 2648, 2900, 1700, 2490, 2020, 2550, 1700, 2400, 1608, 2400, 1700, 2300, 1420, 2300, 1700, 2150, 1328, 2150, 1700, 2100, 1748, 2100, 1700, 2050, 1800, 2050, 1700, 2050, 1200, 2050, 1700, 2000, 1220, 2000, 1630, 2050, 1440, 2050, 1720, 2100, 1548, 2100, 1580, 2200, 1748, 2200, 1930, 2200, 1448, 2200, 2170, 1930, 1668, 2250, 2200, 2170, 1120, 2200, 2060, 2060, 1260, 2100, 2150, 1980, 1748, 2100, 2160, 2160, 2100, 2160, 1700, 3430, 3008, 3000, 1700, 2680, 2408, 2700, 1700, 2500, 1828, 2500, 1700, 2480, 1860, 2480, 1700, 2470, 1620, 2470, 1700, 2450, 1788, 2450, 1700, 2430, 1760, 2430, 1700, 2420, 1740, 2420, 1700, 2400, 1960, 2400, 1700, 2380, 1688, 2380, 1700, 2370, 1660, 2370, 1700, 2350, 1628, 2350, 1700, 2330, 1608, 2330, 1700, 2320, 1588, 2320, 1700, 2300, 1568, 2300, 1700, 2280, 1540, 2280, 1700, 2270, 1528, 2270, 1700, 2250, 1400, 2250, 1700, 2200, 1220, 2200, 1700, 2100, 1260, 2100, 1700, 2050, 1300, 2050, 1700, 2000, 1580, 2000, 1700, 2000, 1220, 2000, 1720, 2050, 1548, 2050, 1660, 2100, 1448, 2100, 1550, 2050, 1980, 2050, 1960, 1960, 1708, 2200, 2020, 2020, 2160, 2300, 1700, 2070, 1728, 2300, 1700, 1970, 1208, 2000, 1700, 2020, 1120, 2000, 1700, 2200, 2300, 2000, 1700, 3480, 3240, 2000, 1700, 2830, 2568, 2000, 1700, 2000, 2120, 2000, 1700, 2400, 1840, 2400, 1700, 2000, 1600, 2000, 1860, 2300, 1748, 2300, 1700, 2000, 1708, 2000, 1700, 2000, 1668, 2000, 1700, 2000, 1660, 2000, 1700, 2000, 1648, 2000, 1700, 2000, 1640, 2000, 1700, 2000, 1628, 2000, 1700, 2000, 1620, 2000, 1700, 2000, 1608, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1588, 2000, 1700, 2000, 1580, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000, 1700, 2000, 1600, 2000],
"RAD_COV_IONIC_OB1_100_1", 0,
"RAD_COV_BODR_2014_02_22", 1,
"covalentVersion", 1,
"bondingVersion", 0,
"defaultBondingMars", [0, 0, 230, 320, 930, 460, 680, 1330, 350, 1020, 830, 850, 680, 750, 680, 710, 680, 630, 640, 640, 1120, 670, 970, 1550, 1100, 1390, 1350, 1260, 1200, 1160, 750, 1110, 1020, 1030, 990, 990, 1570, 960, 1330, 1960, 990, 1710, 1440, 1480, 1470, 1360, 1330, 1340, 1350, 1220, 1350, 1190, 1340, 1160, 1330, 1110, 1500, 1100, 1520, 1120, 1450, 1180, 1220, 1240, 1170, 1210, 1210, 1210, 1220, 1160, 1210, 1140, 1910, 1170, 1470, 2100, 1120, 1850, 1780, 1630, 1560, 1540, 1480, 1470, 1470, 1380, 1350, 1280, 1400, 1250, 1450, 1250, 1500, 1200, 1590, 1280, 1690, 1360, 1630, 1420, 1460, 1400, 1460, 1400, 1470, 1360, 1400, 1330, 1980, 1310, 1670, 2320, 1340, 1960, 1870, 1800, 1830, 1630, 1820, 1760, 1810, 1740, 1800, 1730, 1800, 1720, 1990, 1680, 1790, 1690, 1760, 1680, 1750, 1670, 1740, 1660, 1730, 1650, 1720, 1640, 1940, 1700, 1720, 1620, 1570, 1520, 1430, 1460, 1370, 1370, 1350, 1310, 1370, 1290, 1320, 1220, 1500, 1230, 1500, 1240, 1700, 1330, 1550, 1440, 1540, 1440, 1540, 1510, 1680, 1450, 1700, 1470, 2400, 1420, 2000, 2230, 1900, 2010, 1880, 1860, 1790, 1750, 1610, 1690, 1580, 1700, 1550, 1710, 1530, 1720, 1510, 1660, 1500, 1660, 1500, 1680, 1500, 1680, 1500, 1650, 1500, 1670, 1500, 1730, 1500, 1760, 1500, 1610, 1600, 1570, 1600, 1490, 1600, 1430, 1600, 1410, 1600, 1340, 1600, 1290],
"FORMAL_CHARGE_MIN", -4,
"FORMAL_CHARGE_MAX", 7,
"cationLookupTable", [53, 680, 69, 440, 70, 350, 85, 350, 87, 230, 104, 160, 117, 680, 119, 160, 121, 130, 133, 220, 138, 90, 155, 80, 165, 1120, 181, 970, 197, 820, 198, 660, 215, 510, 229, 650, 232, 420, 247, 440, 249, 350, 262, 2190, 264, 370, 266, 300, 281, 340, 283, 270, 293, 1540, 309, 1330, 325, 1180, 326, 990, 343, 732, 357, 960, 358, 940, 359, 760, 360, 680, 374, 880, 375, 740, 376, 630, 377, 590, 389, 810, 390, 890, 391, 630, 394, 520, 406, 800, 407, 660, 408, 600, 411, 460, 422, 740, 423, 640, 438, 720, 439, 630, 454, 690, 469, 960, 470, 720, 485, 880, 486, 740, 501, 810, 503, 620, 518, 730, 520, 530, 535, 580, 537, 460, 549, 660, 552, 500, 554, 420, 569, 470, 571, 390, 597, 1470, 614, 1120, 631, 893, 645, 1090, 648, 790, 661, 1000, 664, 740, 665, 690, 677, 930, 680, 700, 682, 620, 699, 979, 712, 670, 727, 680, 742, 800, 744, 650, 757, 1260, 758, 890, 773, 1140, 774, 970, 791, 810, 806, 930, 808, 710, 823, 760, 825, 620, 837, 820, 840, 700, 842, 560, 857, 620, 859, 500, 885, 1670, 901, 1530, 902, 1340, 917, 1390, 919, 1016, 933, 1270, 935, 1034, 936, 920, 951, 1013, 952, 900, 967, 995, 983, 979, 999, 964, 1014, 1090, 1015, 950, 1031, 938, 1047, 923, 1048, 840, 1063, 908, 1079, 894, 1095, 881, 1111, 870, 1126, 930, 1127, 858, 1143, 850, 1160, 780, 1177, 680, 1192, 700, 1194, 620, 1208, 720, 1211, 560, 1224, 880, 1226, 690, 1240, 680, 1254, 800, 1256, 650, 1269, 1370, 1271, 850, 1285, 1270, 1286, 1100, 1301, 1470, 1303, 950, 1318, 1200, 1320, 840, 1333, 980, 1335, 960, 1337, 740, 1354, 670, 1371, 620, 1397, 1800, 1414, 1430, 1431, 1180, 1448, 1020, 1463, 1130, 1464, 980, 1465, 890, 1480, 970, 1482, 800, 1495, 1100, 1496, 950, 1499, 710, 1511, 1080, 1512, 930, 1527, 1070, 1528, 920],
"anionLookupTable", [19, 1540, 96, 2600, 113, 1710, 130, 1360, 131, 680, 147, 1330, 241, 2120, 258, 1840, 275, 1810, 512, 2720, 529, 2220, 546, 1980, 563, 1960, 800, 2940, 803, 3700, 817, 2450, 834, 2110, 835, 2500, 851, 2200]);
c$.bsCations = c$.prototype.bsCations =  new JU.BS ();
c$.bsAnions = c$.prototype.bsAnions =  new JU.BS ();
{
for (var i = 0; i < JU.Elements.anionLookupTable.length; i += 2) JU.Elements.bsAnions.set (JU.Elements.anionLookupTable[i] >> 4);

for (var i = 0; i < JU.Elements.cationLookupTable.length; i += 2) JU.Elements.bsCations.set (JU.Elements.cationLookupTable[i] >> 4);

}Clazz_defineStatics (c$,
"hydrophobicities", [0, 0.62, -2.53, -0.78, -0.9, 0.29, -0.85, -0.74, 0.48, -0.4, 1.38, 1.06, -1.5, 0.64, 1.19, 0.12, -0.18, -0.05, 0.81, 0.26, 1.08]);
{
if ((JU.Elements.elementNames.length != JU.Elements.elementNumberMax) || (JU.Elements.vanderwaalsMars.length >> 2 != JU.Elements.elementNumberMax) || (JU.Elements.defaultBondingMars.length >> 1 != JU.Elements.elementNumberMax)) {
JU.Logger.error ("ERROR!!! Element table length mismatch:\n elementSymbols.length=" + JU.Elements.elementSymbols.length + "\n elementNames.length=" + JU.Elements.elementNames.length + "\n vanderwaalsMars.length=" + JU.Elements.vanderwaalsMars.length + "\n covalentMars.length=" + JU.Elements.defaultBondingMars.length);
}}Clazz_defineStatics (c$,
"electroNegativities", [0, 2.2, 0, 0.97, 1.47, 2.01, 2.5, 3.07, 3.5, 4.1, 0, 1.01, 1.23, 1.47, 1.74, 2.06, 2.44, 2.83, 0, 0.91, 1.04, 1.2, 1.32, 1.45, 1.56, 1.6, 1.64, 1.7, 1.75, 1.75, 1.66, 1.82, 2.02, 2.2, 2.48, 2.74, 0, 0.89, 0.99, 1.11, 1.22, 1.23, 1.3, 1.36, 1.42, 1.45, 1.35, 1.42, 1.46, 1.49, 1.72, 1.82, 2.01, 2.21]);
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.Escape", ["java.lang.Float", "java.util.Map", "JU.A4", "$.BS", "$.Lst", "$.M3", "$.M34", "$.M4", "$.P3", "$.P4", "$.PT", "$.Quat", "$.SB", "$.T3", "$.V3", "JS.SV"], function () {
c$ = Clazz_declareType (JU, "Escape");
c$.escapeColor = Clazz_defineMethod (c$, "escapeColor", 
function (argb) {
return (argb == 0 ? null : "[x" + JU.Escape.getHexColorFromRGB (argb) + "]");
}, "~N");
c$.getHexColorFromRGB = Clazz_defineMethod (c$, "getHexColorFromRGB", 
function (argb) {
if (argb == 0) return null;
var r = "00" + Integer.toHexString ((argb >> 16) & 0xFF);
r = r.substring (r.length - 2);
var g = "00" + Integer.toHexString ((argb >> 8) & 0xFF);
g = g.substring (g.length - 2);
var b = "00" + Integer.toHexString (argb & 0xFF);
b = b.substring (b.length - 2);
return r + g + b;
}, "~N");
c$.eP = Clazz_defineMethod (c$, "eP", 
function (xyz) {
if (xyz == null) return "null";
return "{" + xyz.x + " " + xyz.y + " " + xyz.z + "}";
}, "JU.T3");
c$.matrixToScript = Clazz_defineMethod (c$, "matrixToScript", 
function (m) {
return JU.PT.replaceAllCharacters (m.toString (), "\n\r ", "").$replace ('\t', ' ');
}, "~O");
c$.eP4 = Clazz_defineMethod (c$, "eP4", 
function (x) {
return "{" + x.x + " " + x.y + " " + x.z + " " + x.w + "}";
}, "JU.P4");
c$.drawQuat = Clazz_defineMethod (c$, "drawQuat", 
function (q, prefix, id, ptCenter, scale) {
var strV = " VECTOR " + JU.Escape.eP (ptCenter) + " ";
if (scale == 0) scale = 1;
return "draw " + prefix + "x" + id + strV + JU.Escape.eP (q.getVectorScaled (0, scale)) + " color red\n" + "draw " + prefix + "y" + id + strV + JU.Escape.eP (q.getVectorScaled (1, scale)) + " color green\n" + "draw " + prefix + "z" + id + strV + JU.Escape.eP (q.getVectorScaled (2, scale)) + " color blue\n";
}, "JU.Quat,~S,~S,JU.P3,~N");
c$.e = Clazz_defineMethod (c$, "e", 
function (x) {
if (x == null) return "null";
if (JU.PT.isNonStringPrimitive (x)) return x.toString ();
if (Clazz_instanceOf (x, String)) return JU.PT.esc (x);
if (Clazz_instanceOf (x, JU.Lst)) return JU.Escape.eV (x);
if (Clazz_instanceOf (x, java.util.Map)) return JU.Escape.escapeMap (x);
if (Clazz_instanceOf (x, JU.BS)) return JU.Escape.eBS (x);
if (Clazz_instanceOf (x, JU.T3)) return JU.Escape.eP (x);
if (Clazz_instanceOf (x, JU.P4)) return JU.Escape.eP4 (x);
if (JU.PT.isAS (x)) return JU.Escape.eAS (x, true);
if (Clazz_instanceOf (x, JU.M34)) return JU.PT.rep (x.toString (), "\t", ",\t");
if (Clazz_instanceOf (x, JU.A4)) {
var a = x;
return "{" + a.x + " " + a.y + " " + a.z + " " + (a.angle * 180 / 3.141592653589793) + "}";
}if (Clazz_instanceOf (x, JU.Quat)) return (x).toString ();
var s = JU.PT.nonArrayString (x);
return (s == null ? JU.PT.toJSON (null, x) : s);
}, "~O");
c$.eV = Clazz_defineMethod (c$, "eV", 
function (list) {
if (list == null) return JU.PT.esc ("");
var s =  new JU.SB ();
s.append ("[");
for (var i = 0; i < list.size (); i++) {
if (i > 0) s.append (", ");
s.append (JU.Escape.escapeNice (list.get (i).asString ()));
}
s.append ("]");
return s.toString ();
}, "JU.Lst");
c$.escapeMap = Clazz_defineMethod (c$, "escapeMap", 
function (ht) {
var sb =  new JU.SB ();
sb.append ("{ ");
var sep = "";
for (var entry, $entry = ht.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var key = entry.getKey ();
sb.append (sep).append (JU.PT.esc (key)).appendC (':');
var val = entry.getValue ();
if (!(Clazz_instanceOf (val, JS.SV))) val = JS.SV.getVariable (val);
sb.append ((val).escape ());
sep = ",";
}
sb.append (" }");
return sb.toString ();
}, "java.util.Map");
c$.escapeFloatA = Clazz_defineMethod (c$, "escapeFloatA", 
function (f, asArray) {
if (asArray) return JU.PT.toJSON (null, f);
var sb =  new JU.SB ();
for (var i = 0; i < f.length; i++) {
if (i > 0) sb.appendC ('\n');
sb.appendF (f[i]);
}
return sb.toString ();
}, "~A,~B");
c$.escapeFloatAA = Clazz_defineMethod (c$, "escapeFloatAA", 
function (f, addSemi) {
var sb =  new JU.SB ();
var eol = (addSemi ? ";\n" : "\n");
for (var i = 0; i < f.length; i++) if (f[i] != null) {
if (i > 0) sb.append (eol);
for (var j = 0; j < f[i].length; j++) sb.appendF (f[i][j]).appendC ('\t');

}
return sb.toString ();
}, "~A,~B");
c$.escapeFloatAAA = Clazz_defineMethod (c$, "escapeFloatAAA", 
function (f, addSemi) {
var sb =  new JU.SB ();
var eol = (addSemi ? ";\n" : "\n");
if (f[0] == null || f[0][0] == null) return "0 0 0" + eol;
sb.appendI (f.length).append (" ").appendI (f[0].length).append (" ").appendI (f[0][0].length);
for (var i = 0; i < f.length; i++) if (f[i] != null) {
sb.append (eol);
for (var j = 0; j < f[i].length; j++) if (f[i][j] != null) {
sb.append (eol);
for (var k = 0; k < f[i][j].length; k++) sb.appendF (f[i][j][k]).appendC ('\t');

}
}
return sb.toString ();
}, "~A,~B");
c$.eAS = Clazz_defineMethod (c$, "eAS", 
function (list, nicely) {
if (list == null) return JU.PT.esc ("");
var s =  new JU.SB ();
s.append ("[");
for (var i = 0; i < list.length; i++) {
if (i > 0) s.append (", ");
s.append (nicely ? JU.Escape.escapeNice (list[i]) : JU.PT.esc (list[i]));
}
s.append ("]");
return s.toString ();
}, "~A,~B");
c$.eAI = Clazz_defineMethod (c$, "eAI", 
function (ilist) {
if (ilist == null) return JU.PT.esc ("");
var s =  new JU.SB ();
s.append ("[");
for (var i = 0; i < ilist.length; i++) {
if (i > 0) s.append (", ");
s.appendI (ilist[i]);
}
return s.append ("]").toString ();
}, "~A");
c$.eAD = Clazz_defineMethod (c$, "eAD", 
function (dlist) {
if (dlist == null) return JU.PT.esc ("");
var s =  new JU.SB ();
s.append ("[");
for (var i = 0; i < dlist.length; i++) {
if (i > 0) s.append (", ");
s.appendD (dlist[i]);
}
return s.append ("]").toString ();
}, "~A");
c$.eAF = Clazz_defineMethod (c$, "eAF", 
function (flist) {
if (flist == null) return JU.PT.esc ("");
var s =  new JU.SB ();
s.append ("[");
for (var i = 0; i < flist.length; i++) {
if (i > 0) s.append (", ");
s.appendF (flist[i]);
}
return s.append ("]").toString ();
}, "~A");
c$.eAP = Clazz_defineMethod (c$, "eAP", 
function (plist) {
if (plist == null) return JU.PT.esc ("");
var s =  new JU.SB ();
s.append ("[");
for (var i = 0; i < plist.length; i++) {
if (i > 0) s.append (", ");
s.append (JU.Escape.eP (plist[i]));
}
return s.append ("]").toString ();
}, "~A");
c$.escapeNice = Clazz_defineMethod (c$, "escapeNice", 
 function (s) {
if (s == null) return "null";
var f = JU.PT.parseFloatStrict (s);
return (Float.isNaN (f) ? JU.PT.esc (s) : s);
}, "~S");
c$.uABsM = Clazz_defineMethod (c$, "uABsM", 
function (s) {
if (s.charAt (0) == '{') return JU.Escape.uP (s);
if ((JU.Escape.isStringArray (s) || s.startsWith ("[{") && s.indexOf ("[{") == s.lastIndexOf ("[{")) && s.indexOf (',') < 0 && s.indexOf ('.') < 0 && s.indexOf ('-') < 0) return JU.BS.unescape (s);
if (s.startsWith ("[[")) return JU.Escape.unescapeMatrix (s);
return s;
}, "~S");
c$.isStringArray = Clazz_defineMethod (c$, "isStringArray", 
function (s) {
return s.startsWith ("({") && s.lastIndexOf ("({") == 0 && s.indexOf ("})") == s.length - 2;
}, "~S");
c$.uP = Clazz_defineMethod (c$, "uP", 
function (strPoint) {
if (strPoint == null || strPoint.length == 0) return strPoint;
var str = strPoint.$replace ('\n', ' ').trim ();
if (str.charAt (0) != '{' || str.charAt (str.length - 1) != '}') return strPoint;
var points =  Clazz_newFloatArray (5, 0);
var nPoints = 0;
str = str.substring (1, str.length - 1);
var next =  Clazz_newIntArray (1, 0);
for (; nPoints < 5; nPoints++) {
points[nPoints] = JU.PT.parseFloatNext (str, next);
if (Float.isNaN (points[nPoints])) {
if (next[0] >= str.length || str.charAt (next[0]) != ',') break;
next[0]++;
nPoints--;
}}
if (nPoints == 3) return JU.P3.new3 (points[0], points[1], points[2]);
if (nPoints == 4) return JU.P4.new4 (points[0], points[1], points[2], points[3]);
return strPoint;
}, "~S");
c$.unescapeMatrix = Clazz_defineMethod (c$, "unescapeMatrix", 
function (strMatrix) {
if (strMatrix == null || strMatrix.length == 0) return strMatrix;
var str = strMatrix.$replace ('\n', ' ').trim ();
if (str.lastIndexOf ("[[") != 0 || str.indexOf ("]]") != str.length - 2) return strMatrix;
var points =  Clazz_newFloatArray (16, 0);
str = str.substring (2, str.length - 2).$replace ('[', ' ').$replace (']', ' ').$replace (',', ' ');
var next =  Clazz_newIntArray (1, 0);
var nPoints = 0;
for (; nPoints < 16; nPoints++) {
points[nPoints] = JU.PT.parseFloatNext (str, next);
if (Float.isNaN (points[nPoints])) {
break;
}}
if (!Float.isNaN (JU.PT.parseFloatNext (str, next))) return strMatrix;
if (nPoints == 9) return JU.M3.newA9 (points);
if (nPoints == 16) return JU.M4.newA16 (points);
return strMatrix;
}, "~S");
c$.eBS = Clazz_defineMethod (c$, "eBS", 
function (bs) {
return JU.BS.escape (bs, '(', ')');
}, "JU.BS");
c$.eBond = Clazz_defineMethod (c$, "eBond", 
function (bs) {
return JU.BS.escape (bs, '[', ']');
}, "JU.BS");
c$.toReadable = Clazz_defineMethod (c$, "toReadable", 
function (name, info) {
var sb =  new JU.SB ();
var sep = "";
if (info == null) return "null";
if (JU.PT.isNonStringPrimitive (info)) return JU.Escape.packageReadable (name, null, info.toString ());
if (Clazz_instanceOf (info, String)) return JU.Escape.packageReadable (name, null, JU.PT.esc (info));
if (Clazz_instanceOf (info, JS.SV)) return JU.Escape.packageReadable (name, null, (info).escape ());
if (JU.PT.isAS (info)) {
sb.append ("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).append (JU.PT.esc ((info)[i]));
sep = ",";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "String[" + imax + "]", sb);
}if (JU.PT.isAI (info)) {
sb.append ("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).appendI ((info)[i]);
sep = ",";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "int[" + imax + "]", sb);
}if (JU.PT.isAF (info)) {
sb.append ("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).appendF ((info)[i]);
sep = ",";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "float[" + imax + "]", sb);
}if (JU.PT.isAD (info)) {
sb.append ("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).appendD ((info)[i]);
sep = ",";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "double[" + imax + "]", sb);
}if (JU.PT.isAP (info)) {
sb.append ("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).append (JU.Escape.eP ((info)[i]));
sep = ",";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "point3f[" + imax + "]", sb);
}if (JU.PT.isASS (info)) {
sb.append ("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).append (JU.Escape.toReadable (null, (info)[i]));
sep = ",\n";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "String[" + imax + "][]", sb);
}if (JU.PT.isAII (info)) {
sb.append ("[");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).append (JU.Escape.toReadable (null, (info)[i]));
sep = ",";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "int[" + imax + "][]", sb);
}if (JU.PT.isAFF (info)) {
sb.append ("[\n");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).append (JU.Escape.toReadable (null, (info)[i]));
sep = ",\n";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "float[][]", sb);
}if (JU.PT.isADD (info)) {
sb.append ("[\n");
var imax = (info).length;
for (var i = 0; i < imax; i++) {
sb.append (sep).append (JU.Escape.toReadable (null, (info)[i]));
sep = ",\n";
}
sb.append ("]");
return JU.Escape.packageReadableSb (name, "double[][]", sb);
}if (Clazz_instanceOf (info, JU.Lst)) {
var imax = (info).size ();
for (var i = 0; i < imax; i++) {
sb.append (JU.Escape.toReadable (name + "[" + (i + 1) + "]", (info).get (i)));
}
return JU.Escape.packageReadableSb (name, "List[" + imax + "]", sb);
}if (Clazz_instanceOf (info, JU.M34) || Clazz_instanceOf (info, JU.T3) || Clazz_instanceOf (info, JU.P4) || Clazz_instanceOf (info, JU.A4)) {
sb.append (JU.Escape.e (info));
return JU.Escape.packageReadableSb (name, null, sb);
}if (Clazz_instanceOf (info, java.util.Map)) {
var e = (info).keySet ().iterator ();
while (e.hasNext ()) {
var key = e.next ();
sb.append (JU.Escape.toReadable ((name == null ? "" : name + ".") + key, (info).get (key)));
}
return sb.toString ();
}return JU.Escape.packageReadable (name, null, JU.PT.toJSON (null, info));
}, "~S,~O");
c$.packageReadableSb = Clazz_defineMethod (c$, "packageReadableSb", 
 function (infoName, infoType, sb) {
return JU.Escape.packageReadable (infoName, infoType, sb.toString ());
}, "~S,~S,JU.SB");
c$.packageReadable = Clazz_defineMethod (c$, "packageReadable", 
 function (infoName, infoType, info) {
var s = (infoType == null ? "" : infoType + "\t");
if (infoName == null) return s + info;
return "\n" + infoName + "\t" + (infoType == null ? "" : "*" + infoType + "\t") + info;
}, "~S,~S,~S");
c$.escapeModelFileNumber = Clazz_defineMethod (c$, "escapeModelFileNumber", 
function (iv) {
return "" + (Clazz_doubleToInt (iv / 1000000)) + "." + (iv % 1000000);
}, "~N");
c$.encapsulateData = Clazz_defineMethod (c$, "encapsulateData", 
function (name, data, depth) {
return "  DATA \"" + name + "\"\n" + (depth == 2 ? JU.Escape.escapeFloatAA (data, true) + ";\n" : depth == 3 ? JU.Escape.escapeFloatAAA (data, true) + ";\n" : data) + "    END \"" + name + "\";\n";
}, "~S,~O,~N");
c$.unescapeUnicode = Clazz_defineMethod (c$, "unescapeUnicode", 
function (s) {
var ichMax = s.length;
var sb = JU.SB.newN (ichMax);
var ich = 0;
while (ich < ichMax) {
var ch = s.charAt (ich++);
if (ch == '\\' && ich < ichMax) {
ch = s.charAt (ich++);
switch (ch) {
case 'u':
if (ich < ichMax) {
var unicode = 0;
for (var k = 4; --k >= 0 && ich < ichMax; ) {
var chT = s.charAt (ich);
var hexit = JU.Escape.getHexitValue (chT);
if (hexit < 0) break;
unicode <<= 4;
unicode += hexit;
++ich;
}
ch = String.fromCharCode (unicode);
}}
}sb.appendC (ch);
}
return sb.toString ();
}, "~S");
c$.getHexitValue = Clazz_defineMethod (c$, "getHexitValue", 
function (ch) {
if (ch.charCodeAt (0) >= 48 && ch.charCodeAt (0) <= 57) return ch.charCodeAt (0) - 48;
 else if (ch.charCodeAt (0) >= 97 && ch.charCodeAt (0) <= 102) return 10 + ch.charCodeAt (0) - 97;
 else if (ch.charCodeAt (0) >= 65 && ch.charCodeAt (0) <= 70) return 10 + ch.charCodeAt (0) - 65;
 else return -1;
}, "~S");
c$.unescapeStringArray = Clazz_defineMethod (c$, "unescapeStringArray", 
function (data) {
if (data == null || !data.startsWith ("[") || !data.endsWith ("]")) return null;
var v =  new JU.Lst ();
var next =  Clazz_newIntArray (1, 0);
next[0] = 1;
while (next[0] < data.length) {
var s = JU.PT.getQuotedStringNext (data, next);
if (s == null) return null;
v.addLast (JU.PT.rep (s, "\\\"", "\""));
while (next[0] < data.length && data.charAt (next[0]) != '"') next[0]++;

}
return v.toArray ( new Array (v.size ()));
}, "~S");
c$.isAV = Clazz_defineMethod (c$, "isAV", 
function (x) {
{
return Clazz_instanceOf(x[0], JS.SV);
}}, "~O");
c$.escapeHelical = Clazz_defineMethod (c$, "escapeHelical", 
function (id, tokType, a, b, pts) {
switch (tokType) {
case 135266320:
return (pts == null ?  new JU.P3 () : pts[0]);
case 1073741854:
case 1666189314:
return (pts == null ?  new JU.V3 () : pts[tokType == 1073741854 ? 1 : 2]);
case 135266305:
return Float.$valueOf (pts == null ? NaN : pts[3].x);
case 135176:
return (pts == null ? "" : "draw ID \"" + id + "\" VECTOR " + JU.Escape.eP (pts[0]) + " " + JU.Escape.eP (pts[1]) + " color " + (pts[3].x < 0 ? "{255.0 200.0 0.0}" : "{255.0 0.0 128.0}"));
case 1746538509:
return (pts == null ? "" : "measure " + JU.Escape.eP (a) + JU.Escape.eP (pts[0]) + JU.Escape.eP (pts[4])) + JU.Escape.eP (b);
default:
return (pts == null ?  new Array (0) : pts);
}
}, "~S,~N,JU.P3,JU.P3,~A");
});
Clazz_declarePackage ("JU");
Clazz_load (["J.api.JmolGraphicsInterface", "JU.Normix"], "JU.GData", ["javajs.awt.Font", "JU.AU", "$.P3", "$.V3", "JU.C", "$.Shader"], function () {
c$ = Clazz_decorateAsClass (function () {
this.apiPlatform = null;
this.translucentCoverOnly = false;
this.currentlyRendering = false;
this.antialiasEnabled = false;
this.windowWidth = 0;
this.windowHeight = 0;
this.displayMinX = 0;
this.displayMaxX = 0;
this.displayMinY = 0;
this.displayMaxY = 0;
this.antialiasThisFrame = false;
this.inGreyscaleMode = false;
this.changeableColixMap = null;
this.backgroundImage = null;
this.newWindowWidth = 0;
this.newWindowHeight = 0;
this.newAntialiasing = false;
this.bgcolor = 0;
this.xLast = 0;
this.yLast = 0;
this.slab = 0;
this.depth = 0;
this.width = 0;
this.height = 0;
this.zSlab = 0;
this.zDepth = 0;
this.zShadePower = 3;
this.ambientOcclusion = 0;
this.colixCurrent = 0;
this.argbCurrent = 0;
this.ht3 = 0;
this.isPass2 = false;
this.textY = 0;
this.bufferSize = 0;
this.shader = null;
this.vwr = null;
this.zShadeR = 0;
this.zShadeG = 0;
this.zShadeB = 0;
this.graphicsForMetrics = null;
this.argbNoisyUp = 0;
this.argbNoisyDn = 0;
this.transformedVectors = null;
this.currentFont = null;
Clazz_instantialize (this, arguments);
}, JU, "GData", null, J.api.JmolGraphicsInterface);
Clazz_prepareFields (c$, function () {
this.changeableColixMap =  Clazz_newShortArray (16, 0);
this.transformedVectors =  new Array (JU.GData.normixCount);
});
Clazz_makeConstructor (c$, 
function () {
this.shader =  new JU.Shader ();
});
Clazz_defineMethod (c$, "initialize", 
function (vwr, apiPlatform) {
this.vwr = vwr;
this.apiPlatform = apiPlatform;
}, "JV.Viewer,javajs.api.GenericPlatform");
Clazz_overrideMethod (c$, "setDepth", 
function (depthValue) {
this.depth = depthValue < 0 ? 0 : depthValue;
}, "~N");
Clazz_overrideMethod (c$, "setSlab", 
function (slabValue) {
this.slab = Math.max (0, slabValue);
}, "~N");
Clazz_defineMethod (c$, "setZShade", 
function (zShade, zSlab, zDepth, zPower) {
if (zShade) this.setZShade2 (zSlab, zDepth, zPower);
}, "~B,~N,~N,~N");
Clazz_defineMethod (c$, "setZShade2", 
function (zSlab, zDepth, zPower) {
this.zShadeR = this.bgcolor & 0xFF;
this.zShadeG = (this.bgcolor & 0xFF00) >> 8;
this.zShadeB = (this.bgcolor & 0xFF0000) >> 16;
this.zSlab = zSlab < 0 ? 0 : zSlab;
this.zDepth = zDepth < 0 ? 0 : zDepth;
this.zShadePower = zPower;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setAmbientOcclusion", 
function (value) {
this.ambientOcclusion = value;
}, "~N");
Clazz_overrideMethod (c$, "isAntialiased", 
function () {
return this.antialiasThisFrame;
});
Clazz_defineMethod (c$, "getChangeableColix", 
function (id, argb) {
if (id >= this.changeableColixMap.length) this.changeableColixMap = JU.AU.arrayCopyShort (this.changeableColixMap, id + 16);
if (this.changeableColixMap[id] == 0) this.changeableColixMap[id] = JU.C.getColix (argb);
return (id | -32768);
}, "~N,~N");
Clazz_defineMethod (c$, "changeColixArgb", 
function (id, argb) {
if (id < this.changeableColixMap.length && this.changeableColixMap[id] != 0) this.changeableColixMap[id] = JU.C.getColix (argb);
}, "~N,~N");
Clazz_defineMethod (c$, "getColorArgbOrGray", 
function (colix) {
if (colix < 0) colix = this.changeableColixMap[colix & 2047];
return (this.inGreyscaleMode ? JU.C.getArgbGreyscale (colix) : JU.C.getArgb (colix));
}, "~N");
Clazz_defineMethod (c$, "getShades", 
function (colix) {
if (colix < 0) colix = this.changeableColixMap[colix & 2047];
return (this.inGreyscaleMode ? this.shader.getShadesG (colix) : this.shader.getShades (colix));
}, "~N");
Clazz_defineMethod (c$, "setGreyscaleMode", 
function (greyscaleMode) {
this.inGreyscaleMode = greyscaleMode;
}, "~B");
Clazz_defineMethod (c$, "getSpecularPower", 
function () {
return this.shader.specularPower;
});
Clazz_defineMethod (c$, "setSpecularPower", 
function (val) {
if (val < 0) {
this.setSpecularExponent (-val);
return;
}if (this.shader.specularPower == val) return;
this.shader.specularPower = val;
this.shader.intenseFraction = val / 100;
this.shader.flushCaches ();
}, "~N");
Clazz_defineMethod (c$, "getSpecularPercent", 
function () {
return this.shader.specularPercent;
});
Clazz_defineMethod (c$, "setSpecularPercent", 
function (val) {
if (this.shader.specularPercent == val) return;
this.shader.specularPercent = val;
this.shader.specularFactor = val / 100;
this.shader.flushCaches ();
}, "~N");
Clazz_defineMethod (c$, "getSpecularExponent", 
function () {
return this.shader.specularExponent;
});
Clazz_defineMethod (c$, "setSpecularExponent", 
function (val) {
if (this.shader.specularExponent == val) return;
this.shader.specularExponent = val;
this.shader.phongExponent = Clazz_doubleToInt (Math.pow (2, val));
this.shader.usePhongExponent = false;
this.shader.flushCaches ();
}, "~N");
Clazz_defineMethod (c$, "getPhongExponent", 
function () {
return this.shader.phongExponent;
});
Clazz_defineMethod (c$, "setPhongExponent", 
function (val) {
if (this.shader.phongExponent == val && this.shader.usePhongExponent) return;
this.shader.phongExponent = val;
var x = (Math.log (val) / Math.log (2));
this.shader.usePhongExponent = (x != Clazz_floatToInt (x));
if (!this.shader.usePhongExponent) this.shader.specularExponent = Clazz_floatToInt (x);
this.shader.flushCaches ();
}, "~N");
Clazz_defineMethod (c$, "getDiffusePercent", 
function () {
return this.shader.diffusePercent;
});
Clazz_defineMethod (c$, "setDiffusePercent", 
function (val) {
if (this.shader.diffusePercent == val) return;
this.shader.diffusePercent = val;
this.shader.diffuseFactor = val / 100;
this.shader.flushCaches ();
}, "~N");
Clazz_defineMethod (c$, "getAmbientPercent", 
function () {
return this.shader.ambientPercent;
});
Clazz_defineMethod (c$, "setAmbientPercent", 
function (val) {
if (this.shader.ambientPercent == val) return;
this.shader.ambientPercent = val;
this.shader.ambientFraction = val / 100;
this.shader.flushCaches ();
}, "~N");
Clazz_defineMethod (c$, "getSpecular", 
function () {
return this.shader.specularOn;
});
Clazz_defineMethod (c$, "setSpecular", 
function (val) {
if (this.shader.specularOn == val) return;
this.shader.specularOn = val;
this.shader.flushCaches ();
}, "~B");
Clazz_defineMethod (c$, "setCel", 
function (val) {
this.shader.setCel (val, this.shader.celPower, this.bgcolor);
}, "~B");
Clazz_defineMethod (c$, "getCel", 
function () {
return this.shader.celOn;
});
Clazz_defineMethod (c$, "getCelPower", 
function () {
return this.shader.celPower;
});
Clazz_defineMethod (c$, "setCelPower", 
function (celPower) {
this.shader.setCel (this.shader.celOn || this.shader.celPower == 0, celPower, this.bgcolor);
}, "~N");
Clazz_defineMethod (c$, "getLightSource", 
function () {
return this.shader.lightSource;
});
Clazz_defineMethod (c$, "isClipped3", 
function (x, y, z) {
return (x < 0 || x >= this.width || y < 0 || y >= this.height || z < this.slab || z > this.depth);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "isClipped", 
function (x, y) {
return (x < 0 || x >= this.width || y < 0 || y >= this.height);
}, "~N,~N");
Clazz_overrideMethod (c$, "isInDisplayRange", 
function (x, y) {
return (x >= this.displayMinX && x < this.displayMaxX && y >= this.displayMinY && y < this.displayMaxY);
}, "~N,~N");
Clazz_overrideMethod (c$, "isClippedXY", 
function (diameter, x, y) {
var r = (diameter + 1) >> 1;
return (x < -r || x >= this.width + r || y < -r || y >= this.height + r);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "isClippedZ", 
function (z) {
return (z != -2147483648 && (z < this.slab || z > this.depth));
}, "~N");
Clazz_defineMethod (c$, "clipCode3", 
function (x, y, z) {
var code = 0;
if (x < 0) code |= 8;
 else if (x >= this.width) code |= 4;
if (y < 0) code |= 2;
 else if (y >= this.height) code |= 1;
if (z < this.slab) code |= 32;
 else if (z > this.depth) code |= 16;
return code;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "clipCode", 
function (z) {
var code = 0;
if (z < this.slab) code |= 32;
 else if (z > this.depth) code |= 16;
return code;
}, "~N");
Clazz_defineMethod (c$, "getFont3D", 
function (fontSize) {
return javajs.awt.Font.createFont3D (0, 0, fontSize, fontSize, this.apiPlatform, this.graphicsForMetrics);
}, "~N");
Clazz_defineMethod (c$, "getFont3DFS", 
function (fontFace, fontSize) {
return javajs.awt.Font.createFont3D (javajs.awt.Font.getFontFaceID (fontFace), 0, fontSize, fontSize, this.apiPlatform, this.graphicsForMetrics);
}, "~S,~N");
Clazz_defineMethod (c$, "getFontFidFS", 
function (fontFace, fontSize) {
return this.getFont3DFSS (fontFace, "Bold", fontSize).fid;
}, "~S,~N");
Clazz_defineMethod (c$, "getFont3DFSS", 
function (fontFace, fontStyle, fontSize) {
var iStyle = javajs.awt.Font.getFontStyleID (fontStyle);
if (iStyle < 0) iStyle = 0;
return javajs.awt.Font.createFont3D (javajs.awt.Font.getFontFaceID (fontFace), iStyle, fontSize, fontSize, this.apiPlatform, this.graphicsForMetrics);
}, "~S,~S,~N");
Clazz_defineMethod (c$, "getFont3DScaled", 
function (font, scale) {
var newScale = font.fontSizeNominal * scale;
return (newScale == font.fontSize ? font : javajs.awt.Font.createFont3D (font.idFontFace, font.idFontStyle, newScale, font.fontSizeNominal, this.apiPlatform, this.graphicsForMetrics));
}, "javajs.awt.Font,~N");
Clazz_defineMethod (c$, "getFontFid", 
function (fontSize) {
return this.getFont3D (fontSize).fid;
}, "~N");
Clazz_defineMethod (c$, "setBackgroundTransparent", 
function (TF) {
}, "~B");
Clazz_defineMethod (c$, "setBackgroundArgb", 
function (argb) {
this.bgcolor = argb;
this.setCel (this.shader.celOn);
}, "~N");
Clazz_defineMethod (c$, "setBackgroundImage", 
function (image) {
this.backgroundImage = image;
}, "~O");
Clazz_defineMethod (c$, "setWindowParameters", 
function (width, height, antialias) {
this.setWinParams (width, height, antialias);
}, "~N,~N,~B");
Clazz_defineMethod (c$, "setWinParams", 
function (width, height, antialias) {
this.newWindowWidth = width;
this.newWindowHeight = height;
this.newAntialiasing = antialias;
}, "~N,~N,~B");
Clazz_defineMethod (c$, "setNewWindowParametersForExport", 
function () {
this.windowWidth = this.newWindowWidth;
this.windowHeight = this.newWindowHeight;
this.setWidthHeight (false);
});
Clazz_defineMethod (c$, "setWidthHeight", 
function (isAntialiased) {
this.width = this.windowWidth;
this.height = this.windowHeight;
if (isAntialiased) {
this.width <<= 1;
this.height <<= 1;
}this.xLast = this.width - 1;
this.yLast = this.height - 1;
this.displayMinX = -(this.width >> 1);
this.displayMaxX = this.width - this.displayMinX;
this.displayMinY = -(this.height >> 1);
this.displayMaxY = this.height - this.displayMinY;
this.ht3 = this.height * 3;
this.bufferSize = this.width * this.height;
}, "~B");
Clazz_defineMethod (c$, "beginRendering", 
function (stereoRotationMatrix, translucentMode, isImageWrite, renderLow) {
}, "JU.M3,~B,~B,~B");
Clazz_defineMethod (c$, "endRendering", 
function () {
});
Clazz_defineMethod (c$, "snapshotAnaglyphChannelBytes", 
function () {
});
Clazz_defineMethod (c$, "getScreenImage", 
function (isImageWrite) {
return null;
}, "~B");
Clazz_defineMethod (c$, "releaseScreenImage", 
function () {
});
Clazz_defineMethod (c$, "applyAnaglygh", 
function (stereoMode, stereoColors) {
}, "J.c.STER,~A");
Clazz_defineMethod (c$, "setPass2", 
function (antialias) {
return false;
}, "~B");
Clazz_defineMethod (c$, "destroy", 
function () {
});
Clazz_defineMethod (c$, "clearFontCache", 
function () {
});
Clazz_defineMethod (c$, "plotImage", 
function (x, y, z, image, jmolRenderer, bgcolix, width, height) {
}, "~N,~N,~N,~O,J.api.JmolRendererInterface,~N,~N,~N");
Clazz_defineMethod (c$, "plotText", 
function (x, y, z, colorArgbOrGray, bgColor, text, font3d, jmolRenderer) {
}, "~N,~N,~N,~N,~N,~S,javajs.awt.Font,J.api.JmolRendererInterface");
Clazz_defineMethod (c$, "renderBackground", 
function (jmolRenderer) {
}, "J.api.JmolRendererInterface");
Clazz_defineMethod (c$, "setFont", 
function (font3d) {
}, "javajs.awt.Font");
Clazz_defineMethod (c$, "setFontFid", 
function (fid) {
}, "~N");
Clazz_defineMethod (c$, "setColor", 
function (argb) {
this.argbCurrent = this.argbNoisyUp = this.argbNoisyDn = argb;
}, "~N");
Clazz_defineMethod (c$, "setC", 
function (colix) {
return true;
}, "~N");
Clazz_defineMethod (c$, "isDirectedTowardsCamera", 
function (normix) {
return (normix < 0) || (this.transformedVectors[normix].z > 0);
}, "~N");
c$.roundInt = Clazz_defineMethod (c$, "roundInt", 
function (a) {
{
return a;
}}, "~N");
Clazz_defineMethod (c$, "clear", 
function () {
});
Clazz_overrideMethod (c$, "renderAllStrings", 
function (jmolRenderer) {
}, "~O");
Clazz_defineMethod (c$, "addRenderer", 
function (tok) {
}, "~N");
c$.getHermiteList = Clazz_defineMethod (c$, "getHermiteList", 
function (tension, p0, p1, p2, p3, p4, list, index0, n, isPt) {
var nPoints = n + 1;
var fnPoints = n - 1;
var x1 = p1.x;
var y1 = p1.y;
var z1 = p1.z;
var x2 = p2.x;
var y2 = p2.y;
var z2 = p2.z;
var xT1 = ((x2 - p0.x) * tension) / 8;
var yT1 = ((y2 - p0.y) * tension) / 8;
var zT1 = ((z2 - p0.z) * tension) / 8;
var xT2 = ((p3.x - x1) * tension) / 8;
var yT2 = ((p3.y - y1) * tension) / 8;
var zT2 = ((p3.z - z1) * tension) / 8;
var xT3 = ((p4.x - x2) * tension) / 8;
var yT3 = ((p4.y - y2) * tension) / 8;
var zT3 = ((p4.z - z2) * tension) / 8;
list[index0] = p1;
for (var i = 0; i < nPoints; i++) {
var s = i / fnPoints;
if (i == nPoints - 1) {
x1 = x2;
y1 = y2;
z1 = z2;
x2 = p3.x;
y2 = p3.y;
z2 = p3.z;
xT1 = xT2;
yT1 = yT2;
zT1 = zT2;
xT2 = xT3;
yT2 = yT3;
zT2 = zT3;
s -= 1;
}var s2 = s * s;
var s3 = s2 * s;
var h1 = 2 * s3 - 3 * s2 + 1;
var h2 = -2 * s3 + 3 * s2;
var h3 = s3 - 2 * s2 + s;
var h4 = s3 - s2;
var x = (h1 * x1 + h2 * x2 + h3 * xT1 + h4 * xT2);
var y = (h1 * y1 + h2 * y2 + h3 * yT1 + h4 * yT2);
var z = (h1 * z1 + h2 * z2 + h3 * zT1 + h4 * zT2);
list[index0 + i] = (isPt ? JU.P3.new3 (x, y, z) : JU.V3.new3 (x, y, z));
}
}, "~N,JU.T3,JU.T3,JU.T3,JU.T3,JU.T3,~A,~N,~N,~B");
Clazz_defineMethod (c$, "setTextPosition", 
function (y) {
this.textY = y;
}, "~N");
Clazz_defineMethod (c$, "getTextPosition", 
function () {
return this.textY;
});
Clazz_defineMethod (c$, "getTransformedVertexVectors", 
function () {
return this.transformedVectors;
});
Clazz_defineMethod (c$, "getFont3DCurrent", 
function () {
return this.currentFont;
});
Clazz_defineStatics (c$,
"ENDCAPS_NONE", 0,
"ENDCAPS_OPEN", 1,
"ENDCAPS_FLAT", 2,
"ENDCAPS_SPHERICAL", 3,
"ENDCAPS_OPENEND", 4,
"EXPORT_RAYTRACER", 2,
"EXPORT_CARTESIAN", 1,
"EXPORT_NOT", 0,
"yGT", 1,
"yLT", 2,
"xGT", 4,
"xLT", 8,
"zGT", 16,
"zLT", 32);
c$.normixCount = c$.prototype.normixCount = JU.Normix.getNormixCount ();
});
Clazz_declarePackage ("JU");
Clazz_load (["J.api.JmolAppletInterface", "$.JmolStatusListener"], "JU.GenericApplet", ["java.lang.Boolean", "java.net.URL", "java.util.Hashtable", "javajs.awt.Dimension", "JU.Lst", "$.PT", "$.SB", "J.c.CBK", "J.i18n.GT", "JU.Logger", "JV.JC", "$.Viewer"], function () {
c$ = Clazz_decorateAsClass (function () {
this.isJS = false;
this.codeBase = null;
this.documentBase = null;
this.isSigned = false;
this.language = null;
this.doTranslate = true;
this.haveDocumentAccess = false;
this.isStereoSlave = false;
this.mayScript = false;
this.htmlName = null;
this.fullName = null;
this.statusForm = null;
this.statusText = null;
this.statusTextarea = null;
this.gRight = null;
this.viewer = null;
this.b$ = null;
this.vwrOptions = null;
this.haveNotifiedError = false;
this.appletObject = null;
this.isJNLP = false;
this.loading = false;
this.syncId = null;
this.outputBuffer = null;
Clazz_instantialize (this, arguments);
}, JU, "GenericApplet", null, [J.api.JmolAppletInterface, J.api.JmolStatusListener]);
Clazz_defineMethod (c$, "init", 
function (applet) {
this.b$ =  new java.util.Hashtable ();
if (JU.GenericApplet.htRegistry == null) JU.GenericApplet.htRegistry =  new java.util.Hashtable ();
this.appletObject = applet;
this.htmlName = JU.PT.split ("" + this.getJmolParameter ("name"), "_object")[0];
this.syncId = this.getJmolParameter ("syncId");
this.fullName = this.htmlName + "__" + this.syncId + "__";
System.out.println ("Jmol JavaScript applet " + this.fullName + " initializing");
var iLevel = (this.getValue ("logLevel", (this.getBooleanValue ("debug", false) ? "5" : "4"))).charCodeAt (0) - 48;
if (iLevel != 4) System.out.println ("setting logLevel=" + iLevel + " -- To change, use script \"set logLevel [0-5]\"");
JU.Logger.setLogLevel (iLevel);
J.i18n.GT.ignoreApplicationBundle ();
this.initOptions ();
JU.GenericApplet.checkIn (this.fullName, this.appletObject);
this.initApplication ();
}, "~O");
Clazz_defineMethod (c$, "initApplication", 
 function () {
this.vwrOptions.put ("applet", Boolean.TRUE);
if (this.getJmolParameter ("statusListener") == null) this.vwrOptions.put ("statusListener", this);
this.viewer =  new JV.Viewer (this.vwrOptions);
this.viewer.pushHoldRepaint ();
var emulate = this.getValueLowerCase ("emulate", "jmol");
this.setStringProperty ("defaults", emulate.equals ("chime") ? "RasMol" : "Jmol");
this.setStringProperty ("backgroundColor", this.getValue ("bgcolor", this.getValue ("boxbgcolor", "black")));
this.viewer.setBooleanProperty ("frank", true);
this.loading = true;
for (var item, $item = 0, $$item = J.c.CBK.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) this.setValue (item.name () + "Callback", null);

this.loading = false;
this.language = this.getJmolParameter ("language");
 new J.i18n.GT (this.viewer, this.language);
if (this.language != null) System.out.print ("requested language=" + this.language + "; ");
this.doTranslate = (!"none".equals (this.language) && this.getBooleanValue ("doTranslate", true));
this.language = J.i18n.GT.getLanguage ();
System.out.println ("language=" + this.language);
if (this.b$.get (J.c.CBK.SCRIPT) == null && this.b$.get (J.c.CBK.ERROR) == null) if (this.b$.get (J.c.CBK.MESSAGE) != null || this.statusForm != null || this.statusText != null) {
if (this.doTranslate && (this.getValue ("doTranslate", null) == null)) {
this.doTranslate = false;
JU.Logger.warn ("Note -- Presence of message callback disables disable translation; to enable message translation use jmolSetTranslation(true) prior to jmolApplet()");
}if (this.doTranslate) JU.Logger.warn ("Note -- Automatic language translation may affect parsing of message callbacks messages; use scriptCallback or errorCallback to process errors");
}if (!this.doTranslate) {
J.i18n.GT.setDoTranslate (false);
JU.Logger.warn ("Note -- language translation disabled");
}if (!this.getBooleanValue ("popupMenu", true)) this.viewer.getProperty ("DATA_API", "disablePopupMenu", null);
var menuFile = this.getJmolParameter ("menuFile");
if (menuFile != null) this.viewer.setMenu (menuFile, true);
var script = this.getValue ("script", "");
var loadParam = this.getValue ("loadInline", null);
if (loadParam == null) {
if ((loadParam = this.getValue ("load", null)) != null) script = "load \"" + loadParam + "\";" + script;
loadParam = null;
}this.viewer.popHoldRepaint ("applet init");
if (loadParam != null && this.viewer.loadInline (loadParam) != null) script = "";
if (script.length > 0) this.scriptProcessor (script, null, 1);
this.viewer.notifyStatusReady (true);
});
Clazz_overrideMethod (c$, "destroy", 
function () {
this.gRight = null;
this.viewer.notifyStatusReady (false);
this.viewer = null;
JU.GenericApplet.checkOut (this.fullName);
});
Clazz_defineMethod (c$, "getBooleanValue", 
function (propertyName, defaultValue) {
var value = this.getValue (propertyName, defaultValue ? "true" : "");
return (value.equalsIgnoreCase ("true") || value.equalsIgnoreCase ("on") || value.equalsIgnoreCase ("yes"));
}, "~S,~B");
Clazz_defineMethod (c$, "getValue", 
function (propertyName, defaultValue) {
var s = this.getJmolParameter (propertyName);
System.out.println ("Jmol getValue " + propertyName + " " + s);
return (s == null ? defaultValue : s);
}, "~S,~S");
Clazz_defineMethod (c$, "getValueLowerCase", 
 function (paramName, defaultValue) {
var value = this.getValue (paramName, defaultValue);
if (value != null) {
value = value.trim ().toLowerCase ();
if (value.length == 0) value = null;
}return value;
}, "~S,~S");
Clazz_defineMethod (c$, "setValue", 
 function (name, defaultValue) {
this.setStringProperty (name, this.getValue (name, defaultValue));
}, "~S,~S");
Clazz_defineMethod (c$, "setStringProperty", 
 function (name, value) {
if (value == null) return;
JU.Logger.info (name + " = \"" + value + "\"");
this.viewer.setStringProperty (name, value);
}, "~S,~S");
Clazz_defineMethod (c$, "scriptProcessor", 
 function (script, statusParams, processType) {
if (script == null || script.length == 0) return "";
switch (processType) {
case 0:
var err = this.viewer.scriptCheck (script);
return (Clazz_instanceOf (err, String) ? err : "");
case 1:
if (statusParams != null) return this.viewer.scriptWaitStatus (script, statusParams).toString ();
return this.viewer.scriptWait (script);
case 2:
default:
return this.viewer.script (script);
}
}, "~S,~S,~N");
Clazz_overrideMethod (c$, "register", 
function (id, jsi) {
JU.GenericApplet.checkIn (id, jsi);
}, "~S,J.api.JmolSyncInterface");
Clazz_overrideMethod (c$, "getJSpecViewProperty", 
function (key) {
return null;
}, "~S");
Clazz_defineMethod (c$, "syncScript", 
function (script) {
this.viewer.syncScript (script, "~", 0);
}, "~S");
Clazz_overrideMethod (c$, "handleEvent", 
function (e) {
if (this.viewer == null) return false;
return this.viewer.processMouseEvent (e.id, e.x, e.y, e.modifiers, e.when);
}, "java.awt.Event");
Clazz_overrideMethod (c$, "getAppletInfo", 
function () {
return J.i18n.GT.o (J.i18n.GT._ ("Jmol Applet version {0} {1}.\n\nAn OpenScience project.\n\nSee http://www.jmol.org for more information"), [JV.JC.version, JV.JC.date]) + "\nhtmlName = " + JU.PT.esc (this.htmlName) + "\nsyncId = " + JU.PT.esc (this.syncId) + "\ndocumentBase = " + JU.PT.esc (this.documentBase) + "\ncodeBase = " + JU.PT.esc (this.codeBase);
});
Clazz_overrideMethod (c$, "script", 
function (script) {
this.scriptNoWait (script);
}, "~S");
Clazz_overrideMethod (c$, "scriptCheck", 
function (script) {
if (script == null || script.length == 0) return "";
return this.scriptProcessor (script, null, 0);
}, "~S");
Clazz_overrideMethod (c$, "scriptNoWait", 
function (script) {
if (script == null || script.length == 0) return "";
return this.scriptProcessor (script, null, 2);
}, "~S");
Clazz_defineMethod (c$, "scriptWait", 
function (script) {
return this.scriptWait (script, null);
}, "~S");
Clazz_defineMethod (c$, "scriptWait", 
function (script, statusParams) {
if (script == null || script.length == 0) return "";
this.outputBuffer = null;
return this.scriptProcessor (script, statusParams, 1);
}, "~S,~S");
Clazz_overrideMethod (c$, "scriptWaitOutput", 
function (script) {
if (script == null || script.length == 0) return "";
this.outputBuffer =  new JU.SB ();
this.viewer.scriptWaitStatus (script, "");
var str = (this.outputBuffer == null ? "" : this.outputBuffer.toString ());
this.outputBuffer = null;
return str;
}, "~S");
Clazz_overrideMethod (c$, "getModelIndexFromId", 
function (id) {
return this.viewer.getModelIndexFromId (id);
}, "~S");
Clazz_overrideMethod (c$, "getProperty", 
function (infoType, paramInfo) {
{
paramInfo || (paramInfo = "");
}return this.viewer.getProperty (null, infoType, paramInfo);
}, "~S,~S");
Clazz_overrideMethod (c$, "getPropertyAsString", 
function (infoType, paramInfo) {
{
paramInfo || (paramInfo = "");
}return this.viewer.getProperty ("readable", infoType, paramInfo).toString ();
}, "~S,~S");
Clazz_overrideMethod (c$, "getPropertyAsJSON", 
function (infoType, paramInfo) {
{
paramInfo || (paramInfo = "");
}return this.viewer.getProperty ("JSON", infoType, paramInfo).toString ();
}, "~S,~S");
Clazz_overrideMethod (c$, "loadInlineString", 
function (strModel, script, isAppend) {
var errMsg = this.viewer.loadInlineAppend (strModel, isAppend);
if (errMsg == null) this.script (script);
return errMsg;
}, "~S,~S,~B");
Clazz_overrideMethod (c$, "loadInlineArray", 
function (strModels, script, isAppend) {
if (strModels == null || strModels.length == 0) return null;
var errMsg = this.viewer.loadInline (strModels, isAppend);
if (errMsg == null) this.script (script);
return errMsg;
}, "~A,~S,~B");
Clazz_overrideMethod (c$, "loadDOMNode", 
function (DOMNode) {
return this.viewer.openDOM (DOMNode);
}, "~O");
Clazz_defineMethod (c$, "loadInline", 
function (strModel) {
return this.loadInlineString (strModel, "", false);
}, "~S");
Clazz_defineMethod (c$, "loadInline", 
function (strModel, script) {
return this.loadInlineString (strModel, script, false);
}, "~S,~S");
Clazz_defineMethod (c$, "loadInline", 
function (strModels) {
return this.loadInlineArray (strModels, "", false);
}, "~A");
Clazz_defineMethod (c$, "loadInline", 
function (strModels, script) {
return this.loadInlineArray (strModels, script, false);
}, "~A,~S");
Clazz_defineMethod (c$, "output", 
function (s) {
if (this.outputBuffer != null && s != null) this.outputBuffer.append (s).appendC ('\n');
}, "~S");
Clazz_overrideMethod (c$, "setCallbackFunction", 
function (callbackName, callbackFunction) {
if (callbackName.equalsIgnoreCase ("modelkit")) return;
if (callbackName.equalsIgnoreCase ("language")) {
this.consoleMessage ("");
this.consoleMessage (null);
return;
}var callback = J.c.CBK.getCallback (callbackName);
if (callback != null && (this.loading || callback !== J.c.CBK.EVAL)) {
if (callbackFunction == null) this.b$.remove (callback);
 else this.b$.put (callback, callbackFunction);
return;
}this.consoleMessage ("Available callbacks include: " + J.c.CBK.getNameList ().$replace (';', ' ').trim ());
}, "~S,~S");
Clazz_defineMethod (c$, "consoleMessage", 
 function (message) {
this.notifyCallback (J.c.CBK.ECHO, ["", message]);
}, "~S");
Clazz_overrideMethod (c$, "notifyEnabled", 
function (type) {
switch (type) {
case J.c.CBK.ECHO:
case J.c.CBK.MESSAGE:
case J.c.CBK.MEASURE:
case J.c.CBK.PICK:
case J.c.CBK.SYNC:
return true;
case J.c.CBK.ANIMFRAME:
case J.c.CBK.DRAGDROP:
case J.c.CBK.ERROR:
case J.c.CBK.EVAL:
case J.c.CBK.LOADSTRUCT:
case J.c.CBK.SCRIPT:
return !this.isJNLP;
case J.c.CBK.APPLETREADY:
case J.c.CBK.ATOMMOVED:
case J.c.CBK.CLICK:
case J.c.CBK.HOVER:
case J.c.CBK.MINIMIZATION:
case J.c.CBK.RESIZE:
case J.c.CBK.STRUCTUREMODIFIED:
break;
}
return (this.b$.get (type) != null);
}, "J.c.CBK");
Clazz_defineMethod (c$, "notifyCallback", 
function (type, data) {
var callback = this.b$.get (type);
var doCallback = (callback != null && (data == null || data[0] == null));
var toConsole = false;
if (data != null) data[0] = this.htmlName;
var strInfo = (data == null || data[1] == null ? null : data[1].toString ());
switch (type) {
case J.c.CBK.APPLETREADY:
data[3] = this.appletObject;
break;
case J.c.CBK.ERROR:
case J.c.CBK.EVAL:
case J.c.CBK.HOVER:
case J.c.CBK.MINIMIZATION:
case J.c.CBK.RESIZE:
case J.c.CBK.DRAGDROP:
break;
case J.c.CBK.CLICK:
if ("alert".equals (callback)) strInfo = "x=" + data[1] + " y=" + data[2] + " action=" + data[3] + " clickCount=" + data[4];
break;
case J.c.CBK.ANIMFRAME:
var iData = data[1];
var frameNo = iData[0];
var fileNo = iData[1];
var modelNo = iData[2];
var firstNo = iData[3];
var lastNo = iData[4];
var isAnimationRunning = (frameNo <= -2);
var animationDirection = (firstNo < 0 ? -1 : 1);
var currentDirection = (lastNo < 0 ? -1 : 1);
if (doCallback) {
data = [this.htmlName, Integer.$valueOf (Math.max (frameNo, -2 - frameNo)), Integer.$valueOf (fileNo), Integer.$valueOf (modelNo), Integer.$valueOf (Math.abs (firstNo)), Integer.$valueOf (Math.abs (lastNo)), Integer.$valueOf (isAnimationRunning ? 1 : 0), Integer.$valueOf (animationDirection), Integer.$valueOf (currentDirection), data[2], data[3]];
}break;
case J.c.CBK.ATOMMOVED:
break;
case J.c.CBK.ECHO:
var isPrivate = (data.length == 2);
var isScriptQueued = (isPrivate || (data[2]).intValue () == 1);
if (!doCallback) {
if (isScriptQueued) toConsole = true;
doCallback = (!isPrivate && (callback = this.b$.get ((type = J.c.CBK.MESSAGE))) != null);
}if (!toConsole) this.output (strInfo);
break;
case J.c.CBK.LOADSTRUCT:
var errorMsg = data[4];
if (errorMsg != null) {
errorMsg = (errorMsg.indexOf ("NOTE:") >= 0 ? "" : J.i18n.GT._ ("File Error:")) + errorMsg;
this.doShowStatus (errorMsg);
this.notifyCallback (J.c.CBK.MESSAGE, ["", errorMsg]);
return;
}break;
case J.c.CBK.MEASURE:
if (!doCallback) doCallback = ((callback = this.b$.get ((type = J.c.CBK.MESSAGE))) != null);
var status = data[3];
if (status.indexOf ("Picked") >= 0 || status.indexOf ("Sequence") >= 0) {
this.doShowStatus (strInfo);
toConsole = true;
} else if (status.indexOf ("Completed") >= 0) {
strInfo = status + ": " + strInfo;
toConsole = true;
}break;
case J.c.CBK.MESSAGE:
toConsole = !doCallback;
doCallback = new Boolean (doCallback & (strInfo != null)).valueOf ();
if (!toConsole) this.output (strInfo);
break;
case J.c.CBK.PICK:
this.doShowStatus (strInfo);
toConsole = true;
break;
case J.c.CBK.SCRIPT:
var msWalltime = (data[3]).intValue ();
if (msWalltime > 0) {
} else if (!doCallback) {
doCallback = ((callback = this.b$.get ((type = J.c.CBK.MESSAGE))) != null);
}this.output (strInfo);
this.doShowStatus (strInfo);
break;
case J.c.CBK.STRUCTUREMODIFIED:
break;
case J.c.CBK.SYNC:
this.sendScript (strInfo, data[2], true, doCallback);
return;
}
if (toConsole) {
var appConsole = this.viewer.getProperty ("DATA_API", "getAppConsole", null);
if (appConsole != null) {
appConsole.notifyCallback (type, data);
this.output (strInfo);
this.doSendJsTextareaStatus (strInfo);
}}if (!doCallback || !this.mayScript) return;
try {
this.doSendCallback (callback, data, strInfo);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
if (!this.haveNotifiedError) if (JU.Logger.debugging) {
JU.Logger.debug (type.name () + "Callback call error to " + callback + ": " + e);
}this.haveNotifiedError = true;
} else {
throw e;
}
}
}, "J.c.CBK,~A");
Clazz_defineMethod (c$, "sendScript", 
 function (script, appletName, isSync, doCallback) {
if (doCallback) {
script = this.notifySync (script, appletName);
if (script == null || script.length == 0 || script.equals ("0")) return "";
}var apps =  new JU.Lst ();
JU.GenericApplet.findApplets (appletName, this.syncId, this.fullName, apps);
var nApplets = apps.size ();
if (nApplets == 0) {
if (!doCallback && !appletName.equals ("*")) JU.Logger.error (this.fullName + " couldn't find applet " + appletName);
return "";
}var sb = (isSync ? null :  new JU.SB ());
var getGraphics = (isSync && script.equals ("GET_GRAPHICS"));
var setNoGraphics = (isSync && script.equals ("SET_GRAPHICS_OFF"));
if (getGraphics) this.viewer.setStereo (false, (this.gRight = null));
for (var i = 0; i < nApplets; i++) {
var theApplet = apps.get (i);
var app = JU.GenericApplet.htRegistry.get (theApplet);
var isScriptable = true;
if (JU.Logger.debugging) JU.Logger.debug (this.fullName + " sending to " + theApplet + ": " + script);
try {
if (isScriptable && (getGraphics || setNoGraphics)) {
this.viewer.setStereo (this.isStereoSlave = getGraphics, this.gRight = (app).setStereoGraphics (getGraphics));
return "";
}if (isSync) app.syncScript (script);
 else if (isScriptable) sb.append ((app).scriptWait (script, "output")).append ("\n");
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
var msg = this.htmlName + " couldn't send to " + theApplet + ": " + script + ": " + e;
JU.Logger.error (msg);
if (!isSync) sb.append (msg);
} else {
throw e;
}
}
}
return (isSync ? "" : sb.toString ());
}, "~S,~S,~B,~B");
Clazz_defineMethod (c$, "notifySync", 
 function (info, appletName) {
var syncCallback = this.b$.get (J.c.CBK.SYNC);
if (!this.mayScript || syncCallback == null) return info;
try {
return this.doSendCallback (syncCallback, [this.fullName, info, appletName], null);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
if (!this.haveNotifiedError) if (JU.Logger.debugging) {
JU.Logger.debug ("syncCallback call error to " + syncCallback + ": " + e);
}this.haveNotifiedError = true;
} else {
throw e;
}
}
return info;
}, "~S,~S");
Clazz_overrideMethod (c$, "eval", 
function (strEval) {
var pt = strEval.indexOf ("\1");
if (pt >= 0) return this.sendScript (strEval.substring (pt + 1), strEval.substring (0, pt), false, false);
if (!this.haveDocumentAccess) return "NO EVAL ALLOWED";
if (this.b$.get (J.c.CBK.EVAL) != null) {
this.notifyCallback (J.c.CBK.EVAL, [null, strEval]);
return "";
}return this.doEval (strEval);
}, "~S");
Clazz_overrideMethod (c$, "functionXY", 
function (functionName, nX, nY) {
return this.doFunctionXY (functionName, nX, nY);
}, "~S,~N,~N");
Clazz_overrideMethod (c$, "functionXYZ", 
function (functionName, nX, nY, nZ) {
return this.doFunctionXYZ (functionName, nX, nY, nZ);
}, "~S,~N,~N,~N");
Clazz_overrideMethod (c$, "createImage", 
function (fileName, type, text_or_bytes, quality) {
return null;
}, "~S,~S,~O,~N");
Clazz_overrideMethod (c$, "getRegistryInfo", 
function () {
JU.GenericApplet.checkIn (null, null);
return JU.GenericApplet.htRegistry;
});
Clazz_overrideMethod (c$, "showUrl", 
function (urlString) {
if (JU.Logger.debugging) JU.Logger.debug ("showUrl(" + urlString + ")");
if (urlString != null && urlString.length > 0) try {
this.doShowDocument ( new java.net.URL (Clazz_castNullAs ("java.net.URL"), urlString, null));
} catch (mue) {
if (Clazz_exceptionOf (mue, java.net.MalformedURLException)) {
this.consoleMessage ("Malformed URL:" + urlString);
} else {
throw mue;
}
}
}, "~S");
Clazz_overrideMethod (c$, "resizeInnerPanel", 
function (data) {
return  new javajs.awt.Dimension (0, 0);
}, "~S");
c$.checkIn = Clazz_defineMethod (c$, "checkIn", 
function (name, applet) {
if (name != null) {
JU.Logger.info ("AppletRegistry.checkIn(" + name + ")");
JU.GenericApplet.htRegistry.put (name, applet);
}if (JU.Logger.debugging) {
for (var entry, $entry = JU.GenericApplet.htRegistry.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var theApplet = entry.getKey ();
JU.Logger.debug (theApplet + " " + entry.getValue ());
}
}}, "~S,~O");
c$.checkOut = Clazz_defineMethod (c$, "checkOut", 
function (name) {
JU.GenericApplet.htRegistry.remove (name);
}, "~S");
c$.findApplets = Clazz_defineMethod (c$, "findApplets", 
function (appletName, mySyncId, excludeName, apps) {
if (appletName != null && appletName.indexOf (",") >= 0) {
var names = JU.PT.split (appletName, ",");
for (var i = 0; i < names.length; i++) JU.GenericApplet.findApplets (names[i], mySyncId, excludeName, apps);

return;
}var ext = "__" + mySyncId + "__";
if (appletName == null || appletName.equals ("*") || appletName.equals (">")) {
for (var appletName2, $appletName2 = JU.GenericApplet.htRegistry.keySet ().iterator (); $appletName2.hasNext () && ((appletName2 = $appletName2.next ()) || true);) {
if (!appletName2.equals (excludeName) && appletName2.indexOf (ext) > 0) {
apps.addLast (appletName2);
}}
return;
}if (excludeName.indexOf ("_object") >= 0 && appletName.indexOf ("_object") < 0) appletName += "_object";
if (appletName.indexOf ("__") < 0) appletName += ext;
if (!JU.GenericApplet.htRegistry.containsKey (appletName)) appletName = "jmolApplet" + appletName;
if (!appletName.equals (excludeName) && JU.GenericApplet.htRegistry.containsKey (appletName)) {
apps.addLast (appletName);
}}, "~S,~S,~S,JU.Lst");
Clazz_defineStatics (c$,
"htRegistry", null,
"SCRIPT_CHECK", 0,
"SCRIPT_WAIT", 1,
"SCRIPT_NOWAIT", 2);
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.AU"], "JU.Geodesic", ["java.lang.NullPointerException", "$.Short", "java.util.Hashtable", "JU.V3"], function () {
c$ = Clazz_declareType (JU, "Geodesic");
c$.getNeighborVertexesArrays = Clazz_defineMethod (c$, "getNeighborVertexesArrays", 
function () {
if (JU.Geodesic.vertexCounts == null) JU.Geodesic.createGeodesic (3);
return JU.Geodesic.neighborVertexesArrays;
});
c$.getVertexCount = Clazz_defineMethod (c$, "getVertexCount", 
function (level) {
if (JU.Geodesic.vertexCounts == null) JU.Geodesic.createGeodesic (3);
return JU.Geodesic.vertexCounts[level];
}, "~N");
c$.getVertexVectors = Clazz_defineMethod (c$, "getVertexVectors", 
function () {
if (JU.Geodesic.vertexCounts == null) JU.Geodesic.createGeodesic (3);
return JU.Geodesic.vertexVectors;
});
c$.getVertexVector = Clazz_defineMethod (c$, "getVertexVector", 
function (i) {
return JU.Geodesic.vertexVectors[i];
}, "~N");
c$.getFaceVertexes = Clazz_defineMethod (c$, "getFaceVertexes", 
function (level) {
return JU.Geodesic.faceVertexesArrays[level];
}, "~N");
c$.createGeodesic = Clazz_defineMethod (c$, "createGeodesic", 
function (lvl) {
if (lvl < JU.Geodesic.currentLevel) return;
JU.Geodesic.currentLevel = lvl;
var v =  Clazz_newShortArray (lvl + 1, 0);
JU.Geodesic.neighborVertexesArrays = JU.AU.newShort2 (lvl + 1);
JU.Geodesic.faceVertexesArrays = JU.AU.newShort2 (lvl + 1);
JU.Geodesic.vertexVectors =  new Array (12);
JU.Geodesic.vertexVectors[0] = JU.V3.new3 (0, 0, JU.Geodesic.halfRoot5);
for (var i = 0; i < 5; ++i) {
JU.Geodesic.vertexVectors[i + 1] = JU.V3.new3 (Math.cos (i * 1.2566371), Math.sin (i * 1.2566371), 0.5);
JU.Geodesic.vertexVectors[i + 6] = JU.V3.new3 (Math.cos (i * 1.2566371 + 0.62831855), Math.sin (i * 1.2566371 + 0.62831855), -0.5);
}
JU.Geodesic.vertexVectors[11] = JU.V3.new3 (0, 0, -JU.Geodesic.halfRoot5);
for (var i = 12; --i >= 0; ) JU.Geodesic.vertexVectors[i].normalize ();

JU.Geodesic.faceVertexesArrays[0] = JU.Geodesic.faceVertexesIcosahedron;
JU.Geodesic.neighborVertexesArrays[0] = JU.Geodesic.neighborVertexesIcosahedron;
v[0] = 12;
for (var i = 0; i < lvl; ++i) JU.Geodesic.quadruple (i, v);

JU.Geodesic.vertexCounts = v;
}, "~N");
c$.quadruple = Clazz_defineMethod (c$, "quadruple", 
 function (level, counts) {
JU.Geodesic.htVertex =  new java.util.Hashtable ();
var oldVertexCount = JU.Geodesic.vertexVectors.length;
var oldFaceVertexes = JU.Geodesic.faceVertexesArrays[level];
var oldFaceVertexesLength = oldFaceVertexes.length;
var oldFaceCount = Clazz_doubleToInt (oldFaceVertexesLength / 3);
var oldEdgesCount = oldVertexCount + oldFaceCount - 2;
var newVertexCount = oldVertexCount + oldEdgesCount;
var newFaceCount = 4 * oldFaceCount;
JU.Geodesic.vertexVectors = JU.AU.arrayCopyObject (JU.Geodesic.vertexVectors, newVertexCount);
var newFacesVertexes =  Clazz_newShortArray (3 * newFaceCount, 0);
JU.Geodesic.faceVertexesArrays[level + 1] = newFacesVertexes;
var neighborVertexes =  Clazz_newShortArray (6 * newVertexCount, 0);
JU.Geodesic.neighborVertexesArrays[level + 1] = neighborVertexes;
for (var i = neighborVertexes.length; --i >= 0; ) neighborVertexes[i] = -1;

counts[level + 1] = newVertexCount;
JU.Geodesic.vertexNext = oldVertexCount;
var iFaceNew = 0;
for (var i = 0; i < oldFaceVertexesLength; ) {
var iA = oldFaceVertexes[i++];
var iB = oldFaceVertexes[i++];
var iC = oldFaceVertexes[i++];
var iAB = JU.Geodesic.getVertex (iA, iB);
var iBC = JU.Geodesic.getVertex (iB, iC);
var iCA = JU.Geodesic.getVertex (iC, iA);
newFacesVertexes[iFaceNew++] = iA;
newFacesVertexes[iFaceNew++] = iAB;
newFacesVertexes[iFaceNew++] = iCA;
newFacesVertexes[iFaceNew++] = iB;
newFacesVertexes[iFaceNew++] = iBC;
newFacesVertexes[iFaceNew++] = iAB;
newFacesVertexes[iFaceNew++] = iC;
newFacesVertexes[iFaceNew++] = iCA;
newFacesVertexes[iFaceNew++] = iBC;
newFacesVertexes[iFaceNew++] = iCA;
newFacesVertexes[iFaceNew++] = iAB;
newFacesVertexes[iFaceNew++] = iBC;
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iAB, iA);
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iAB, iCA);
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iAB, iBC);
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iAB, iB);
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iBC, iB);
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iBC, iCA);
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iBC, iC);
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iCA, iC);
JU.Geodesic.addNeighboringVertexes (neighborVertexes, iCA, iA);
}
if (true) {
var vertexCount = JU.Geodesic.vertexVectors.length;
if (iFaceNew != newFacesVertexes.length) throw  new NullPointerException ();
if (JU.Geodesic.vertexNext != newVertexCount) throw  new NullPointerException ();
for (var i = 0; i < 12; ++i) {
for (var j = 0; j < 5; ++j) {
var neighbor = neighborVertexes[i * 6 + j];
if (neighbor < 0) throw  new NullPointerException ();
if (neighbor >= vertexCount) throw  new NullPointerException ();
if (neighborVertexes[i * 6 + 5] != -1) throw  new NullPointerException ();
}
}
for (var i = 72; i < neighborVertexes.length; ++i) {
var neighbor = neighborVertexes[i];
if (neighbor < 0) throw  new NullPointerException ();
if (neighbor >= vertexCount) throw  new NullPointerException ();
}
for (var i = 0; i < newVertexCount; ++i) {
var neighborCount = 0;
for (var j = neighborVertexes.length; --j >= 0; ) if (neighborVertexes[j] == i) ++neighborCount;

if ((i < 12 && neighborCount != 5) || (i >= 12 && neighborCount != 6)) throw  new NullPointerException ();
var faceCount = 0;
for (var j = newFacesVertexes.length; --j >= 0; ) if (newFacesVertexes[j] == i) ++faceCount;

if ((i < 12 && faceCount != 5) || (i >= 12 && faceCount != 6)) throw  new NullPointerException ();
}
}JU.Geodesic.htVertex = null;
}, "~N,~A");
c$.addNeighboringVertexes = Clazz_defineMethod (c$, "addNeighboringVertexes", 
 function (neighborVertexes, v1, v2) {
for (var i = v1 * 6, iMax = i + 6; i < iMax; ++i) {
if (neighborVertexes[i] == v2) return;
if (neighborVertexes[i] < 0) {
neighborVertexes[i] = v2;
for (var j = v2 * 6, jMax = j + 6; j < jMax; ++j) {
if (neighborVertexes[j] == v1) return;
if (neighborVertexes[j] < 0) {
neighborVertexes[j] = v1;
return;
}}
}}
throw  new NullPointerException ();
}, "~A,~N,~N");
c$.getVertex = Clazz_defineMethod (c$, "getVertex", 
 function (v1, v2) {
if (v1 > v2) {
var t = v1;
v1 = v2;
v2 = t;
}var hashKey = Integer.$valueOf ((v1 << 16) + v2);
var iv = JU.Geodesic.htVertex.get (hashKey);
if (iv != null) {
return iv.shortValue ();
}var newVertexVector = JU.Geodesic.vertexVectors[JU.Geodesic.vertexNext] =  new JU.V3 ();
newVertexVector.add2 (JU.Geodesic.vertexVectors[v1], JU.Geodesic.vertexVectors[v2]);
newVertexVector.normalize ();
JU.Geodesic.htVertex.put (hashKey, Short.$valueOf (JU.Geodesic.vertexNext));
return JU.Geodesic.vertexNext++;
}, "~N,~N");
c$.halfRoot5 = c$.prototype.halfRoot5 = (0.5 * Math.sqrt (5));
Clazz_defineStatics (c$,
"oneFifth", 1.2566371,
"oneTenth", 0.62831855,
"faceVertexesIcosahedron", [0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5, 0, 5, 1, 1, 6, 2, 2, 7, 3, 3, 8, 4, 4, 9, 5, 5, 10, 1, 6, 1, 10, 7, 2, 6, 8, 3, 7, 9, 4, 8, 10, 5, 9, 11, 6, 10, 11, 7, 6, 11, 8, 7, 11, 9, 8, 11, 10, 9],
"neighborVertexesIcosahedron", [1, 2, 3, 4, 5, -1, 0, 5, 10, 6, 2, -1, 0, 1, 6, 7, 3, -1, 0, 2, 7, 8, 4, -1, 0, 3, 8, 9, 5, -1, 0, 4, 9, 10, 1, -1, 1, 10, 11, 7, 2, -1, 2, 6, 11, 8, 3, -1, 3, 7, 11, 9, 4, -1, 4, 8, 11, 10, 5, -1, 5, 9, 11, 6, 1, -1, 6, 7, 8, 9, 10, -1],
"standardLevel", 3,
"maxLevel", 3,
"vertexCounts", null,
"vertexVectors", null,
"faceVertexesArrays", null,
"neighborVertexesArrays", null,
"currentLevel", 0,
"vertexNext", 0,
"htVertex", null,
"VALIDATE", true);
});
Clazz_declarePackage ("JU");
c$ = Clazz_decorateAsClass (function () {
this.entryCount = 0;
this.entries = null;
Clazz_instantialize (this, arguments);
}, JU, "Int2IntHash");
Clazz_makeConstructor (c$, 
function (initialCapacity) {
this.entries =  new Array (initialCapacity);
}, "~N");
Clazz_defineMethod (c$, "get", 
function (key) {
var entries = this.entries;
var hash = (key & 0x7FFFFFFF) % entries.length;
for (var e = entries[hash]; e != null; e = e.next) if (e.key == key) return e.value;

return -2147483648;
}, "~N");
Clazz_defineMethod (c$, "put", 
function (key, value) {
var entries = this.entries;
var n = entries.length;
var hash = (key & 0x7FFFFFFF) % n;
for (var e = entries[hash]; e != null; e = e.next) if (e.key == key) {
e.value = value;
return;
}
if (this.entryCount > n) {
var oldSize = n;
n += n + 1;
var newEntries =  new Array (n);
for (var i = oldSize; --i >= 0; ) {
for (var e = entries[i]; e != null; ) {
var t = e;
e = e.next;
hash = (t.key & 0x7FFFFFFF) % n;
t.next = newEntries[hash];
newEntries[hash] = t;
}
}
entries = this.entries = newEntries;
hash = (key & 0x7FFFFFFF) % n;
}entries[hash] =  new JU.Int2IntHashEntry (key, value, entries[hash]);
++this.entryCount;
}, "~N,~N");
c$ = Clazz_decorateAsClass (function () {
this.key = 0;
this.value = 0;
this.next = null;
Clazz_instantialize (this, arguments);
}, JU, "Int2IntHashEntry");
Clazz_makeConstructor (c$, 
function (key, value, next) {
this.key = key;
this.value = value;
this.next = next;
}, "~N,~N,JU.Int2IntHashEntry");
Clazz_declarePackage ("JU");
Clazz_declareInterface (JU, "Node");
Clazz_declarePackage ("JU");
Clazz_load (["JU.Node"], "JU.BNode", null, function () {
Clazz_declareInterface (JU, "BNode", JU.Node);
});
Clazz_declarePackage ("JU");
Clazz_load (["java.lang.Enum"], "JU.Edge", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.index = -1;
this.order = 0;
Clazz_instantialize (this, arguments);
}, JU, "Edge");
c$.getArgbHbondType = Clazz_defineMethod (c$, "getArgbHbondType", 
function (order) {
var argbIndex = ((order & 30720) >> 11);
return JU.Edge.argbsHbondType[argbIndex];
}, "~N");
c$.getBondOrderNumberFromOrder = Clazz_defineMethod (c$, "getBondOrderNumberFromOrder", 
function (order) {
order &= -131073;
if (order == 131071 || order == 65535) return "0";
if (JM.Bond.isOrderH (order) || (order & 256) != 0) return JU.Edge.EnumBondOrder.SINGLE.number;
if ((order & 224) != 0) return (order >> 5) + "." + (order & 0x1F);
return JU.Edge.EnumBondOrder.getNumberFromCode (order);
}, "~N");
c$.getCmlBondOrder = Clazz_defineMethod (c$, "getCmlBondOrder", 
function (order) {
var sname = JU.Edge.getBondOrderNameFromOrder (order);
switch (sname.charAt (0)) {
case 's':
case 'd':
case 't':
return "" + sname.toUpperCase ().charAt (0);
case 'a':
if (sname.indexOf ("Double") >= 0) return "D";
 else if (sname.indexOf ("Single") >= 0) return "S";
return "aromatic";
case 'p':
if (sname.indexOf (" ") >= 0) return sname.substring (sname.indexOf (" ") + 1);
return "partial12";
}
return null;
}, "~N");
c$.getBondOrderNameFromOrder = Clazz_defineMethod (c$, "getBondOrderNameFromOrder", 
function (order) {
order &= -131073;
switch (order) {
case 65535:
case 131071:
return "";
case 32768:
return JU.Edge.EnumBondOrder.STRUT.$$name;
case 1:
return JU.Edge.EnumBondOrder.SINGLE.$$name;
case 2:
return JU.Edge.EnumBondOrder.DOUBLE.$$name;
}
if ((order & 224) != 0) return "partial " + JU.Edge.getBondOrderNumberFromOrder (order);
if (JM.Bond.isOrderH (order)) return JU.Edge.EnumBondOrder.H_REGULAR.$$name;
if ((order & 256) != 0) return JU.Edge.EnumBondOrder.SINGLE.$$name;
return JU.Edge.EnumBondOrder.getNameFromCode (order);
}, "~N");
c$.getPartialBondDotted = Clazz_defineMethod (c$, "getPartialBondDotted", 
function (order) {
return (order & 0x1F);
}, "~N");
c$.getPartialBondOrder = Clazz_defineMethod (c$, "getPartialBondOrder", 
function (order) {
return ((order & -131073) >> 5);
}, "~N");
c$.getCovalentBondOrder = Clazz_defineMethod (c$, "getCovalentBondOrder", 
function (order) {
if ((order & 1023) == 0) return 0;
order &= -131073;
if ((order & 224) != 0) return JU.Edge.getPartialBondOrder (order);
if ((order & 256) != 0) order &= -257;
if ((order & 0xF8) != 0) order = 1;
return order & 7;
}, "~N");
c$.getBondOrderFromFloat = Clazz_defineMethod (c$, "getBondOrderFromFloat", 
function (fOrder) {
switch (Clazz_floatToInt (fOrder * 10)) {
case 10:
return 1;
case 5:
case -10:
return 33;
case 15:
return 515;
case -15:
return 66;
case 20:
return 2;
case 25:
return 97;
case -25:
return 100;
case 30:
return 3;
case 40:
return 4;
}
return 131071;
}, "~N");
c$.getBondOrderFromString = Clazz_defineMethod (c$, "getBondOrderFromString", 
function (name) {
return JU.Edge.EnumBondOrder.getCodeFromName (name);
}, "~S");
Clazz_pu$h(self.c$);
c$ = Clazz_decorateAsClass (function () {
this.code = 0;
this.number = null;
this.$$name = null;
Clazz_instantialize (this, arguments);
}, JU.Edge, "EnumBondOrder", Enum);
Clazz_makeConstructor (c$, 
 function (a, b, c) {
this.code = a;
this.number = b;
this.$$name = c;
}, "~N,~S,~S");
c$.getCodeFromName = Clazz_defineMethod (c$, "getCodeFromName", 
function (a) {
for (var item, $item = 0, $$item = JU.Edge.EnumBondOrder.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.$$name.equalsIgnoreCase (a)) return item.code;

return 131071;
}, "~S");
c$.getNameFromCode = Clazz_defineMethod (c$, "getNameFromCode", 
function (a) {
for (var item, $item = 0, $$item = JU.Edge.EnumBondOrder.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.code == a) return item.$$name;

return "?";
}, "~N");
c$.getNumberFromCode = Clazz_defineMethod (c$, "getNumberFromCode", 
function (a) {
for (var item, $item = 0, $$item = JU.Edge.EnumBondOrder.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) if (item.code == a) return item.number;

return "?";
}, "~N");
Clazz_defineEnumConstant (c$, "SINGLE", 0, [1, "1", "single"]);
Clazz_defineEnumConstant (c$, "DOUBLE", 1, [2, "2", "double"]);
Clazz_defineEnumConstant (c$, "TRIPLE", 2, [3, "3", "triple"]);
Clazz_defineEnumConstant (c$, "QUADRUPLE", 3, [4, "4", "quadruple"]);
Clazz_defineEnumConstant (c$, "AROMATIC", 4, [515, "1.5", "aromatic"]);
Clazz_defineEnumConstant (c$, "STRUT", 5, [32768, "1", "struts"]);
Clazz_defineEnumConstant (c$, "H_REGULAR", 6, [2048, "1", "hbond"]);
Clazz_defineEnumConstant (c$, "PARTIAL01", 7, [33, "0.5", "partial"]);
Clazz_defineEnumConstant (c$, "PARTIAL12", 8, [66, "1.5", "partialDouble"]);
Clazz_defineEnumConstant (c$, "PARTIAL23", 9, [97, "2.5", "partialTriple"]);
Clazz_defineEnumConstant (c$, "PARTIAL32", 10, [100, "2.5", "partialTriple2"]);
Clazz_defineEnumConstant (c$, "AROMATIC_SINGLE", 11, [513, "1", "aromaticSingle"]);
Clazz_defineEnumConstant (c$, "AROMATIC_DOUBLE", 12, [514, "2", "aromaticDouble"]);
Clazz_defineEnumConstant (c$, "UNSPECIFIED", 13, [17, "1", "unspecified"]);
c$ = Clazz_p0p ();
Clazz_defineStatics (c$,
"BOND_STEREO_MASK", 0x400,
"BOND_STEREO_NEAR", 0x401,
"BOND_STEREO_FAR", 0x411,
"BOND_AROMATIC_MASK", 0x200,
"BOND_AROMATIC_SINGLE", 0x201,
"BOND_AROMATIC_DOUBLE", 0x202,
"BOND_AROMATIC", 0x203,
"BOND_SULFUR_MASK", 0x100,
"BOND_PARTIAL_MASK", 0xE0,
"BOND_PARTIAL01", 0x21,
"BOND_PARTIAL12", 0x42,
"BOND_PARTIAL23", 0x61,
"BOND_PARTIAL32", 0x64,
"BOND_COVALENT_MASK", 0x3FF,
"BOND_COVALENT_SINGLE", 1,
"BOND_COVALENT_DOUBLE", 2,
"BOND_COVALENT_TRIPLE", 3,
"BOND_COVALENT_QUADRUPLE", 4,
"BOND_ORDER_UNSPECIFIED", 0x11,
"BOND_ORDER_ANY", 0x0FFFF,
"BOND_ORDER_NULL", 0x1FFFF,
"BOND_STRUT", 0x08000,
"BOND_PYMOL_SINGLE", 0x10000,
"BOND_PYMOL_MULT", 0x18000,
"BOND_NEW", 0x20000,
"BOND_HBOND_SHIFT", 11,
"BOND_HYDROGEN_MASK", 30720,
"BOND_H_REGULAR", 2048,
"BOND_H_CALC_MASK", 28672,
"BOND_H_CALC", 4096,
"BOND_H_PLUS_2", 6144,
"BOND_H_PLUS_3", 8192,
"BOND_H_PLUS_4", 10240,
"BOND_H_PLUS_5", 12288,
"BOND_H_MINUS_3", 14336,
"BOND_H_MINUS_4", 16384,
"BOND_H_NUCLEOTIDE", 18432,
"argbsHbondType", [0xFFFF69B4, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFFFF, 0xFFFF00FF, 0xFFFF0000, 0xFFFFA500, 0xFF00FFFF, 0xFF00FF00, 0xFFFF8080],
"FLAG_AROMATIC_DOUBLE", 16,
"FLAG_AROMATIC_DEFINED", 8,
"FLAG_AROMATIC_STRICT", 4,
"FLAG_IGNORE_STEREOCHEMISTRY", 2,
"FLAG_NO_AROMATIC", 1);
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.Elements"], "JU.JmolMolecule", ["java.lang.Character", "java.util.Hashtable", "JU.AU", "$.BS", "$.PT", "JU.BNode"], function () {
c$ = Clazz_decorateAsClass (function () {
this.nodes = null;
this.moleculeIndex = 0;
this.modelIndex = 0;
this.indexInModel = 0;
this.firstAtomIndex = 0;
this.ac = 0;
this.nElements = 0;
this.elementCounts = null;
this.altElementCounts = null;
this.elementNumberMax = 0;
this.altElementMax = 0;
this.mf = null;
this.atomList = null;
Clazz_instantialize (this, arguments);
}, JU, "JmolMolecule");
Clazz_prepareFields (c$, function () {
this.elementCounts =  Clazz_newIntArray (JU.Elements.elementNumberMax, 0);
this.altElementCounts =  Clazz_newIntArray (JU.Elements.altElementMax, 0);
});
Clazz_makeConstructor (c$, 
function () {
});
c$.getMolecules = Clazz_defineMethod (c$, "getMolecules", 
function (atoms, bsModelAtoms, biobranches, bsExclude) {
var bsToTest = null;
var bsBranch =  new JU.BS ();
var thisModelIndex = -1;
var indexInModel = 0;
var moleculeCount = 0;
var molecules =  new Array (4);
if (bsExclude == null) bsExclude =  new JU.BS ();
for (var i = 0; i < atoms.length; i++) if (!bsExclude.get (i) && !bsBranch.get (i)) {
if (atoms[i].isDeleted ()) {
bsExclude.set (i);
continue;
}var modelIndex = atoms[i].getModelIndex ();
if (modelIndex != thisModelIndex) {
thisModelIndex = modelIndex;
indexInModel = 0;
bsToTest = bsModelAtoms[modelIndex];
}bsBranch = JU.JmolMolecule.getBranchBitSet (atoms, i, bsToTest, biobranches, -1, true, true);
if (bsBranch.nextSetBit (0) >= 0) {
molecules = JU.JmolMolecule.addMolecule (molecules, moleculeCount++, atoms, i, bsBranch, modelIndex, indexInModel++, bsExclude);
}}
return JU.JmolMolecule.allocateArray (molecules, moleculeCount);
}, "~A,~A,JU.Lst,JU.BS");
c$.getBranchBitSet = Clazz_defineMethod (c$, "getBranchBitSet", 
function (atoms, atomIndex, bsToTest, biobranches, atomIndexNot, allowCyclic, allowBioResidue) {
var bs = JU.BS.newN (atoms.length);
if (atomIndex < 0) return bs;
if (atomIndexNot >= 0) bsToTest.clear (atomIndexNot);
return (JU.JmolMolecule.getCovalentlyConnectedBitSet (atoms, atoms[atomIndex], bsToTest, allowCyclic, allowBioResidue, biobranches, bs) ? bs :  new JU.BS ());
}, "~A,~N,JU.BS,JU.Lst,~N,~B,~B");
c$.addMolecule = Clazz_defineMethod (c$, "addMolecule", 
function (molecules, iMolecule, atoms, iAtom, bsBranch, modelIndex, indexInModel, bsExclude) {
bsExclude.or (bsBranch);
if (iMolecule == molecules.length) molecules = JU.JmolMolecule.allocateArray (molecules, iMolecule * 2 + 1);
molecules[iMolecule] = JU.JmolMolecule.initialize (atoms, iMolecule, iAtom, bsBranch, modelIndex, indexInModel);
return molecules;
}, "~A,~N,~A,~N,JU.BS,~N,~N,JU.BS");
c$.getMolecularFormula = Clazz_defineMethod (c$, "getMolecularFormula", 
function (atoms, bsSelected, includeMissingHydrogens, wts, isEmpirical) {
var m =  new JU.JmolMolecule ();
m.nodes = atoms;
m.atomList = bsSelected;
return m.getMolecularFormula (includeMissingHydrogens, wts, isEmpirical);
}, "~A,JU.BS,~B,~A,~B");
Clazz_defineMethod (c$, "getMolecularFormula", 
function (includeMissingHydrogens, wts, isEmpirical) {
if (this.mf != null) return this.mf;
if (this.atomList == null) {
this.atomList =  new JU.BS ();
this.atomList.setBits (0, this.nodes.length);
}this.elementCounts =  Clazz_newIntArray (JU.Elements.elementNumberMax, 0);
this.altElementCounts =  Clazz_newIntArray (JU.Elements.altElementMax, 0);
this.ac = this.atomList.cardinality ();
for (var p = 0, i = this.atomList.nextSetBit (0); i >= 0; i = this.atomList.nextSetBit (i + 1), p++) {
var n = this.nodes[i].getAtomicAndIsotopeNumber ();
var f = (wts == null ? 1 : Clazz_floatToInt (8 * wts[p]));
if (n < JU.Elements.elementNumberMax) {
if (this.elementCounts[n] == 0) this.nElements++;
this.elementCounts[n] += f;
this.elementNumberMax = Math.max (this.elementNumberMax, n);
if (includeMissingHydrogens) {
var nH = this.nodes[i].getImplicitHydrogenCount ();
if (nH > 0) {
if (this.elementCounts[1] == 0) this.nElements++;
this.elementCounts[1] += nH * f;
}}} else {
n = JU.Elements.altElementIndexFromNumber (n);
if (this.altElementCounts[n] == 0) this.nElements++;
this.altElementCounts[n] += f;
this.altElementMax = Math.max (this.altElementMax, n);
}}
if (wts != null) for (var i = 1; i <= this.elementNumberMax; i++) {
var c = Clazz_doubleToInt (this.elementCounts[i] / 8);
if (c * 8 != this.elementCounts[i]) return "?";
this.elementCounts[i] = c;
}
if (isEmpirical) {
var min = 2;
var ok = true;
while (ok) {
min = 100000;
var c;
for (var i = 1; i <= this.elementNumberMax; i++) if ((c = this.elementCounts[i]) > 0 && c < min) min = c;

if (min == 1) break;
var j = min;
for (; j > 1; j--) {
ok = true;
for (var i = 1; i <= this.elementNumberMax && ok; i++) if (Clazz_doubleToInt ((c = this.elementCounts[i]) / j) * j != c) ok = false;

if (ok) {
for (var i = 1; i <= this.elementNumberMax; i++) this.elementCounts[i] /= j;

break;
}}
}
}var mf = "";
var sep = "";
var nX;
for (var i = 1; i <= this.elementNumberMax; i++) {
nX = this.elementCounts[i];
if (nX != 0) {
mf += sep + JU.Elements.elementSymbolFromNumber (i) + " " + nX;
sep = " ";
}}
for (var i = 1; i <= this.altElementMax; i++) {
nX = this.altElementCounts[i];
if (nX != 0) {
mf += sep + JU.Elements.elementSymbolFromNumber (JU.Elements.altElementNumberFromIndex (i)) + " " + nX;
sep = " ";
}}
return mf;
}, "~B,~A,~B");
c$.initialize = Clazz_defineMethod (c$, "initialize", 
 function (nodes, moleculeIndex, firstAtomIndex, atomList, modelIndex, indexInModel) {
var jm =  new JU.JmolMolecule ();
jm.nodes = nodes;
jm.firstAtomIndex = firstAtomIndex;
jm.atomList = atomList;
jm.ac = atomList.cardinality ();
jm.moleculeIndex = moleculeIndex;
jm.modelIndex = modelIndex;
jm.indexInModel = indexInModel;
return jm;
}, "~A,~N,~N,JU.BS,~N,~N");
c$.getCovalentlyConnectedBitSet = Clazz_defineMethod (c$, "getCovalentlyConnectedBitSet", 
 function (atoms, atom, bsToTest, allowCyclic, allowBioResidue, biobranches, bsResult) {
var atomIndex = atom.getIndex ();
if (!bsToTest.get (atomIndex)) return allowCyclic;
if (!allowBioResidue && (Clazz_instanceOf (atom, JU.BNode)) && (atom).getBioStructureTypeName ().length > 0) return allowCyclic;
bsToTest.clear (atomIndex);
if (biobranches != null && !bsResult.get (atomIndex)) {
for (var i = biobranches.size (); --i >= 0; ) {
var b = biobranches.get (i);
if (b.get (atomIndex)) {
bsResult.or (b);
bsToTest.andNot (b);
for (var j = b.nextSetBit (0); j >= 0; j = b.nextSetBit (j + 1)) {
var atom1 = atoms[j];
bsToTest.set (j);
JU.JmolMolecule.getCovalentlyConnectedBitSet (atoms, atom1, bsToTest, allowCyclic, allowBioResidue, biobranches, bsResult);
bsToTest.clear (j);
}
break;
}}
}bsResult.set (atomIndex);
var bonds = atom.getEdges ();
if (bonds == null) return true;
for (var i = bonds.length; --i >= 0; ) {
var bond = bonds[i];
if (bond.isCovalent () && !JU.JmolMolecule.getCovalentlyConnectedBitSet (atoms, bond.getOtherAtomNode (atom), bsToTest, allowCyclic, allowBioResidue, biobranches, bsResult)) return false;
}
return true;
}, "~A,JU.Node,JU.BS,~B,~B,JU.Lst,JU.BS");
c$.allocateArray = Clazz_defineMethod (c$, "allocateArray", 
 function (molecules, len) {
return (len == molecules.length ? molecules : JU.AU.arrayCopyObject (molecules, len));
}, "~A,~N");
c$.getBitSetForMF = Clazz_defineMethod (c$, "getBitSetForMF", 
function (at, bsAtoms, mf) {
var map =  new java.util.Hashtable ();
var ch;
var isDigit;
mf = JU.PT.rep (JU.PT.clean (mf + "Z"), " ", "");
for (var i = 0, pt = 0, pt0 = 0, n = mf.length; i < n; i++) {
if ((isDigit = Character.isDigit ((ch = mf.charAt (i)))) || i > 0 && Character.isUpperCase (ch)) {
pt0 = i;
var s = mf.substring (pt, pt0).trim ();
if (isDigit) while (i < n && Character.isDigit (mf.charAt (i))) i++;

pt = i;
map.put (s, [isDigit ? JU.PT.parseInt (mf.substring (pt0, pt)) : 1]);
}}
var bs =  new JU.BS ();
for (var i = bsAtoms.nextSetBit (0); i >= 0; i = bsAtoms.nextSetBit (i + 1)) {
var a = at[i].getElementSymbol ();
var c = map.get (a);
if (c == null || c[0]-- < 1) continue;
bs.set (i);
}
for (var e, $e = map.values ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) if (e[0] > 0) return  new JU.BS ();

return bs;
}, "~A,JU.BS,~S");
});
Clazz_declarePackage ("JU");
Clazz_load (["java.util.Hashtable", "JU.DefaultLogger"], "JU.Logger", ["java.lang.Long"], function () {
c$ = Clazz_declareType (JU, "Logger");
c$.getProperty = Clazz_defineMethod (c$, "getProperty", 
 function (level, defaultValue) {
try {
var property = System.getProperty ("jmol.logger." + level, null);
if (property != null) {
return (property.equalsIgnoreCase ("true"));
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
return defaultValue;
}, "~S,~B");
c$.setLogger = Clazz_defineMethod (c$, "setLogger", 
function (logger) {
JU.Logger._logger = logger;
JU.Logger.debugging = JU.Logger.isActiveLevel (5) || JU.Logger.isActiveLevel (6);
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}, "JU.LoggerInterface");
c$.isActiveLevel = Clazz_defineMethod (c$, "isActiveLevel", 
function (level) {
return JU.Logger._logger != null && level >= 0 && level < 7 && JU.Logger._activeLevels[level];
}, "~N");
c$.setActiveLevel = Clazz_defineMethod (c$, "setActiveLevel", 
function (level, active) {
if (level < 0) level = 0;
if (level >= 7) level = 6;
JU.Logger._activeLevels[level] = active;
JU.Logger.debugging = JU.Logger.isActiveLevel (5) || JU.Logger.isActiveLevel (6);
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}, "~N,~B");
c$.setLogLevel = Clazz_defineMethod (c$, "setLogLevel", 
function (level) {
for (var i = 7; --i >= 0; ) JU.Logger.setActiveLevel (i, i <= level);

}, "~N");
c$.getLevel = Clazz_defineMethod (c$, "getLevel", 
function (level) {
switch (level) {
case 6:
return "DEBUGHIGH";
case 5:
return "DEBUG";
case 4:
return "INFO";
case 3:
return "WARN";
case 2:
return "ERROR";
case 1:
return "FATAL";
}
return "????";
}, "~N");
c$.logLevel = Clazz_defineMethod (c$, "logLevel", 
function () {
return JU.Logger._logLevel;
});
c$.doLogLevel = Clazz_defineMethod (c$, "doLogLevel", 
function (log) {
JU.Logger._logLevel = log;
}, "~B");
c$.debug = Clazz_defineMethod (c$, "debug", 
function (txt) {
if (!JU.Logger.debugging) return;
try {
JU.Logger._logger.debug (txt);
} catch (t) {
}
}, "~S");
c$.info = Clazz_defineMethod (c$, "info", 
function (txt) {
try {
if (JU.Logger.isActiveLevel (4)) {
JU.Logger._logger.info (txt);
}} catch (t) {
}
}, "~S");
c$.warn = Clazz_defineMethod (c$, "warn", 
function (txt) {
try {
if (JU.Logger.isActiveLevel (3)) {
JU.Logger._logger.warn (txt);
}} catch (t) {
}
}, "~S");
c$.warnEx = Clazz_defineMethod (c$, "warnEx", 
function (txt, e) {
try {
if (JU.Logger.isActiveLevel (3)) {
JU.Logger._logger.warnEx (txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.error = Clazz_defineMethod (c$, "error", 
function (txt) {
try {
if (JU.Logger.isActiveLevel (2)) {
JU.Logger._logger.error (txt);
}} catch (t) {
}
}, "~S");
c$.errorEx = Clazz_defineMethod (c$, "errorEx", 
function (txt, e) {
try {
if (JU.Logger.isActiveLevel (2)) {
JU.Logger._logger.errorEx (txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.getLogLevel = Clazz_defineMethod (c$, "getLogLevel", 
function () {
for (var i = 7; --i >= 0; ) if (JU.Logger.isActiveLevel (i)) return i;

return 0;
});
c$.fatal = Clazz_defineMethod (c$, "fatal", 
function (txt) {
try {
if (JU.Logger.isActiveLevel (1)) {
JU.Logger._logger.fatal (txt);
}} catch (t) {
}
}, "~S");
c$.fatalEx = Clazz_defineMethod (c$, "fatalEx", 
function (txt, e) {
try {
if (JU.Logger.isActiveLevel (1)) {
JU.Logger._logger.fatalEx (txt, e);
}} catch (t) {
}
}, "~S,Throwable");
c$.startTimer = Clazz_defineMethod (c$, "startTimer", 
function (msg) {
if (msg != null) JU.Logger.htTiming.put (msg, Long.$valueOf (System.currentTimeMillis ()));
}, "~S");
c$.getTimerMsg = Clazz_defineMethod (c$, "getTimerMsg", 
function (msg, time) {
if (time == 0) time = JU.Logger.getTimeFrom (msg);
return "Time for " + msg + ": " + (time) + " ms";
}, "~S,~N");
c$.getTimeFrom = Clazz_defineMethod (c$, "getTimeFrom", 
 function (msg) {
var t;
return (msg == null || (t = JU.Logger.htTiming.get (msg)) == null ? -1 : System.currentTimeMillis () - t.longValue ());
}, "~S");
c$.checkTimer = Clazz_defineMethod (c$, "checkTimer", 
function (msg, andReset) {
var time = JU.Logger.getTimeFrom (msg);
if (time >= 0 && !msg.startsWith ("(")) JU.Logger.info (JU.Logger.getTimerMsg (msg, time));
if (andReset) JU.Logger.startTimer (msg);
return time;
}, "~S,~B");
c$.checkMemory = Clazz_defineMethod (c$, "checkMemory", 
function () {
var bTotal = 0;
var bFree = 0;
var bMax = 0;
{
}JU.Logger.info ("Memory: Total-Free=" + (bTotal - bFree) + "; Total=" + bTotal + "; Free=" + bFree + "; Max=" + bMax);
});
c$._logger = c$.prototype._logger =  new JU.DefaultLogger ();
Clazz_defineStatics (c$,
"LEVEL_FATAL", 1,
"LEVEL_ERROR", 2,
"LEVEL_WARN", 3,
"LEVEL_INFO", 4,
"LEVEL_DEBUG", 5,
"LEVEL_DEBUGHIGH", 6,
"LEVEL_MAX", 7,
"_activeLevels",  Clazz_newBooleanArray (7, false),
"_logLevel", false,
"debugging", false,
"debuggingHigh", false);
{
JU.Logger._activeLevels[6] = JU.Logger.getProperty ("debugHigh", false);
JU.Logger._activeLevels[5] = JU.Logger.getProperty ("debug", false);
JU.Logger._activeLevels[4] = JU.Logger.getProperty ("info", true);
JU.Logger._activeLevels[3] = JU.Logger.getProperty ("warn", true);
JU.Logger._activeLevels[2] = JU.Logger.getProperty ("error", true);
JU.Logger._activeLevels[1] = JU.Logger.getProperty ("fatal", true);
JU.Logger._logLevel = JU.Logger.getProperty ("logLevel", false);
JU.Logger.debugging = (JU.Logger._logger != null && (JU.Logger._activeLevels[5] || JU.Logger._activeLevels[6]));
JU.Logger.debuggingHigh = (JU.Logger.debugging && JU.Logger._activeLevels[6]);
}c$.htTiming = c$.prototype.htTiming =  new java.util.Hashtable ();
});
Clazz_declarePackage ("JU");
Clazz_declareInterface (JU, "LoggerInterface");
Clazz_declarePackage ("JU");
Clazz_load (["JU.V3"], "JU.Measure", ["java.lang.Float", "javajs.api.Interface", "JU.Lst", "$.P3", "$.P4", "$.Quat"], function () {
c$ = Clazz_declareType (JU, "Measure");
c$.computeAngle = Clazz_defineMethod (c$, "computeAngle", 
function (pointA, pointB, pointC, vectorBA, vectorBC, asDegrees) {
vectorBA.sub2 (pointA, pointB);
vectorBC.sub2 (pointC, pointB);
var angle = vectorBA.angle (vectorBC);
return (asDegrees ? angle / 0.017453292 : angle);
}, "JU.T3,JU.T3,JU.T3,JU.V3,JU.V3,~B");
c$.computeAngleABC = Clazz_defineMethod (c$, "computeAngleABC", 
function (pointA, pointB, pointC, asDegrees) {
var vectorBA =  new JU.V3 ();
var vectorBC =  new JU.V3 ();
return JU.Measure.computeAngle (pointA, pointB, pointC, vectorBA, vectorBC, asDegrees);
}, "JU.T3,JU.T3,JU.T3,~B");
c$.computeTorsion = Clazz_defineMethod (c$, "computeTorsion", 
function (p1, p2, p3, p4, asDegrees) {
var ijx = p1.x - p2.x;
var ijy = p1.y - p2.y;
var ijz = p1.z - p2.z;
var kjx = p3.x - p2.x;
var kjy = p3.y - p2.y;
var kjz = p3.z - p2.z;
var klx = p3.x - p4.x;
var kly = p3.y - p4.y;
var klz = p3.z - p4.z;
var ax = ijy * kjz - ijz * kjy;
var ay = ijz * kjx - ijx * kjz;
var az = ijx * kjy - ijy * kjx;
var cx = kjy * klz - kjz * kly;
var cy = kjz * klx - kjx * klz;
var cz = kjx * kly - kjy * klx;
var ai2 = 1 / (ax * ax + ay * ay + az * az);
var ci2 = 1 / (cx * cx + cy * cy + cz * cz);
var ai = Math.sqrt (ai2);
var ci = Math.sqrt (ci2);
var denom = ai * ci;
var cross = ax * cx + ay * cy + az * cz;
var cosang = cross * denom;
if (cosang > 1) {
cosang = 1;
}if (cosang < -1) {
cosang = -1;
}var torsion = Math.acos (cosang);
var dot = ijx * cx + ijy * cy + ijz * cz;
var absDot = Math.abs (dot);
torsion = (dot / absDot > 0) ? torsion : -torsion;
return (asDegrees ? torsion / 0.017453292 : torsion);
}, "JU.T3,JU.T3,JU.T3,JU.T3,~B");
c$.computeHelicalAxis = Clazz_defineMethod (c$, "computeHelicalAxis", 
function (a, b, dq) {
var vab =  new JU.V3 ();
vab.sub2 (b, a);
var theta = dq.getTheta ();
var n = dq.getNormal ();
var v_dot_n = vab.dot (n);
if (Math.abs (v_dot_n) < 0.0001) v_dot_n = 0;
var va_prime_d =  new JU.V3 ();
va_prime_d.cross (vab, n);
if (va_prime_d.dot (va_prime_d) != 0) va_prime_d.normalize ();
var vda =  new JU.V3 ();
var vcb = JU.V3.newV (n);
if (v_dot_n == 0) v_dot_n = 1.4E-45;
vcb.scale (v_dot_n);
vda.sub2 (vcb, vab);
vda.scale (0.5);
va_prime_d.scale (theta == 0 ? 0 : (vda.length () / Math.tan (theta / 2 / 180 * 3.141592653589793)));
var r = JU.V3.newV (va_prime_d);
if (theta != 0) r.add (vda);
var pt_a_prime = JU.P3.newP (a);
pt_a_prime.sub (r);
if (v_dot_n != 1.4E-45) n.scale (v_dot_n);
var pt_b_prime = JU.P3.newP (pt_a_prime);
pt_b_prime.add (n);
theta = JU.Measure.computeTorsion (a, pt_a_prime, pt_b_prime, b, true);
if (Float.isNaN (theta) || r.length () < 0.0001) theta = dq.getThetaDirectedV (n);
var residuesPerTurn = Math.abs (theta == 0 ? 0 : 360 / theta);
var pitch = Math.abs (v_dot_n == 1.4E-45 ? 0 : n.length () * (theta == 0 ? 1 : 360 / theta));
return [pt_a_prime, n, r, JU.P3.new3 (theta, pitch, residuesPerTurn), pt_b_prime];
}, "JU.P3,JU.P3,JU.Quat");
c$.getPlaneThroughPoints = Clazz_defineMethod (c$, "getPlaneThroughPoints", 
function (pointA, pointB, pointC, vNorm, vAB, plane) {
var w = JU.Measure.getNormalThroughPoints (pointA, pointB, pointC, vNorm, vAB);
plane.set4 (vNorm.x, vNorm.y, vNorm.z, w);
return plane;
}, "JU.T3,JU.T3,JU.T3,JU.V3,JU.V3,JU.P4");
c$.getPlaneThroughPoint = Clazz_defineMethod (c$, "getPlaneThroughPoint", 
function (pt, normal, plane) {
plane.set4 (normal.x, normal.y, normal.z, -normal.dot (pt));
}, "JU.T3,JU.V3,JU.P4");
c$.distanceToPlane = Clazz_defineMethod (c$, "distanceToPlane", 
function (plane, pt) {
return (plane == null ? NaN : (plane.x * pt.x + plane.y * pt.y + plane.z * pt.z + plane.w) / Math.sqrt (plane.x * plane.x + plane.y * plane.y + plane.z * plane.z));
}, "JU.P4,JU.T3");
c$.distanceToPlaneD = Clazz_defineMethod (c$, "distanceToPlaneD", 
function (plane, d, pt) {
return (plane == null ? NaN : (plane.x * pt.x + plane.y * pt.y + plane.z * pt.z + plane.w) / d);
}, "JU.P4,~N,JU.P3");
c$.distanceToPlaneV = Clazz_defineMethod (c$, "distanceToPlaneV", 
function (norm, w, pt) {
return (norm == null ? NaN : (norm.x * pt.x + norm.y * pt.y + norm.z * pt.z + w) / Math.sqrt (norm.x * norm.x + norm.y * norm.y + norm.z * norm.z));
}, "JU.V3,~N,JU.P3");
c$.calcNormalizedNormal = Clazz_defineMethod (c$, "calcNormalizedNormal", 
function (pointA, pointB, pointC, vNormNorm, vAB) {
vAB.sub2 (pointB, pointA);
vNormNorm.sub2 (pointC, pointA);
vNormNorm.cross (vAB, vNormNorm);
vNormNorm.normalize ();
}, "JU.T3,JU.T3,JU.T3,JU.V3,JU.V3");
c$.getDirectedNormalThroughPoints = Clazz_defineMethod (c$, "getDirectedNormalThroughPoints", 
function (pointA, pointB, pointC, ptRef, vNorm, vAB) {
var nd = JU.Measure.getNormalThroughPoints (pointA, pointB, pointC, vNorm, vAB);
if (ptRef != null) {
var pt0 = JU.P3.newP (pointA);
pt0.add (vNorm);
var d = pt0.distance (ptRef);
pt0.sub2 (pointA, vNorm);
if (d > pt0.distance (ptRef)) {
vNorm.scale (-1);
nd = -nd;
}}return nd;
}, "JU.T3,JU.T3,JU.T3,JU.T3,JU.V3,JU.V3");
c$.getNormalThroughPoints = Clazz_defineMethod (c$, "getNormalThroughPoints", 
function (pointA, pointB, pointC, vNorm, vTemp) {
JU.Measure.calcNormalizedNormal (pointA, pointB, pointC, vNorm, vTemp);
vTemp.setT (pointA);
return -vTemp.dot (vNorm);
}, "JU.T3,JU.T3,JU.T3,JU.V3,JU.V3");
c$.getPlaneProjection = Clazz_defineMethod (c$, "getPlaneProjection", 
function (pt, plane, ptProj, vNorm) {
var dist = JU.Measure.distanceToPlane (plane, pt);
vNorm.set (plane.x, plane.y, plane.z);
vNorm.normalize ();
vNorm.scale (-dist);
ptProj.add2 (pt, vNorm);
}, "JU.P3,JU.P4,JU.P3,JU.V3");
c$.getNormalFromCenter = Clazz_defineMethod (c$, "getNormalFromCenter", 
function (ptCenter, ptA, ptB, ptC, isOutward, normal) {
var vAB =  new JU.V3 ();
var d = JU.Measure.getNormalThroughPoints (ptA, ptB, ptC, normal, vAB);
var isReversed = (JU.Measure.distanceToPlaneV (normal, d, ptCenter) > 0);
if (isReversed == isOutward) normal.scale (-1.0);
return !isReversed;
}, "JU.P3,JU.P3,JU.P3,JU.P3,~B,JU.V3");
c$.getNormalToLine = Clazz_defineMethod (c$, "getNormalToLine", 
function (pointA, pointB, vNormNorm) {
vNormNorm.sub2 (pointA, pointB);
vNormNorm.cross (vNormNorm, JU.Measure.axisY);
vNormNorm.normalize ();
if (Float.isNaN (vNormNorm.x)) vNormNorm.set (1, 0, 0);
}, "JU.P3,JU.P3,JU.V3");
c$.getBisectingPlane = Clazz_defineMethod (c$, "getBisectingPlane", 
function (pointA, vAB, ptTemp, vTemp, plane) {
ptTemp.scaleAdd2 (0.5, vAB, pointA);
vTemp.setT (vAB);
vTemp.normalize ();
JU.Measure.getPlaneThroughPoint (ptTemp, vTemp, plane);
}, "JU.P3,JU.V3,JU.T3,JU.V3,JU.P4");
c$.projectOntoAxis = Clazz_defineMethod (c$, "projectOntoAxis", 
function (point, axisA, axisUnitVector, vectorProjection) {
vectorProjection.sub2 (point, axisA);
var projectedLength = vectorProjection.dot (axisUnitVector);
point.scaleAdd2 (projectedLength, axisUnitVector, axisA);
vectorProjection.sub2 (point, axisA);
}, "JU.P3,JU.P3,JU.V3,JU.V3");
c$.calcBestAxisThroughPoints = Clazz_defineMethod (c$, "calcBestAxisThroughPoints", 
function (points, axisA, axisUnitVector, vectorProjection, nTriesMax) {
var nPoints = points.length;
axisA.setT (points[0]);
axisUnitVector.sub2 (points[nPoints - 1], axisA);
axisUnitVector.normalize ();
JU.Measure.calcAveragePointN (points, nPoints, axisA);
var nTries = 0;
while (nTries++ < nTriesMax && JU.Measure.findAxis (points, nPoints, axisA, axisUnitVector, vectorProjection) > 0.001) {
}
var tempA = JU.P3.newP (points[0]);
JU.Measure.projectOntoAxis (tempA, axisA, axisUnitVector, vectorProjection);
axisA.setT (tempA);
}, "~A,JU.P3,JU.V3,JU.V3,~N");
c$.findAxis = Clazz_defineMethod (c$, "findAxis", 
function (points, nPoints, axisA, axisUnitVector, vectorProjection) {
var sumXiYi =  new JU.V3 ();
var vTemp =  new JU.V3 ();
var pt =  new JU.P3 ();
var ptProj =  new JU.P3 ();
var a = JU.V3.newV (axisUnitVector);
var sum_Xi2 = 0;
for (var i = nPoints; --i >= 0; ) {
pt.setT (points[i]);
ptProj.setT (pt);
JU.Measure.projectOntoAxis (ptProj, axisA, axisUnitVector, vectorProjection);
vTemp.sub2 (pt, ptProj);
vTemp.cross (vectorProjection, vTemp);
sumXiYi.add (vTemp);
sum_Xi2 += vectorProjection.lengthSquared ();
}
var m = JU.V3.newV (sumXiYi);
m.scale (1 / sum_Xi2);
vTemp.cross (m, axisUnitVector);
axisUnitVector.add (vTemp);
axisUnitVector.normalize ();
vTemp.sub2 (axisUnitVector, a);
return vTemp.length ();
}, "~A,~N,JU.P3,JU.V3,JU.V3");
c$.calcAveragePoint = Clazz_defineMethod (c$, "calcAveragePoint", 
function (pointA, pointB, pointC) {
pointC.set ((pointA.x + pointB.x) / 2, (pointA.y + pointB.y) / 2, (pointA.z + pointB.z) / 2);
}, "JU.P3,JU.P3,JU.P3");
c$.calcAveragePointN = Clazz_defineMethod (c$, "calcAveragePointN", 
function (points, nPoints, averagePoint) {
averagePoint.setT (points[0]);
for (var i = 1; i < nPoints; i++) averagePoint.add (points[i]);

averagePoint.scale (1 / nPoints);
}, "~A,~N,JU.P3");
c$.transformPoints = Clazz_defineMethod (c$, "transformPoints", 
function (vPts, m4, center) {
var v =  new JU.Lst ();
for (var i = 0; i < vPts.size (); i++) {
var pt = JU.P3.newP (vPts.get (i));
pt.sub (center);
m4.rotTrans (pt);
pt.add (center);
v.addLast (pt);
}
return v;
}, "JU.Lst,JU.M4,JU.P3");
c$.isInTetrahedron = Clazz_defineMethod (c$, "isInTetrahedron", 
function (pt, ptA, ptB, ptC, ptD, plane, vTemp, vTemp2, fullyEnclosed) {
var b = (JU.Measure.distanceToPlane (JU.Measure.getPlaneThroughPoints (ptC, ptD, ptA, vTemp, vTemp2, plane), pt) >= 0);
if (b != (JU.Measure.distanceToPlane (JU.Measure.getPlaneThroughPoints (ptA, ptD, ptB, vTemp, vTemp2, plane), pt) >= 0)) return false;
if (b != (JU.Measure.distanceToPlane (JU.Measure.getPlaneThroughPoints (ptB, ptD, ptC, vTemp, vTemp2, plane), pt) >= 0)) return false;
var d = JU.Measure.distanceToPlane (JU.Measure.getPlaneThroughPoints (ptA, ptB, ptC, vTemp, vTemp2, plane), pt);
if (fullyEnclosed) return (b == (d >= 0));
var d1 = JU.Measure.distanceToPlane (plane, ptD);
return d1 * d <= 0 || Math.abs (d1) > Math.abs (d);
}, "JU.P3,JU.P3,JU.P3,JU.P3,JU.P3,JU.P4,JU.V3,JU.V3,~B");
c$.getIntersectionPP = Clazz_defineMethod (c$, "getIntersectionPP", 
function (plane1, plane2) {
var a1 = plane1.x;
var b1 = plane1.y;
var c1 = plane1.z;
var d1 = plane1.w;
var a2 = plane2.x;
var b2 = plane2.y;
var c2 = plane2.z;
var d2 = plane2.w;
var norm1 = JU.V3.new3 (a1, b1, c1);
var norm2 = JU.V3.new3 (a2, b2, c2);
var nxn =  new JU.V3 ();
nxn.cross (norm1, norm2);
var ax = Math.abs (nxn.x);
var ay = Math.abs (nxn.y);
var az = Math.abs (nxn.z);
var x;
var y;
var z;
var diff;
var type = (ax > ay ? (ax > az ? 1 : 3) : ay > az ? 2 : 3);
switch (type) {
case 1:
x = 0;
diff = (b1 * c2 - b2 * c1);
if (Math.abs (diff) < 0.01) return null;
y = (c1 * d2 - c2 * d1) / diff;
z = (b2 * d1 - d2 * b1) / diff;
break;
case 2:
diff = (a1 * c2 - a2 * c1);
if (Math.abs (diff) < 0.01) return null;
x = (c1 * d2 - c2 * d1) / diff;
y = 0;
z = (a2 * d1 - d2 * a1) / diff;
break;
case 3:
default:
diff = (a1 * b2 - a2 * b1);
if (Math.abs (diff) < 0.01) return null;
x = (b1 * d2 - b2 * d1) / diff;
y = (a2 * d1 - d2 * a1) / diff;
z = 0;
}
var list =  new JU.Lst ();
list.addLast (JU.P3.new3 (x, y, z));
nxn.normalize ();
list.addLast (nxn);
return list;
}, "JU.P4,JU.P4");
c$.getIntersection = Clazz_defineMethod (c$, "getIntersection", 
function (pt1, v, plane, ptRet, tempNorm, vTemp) {
JU.Measure.getPlaneProjection (pt1, plane, ptRet, tempNorm);
tempNorm.set (plane.x, plane.y, plane.z);
tempNorm.normalize ();
if (v == null) v = JU.V3.newV (tempNorm);
var l_dot_n = v.dot (tempNorm);
if (Math.abs (l_dot_n) < 0.01) return null;
vTemp.sub2 (ptRet, pt1);
ptRet.scaleAdd2 (vTemp.dot (tempNorm) / l_dot_n, v, pt1);
return ptRet;
}, "JU.P3,JU.V3,JU.P4,JU.P3,JU.V3,JU.V3");
c$.calculateQuaternionRotation = Clazz_defineMethod (c$, "calculateQuaternionRotation", 
function (centerAndPoints, retStddev) {
retStddev[1] = NaN;
var q =  new JU.Quat ();
if (centerAndPoints[0].length == 1 || centerAndPoints[0].length != centerAndPoints[1].length) return q;
var n = centerAndPoints[0].length - 1;
if (n < 2) return q;
var Sxx = 0;
var Sxy = 0;
var Sxz = 0;
var Syx = 0;
var Syy = 0;
var Syz = 0;
var Szx = 0;
var Szy = 0;
var Szz = 0;
var ptA =  new JU.P3 ();
var ptB =  new JU.P3 ();
for (var i = n + 1; --i >= 1; ) {
var aij = centerAndPoints[0][i];
var bij = centerAndPoints[1][i];
ptA.sub2 (aij, centerAndPoints[0][0]);
ptB.sub2 (bij, centerAndPoints[0][1]);
Sxx += ptA.x * ptB.x;
Sxy += ptA.x * ptB.y;
Sxz += ptA.x * ptB.z;
Syx += ptA.y * ptB.x;
Syy += ptA.y * ptB.y;
Syz += ptA.y * ptB.z;
Szx += ptA.z * ptB.x;
Szy += ptA.z * ptB.y;
Szz += ptA.z * ptB.z;
}
retStddev[0] = JU.Measure.getRmsd (centerAndPoints, q);
var N =  Clazz_newDoubleArray (4, 4, 0);
N[0][0] = Sxx + Syy + Szz;
N[0][1] = N[1][0] = Syz - Szy;
N[0][2] = N[2][0] = Szx - Sxz;
N[0][3] = N[3][0] = Sxy - Syx;
N[1][1] = Sxx - Syy - Szz;
N[1][2] = N[2][1] = Sxy + Syx;
N[1][3] = N[3][1] = Szx + Sxz;
N[2][2] = -Sxx + Syy - Szz;
N[2][3] = N[3][2] = Syz + Szy;
N[3][3] = -Sxx - Syy + Szz;
var v = (javajs.api.Interface.getInterface ("JU.Eigen")).setM (N).getEigenvectorsFloatTransposed ()[3];
q = JU.Quat.newP4 (JU.P4.new4 (v[1], v[2], v[3], v[0]));
retStddev[1] = JU.Measure.getRmsd (centerAndPoints, q);
return q;
}, "~A,~A");
c$.getTransformMatrix4 = Clazz_defineMethod (c$, "getTransformMatrix4", 
function (ptsA, ptsB, m, centerA) {
var cptsA = JU.Measure.getCenterAndPoints (ptsA);
var cptsB = JU.Measure.getCenterAndPoints (ptsB);
var retStddev =  Clazz_newFloatArray (2, 0);
var q = JU.Measure.calculateQuaternionRotation ([cptsA, cptsB], retStddev);
var v = JU.V3.newVsub (cptsB[0], cptsA[0]);
m.setMV (q.getMatrix (), v);
if (centerA != null) centerA.setT (cptsA[0]);
return retStddev[1];
}, "JU.Lst,JU.Lst,JU.M4,JU.P3");
c$.getCenterAndPoints = Clazz_defineMethod (c$, "getCenterAndPoints", 
function (vPts) {
var n = vPts.size ();
var pts =  new Array (n + 1);
pts[0] =  new JU.P3 ();
if (n > 0) {
for (var i = 0; i < n; i++) {
pts[0].add (pts[i + 1] = vPts.get (i));
}
pts[0].scale (1 / n);
}return pts;
}, "JU.Lst");
c$.getRmsd = Clazz_defineMethod (c$, "getRmsd", 
function (centerAndPoints, q) {
var sum2 = 0;
var ptsA = centerAndPoints[0];
var ptsB = centerAndPoints[1];
var cA = ptsA[0];
var cB = ptsB[0];
var n = ptsA.length - 1;
var ptAnew =  new JU.P3 ();
for (var i = n + 1; --i >= 1; ) {
ptAnew.sub2 (ptsA[i], cA);
q.transform2 (ptAnew, ptAnew).add (cB);
sum2 += ptAnew.distanceSquared (ptsB[i]);
}
return Math.sqrt (sum2 / n);
}, "~A,JU.Quat");
Clazz_defineStatics (c$,
"radiansPerDegree", (0.017453292519943295));
c$.axisY = c$.prototype.axisY = JU.V3.new3 (0, 1, 0);
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.MeshSurface", ["java.lang.Float", "JU.AU", "$.P3", "J.api.Interface", "JU.BoxInfo", "$.C", "$.Geodesic", "$.TempArray"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.slicer = null;
this.spanningVectors = null;
this.meshType = null;
this.vc = 0;
this.vs = null;
this.vvs = null;
this.vertexSource = null;
this.pc = 0;
this.pis = null;
this.colorsExplicit = false;
this.isTriangleSet = false;
this.haveQuads = false;
this.colix = 0;
this.colixBack = 0;
this.isColorSolid = true;
this.offset = null;
this.altVertices = null;
this.pcs = null;
this.vcs = null;
this.normals = null;
this.normalsTemp = null;
this.normalCount = 0;
this.normixCount = 0;
this.bsPolygons = null;
this.mat4 = null;
this.surfaceSet = null;
this.vertexSets = null;
this.nSets = 0;
this.dataOnly = false;
this.lastColor = 0;
this.lastColix = 0;
this.iA = 0;
this.iB = 0;
this.iC = 0;
this.polygonCount0 = 0;
this.vertexCount0 = 0;
this.bsSlabDisplay = null;
this.bsSlabGhost = null;
this.slabMeshType = 0;
this.slabColix = 0;
this.bsDisplay = null;
this.slabOptions = null;
this.mergeVertexCount0 = 0;
this.mergePolygonCount0 = 0;
this.isMerged = false;
Clazz_instantialize (this, arguments);
}, JU, "MeshSurface");
Clazz_defineMethod (c$, "getMeshSlicer", 
function () {
return (this.slicer == null ? this.slicer = (J.api.Interface.getInterface ("JU.MeshSlicer", this.vwr, "script")).set (this) : this.slicer);
});
c$.newMesh = Clazz_defineMethod (c$, "newMesh", 
function (isAlt, vertices, vertexCount, polygonIndexes, normals, nNormals) {
var ms =  new JU.MeshSurface ();
ms.pis = polygonIndexes;
if (isAlt) ms.altVertices = vertices;
 else ms.vs = vertices;
ms.vc = (vertexCount == 0 ? vertices.length : vertexCount);
ms.normals = normals;
ms.normalCount = (nNormals == 0 && normals != null ? normals.length : nNormals);
return ms;
}, "~B,~A,~N,~A,~A,~N");
Clazz_defineMethod (c$, "getVertices", 
function () {
return (this.altVertices == null ? this.vs : this.altVertices);
});
Clazz_defineMethod (c$, "getFaces", 
function () {
return this.pis;
});
Clazz_defineMethod (c$, "setColix", 
function (colix) {
this.colix = colix;
}, "~N");
Clazz_defineMethod (c$, "setColixBack", 
function (colix) {
this.colixBack = colix;
}, "~N");
Clazz_defineMethod (c$, "addV", 
function (vertex, asCopy) {
if (this.vc == 0) this.vs =  new Array (25);
 else if (this.vc == this.vs.length) this.vs = JU.AU.doubleLength (this.vs);
this.vs[this.vc] = (asCopy ? JU.P3.newP (vertex) : vertex);
return this.vc++;
}, "JU.T3,~B");
Clazz_defineMethod (c$, "addTriangle", 
function (vertexA, vertexB, vertexC) {
this.addPolygon ([vertexA, vertexB, vertexC], null);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "addQuad", 
function (vertexA, vertexB, vertexC, vertexD) {
this.haveQuads = true;
this.addPolygon ([vertexA, vertexB, vertexC, vertexD], null);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "setPolygonCount", 
function (polygonCount) {
this.pc = polygonCount;
if (polygonCount < 0) return;
if (this.pis == null || polygonCount > this.pis.length) this.pis = JU.AU.newInt2 (polygonCount);
}, "~N");
Clazz_defineMethod (c$, "addVCVal", 
function (vertex, value, asCopy) {
if (this.vc == 0) this.vvs =  Clazz_newFloatArray (25, 0);
 else if (this.vc >= this.vvs.length) this.vvs = JU.AU.doubleLengthF (this.vvs);
this.vvs[this.vc] = value;
return this.addV (vertex, asCopy);
}, "JU.T3,~N,~B");
Clazz_defineMethod (c$, "addTriangleCheck", 
function (vertexA, vertexB, vertexC, check, iContour, color) {
return (this.vs == null || this.vvs != null && (Float.isNaN (this.vvs[vertexA]) || Float.isNaN (this.vvs[vertexB]) || Float.isNaN (this.vvs[vertexC])) || Float.isNaN (this.vs[vertexA].x) || Float.isNaN (this.vs[vertexB].x) || Float.isNaN (this.vs[vertexC].x) ? -1 : this.addPolygonV3 (vertexA, vertexB, vertexC, check, iContour, color, null));
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "addPolygonV3", 
function (vertexA, vertexB, vertexC, check, iContour, color, bs) {
return (this.dataOnly ? this.addPolygon ([vertexA, vertexB, vertexC, check], bs) : this.addPolygonC ([vertexA, vertexB, vertexC, check, iContour], color, bs, (iContour < 0)));
}, "~N,~N,~N,~N,~N,~N,JU.BS");
Clazz_defineMethod (c$, "addPolygonC", 
function (polygon, color, bs, isExplicit) {
if (color != 0) {
if (this.pcs == null || this.pc == 0) this.lastColor = 0;
if (isExplicit) {
this.colorsExplicit = true;
} else {
if (this.pcs == null) {
this.pcs =  Clazz_newShortArray (25, 0);
} else if (this.pc >= this.pcs.length) {
this.pcs = JU.AU.doubleLengthShort (this.pcs);
}this.pcs[this.pc] = (isExplicit ? 2047 : color == this.lastColor ? this.lastColix : (this.lastColix = JU.C.getColix (this.lastColor = color)));
}}return this.addPolygon (polygon, bs);
}, "~A,~N,JU.BS,~B");
Clazz_defineMethod (c$, "addPolygon", 
function (polygon, bs) {
var n = this.pc;
if (n == 0) this.pis = JU.AU.newInt2 (25);
 else if (n == this.pis.length) this.pis = JU.AU.doubleLength (this.pis);
if (bs != null) bs.set (n);
this.pis[this.pc++] = polygon;
return n;
}, "~A,JU.BS");
Clazz_defineMethod (c$, "invalidatePolygons", 
function () {
for (var i = this.pc; --i >= this.mergePolygonCount0; ) if ((this.bsSlabDisplay == null || this.bsSlabDisplay.get (i)) && this.setABC (i) == null) this.pis[i] = null;

});
Clazz_defineMethod (c$, "setABC", 
function (i) {
if (this.bsSlabDisplay != null && !this.bsSlabDisplay.get (i) && (this.bsSlabGhost == null || !this.bsSlabGhost.get (i))) return null;
var polygon = this.pis[i];
if (polygon == null || polygon.length < 3) return null;
this.iA = polygon[0];
this.iB = polygon[1];
this.iC = polygon[2];
return (this.vvs == null || !Float.isNaN (this.vvs[this.iA]) && !Float.isNaN (this.vvs[this.iB]) && !Float.isNaN (this.vvs[this.iC]) ? polygon : null);
}, "~N");
Clazz_defineMethod (c$, "setTranslucentVertices", 
function (bsVertices) {
}, "JU.BS");
Clazz_defineMethod (c$, "getSlabColor", 
function () {
return (this.bsSlabGhost == null ? null : JU.C.getHexCode (this.slabColix));
});
Clazz_defineMethod (c$, "getSlabTranslucency", 
function () {
return (this.bsSlabGhost == null ? null : "" + JU.C.getColixTranslucencyFractional (this.slabColix));
});
Clazz_defineMethod (c$, "getSlabType", 
function () {
return (this.bsSlabGhost != null && this.slabMeshType == 1073742018 ? "mesh" : null);
});
Clazz_defineMethod (c$, "resetSlab", 
function () {
if (this.slicer != null) this.slicer.slabPolygons (JU.TempArray.getSlabObjectType (1048587, null, false, null), false);
});
Clazz_defineMethod (c$, "slabPolygonsList", 
function (slabInfo, allowCap) {
this.getMeshSlicer ();
for (var i = 0; i < slabInfo.size (); i++) if (!this.slicer.slabPolygons (slabInfo.get (i), allowCap)) break;

}, "JU.Lst,~B");
Clazz_defineMethod (c$, "slabBrillouin", 
function (unitCellVectors) {
return;
}, "~A");
Clazz_defineMethod (c$, "getResolution", 
function () {
return 0;
});
c$.getSphereData = Clazz_defineMethod (c$, "getSphereData", 
function (lvl) {
JU.Geodesic.createGeodesic (lvl);
var vertexCount = JU.Geodesic.getVertexCount (lvl);
var f = JU.Geodesic.getFaceVertexes (lvl);
var nFaces = Clazz_doubleToInt (f.length / 3);
var faces = JU.AU.newInt2 (nFaces);
for (var i = 0, fpt = 0; i < nFaces; i++) {
faces[i] = [f[fpt++], f[fpt++], f[fpt++]];
}
var vectors =  new Array (vertexCount);
for (var i = 0; i < vertexCount; i++) vectors[i] = JU.Geodesic.getVertexVector (i);

return JU.MeshSurface.newMesh (true, vectors, 0, faces, vectors, 0);
}, "~N");
Clazz_defineMethod (c$, "setBox", 
function (xyzMin, xyzMax) {
xyzMin.set (3.4028235E38, 3.4028235E38, 3.4028235E38);
xyzMax.set (-3.4028235E38, -3.4028235E38, -3.4028235E38);
for (var i = 0; i < this.vc; i++) {
var p = this.vs[i];
if (!Float.isNaN (p.x)) JU.BoxInfo.addPoint (p, xyzMin, xyzMax, 0);
}
}, "JU.P3,JU.P3");
Clazz_defineMethod (c$, "setBoundingBox", 
function (boundBoxPoints) {
}, "~A");
c$.getSphericalInterpolationFraction = Clazz_defineMethod (c$, "getSphericalInterpolationFraction", 
function (r, valueA, valueB, d) {
var ra = Math.abs (r + valueA) / d;
var rb = Math.abs (r + valueB) / d;
r /= d;
var ra2 = ra * ra;
var q = ra2 - rb * rb + 1;
var p = 4 * (r * r - ra2);
var factor = (ra < rb ? 1 : -1);
return (((q) + factor * Math.sqrt (q * q + p)) / 2);
}, "~N,~N,~N,~N");
Clazz_defineStatics (c$,
"SEED_COUNT", 25,
"P_CHECK", 3,
"P_CONTOUR", 4,
"P_EXPLICIT_COLOR", 4);
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.Geodesic"], "JU.Normix", ["JU.BS"], function () {
c$ = Clazz_declareType (JU, "Normix");
c$.getNormixCount = Clazz_defineMethod (c$, "getNormixCount", 
function () {
return (JU.Normix.normixCount > 1 ? JU.Normix.normixCount : (JU.Normix.normixCount = JU.Geodesic.getVertexCount (3)));
});
c$.newVertexBitSet = Clazz_defineMethod (c$, "newVertexBitSet", 
function () {
return JU.BS.newN (JU.Normix.getNormixCount ());
});
c$.getVertexVectors = Clazz_defineMethod (c$, "getVertexVectors", 
function () {
if (JU.Normix.vertexVectors == null) JU.Normix.vertexVectors = JU.Geodesic.getVertexVectors ();
return JU.Normix.vertexVectors;
});
c$.setInverseNormixes = Clazz_defineMethod (c$, "setInverseNormixes", 
function () {
if (JU.Normix.inverseNormixes != null) return;
JU.Normix.getNormixCount ();
JU.Normix.getVertexVectors ();
JU.Normix.inverseNormixes =  Clazz_newShortArray (JU.Normix.normixCount, 0);
var bsTemp =  new JU.BS ();
for (var n = JU.Normix.normixCount; --n >= 0; ) {
var v = JU.Normix.vertexVectors[n];
JU.Normix.inverseNormixes[n] = JU.Normix.getNormix (-v.x, -v.y, -v.z, 3, bsTemp);
}
});
c$.getInverseNormix = Clazz_defineMethod (c$, "getInverseNormix", 
function (normix) {
return JU.Normix.inverseNormixes[normix];
}, "~N");
c$.getNeighborVertexArrays = Clazz_defineMethod (c$, "getNeighborVertexArrays", 
 function () {
if (JU.Normix.neighborVertexesArrays == null) {
JU.Normix.neighborVertexesArrays = JU.Geodesic.getNeighborVertexesArrays ();
}return JU.Normix.neighborVertexesArrays;
});
c$.getNormixV = Clazz_defineMethod (c$, "getNormixV", 
function (v, bsTemp) {
return JU.Normix.getNormix (v.x, v.y, v.z, 3, bsTemp);
}, "JU.V3,JU.BS");
c$.get2SidedNormix = Clazz_defineMethod (c$, "get2SidedNormix", 
function (v, bsTemp) {
return ~JU.Normix.getNormixV (v, bsTemp);
}, "JU.V3,JU.BS");
c$.getNormix = Clazz_defineMethod (c$, "getNormix", 
 function (x, y, z, geodesicLevel, bsConsidered) {
var champion;
var t;
if (z >= 0) {
champion = 0;
t = z - 1;
} else {
champion = 11;
t = z - (-1);
}bsConsidered.clearAll ();
bsConsidered.set (champion);
JU.Normix.getVertexVectors ();
JU.Normix.getNeighborVertexArrays ();
var championDist2 = x * x + y * y + t * t;
for (var lvl = 0; lvl <= geodesicLevel; ++lvl) {
var neighborVertexes = JU.Normix.neighborVertexesArrays[lvl];
for (var offsetNeighbors = 6 * champion, i = offsetNeighbors + (champion < 12 ? 5 : 6); --i >= offsetNeighbors; ) {
var challenger = neighborVertexes[i];
if (bsConsidered.get (challenger)) continue;
bsConsidered.set (challenger);
var v = JU.Normix.vertexVectors[challenger];
var d;
d = v.x - x;
var d2 = d * d;
if (d2 >= championDist2) continue;
d = v.y - y;
d2 += d * d;
if (d2 >= championDist2) continue;
d = v.z - z;
d2 += d * d;
if (d2 >= championDist2) continue;
champion = challenger;
championDist2 = d2;
}
}
return champion;
}, "~N,~N,~N,~N,JU.BS");
Clazz_defineStatics (c$,
"NORMIX_GEODESIC_LEVEL", 3,
"normixCount", 0,
"vertexVectors", null,
"inverseNormixes", null,
"neighborVertexesArrays", null,
"NORMIX_NULL", 9999);
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.Parser", ["java.lang.Float", "JU.PT"], function () {
c$ = Clazz_declareType (JU, "Parser");
c$.parseStringInfestedFloatArray = Clazz_defineMethod (c$, "parseStringInfestedFloatArray", 
function (str, bs, data) {
return JU.Parser.parseFloatArrayBsData (JU.PT.getTokens (str), bs, data);
}, "~S,JU.BS,~A");
c$.parseFloatArrayBsData = Clazz_defineMethod (c$, "parseFloatArrayBsData", 
function (tokens, bs, data) {
var len = data.length;
var nTokens = tokens.length;
var n = 0;
var max = 0;
var haveBitSet = (bs != null);
for (var i = (haveBitSet ? bs.nextSetBit (0) : 0); i >= 0 && i < len && n < nTokens; i = (haveBitSet ? bs.nextSetBit (i + 1) : i + 1)) {
var f;
while (Float.isNaN (f = JU.PT.parseFloat (tokens[n++])) && n < nTokens) {
}
if (!Float.isNaN (f)) data[(max = i)] = f;
if (n == nTokens) break;
}
return max + 1;
}, "~A,JU.BS,~A");
c$.parseFloatArrayFromMatchAndField = Clazz_defineMethod (c$, "parseFloatArrayFromMatchAndField", 
function (str, bs, fieldMatch, fieldMatchColumnCount, matchData, field, fieldColumnCount, data, firstLine) {
var f;
var i = -1;
var isMatch = (matchData != null);
var lines = JU.Parser.markLines (str, (str.indexOf ('\n') >= 0 ? '\n' : ';'));
var iLine = (firstLine <= 1 || firstLine >= lines.length ? 0 : firstLine - 1);
var pt = (iLine == 0 ? 0 : lines[iLine - 1]);
var nLines = lines.length;
if (data == null) data =  Clazz_newFloatArray (nLines - iLine, 0);
var len = data.length;
var minLen = (fieldColumnCount <= 0 ? Math.max (field, fieldMatch) : Math.max (field + fieldColumnCount, fieldMatch + fieldMatchColumnCount) - 1);
var haveBitSet = (bs != null);
for (; iLine < nLines; iLine++) {
var line = str.substring (pt, lines[iLine]).trim ();
pt = lines[iLine];
var tokens = (fieldColumnCount <= 0 ? JU.PT.getTokens (line) : null);
if (fieldColumnCount <= 0) {
if (tokens.length < minLen || Float.isNaN (f = JU.PT.parseFloat (tokens[field - 1]))) continue;
} else {
if (line.length < minLen || Float.isNaN (f = JU.PT.parseFloat (line.substring (field - 1, field + fieldColumnCount - 1)))) continue;
}var iData;
if (isMatch) {
iData = JU.PT.parseInt (tokens == null ? line.substring (fieldMatch - 1, fieldMatch + fieldMatchColumnCount - 1) : tokens[fieldMatch - 1]);
if (iData == -2147483648 || iData < 0 || iData >= len || (iData = matchData[iData]) < 0) continue;
if (haveBitSet) bs.set (iData);
} else {
if (haveBitSet) i = bs.nextSetBit (i + 1);
 else i++;
if (i < 0 || i >= len) return data;
iData = i;
}data[iData] = f;
}
return data;
}, "~S,JU.BS,~N,~N,~A,~N,~N,~A,~N");
c$.fixDataString = Clazz_defineMethod (c$, "fixDataString", 
function (str) {
str = str.$replace (';', str.indexOf ('\n') < 0 ? '\n' : ' ');
str = JU.PT.trim (str, "\n \t");
str = JU.PT.rep (str, "\n ", "\n");
str = JU.PT.rep (str, "\n\n", "\n");
return str;
}, "~S");
c$.markLines = Clazz_defineMethod (c$, "markLines", 
function (data, eol) {
var nLines = 0;
for (var i = data.length; --i >= 0; ) if (data.charAt (i) == eol) nLines++;

var lines =  Clazz_newIntArray (nLines + 1, 0);
nLines = 0;
var pt = 0;
while ((pt = data.indexOf (eol, pt)) >= 0) lines[nLines++] = ++pt;

lines[nLines] = data.length;
return lines;
}, "~S,~S");
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.P3"], "JU.Point3fi", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.mi = -1;
this.i = 0;
this.sX = 0;
this.sY = 0;
this.sZ = 0;
this.sD = -1;
Clazz_instantialize (this, arguments);
}, JU, "Point3fi", JU.P3, Cloneable);
c$.set2 = Clazz_defineMethod (c$, "set2", 
function (p3f, p3i) {
p3f.x = p3i.x;
p3f.y = p3i.y;
p3f.z = p3i.z;
}, "JU.P3,JU.P3i");
Clazz_defineMethod (c$, "copy", 
function () {
try {
return this.clone ();
} catch (e) {
if (Clazz_exceptionOf (e, CloneNotSupportedException)) {
return null;
} else {
throw e;
}
}
});
});
Clazz_declarePackage ("JU");
c$ = Clazz_decorateAsClass (function () {
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
Clazz_instantialize (this, arguments);
}, JU, "Rectangle");
Clazz_defineMethod (c$, "contains", 
function (X, Y) {
return (X >= this.x && Y >= this.y && X - this.x < this.width && Y - this.y < this.height);
}, "~N,~N");
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.Rgb16", ["JU.SB"], function () {
c$ = Clazz_decorateAsClass (function () {
this.r = 0;
this.g = 0;
this.b = 0;
Clazz_instantialize (this, arguments);
}, JU, "Rgb16");
Clazz_makeConstructor (c$, 
function () {
});
c$.newI = Clazz_defineMethod (c$, "newI", 
function (argb) {
var c =  new JU.Rgb16 ();
c.setInt (argb);
return c;
}, "~N");
Clazz_defineMethod (c$, "setInt", 
function (a) {
this.r = ((a >> 8) & 0xFF00) | 0x80;
this.g = ((a) & 0xFF00) | 0x80;
this.b = ((a << 8) & 0xFF00) | 0x80;
}, "~N");
Clazz_defineMethod (c$, "setRgb", 
function (a) {
this.r = a.r;
this.g = a.g;
this.b = a.b;
}, "JU.Rgb16");
Clazz_defineMethod (c$, "diffDiv", 
function (a, b, divisor) {
this.r = Clazz_doubleToInt ((a.r - b.r) / divisor);
this.g = Clazz_doubleToInt ((a.g - b.g) / divisor);
this.b = Clazz_doubleToInt ((a.b - b.b) / divisor);
}, "JU.Rgb16,JU.Rgb16,~N");
Clazz_defineMethod (c$, "setAndIncrement", 
function (base, inc) {
this.r = base.r;
base.r += inc.r;
this.g = base.g;
base.g += inc.g;
this.b = base.b;
base.b += inc.b;
}, "JU.Rgb16,JU.Rgb16");
Clazz_defineMethod (c$, "getArgb", 
function () {
return (0xFF000000 | ((this.r << 8) & 0x00FF0000) | (this.g & 0x0000FF00) | (this.b >> 8));
});
Clazz_overrideMethod (c$, "toString", 
function () {
return  new JU.SB ().append ("Rgb16(").appendI (this.r).appendC (',').appendI (this.g).appendC (',').appendI (this.b).append (" -> ").appendI ((this.r >> 8) & 0xFF).appendC (',').appendI ((this.g >> 8) & 0xFF).appendC (',').appendI ((this.b >> 8) & 0xFF).appendC (')').toString ();
});
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.AU", "$.V3"], "JU.Shader", ["JU.CU", "JU.C"], function () {
c$ = Clazz_decorateAsClass (function () {
this.xLight = 0;
this.yLight = 0;
this.zLight = 0;
this.lightSource = null;
this.specularOn = true;
this.usePhongExponent = false;
this.ambientPercent = 45;
this.diffusePercent = 84;
this.specularExponent = 6;
this.specularPercent = 22;
this.specularPower = 40;
this.phongExponent = 64;
this.ambientFraction = 0;
this.diffuseFactor = 0;
this.intenseFraction = 0;
this.specularFactor = 0;
this.ashades = null;
this.ashadesGreyscale = null;
this.celOn = false;
this.celPower = 10;
this.celRGB = 0;
this.celZ = 0;
this.useLight = false;
this.sphereShadeIndexes = null;
this.seed = 0x12345679;
this.sphereShapeCache = null;
this.ellipsoidShades = null;
this.nOut = 0;
this.nIn = 0;
Clazz_instantialize (this, arguments);
}, JU, "Shader");
Clazz_prepareFields (c$, function () {
this.lightSource =  new JU.V3 ();
this.ambientFraction = this.ambientPercent / 100;
this.diffuseFactor = this.diffusePercent / 100;
this.intenseFraction = this.specularPower / 100;
this.specularFactor = this.specularPercent / 100;
this.ashades = JU.AU.newInt2 (128);
this.sphereShadeIndexes =  Clazz_newByteArray (65536, 0);
this.sphereShapeCache = JU.AU.newInt2 (128);
});
Clazz_makeConstructor (c$, 
function () {
this.setLightSource (-1.0, -1.0, 2.5);
});
Clazz_defineMethod (c$, "setLightSource", 
 function (x, y, z) {
this.lightSource.set (x, y, z);
this.lightSource.normalize ();
this.xLight = this.lightSource.x;
this.yLight = this.lightSource.y;
this.zLight = this.lightSource.z;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setCel", 
function (celShading, celShadingPower, argb) {
celShading = celShading && celShadingPower != 0;
argb = JU.C.getArgb (JU.C.getBgContrast (argb));
argb = (argb == 0xFF000000 ? 0xFF040404 : argb == -1 ? -2 : argb + 1);
if (this.celOn == celShading && this.celRGB == argb && this.celPower == celShadingPower) return;
this.celOn = celShading;
this.celPower = celShadingPower;
this.useLight = (!this.celOn || celShadingPower > 0);
this.celZ = 1 - Math.pow (2, -Math.abs (celShadingPower) / 10);
this.celRGB = argb;
this.flushCaches ();
}, "~B,~N,~N");
Clazz_defineMethod (c$, "flushCaches", 
function () {
this.checkShades (JU.C.colixMax);
for (var i = JU.C.colixMax; --i >= 0; ) this.ashades[i] = null;

this.calcSphereShading ();
for (var i = 128; --i >= 0; ) this.sphereShapeCache[i] = null;

this.ellipsoidShades = null;
});
Clazz_defineMethod (c$, "setLastColix", 
function (argb, asGrey) {
JU.C.allocateColix (argb, true);
this.checkShades (2047);
if (asGrey) JU.C.setLastGrey (argb);
this.ashades[2047] = this.getShades2 (argb, false);
}, "~N,~B");
Clazz_defineMethod (c$, "getShades", 
function (colix) {
this.checkShades (JU.C.colixMax);
colix &= -30721;
var shades = this.ashades[colix];
if (shades == null) shades = this.ashades[colix] = this.getShades2 (JU.C.argbs[colix], false);
return shades;
}, "~N");
Clazz_defineMethod (c$, "getShadesG", 
function (colix) {
this.checkShades (JU.C.colixMax);
colix &= -30721;
if (this.ashadesGreyscale == null) this.ashadesGreyscale = JU.AU.newInt2 (this.ashades.length);
var shadesGreyscale = this.ashadesGreyscale[colix];
if (shadesGreyscale == null) shadesGreyscale = this.ashadesGreyscale[colix] = this.getShades2 (JU.C.argbs[colix], true);
return shadesGreyscale;
}, "~N");
Clazz_defineMethod (c$, "checkShades", 
 function (n) {
if (this.ashades != null && this.ashades.length >= n) return;
if (n == 2047) n++;
this.ashades = JU.AU.arrayCopyII (this.ashades, n);
if (this.ashadesGreyscale != null) this.ashadesGreyscale = JU.AU.arrayCopyII (this.ashadesGreyscale, n);
}, "~N");
Clazz_defineMethod (c$, "getShades2", 
 function (rgb, greyScale) {
var shades =  Clazz_newIntArray (64, 0);
if (rgb == 0) return shades;
var red0 = ((rgb >> 16) & 0xFF);
var grn0 = ((rgb >> 8) & 0xFF);
var blu0 = (rgb & 0xFF);
var red = 0;
var grn = 0;
var blu = 0;
var f = this.ambientFraction;
while (true) {
red = red0 * f + 0.5;
grn = grn0 * f + 0.5;
blu = blu0 * f + 0.5;
if (f > 0 && red < 4 && grn < 4 && blu < 4) {
red0++;
grn0++;
blu0++;
if (f < 0.1) f += 0.1;
rgb = JU.CU.rgb (Clazz_doubleToInt (Math.floor (red0)), Clazz_doubleToInt (Math.floor (grn0)), Clazz_doubleToInt (Math.floor (blu0)));
continue;
}break;
}
var i = 0;
f = (1 - f) / 52;
var redStep = red0 * f;
var grnStep = grn0 * f;
var bluStep = blu0 * f;
if (this.celOn) {
var max = 32;
var _rgb = JU.CU.rgb (Clazz_doubleToInt (Math.floor (red)), Clazz_doubleToInt (Math.floor (grn)), Clazz_doubleToInt (Math.floor (blu)));
if (this.celPower >= 0) for (; i < max; ++i) shades[i] = _rgb;

red += redStep * max;
grn += grnStep * max;
blu += bluStep * max;
_rgb = JU.CU.rgb (Clazz_doubleToInt (Math.floor (red)), Clazz_doubleToInt (Math.floor (grn)), Clazz_doubleToInt (Math.floor (blu)));
for (; i < 64; i++) shades[i] = _rgb;

shades[0] = shades[1] = this.celRGB;
} else {
for (; i < 52; ++i) {
shades[i] = JU.CU.rgb (Clazz_doubleToInt (Math.floor (red)), Clazz_doubleToInt (Math.floor (grn)), Clazz_doubleToInt (Math.floor (blu)));
red += redStep;
grn += grnStep;
blu += bluStep;
}
shades[i++] = rgb;
f = this.intenseFraction / (64 - i);
redStep = (255.5 - red) * f;
grnStep = (255.5 - grn) * f;
bluStep = (255.5 - blu) * f;
for (; i < 64; i++) {
red += redStep;
grn += grnStep;
blu += bluStep;
shades[i] = JU.CU.rgb (Clazz_doubleToInt (Math.floor (red)), Clazz_doubleToInt (Math.floor (grn)), Clazz_doubleToInt (Math.floor (blu)));
}
}if (greyScale) for (; --i >= 0; ) shades[i] = JU.CU.toFFGGGfromRGB (shades[i]);

return shades;
}, "~N,~B");
Clazz_defineMethod (c$, "getShadeIndex", 
function (x, y, z) {
var magnitude = Math.sqrt (x * x + y * y + z * z);
return Math.round (this.getShadeF ((x / magnitude), (y / magnitude), (z / magnitude)) * 63);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getShadeB", 
function (x, y, z) {
return Math.round (this.getShadeF (x, y, z) * 63);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getShadeFp8", 
function (x, y, z) {
var magnitude = Math.sqrt (x * x + y * y + z * z);
return Clazz_doubleToInt (Math.floor (this.getShadeF ((x / magnitude), (y / magnitude), (z / magnitude)) * 63 * (256)));
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getShadeF", 
 function (x, y, z) {
var NdotL = (this.useLight ? x * this.xLight + y * this.yLight + z * this.zLight : z);
if (NdotL <= 0) return 0;
var intensity = NdotL * this.diffuseFactor;
if (this.specularOn) {
var k_specular = 2 * NdotL * z - this.zLight;
if (k_specular > 0) {
if (this.usePhongExponent) {
k_specular = Math.pow (k_specular, this.phongExponent);
} else {
for (var n = this.specularExponent; --n >= 0 && k_specular > .0001; ) k_specular *= k_specular;

}intensity += k_specular * this.specularFactor;
}}return (this.celOn && z < this.celZ ? 0 : intensity > 1 ? 1 : intensity);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "getShadeN", 
function (x, y, z, r) {
var fp8ShadeIndex = Clazz_doubleToInt (Math.floor (this.getShadeF (x / r, y / r, z / r) * 63 * (256)));
var shadeIndex = fp8ShadeIndex >> 8;
if (!this.useLight) return shadeIndex;
if ((fp8ShadeIndex & 0xFF) > this.nextRandom8Bit ()) ++shadeIndex;
var random16bit = this.seed & 0xFFFF;
if (random16bit < 21845 && shadeIndex > 0) --shadeIndex;
 else if (random16bit > 43690 && shadeIndex < 63) ++shadeIndex;
return shadeIndex;
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "calcSphereShading", 
 function () {
var xF = -127.5;
var r2 = 16900;
for (var i = 0; i < 256; ++xF, ++i) {
var yF = -127.5;
var xF2 = xF * xF;
for (var j = 0; j < 256; ++yF, ++j) {
var shadeIndex = 0;
var z2 = r2 - xF2 - yF * yF;
if (z2 > 0) {
var z = Math.sqrt (z2);
shadeIndex = this.getShadeN (xF, yF, z, 130);
}this.sphereShadeIndexes[(j << 8) + i] = shadeIndex;
}
}
});
Clazz_defineMethod (c$, "nextRandom8Bit", 
function () {
var t = this.seed;
this.seed = t = ((t << 16) + (t << 1) + t) & 0x7FFFFFFF;
return t >> 23;
});
Clazz_defineMethod (c$, "getEllipsoidShade", 
function (x, y, z, radius, mDeriv) {
var tx = mDeriv.m00 * x + mDeriv.m01 * y + mDeriv.m02 * z + mDeriv.m03;
var ty = mDeriv.m10 * x + mDeriv.m11 * y + mDeriv.m12 * z + mDeriv.m13;
var tz = mDeriv.m20 * x + mDeriv.m21 * y + mDeriv.m22 * z + mDeriv.m23;
var f = Math.min (radius / 2, 45) / Math.sqrt (tx * tx + ty * ty + tz * tz);
var i = Clazz_floatToInt (-tx * f);
var j = Clazz_floatToInt (-ty * f);
var k = Clazz_floatToInt (tz * f);
var outside = i < -20 || i >= 20 || j < -20 || j >= 20 || k < 0 || k >= 40;
if (outside) {
while (i % 2 == 0 && j % 2 == 0 && k % 2 == 0 && i + j + k > 0) {
i >>= 1;
j >>= 1;
k >>= 1;
}
outside = i < -20 || i >= 20 || j < -20 || j >= 20 || k < 0 || k >= 40;
}if (outside) this.nOut++;
 else this.nIn++;
return (outside ? this.getShadeIndex (i, j, k) : this.ellipsoidShades[i + 20][j + 20][k]);
}, "~N,~N,~N,~N,JU.M4");
Clazz_defineMethod (c$, "createEllipsoidShades", 
function () {
this.ellipsoidShades =  Clazz_newByteArray (40, 40, 40, 0);
for (var ii = 0; ii < 40; ii++) for (var jj = 0; jj < 40; jj++) for (var kk = 0; kk < 40; kk++) this.ellipsoidShades[ii][jj][kk] = this.getShadeIndex (ii - 20, jj - 20, kk);



});
Clazz_defineStatics (c$,
"SHADE_INDEX_MAX", 64,
"SHADE_INDEX_LAST", 63,
"SHADE_INDEX_NORMAL", 52,
"SHADE_INDEX_NOISY_LIMIT", 56,
"SLIM", 20,
"SDIM", 40,
"maxSphereCache", 128);
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.SimpleUnitCell", ["java.lang.Float", "JU.AU", "$.M4", "$.P3", "$.V3"], function () {
c$ = Clazz_decorateAsClass (function () {
this.notionalUnitcell = null;
this.matrixCartesianToFractional = null;
this.matrixFractionalToCartesian = null;
this.volume = 0;
this.na = 0;
this.nb = 0;
this.nc = 0;
this.a = 0;
this.b = 0;
this.c = 0;
this.alpha = 0;
this.beta = 0;
this.gamma = 0;
this.cosAlpha = 0;
this.sinAlpha = 0;
this.cosBeta = 0;
this.sinBeta = 0;
this.cosGamma = 0;
this.sinGamma = 0;
this.cA_ = 0;
this.cB_ = 0;
this.a_ = 0;
this.b_ = 0;
this.c_ = 0;
this.dimension = 0;
this.fractionalOrigin = null;
this.matrixCtoFANoOffset = null;
this.matrixFtoCNoOffset = null;
Clazz_instantialize (this, arguments);
}, JU, "SimpleUnitCell");
Clazz_defineMethod (c$, "isSupercell", 
function () {
return (this.na > 1 || this.nb > 1 || this.nc > 1);
});
c$.isValid = Clazz_defineMethod (c$, "isValid", 
function (parameters) {
return (parameters != null && (parameters[0] > 0 || parameters.length > 14 && !Float.isNaN (parameters[14])));
}, "~A");
Clazz_makeConstructor (c$, 
function () {
this.fractionalOrigin =  new JU.P3 ();
});
c$.newA = Clazz_defineMethod (c$, "newA", 
function (parameters) {
var c =  new JU.SimpleUnitCell ();
c.init (parameters);
return c;
}, "~A");
Clazz_defineMethod (c$, "init", 
function (parameters) {
if (parameters == null) parameters = [1, 1, 1, 90, 90, 90];
if (!JU.SimpleUnitCell.isValid (parameters)) return;
this.notionalUnitcell = JU.AU.arrayCopyF (parameters, parameters.length);
this.a = parameters[0];
this.b = parameters[1];
this.c = parameters[2];
this.alpha = parameters[3];
this.beta = parameters[4];
this.gamma = parameters[5];
this.na = Math.max (1, parameters.length >= 25 && !Float.isNaN (parameters[22]) ? Clazz_floatToInt (parameters[22]) : 1);
this.nb = Math.max (1, parameters.length >= 25 && !Float.isNaN (parameters[23]) ? Clazz_floatToInt (parameters[23]) : 1);
this.nc = Math.max (1, parameters.length >= 25 && !Float.isNaN (parameters[24]) ? Clazz_floatToInt (parameters[24]) : 1);
if (this.a <= 0) {
var va = JU.V3.new3 (parameters[6], parameters[7], parameters[8]);
var vb = JU.V3.new3 (parameters[9], parameters[10], parameters[11]);
var vc = JU.V3.new3 (parameters[12], parameters[13], parameters[14]);
this.setABC (va, vb, vc);
if (this.c < 0) {
var n = JU.AU.arrayCopyF (parameters, -1);
if (this.b < 0) {
vb.set (0, 0, 1);
vb.cross (vb, va);
if (vb.length () < 0.001) vb.set (0, 1, 0);
vb.normalize ();
n[9] = vb.x;
n[10] = vb.y;
n[11] = vb.z;
}if (this.c < 0) {
vc.cross (va, vb);
vc.normalize ();
n[12] = vc.x;
n[13] = vc.y;
n[14] = vc.z;
}parameters = n;
}}this.a *= this.na;
if (this.b <= 0) {
this.b = this.c = 1;
this.dimension = 1;
} else if (this.c <= 0) {
this.c = 1;
this.b *= this.nb;
this.dimension = 2;
} else {
this.b *= this.nb;
this.c *= this.nc;
this.dimension = 3;
}this.setCellParams ();
if (parameters.length > 21 && !Float.isNaN (parameters[21])) {
var scaleMatrix =  Clazz_newFloatArray (16, 0);
for (var i = 0; i < 16; i++) {
var f;
switch (i % 4) {
case 0:
f = this.na;
break;
case 1:
f = this.nb;
break;
case 2:
f = this.nc;
break;
default:
f = 1;
break;
}
scaleMatrix[i] = parameters[6 + i] * f;
}
this.matrixCartesianToFractional = JU.M4.newA16 (scaleMatrix);
this.matrixCartesianToFractional.getTranslation (this.fractionalOrigin);
this.matrixFractionalToCartesian = JU.M4.newM4 (this.matrixCartesianToFractional).invert ();
if (parameters[0] == 1) this.setParamsFromMatrix ();
} else if (parameters.length > 14 && !Float.isNaN (parameters[14])) {
var m = this.matrixFractionalToCartesian =  new JU.M4 ();
m.setColumn4 (0, parameters[6] * this.na, parameters[7] * this.na, parameters[8] * this.na, 0);
m.setColumn4 (1, parameters[9] * this.nb, parameters[10] * this.nb, parameters[11] * this.nb, 0);
m.setColumn4 (2, parameters[12] * this.nc, parameters[13] * this.nc, parameters[14] * this.nc, 0);
m.setColumn4 (3, 0, 0, 0, 1);
this.matrixCartesianToFractional = JU.M4.newM4 (this.matrixFractionalToCartesian).invert ();
} else {
var m = this.matrixFractionalToCartesian =  new JU.M4 ();
m.setColumn4 (0, this.a, 0, 0, 0);
m.setColumn4 (1, (this.b * this.cosGamma), (this.b * this.sinGamma), 0, 0);
m.setColumn4 (2, (this.c * this.cosBeta), (this.c * (this.cosAlpha - this.cosBeta * this.cosGamma) / this.sinGamma), (this.volume / (this.a * this.b * this.sinGamma)), 0);
m.setColumn4 (3, 0, 0, 0, 1);
this.matrixCartesianToFractional = JU.M4.newM4 (this.matrixFractionalToCartesian).invert ();
}this.matrixCtoFANoOffset = this.matrixCartesianToFractional;
this.matrixFtoCNoOffset = this.matrixFractionalToCartesian;
}, "~A");
Clazz_defineMethod (c$, "setParamsFromMatrix", 
 function () {
var va = JU.V3.new3 (1, 0, 0);
var vb = JU.V3.new3 (0, 1, 0);
var vc = JU.V3.new3 (0, 0, 1);
this.matrixFractionalToCartesian.rotate (va);
this.matrixFractionalToCartesian.rotate (vb);
this.matrixFractionalToCartesian.rotate (vc);
this.setABC (va, vb, vc);
this.setCellParams ();
});
Clazz_defineMethod (c$, "setABC", 
 function (va, vb, vc) {
this.a = va.length ();
this.b = vb.length ();
this.c = vc.length ();
if (this.a == 0) return;
if (this.b == 0) this.b = this.c = -1;
 else if (this.c == 0) this.c = -1;
this.alpha = (this.b < 0 || this.c < 0 ? 90 : vb.angle (vc) / 0.017453292);
this.beta = (this.c < 0 ? 90 : va.angle (vc) / 0.017453292);
this.gamma = (this.b < 0 ? 90 : va.angle (vb) / 0.017453292);
}, "JU.V3,JU.V3,JU.V3");
Clazz_defineMethod (c$, "setCellParams", 
 function () {
this.cosAlpha = Math.cos (0.017453292 * this.alpha);
this.sinAlpha = Math.sin (0.017453292 * this.alpha);
this.cosBeta = Math.cos (0.017453292 * this.beta);
this.sinBeta = Math.sin (0.017453292 * this.beta);
this.cosGamma = Math.cos (0.017453292 * this.gamma);
this.sinGamma = Math.sin (0.017453292 * this.gamma);
var unitVolume = Math.sqrt (this.sinAlpha * this.sinAlpha + this.sinBeta * this.sinBeta + this.sinGamma * this.sinGamma + 2.0 * this.cosAlpha * this.cosBeta * this.cosGamma - 2);
this.volume = this.a * this.b * this.c * unitVolume;
this.cA_ = (this.cosAlpha - this.cosBeta * this.cosGamma) / this.sinGamma;
this.cB_ = unitVolume / this.sinGamma;
this.a_ = this.b * this.c * this.sinAlpha / this.volume;
this.b_ = this.a * this.c * this.sinBeta / this.volume;
this.c_ = this.a * this.b * this.sinGamma / this.volume;
});
Clazz_defineMethod (c$, "getFractionalOrigin", 
function () {
return this.fractionalOrigin;
});
Clazz_defineMethod (c$, "toSupercell", 
function (fpt) {
fpt.x /= this.na;
fpt.y /= this.nb;
fpt.z /= this.nc;
return fpt;
}, "JU.P3");
Clazz_defineMethod (c$, "toCartesian", 
function (pt, ignoreOffset) {
if (this.matrixFractionalToCartesian != null) (ignoreOffset ? this.matrixFtoCNoOffset : this.matrixFractionalToCartesian).rotTrans (pt);
}, "JU.T3,~B");
Clazz_defineMethod (c$, "toFractional", 
function (pt, isAbsolute) {
if (this.matrixCartesianToFractional == null) return;
(isAbsolute ? this.matrixCtoFANoOffset : this.matrixCartesianToFractional).rotTrans (pt);
}, "JU.T3,~B");
Clazz_defineMethod (c$, "isPolymer", 
function () {
return (this.dimension == 1);
});
Clazz_defineMethod (c$, "isSlab", 
function () {
return (this.dimension == 2);
});
Clazz_defineMethod (c$, "getNotionalUnitCell", 
function () {
return this.notionalUnitcell;
});
Clazz_defineMethod (c$, "getUnitCellAsArray", 
function (vectorsOnly) {
var m = this.matrixFractionalToCartesian;
return (vectorsOnly ? [m.m00, m.m10, m.m20, m.m01, m.m11, m.m21, m.m02, m.m12, m.m22] : [this.a, this.b, this.c, this.alpha, this.beta, this.gamma, m.m00, m.m10, m.m20, m.m01, m.m11, m.m21, m.m02, m.m12, m.m22, this.dimension, this.volume]);
}, "~B");
Clazz_defineMethod (c$, "getInfo", 
function (infoType) {
switch (infoType) {
case 0:
return this.a;
case 1:
return this.b;
case 2:
return this.c;
case 3:
return this.alpha;
case 4:
return this.beta;
case 5:
return this.gamma;
case 6:
return this.dimension;
}
return NaN;
}, "~N");
c$.ijkToPoint3f = Clazz_defineMethod (c$, "ijkToPoint3f", 
function (nnn, cell, offset) {
var f = (nnn > 1000000000 ? 1000 : nnn > 1000000 ? 100 : 10);
var f2 = f * f;
offset -= (offset >= 0 ? Clazz_doubleToInt (5 * f / 10) : offset);
cell.x = ((Clazz_doubleToInt (nnn / f2)) % f) + offset;
cell.y = Clazz_doubleToInt ((nnn % f2) / f) + offset;
cell.z = (nnn % f) + offset;
}, "~N,JU.P3,~N");
c$.getCellWeight = Clazz_defineMethod (c$, "getCellWeight", 
function (pt) {
var f = 1;
if (pt.x == 0) f /= 2;
if (pt.y == 0) f /= 2;
if (pt.z == 0) f /= 2;
return f;
}, "JU.P3");
Clazz_defineStatics (c$,
"toRadians", 0.017453292,
"INFO_DIMENSIONS", 6,
"INFO_GAMMA", 5,
"INFO_BETA", 4,
"INFO_ALPHA", 3,
"INFO_C", 2,
"INFO_B", 1,
"INFO_A", 0);
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.TempArray", ["java.lang.Boolean", "$.Float", "JU.P3", "$.P3i"], function () {
c$ = Clazz_decorateAsClass (function () {
this.lengthsFreePoints = null;
this.freePoints = null;
this.lengthsFreeScreens = null;
this.freeScreens = null;
this.lengthsFreeEnum = null;
this.freeEnum = null;
Clazz_instantialize (this, arguments);
}, JU, "TempArray");
Clazz_prepareFields (c$, function () {
this.lengthsFreePoints =  Clazz_newIntArray (6, 0);
this.freePoints =  new Array (6);
this.lengthsFreeScreens =  Clazz_newIntArray (6, 0);
this.freeScreens =  new Array (6);
this.lengthsFreeEnum =  Clazz_newIntArray (2, 0);
this.freeEnum =  new Array (2);
});
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "clear", 
function () {
this.clearTempPoints ();
this.clearTempScreens ();
});
c$.findBestFit = Clazz_defineMethod (c$, "findBestFit", 
 function (size, lengths) {
var iFit = -1;
var fitLength = 2147483647;
for (var i = lengths.length; --i >= 0; ) {
var freeLength = lengths[i];
if (freeLength >= size && freeLength < fitLength) {
fitLength = freeLength;
iFit = i;
}}
if (iFit >= 0) lengths[iFit] = 0;
return iFit;
}, "~N,~A");
c$.findShorter = Clazz_defineMethod (c$, "findShorter", 
 function (size, lengths) {
for (var i = lengths.length; --i >= 0; ) if (lengths[i] == 0) {
lengths[i] = size;
return i;
}
var iShortest = 0;
var shortest = lengths[0];
for (var i = lengths.length; --i > 0; ) if (lengths[i] < shortest) {
shortest = lengths[i];
iShortest = i;
}
if (shortest < size) {
lengths[iShortest] = size;
return iShortest;
}return -1;
}, "~N,~A");
Clazz_defineMethod (c$, "clearTempPoints", 
 function () {
for (var i = 0; i < 6; i++) {
this.lengthsFreePoints[i] = 0;
this.freePoints[i] = null;
}
});
Clazz_defineMethod (c$, "allocTempPoints", 
function (size) {
var tempPoints;
var iFit = JU.TempArray.findBestFit (size, this.lengthsFreePoints);
if (iFit > 0) {
tempPoints = this.freePoints[iFit];
} else {
tempPoints =  new Array (size);
for (var i = size; --i >= 0; ) tempPoints[i] =  new JU.P3 ();

}return tempPoints;
}, "~N");
Clazz_defineMethod (c$, "freeTempPoints", 
function (tempPoints) {
for (var i = 0; i < this.freePoints.length; i++) if (this.freePoints[i] === tempPoints) {
this.lengthsFreePoints[i] = tempPoints.length;
return;
}
var iFree = JU.TempArray.findShorter (tempPoints.length, this.lengthsFreePoints);
if (iFree >= 0) this.freePoints[iFree] = tempPoints;
}, "~A");
Clazz_defineMethod (c$, "clearTempScreens", 
 function () {
for (var i = 0; i < 6; i++) {
this.lengthsFreeScreens[i] = 0;
this.freeScreens[i] = null;
}
});
Clazz_defineMethod (c$, "allocTempScreens", 
function (size) {
var tempScreens;
var iFit = JU.TempArray.findBestFit (size, this.lengthsFreeScreens);
if (iFit > 0) {
tempScreens = this.freeScreens[iFit];
} else {
tempScreens =  new Array (size);
for (var i = size; --i >= 0; ) tempScreens[i] =  new JU.P3i ();

}return tempScreens;
}, "~N");
Clazz_defineMethod (c$, "freeTempScreens", 
function (tempScreens) {
for (var i = 0; i < this.freeScreens.length; i++) if (this.freeScreens[i] === tempScreens) {
this.lengthsFreeScreens[i] = tempScreens.length;
return;
}
var iFree = JU.TempArray.findShorter (tempScreens.length, this.lengthsFreeScreens);
if (iFree >= 0) this.freeScreens[iFree] = tempScreens;
}, "~A");
Clazz_defineMethod (c$, "allocTempEnum", 
function (size) {
var tempEnum;
var iFit = JU.TempArray.findBestFit (size, this.lengthsFreeEnum);
if (iFit > 0) {
tempEnum = this.freeEnum[iFit];
} else {
tempEnum =  new Array (size);
}return tempEnum;
}, "~N");
Clazz_defineMethod (c$, "freeTempEnum", 
function (tempEnum) {
for (var i = 0; i < this.freeEnum.length; i++) if (this.freeEnum[i] === tempEnum) {
this.lengthsFreeEnum[i] = tempEnum.length;
return;
}
var iFree = JU.TempArray.findShorter (tempEnum.length, this.lengthsFreeEnum);
if (iFree >= 0) this.freeEnum[iFree] = tempEnum;
}, "~A");
c$.getSlabWithinRange = Clazz_defineMethod (c$, "getSlabWithinRange", 
function (min, max) {
return [Integer.$valueOf (1073742114), [Float.$valueOf (min), Float.$valueOf (max)], Boolean.FALSE, null];
}, "~N,~N");
c$.getSlabObjectType = Clazz_defineMethod (c$, "getSlabObjectType", 
function (tok, data, isCap, colorData) {
return [Integer.$valueOf (tok), data, Boolean.$valueOf (isCap), colorData];
}, "~N,~O,~B,~O");
Clazz_defineStatics (c$,
"freePointsSize", 6,
"freeScreensSize", 6,
"freeEnumSize", 2);
});
Clazz_declarePackage ("JU");
Clazz_load (null, "JU.Txt", ["JU.P3", "$.PT", "JU.Escape"], function () {
c$ = Clazz_declareType (JU, "Txt");
c$.formatText = Clazz_defineMethod (c$, "formatText", 
function (vwr, text0) {
var i;
if ((i = text0.indexOf ("@{")) < 0 && (i = text0.indexOf ("%{")) < 0) return text0;
var text = text0;
var isEscaped = (text.indexOf ("\\") >= 0);
if (isEscaped) {
text = JU.PT.rep (text, "\\%", "\1");
text = JU.PT.rep (text, "\\@", "\2");
isEscaped = !text.equals (text0);
}text = JU.PT.rep (text, "%{", "@{");
var name;
while ((i = text.indexOf ("@{")) >= 0) {
i++;
var i0 = i + 1;
var len = text.length;
var nP = 1;
var chFirst = '\u0000';
var chLast = '\u0000';
while (nP > 0 && ++i < len) {
var ch = text.charAt (i);
if (chFirst != '\0') {
if (chLast == '\\') {
ch = '\0';
} else if (ch == chFirst) {
chFirst = '\0';
}chLast = ch;
continue;
}switch (ch) {
case '\'':
case '"':
chFirst = ch;
break;
case '{':
nP++;
break;
case '}':
nP--;
break;
}
}
if (i >= len) return text;
name = text.substring (i0, i);
if (name.length == 0) return text;
var v = vwr.evaluateExpression (name);
if (Clazz_instanceOf (v, JU.P3)) v = JU.Escape.eP (v);
text = text.substring (0, i0 - 2) + v.toString () + text.substring (i + 1);
}
if (isEscaped) {
text = JU.PT.rep (text, "\2", "@");
text = JU.PT.rep (text, "\1", "%");
}return text;
}, "J.api.JmolViewer,~S");
});
Clazz_declarePackage ("JU");
Clazz_load (["JU.V3"], "JU.Vibration", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.modDim = -1;
this.modScale = NaN;
Clazz_instantialize (this, arguments);
}, JU, "Vibration", JU.V3);
Clazz_defineMethod (c$, "setTempPoint", 
function (pt, t456, scale, modulationScale) {
switch (this.modDim) {
case -2:
break;
default:
pt.scaleAdd2 ((Math.cos (t456.x * 6.283185307179586) * scale), this, pt);
break;
}
}, "JU.T3,JU.T3,~N,~N");
Clazz_defineMethod (c$, "getInfo", 
function (info) {
info.put ("vibVector", JU.V3.newV (this));
info.put ("vibType", (this.modDim == -2 ? "spin" : this.modDim == -1 ? "vib" : "mod"));
}, "java.util.Map");
Clazz_overrideMethod (c$, "clone", 
function () {
var v =  new JU.Vibration ();
v.setT (this);
v.modDim = this.modDim;
return v;
});
Clazz_defineMethod (c$, "setXYZ", 
function (vib) {
this.setT (vib);
}, "JU.T3");
Clazz_defineMethod (c$, "setType", 
function (type) {
this.modDim = type;
return this;
}, "~N");
Clazz_defineMethod (c$, "isNonzero", 
function () {
return this.x != 0 || this.y != 0 || this.z != 0;
});
Clazz_defineStatics (c$,
"twoPI", 6.283185307179586,
"TYPE_VIBRATION", -1,
"TYPE_SPIN", -2);
});
Clazz_declarePackage ("JV");
Clazz_load (["javajs.api.EventManager", "J.i18n.GT", "JU.Rectangle", "JV.MouseState"], ["JV.ActionManager", "$.Gesture", "$.MotionPoint"], ["java.lang.Character", "$.Float", "JU.P3", "$.PT", "J.api.Interface", "J.thread.HoverWatcherThread", "JU.BSUtil", "$.Escape", "$.Logger", "$.Point3fi", "JV.binding.Binding", "$.JmolBinding"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.haveMultiTouchInput = false;
this.isMultiTouch = false;
this.b = null;
this.jmolBinding = null;
this.pfaatBinding = null;
this.dragBinding = null;
this.rasmolBinding = null;
this.predragBinding = null;
this.LEFT_CLICKED = 0;
this.LEFT_DRAGGED = 0;
this.hoverWatcherThread = null;
this.dragGesture = null;
this.apm = 1;
this.bondPickingMode = 0;
this.pickingStyle = 0;
this.pickingStyleSelect = 0;
this.pickingStyleMeasure = 5;
this.rootPickingStyle = 0;
this.pickAtomAssignType = "C";
this.pickBondAssignType = 'p';
this.isPickAtomAssignCharge = false;
this.xyRange = 0;
this.gestureSwipeFactor = 1.0;
this.mouseDragFactor = 1.0;
this.mouseWheelFactor = 1.15;
this.current = null;
this.moved = null;
this.clicked = null;
this.pressed = null;
this.dragged = null;
this.pressedCount = 0;
this.clickedCount = 0;
this.drawMode = false;
this.labelMode = false;
this.dragSelectedMode = false;
this.measuresEnabled = true;
this.haveSelection = false;
this.hoverActive = false;
this.mp = null;
this.dragAtomIndex = -1;
this.rubberbandSelectionMode = false;
this.rectRubber = null;
this.isAltKeyReleased = true;
this.keyProcessing = false;
this.isMultiTouchClient = false;
this.isMultiTouchServer = false;
this.pressAction = 0;
this.dragAction = 0;
this.clickAction = 0;
this.measurementQueued = null;
this.selectionWorking = false;
Clazz_instantialize (this, arguments);
}, JV, "ActionManager", null, javajs.api.EventManager);
Clazz_prepareFields (c$, function () {
this.current =  new JV.MouseState ("current");
this.moved =  new JV.MouseState ("moved");
this.clicked =  new JV.MouseState ("clicked");
this.pressed =  new JV.MouseState ("pressed");
this.dragged =  new JV.MouseState ("dragged");
this.rectRubber =  new JU.Rectangle ();
});
Clazz_defineMethod (c$, "setViewer", 
function (vwr, commandOptions) {
this.vwr = vwr;
this.setBinding (this.jmolBinding =  new JV.binding.JmolBinding ());
this.LEFT_CLICKED = JV.binding.Binding.getMouseAction (1, 16, 2);
this.LEFT_DRAGGED = JV.binding.Binding.getMouseAction (1, 16, 1);
this.dragGesture =  new JV.Gesture (20, vwr);
}, "JV.Viewer,~S");
Clazz_defineMethod (c$, "checkHover", 
function () {
if (!this.vwr.getInMotion (true) && !this.vwr.tm.spinOn && !this.vwr.tm.navOn && !this.vwr.checkObjectHovered (this.current.x, this.current.y)) {
var atomIndex = this.vwr.findNearestAtomIndex (this.current.x, this.current.y);
if (atomIndex < 0) return;
var isLabel = (this.getAtomPickingMode () == 2 && this.bnd (JV.binding.Binding.getMouseAction (this.clickedCount, this.moved.modifiers, 1), 10));
this.vwr.hoverOn (atomIndex, isLabel);
}});
Clazz_defineMethod (c$, "processMultitouchEvent", 
function (groupID, eventType, touchID, iData, pt, time) {
}, "~N,~N,~N,~N,JU.P3,~N");
Clazz_defineMethod (c$, "bnd", 
function (mouseAction, jmolAction) {
return this.b.isBound (mouseAction, jmolAction);
}, "~N,~N");
Clazz_defineMethod (c$, "bind", 
function (desc, name) {
var jmolAction = JV.ActionManager.getActionFromName (name);
var mouseAction = JV.binding.Binding.getMouseActionStr (desc);
if (mouseAction == 0) return;
if (jmolAction >= 0) {
this.b.bindAction (mouseAction, jmolAction);
} else {
this.b.bindName (mouseAction, name);
}}, "~S,~S");
Clazz_defineMethod (c$, "clearBindings", 
function () {
this.setBinding (this.jmolBinding =  new JV.binding.JmolBinding ());
this.pfaatBinding = null;
this.dragBinding = null;
this.rasmolBinding = null;
});
Clazz_defineMethod (c$, "unbindAction", 
function (desc, name) {
if (desc == null && name == null) {
this.clearBindings ();
return;
}var jmolAction = JV.ActionManager.getActionFromName (name);
var mouseAction = JV.binding.Binding.getMouseActionStr (desc);
if (jmolAction >= 0) this.b.unbindAction (mouseAction, jmolAction);
 else if (mouseAction != 0) this.b.unbindName (mouseAction, name);
if (name == null) this.b.unbindUserAction (desc);
}, "~S,~S");
c$.newAction = Clazz_defineMethod (c$, "newAction", 
function (i, name, info) {
JV.ActionManager.actionInfo[i] = info;
JV.ActionManager.actionNames[i] = name;
}, "~N,~S,~S");
c$.getActionName = Clazz_defineMethod (c$, "getActionName", 
function (i) {
return (i < JV.ActionManager.actionNames.length ? JV.ActionManager.actionNames[i] : null);
}, "~N");
c$.getActionFromName = Clazz_defineMethod (c$, "getActionFromName", 
function (name) {
for (var i = 0; i < JV.ActionManager.actionNames.length; i++) if (JV.ActionManager.actionNames[i].equalsIgnoreCase (name)) return i;

return -1;
}, "~S");
Clazz_defineMethod (c$, "getBindingInfo", 
function (qualifiers) {
return this.b.getBindingInfo (JV.ActionManager.actionInfo, JV.ActionManager.actionNames, qualifiers);
}, "~S");
Clazz_defineMethod (c$, "setBinding", 
function (newBinding) {
this.b = newBinding;
}, "JV.binding.Binding");
c$.getPickingModeName = Clazz_defineMethod (c$, "getPickingModeName", 
function (pickingMode) {
return (pickingMode < 0 || pickingMode >= JV.ActionManager.pickingModeNames.length ? "off" : JV.ActionManager.pickingModeNames[pickingMode]);
}, "~N");
c$.getPickingMode = Clazz_defineMethod (c$, "getPickingMode", 
function (str) {
for (var i = JV.ActionManager.pickingModeNames.length; --i >= 0; ) if (str.equalsIgnoreCase (JV.ActionManager.pickingModeNames[i])) return i;

return -1;
}, "~S");
c$.getPickingStyleName = Clazz_defineMethod (c$, "getPickingStyleName", 
function (pickingStyle) {
return (pickingStyle < 0 || pickingStyle >= JV.ActionManager.pickingStyleNames.length ? "toggle" : JV.ActionManager.pickingStyleNames[pickingStyle]);
}, "~N");
c$.getPickingStyleIndex = Clazz_defineMethod (c$, "getPickingStyleIndex", 
function (str) {
for (var i = JV.ActionManager.pickingStyleNames.length; --i >= 0; ) if (str.equalsIgnoreCase (JV.ActionManager.pickingStyleNames[i])) return i;

return -1;
}, "~S");
Clazz_defineMethod (c$, "getAtomPickingMode", 
function () {
return this.apm;
});
Clazz_defineMethod (c$, "setPickingMode", 
function (pickingMode) {
var isNew = false;
switch (pickingMode) {
case -1:
isNew = true;
this.bondPickingMode = 35;
pickingMode = 1;
break;
case 35:
case 34:
case 33:
this.vwr.setBooleanProperty ("bondPicking", true);
this.bondPickingMode = pickingMode;
return;
case 8:
this.bondPickingMode = pickingMode;
if (this.vwr.getBondPicking ()) return;
isNew = true;
break;
}
isNew = new Boolean (isNew | (this.apm != pickingMode)).valueOf ();
this.apm = pickingMode;
if (isNew) this.resetMeasurement ();
}, "~N");
Clazz_defineMethod (c$, "setAtomPickingOption", 
function (option) {
switch (this.apm) {
case 32:
this.pickAtomAssignType = option;
this.isPickAtomAssignCharge = (this.pickAtomAssignType.equals ("Pl") || this.pickAtomAssignType.equals ("Mi"));
break;
}
}, "~S");
Clazz_defineMethod (c$, "setBondPickingOption", 
function (option) {
switch (this.bondPickingMode) {
case 33:
this.pickBondAssignType = Character.toLowerCase (option.charAt (0));
break;
}
}, "~S");
Clazz_defineMethod (c$, "getPickingState", 
function () {
var script = ";set modelkitMode " + this.vwr.getBoolean (603979883) + ";set picking " + JV.ActionManager.getPickingModeName (this.apm);
if (this.apm == 32) script += "_" + this.pickAtomAssignType;
script += ";";
if (this.bondPickingMode != 0) script += "set picking " + JV.ActionManager.getPickingModeName (this.bondPickingMode);
if (this.bondPickingMode == 33) script += "_" + this.pickBondAssignType;
script += ";";
return script;
});
Clazz_defineMethod (c$, "getPickingStyle", 
function () {
return this.pickingStyle;
});
Clazz_defineMethod (c$, "setPickingStyle", 
function (pickingStyle) {
this.pickingStyle = pickingStyle;
if (pickingStyle >= 4) {
this.pickingStyleMeasure = pickingStyle;
this.resetMeasurement ();
} else {
if (pickingStyle < 3) this.rootPickingStyle = pickingStyle;
this.pickingStyleSelect = pickingStyle;
}this.rubberbandSelectionMode = false;
switch (this.pickingStyleSelect) {
case 2:
if (!this.b.name.equals ("extendedSelect")) this.setBinding (this.pfaatBinding == null ? this.pfaatBinding = JV.binding.Binding.newBinding (this.vwr, "Pfaat") : this.pfaatBinding);
break;
case 3:
if (!this.b.name.equals ("drag")) this.setBinding (this.dragBinding == null ? this.dragBinding = JV.binding.Binding.newBinding (this.vwr, "Drag") : this.dragBinding);
this.rubberbandSelectionMode = true;
break;
case 1:
if (!this.b.name.equals ("selectOrToggle")) this.setBinding (this.rasmolBinding == null ? this.rasmolBinding = JV.binding.Binding.newBinding (this.vwr, "Rasmol") : this.rasmolBinding);
break;
default:
if (this.b !== this.jmolBinding) this.setBinding (this.jmolBinding);
}
if (!this.b.name.equals ("drag")) this.predragBinding = this.b;
}, "~N");
Clazz_defineMethod (c$, "setGestureSwipeFactor", 
function (factor) {
this.gestureSwipeFactor = factor;
}, "~N");
Clazz_defineMethod (c$, "setMouseDragFactor", 
function (factor) {
this.mouseDragFactor = factor;
}, "~N");
Clazz_defineMethod (c$, "setMouseWheelFactor", 
function (factor) {
this.mouseWheelFactor = factor;
}, "~N");
Clazz_defineMethod (c$, "setCurrent", 
function (time, x, y, mods) {
this.vwr.hoverOff ();
this.current.set (time, x, y, mods);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "getCurrentX", 
function () {
return this.current.x;
});
Clazz_defineMethod (c$, "getCurrentY", 
function () {
return this.current.y;
});
Clazz_defineMethod (c$, "setMouseMode", 
function () {
this.drawMode = this.labelMode = false;
this.dragSelectedMode = this.vwr.getDragSelected ();
this.measuresEnabled = !this.dragSelectedMode;
if (!this.dragSelectedMode) switch (this.apm) {
default:
return;
case 32:
this.measuresEnabled = !this.isPickAtomAssignCharge;
return;
case 4:
this.drawMode = true;
this.measuresEnabled = false;
break;
case 2:
this.labelMode = true;
this.measuresEnabled = false;
break;
case 9:
this.measuresEnabled = false;
break;
case 19:
case 22:
case 20:
case 21:
this.measuresEnabled = false;
return;
}
this.exitMeasurementMode (null);
});
Clazz_defineMethod (c$, "clearMouseInfo", 
function () {
this.pressedCount = this.clickedCount = 0;
this.dragGesture.setAction (0, 0);
this.exitMeasurementMode (null);
});
Clazz_defineMethod (c$, "isMTClient", 
function () {
return this.isMultiTouchClient;
});
Clazz_defineMethod (c$, "isMTServer", 
function () {
return this.isMultiTouchServer;
});
Clazz_defineMethod (c$, "dispose", 
function () {
this.clear ();
});
Clazz_defineMethod (c$, "clear", 
function () {
this.startHoverWatcher (false);
if (this.predragBinding != null) this.b = this.predragBinding;
this.vwr.setPickingMode (null, 1);
this.vwr.setPickingStyle (null, this.rootPickingStyle);
this.isAltKeyReleased = true;
});
Clazz_defineMethod (c$, "startHoverWatcher", 
function (isStart) {
if (this.vwr.isPreviewOnly) return;
try {
if (isStart) {
if (this.hoverWatcherThread != null) return;
this.current.time = -1;
this.hoverWatcherThread =  new J.thread.HoverWatcherThread (this, this.current, this.moved, this.vwr);
} else {
if (this.hoverWatcherThread == null) return;
this.current.time = -1;
this.hoverWatcherThread.interrupt ();
this.hoverWatcherThread = null;
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}, "~B");
Clazz_defineMethod (c$, "setModeMouse", 
function (modeMouse) {
if (modeMouse == -1) {
this.startHoverWatcher (false);
}}, "~N");
Clazz_overrideMethod (c$, "keyPressed", 
function (key, modifiers) {
if (this.keyProcessing) return false;
this.vwr.hoverOff ();
this.keyProcessing = true;
switch (key) {
case 18:
if (this.dragSelectedMode && this.isAltKeyReleased) this.vwr.moveSelected (-2147483648, 0, -2147483648, -2147483648, -2147483648, null, false, false);
this.isAltKeyReleased = false;
this.moved.modifiers |= 8;
break;
case 16:
this.dragged.modifiers |= 1;
this.moved.modifiers |= 1;
break;
case 17:
this.moved.modifiers |= 2;
break;
case 27:
this.exitMeasurementMode ("escape");
break;
}
var action = 16 | 256 | 8192 | this.moved.modifiers;
if (!this.labelMode && !this.b.isUserAction (action)) this.checkMotionRotateZoom (action, this.current.x, 0, 0, false);
if (this.vwr.getBoolean (603979887)) {
switch (key) {
case 38:
case 40:
case 37:
case 39:
case 32:
case 46:
this.vwr.navigate (key, modifiers);
break;
}
}this.keyProcessing = false;
return true;
}, "~N,~N");
Clazz_overrideMethod (c$, "keyReleased", 
function (key) {
switch (key) {
case 18:
if (this.dragSelectedMode) this.vwr.moveSelected (2147483647, 0, -2147483648, -2147483648, -2147483648, null, false, false);
this.isAltKeyReleased = true;
this.moved.modifiers &= -9;
break;
case 16:
this.moved.modifiers &= -2;
break;
case 17:
this.moved.modifiers &= -3;
}
if (this.moved.modifiers == 0) this.vwr.setCursor (0);
if (!this.vwr.getBoolean (603979887)) return;
switch (key) {
case 38:
case 40:
case 37:
case 39:
this.vwr.navigate (0, 0);
break;
}
}, "~N");
Clazz_overrideMethod (c$, "mouseEnterExit", 
function (time, x, y, isExit) {
this.setCurrent (time, x, y, 0);
}, "~N,~N,~N,~B");
Clazz_defineMethod (c$, "setMouseActions", 
 function (count, buttonMods, isRelease) {
this.pressAction = JV.binding.Binding.getMouseAction (count, buttonMods, isRelease ? 5 : 4);
this.dragAction = JV.binding.Binding.getMouseAction (count, buttonMods, 1);
this.clickAction = JV.binding.Binding.getMouseAction (count, buttonMods, 2);
}, "~N,~N,~B");
Clazz_overrideMethod (c$, "mouseAction", 
function (mode, time, x, y, count, buttonMods) {
if (!this.vwr.getMouseEnabled ()) return;
if (JU.Logger.debuggingHigh && mode != 0) this.vwr.showString ("mouse action: " + mode + " " + buttonMods + " " + JV.binding.Binding.getMouseActionName (JV.binding.Binding.getMouseAction (count, buttonMods, mode), false), false);
switch (mode) {
case 0:
this.setCurrent (time, x, y, buttonMods);
this.moved.setCurrent (this.current, 0);
if (this.mp != null || this.hoverActive) {
this.clickAction = JV.binding.Binding.getMouseAction (this.clickedCount, buttonMods, 0);
this.checkClickAction (x, y, time, 0);
return;
}if (this.isZoomArea (x)) {
this.checkMotionRotateZoom (this.LEFT_DRAGGED, 0, 0, 0, false);
return;
}if (this.vwr.currentCursor == 8) this.vwr.setCursor (0);
return;
case 4:
this.setMouseMode ();
this.pressedCount = (this.pressed.check (20, x, y, buttonMods, time, 700) ? this.pressedCount + 1 : 1);
if (this.pressedCount == 1) {
this.vwr.checkInMotion (1);
this.setCurrent (time, x, y, buttonMods);
}this.pressAction = JV.binding.Binding.getMouseAction (this.pressedCount, buttonMods, 4);
this.vwr.setCursor (12);
this.pressed.setCurrent (this.current, 1);
this.dragged.setCurrent (this.current, 1);
this.vwr.setFocus ();
this.dragGesture.setAction (this.dragAction, time);
this.checkPressedAction (x, y, time);
return;
case 1:
this.setMouseMode ();
this.setMouseActions (this.pressedCount, buttonMods, false);
var deltaX = x - this.dragged.x;
var deltaY = y - this.dragged.y;
this.setCurrent (time, x, y, buttonMods);
this.dragged.setCurrent (this.current, -1);
this.dragGesture.add (this.dragAction, x, y, time);
this.checkDragWheelAction (this.dragAction, x, y, deltaX, deltaY, time, 1);
return;
case 5:
this.setMouseActions (this.pressedCount, buttonMods, true);
this.setCurrent (time, x, y, buttonMods);
this.vwr.spinXYBy (0, 0, 0);
var dragRelease = !this.pressed.check (this.xyRange, x, y, buttonMods, time, 9223372036854775807);
this.checkReleaseAction (x, y, time, dragRelease);
return;
case 3:
if (this.vwr.isApplet && !this.vwr.hasFocus ()) return;
this.setCurrent (time, this.current.x, this.current.y, buttonMods);
this.checkDragWheelAction (JV.binding.Binding.getMouseAction (0, buttonMods, 3), this.current.x, this.current.y, 0, y, time, 3);
return;
case 2:
this.setMouseMode ();
this.clickedCount = (count > 1 ? count : this.clicked.check (0, 0, 0, buttonMods, time, 700) ? this.clickedCount + 1 : 1);
if (this.clickedCount == 1) {
this.setCurrent (time, x, y, buttonMods);
}this.setMouseActions (this.clickedCount, buttonMods, false);
this.clicked.setCurrent (this.current, this.clickedCount);
this.vwr.setFocus ();
if (this.apm != 9 && this.bnd (JV.binding.Binding.getMouseAction (1, buttonMods, 4), 31)) return;
this.clickAction = JV.binding.Binding.getMouseAction (this.clickedCount, buttonMods, 2);
this.checkClickAction (x, y, time, this.clickedCount);
return;
}
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "checkPressedAction", 
 function (x, y, time) {
var buttonMods = JV.binding.Binding.getButtonMods (this.pressAction);
var isSelectAndDrag = this.bnd (JV.binding.Binding.getMouseAction (1, buttonMods, 4), 31);
if (buttonMods != 0) {
this.pressAction = this.vwr.notifyMouseClicked (x, y, this.pressAction, 4);
if (this.pressAction == 0) return;
buttonMods = JV.binding.Binding.getButtonMods (this.pressAction);
}this.setMouseActions (this.pressedCount, buttonMods, false);
if (JU.Logger.debugging) JU.Logger.debug (JV.binding.Binding.getMouseActionName (this.pressAction, false));
if (this.drawMode && (this.bnd (this.dragAction, 8) || this.bnd (this.dragAction, 9)) || this.labelMode && this.bnd (this.dragAction, 10)) {
this.vwr.checkObjectDragged (-2147483648, 0, x, y, this.dragAction);
return;
}this.checkUserAction (this.pressAction, x, y, 0, 0, time, 4);
var isBound = false;
switch (this.apm) {
case 32:
isBound = this.bnd (this.clickAction, 0);
break;
case 28:
isBound = this.bnd (this.dragAction, 7) || this.bnd (this.dragAction, 14);
break;
case 26:
case 36:
case 27:
isBound = this.bnd (this.dragAction, 7) || this.bnd (this.dragAction, 27) || this.bnd (this.dragAction, 14);
break;
case 29:
isBound = this.bnd (this.dragAction, 11) || this.bnd (this.dragAction, 14);
break;
case 30:
isBound = this.bnd (this.dragAction, 12) || this.bnd (this.dragAction, 27) || this.bnd (this.dragAction, 14);
break;
}
if (isBound) {
this.dragAtomIndex = this.vwr.findNearestAtomIndexMovable (x, y, true);
if (this.dragAtomIndex >= 0 && (this.apm == 32 || this.apm == 31) && this.vwr.ms.isAtomAssignable (this.dragAtomIndex)) {
this.enterMeasurementMode (this.dragAtomIndex);
this.mp.addPoint (this.dragAtomIndex, null, false);
}return;
}if (this.bnd (this.pressAction, 23)) {
var type = 'j';
if (this.vwr.getBoolean (603979883)) {
var t = this.vwr.checkObjectClicked (x, y, this.LEFT_CLICKED);
type = (t != null && "bond".equals (t.get ("type")) ? 'b' : this.vwr.findNearestAtomIndex (x, y) >= 0 ? 'a' : 'm');
}this.vwr.popupMenu (x, y, type);
return;
}if (this.dragSelectedMode) {
this.haveSelection = true;
if (isSelectAndDrag) {
this.haveSelection = (this.vwr.findNearestAtomIndexMovable (x, y, true) >= 0);
}if (!this.haveSelection) return;
if (this.bnd (this.dragAction, 13) || this.bnd (this.dragAction, 14)) this.vwr.moveSelected (-2147483648, 0, -2147483648, -2147483648, -2147483648, null, false, false);
return;
}this.checkMotionRotateZoom (this.dragAction, x, 0, 0, true);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "checkDragWheelAction", 
 function (dragWheelAction, x, y, deltaX, deltaY, time, mode) {
var buttonmods = JV.binding.Binding.getButtonMods (dragWheelAction);
if (buttonmods != 0) {
var newAction = this.vwr.notifyMouseClicked (x, y, JV.binding.Binding.getMouseAction (this.pressedCount, buttonmods, mode), mode);
if (newAction == 0) return;
if (newAction > 0) dragWheelAction = newAction;
}if (this.isRubberBandSelect (dragWheelAction)) {
this.calcRectRubberBand ();
this.vwr.refresh (3, "rubberBand selection");
return;
}if (this.checkUserAction (dragWheelAction, x, y, deltaX, deltaY, time, mode)) return;
if (this.vwr.getRotateBondIndex () >= 0) {
if (this.bnd (dragWheelAction, 26)) {
this.vwr.moveSelected (deltaX, deltaY, -2147483648, x, y, null, false, false);
return;
}if (!this.bnd (dragWheelAction, 25)) this.vwr.setRotateBondIndex (-1);
}var bs = null;
if (this.dragAtomIndex >= 0) {
switch (this.apm) {
case 26:
this.setMotion (13, true);
if (this.bnd (dragWheelAction, 27) && this.vwr.getBoolean (603979785)) {
this.vwr.rotateSelected (this.getDegrees (deltaX, true), this.getDegrees (deltaY, false), null);
} else {
this.vwr.moveSelected (deltaX, deltaY, (this.bnd (dragWheelAction, 14) ? -deltaY : -2147483648), -2147483648, -2147483648, null, true, false);
}return;
case 36:
case 27:
case 30:
bs = this.vwr.ms.getAtoms (3145754, JU.BSUtil.newAndSetBit (this.dragAtomIndex));
if (this.apm == 36) bs.and (this.vwr.getAtomBitSet ("ligand"));
case 28:
case 29:
if (this.dragGesture.getPointCount () == 1) this.vwr.undoMoveActionClear (this.dragAtomIndex, 2, true);
this.setMotion (13, true);
if (this.bnd (dragWheelAction, 27)) {
this.vwr.rotateSelected (this.getDegrees (deltaX, true), this.getDegrees (deltaY, false), bs);
} else {
switch (this.apm) {
case 36:
case 27:
case 30:
this.vwr.select (bs, false, 0, true);
break;
}
this.vwr.moveAtomWithHydrogens (this.dragAtomIndex, deltaX, deltaY, (this.bnd (dragWheelAction, 14) ? -deltaY : -2147483648), bs);
}return;
}
}if (this.dragAtomIndex >= 0 && mode == 1 && this.bnd (this.clickAction, 0) && this.apm == 32) {
var nearestAtomIndex = this.vwr.findNearestAtomIndexMovable (x, y, false);
if (nearestAtomIndex >= 0) {
if (this.mp != null) {
this.mp.setCount (1);
} else if (this.measuresEnabled) {
this.enterMeasurementMode (nearestAtomIndex);
}this.addToMeasurement (nearestAtomIndex, null, true);
this.mp.colix = 20;
} else if (this.mp != null) {
this.mp.setCount (1);
this.mp.colix = 23;
}if (this.mp == null) return;
this.mp.traceX = x;
this.mp.traceY = y;
this.vwr.refresh (3, "assignNew");
return;
}if (!this.drawMode && !this.labelMode && this.bnd (dragWheelAction, 45)) {
this.vwr.translateXYBy (deltaX, deltaY);
return;
}if (this.dragSelectedMode && this.haveSelection && (this.bnd (dragWheelAction, 13) || this.bnd (dragWheelAction, 27))) {
var iatom = this.vwr.bsA ().nextSetBit (0);
if (iatom < 0) return;
if (this.dragGesture.getPointCount () == 1) this.vwr.undoMoveActionClear (iatom, 2, true);
 else this.vwr.moveSelected (2147483647, 0, -2147483648, -2147483648, -2147483648, null, false, false);
this.setMotion (13, true);
if (this.bnd (dragWheelAction, 27) && this.vwr.getBoolean (603979785)) this.vwr.rotateSelected (this.getDegrees (deltaX, true), this.getDegrees (deltaY, false), null);
 else this.vwr.moveSelected (deltaX, deltaY, -2147483648, -2147483648, -2147483648, null, true, false);
return;
}if (this.drawMode && (this.bnd (dragWheelAction, 8) || this.bnd (dragWheelAction, 9)) || this.labelMode && this.bnd (dragWheelAction, 10)) {
this.setMotion (13, true);
this.vwr.checkObjectDragged (this.dragged.x, this.dragged.y, x, y, dragWheelAction);
return;
}if (this.checkMotionRotateZoom (dragWheelAction, x, deltaX, deltaY, true)) {
if (this.vwr.tm.slabEnabled && this.checkSlideZoom (dragWheelAction)) this.vwr.slabDepthByPixels (deltaY);
 else this.vwr.zoomBy (deltaY);
return;
}if (this.bnd (dragWheelAction, 25)) {
this.vwr.rotateXYBy (this.getDegrees (deltaX, true), this.getDegrees (deltaY, false));
return;
}if (this.bnd (dragWheelAction, 29)) {
if (deltaX == 0 && Math.abs (deltaY) > 1) {
this.setMotion (8, true);
this.vwr.zoomBy (deltaY + (deltaY > 0 ? -1 : 1));
} else if (deltaY == 0 && Math.abs (deltaX) > 1) {
this.setMotion (13, true);
this.vwr.rotateZBy (-deltaX + (deltaX > 0 ? 1 : -1), 2147483647, 2147483647);
}return;
} else if (this.bnd (dragWheelAction, 46)) {
this.zoomByFactor (deltaY, 2147483647, 2147483647);
return;
} else if (this.bnd (dragWheelAction, 28)) {
this.setMotion (13, true);
this.vwr.rotateZBy (-deltaX, 2147483647, 2147483647);
return;
}if (this.vwr.tm.slabEnabled) {
if (this.bnd (dragWheelAction, 6)) {
this.vwr.depthByPixels (deltaY);
return;
}if (this.bnd (dragWheelAction, 38)) {
this.vwr.slabByPixels (deltaY);
return;
}if (this.bnd (dragWheelAction, 39)) {
this.vwr.slabDepthByPixels (deltaY);
return;
}}}, "~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "checkReleaseAction", 
 function (x, y, time, dragRelease) {
if (JU.Logger.debugging) JU.Logger.debug (JV.binding.Binding.getMouseActionName (this.pressAction, false));
this.vwr.checkInMotion (0);
this.vwr.setInMotion (false);
this.vwr.setCursor (0);
this.dragGesture.add (this.dragAction, x, y, time);
if (dragRelease) this.vwr.setRotateBondIndex (-2147483648);
if (this.dragAtomIndex >= 0) {
if (this.apm == 29 || this.apm == 30) this.minimize (true);
}if (this.apm == 32 && this.bnd (this.clickAction, 0)) {
if (this.mp == null || this.dragAtomIndex < 0) return;
this.assignNew (x, y);
return;
}this.dragAtomIndex = -1;
var isRbAction = this.isRubberBandSelect (this.dragAction);
if (isRbAction) this.selectRb (this.clickAction);
this.rubberbandSelectionMode = (this.b.name.equals ("drag"));
this.rectRubber.x = 2147483647;
if (dragRelease) {
this.vwr.notifyMouseClicked (x, y, JV.binding.Binding.getMouseAction (this.pressedCount, 0, 5), 5);
}if (this.drawMode && (this.bnd (this.dragAction, 8) || this.bnd (this.dragAction, 9)) || this.labelMode && this.bnd (this.dragAction, 10)) {
this.vwr.checkObjectDragged (2147483647, 0, x, y, this.dragAction);
return;
}if (this.dragSelectedMode && this.bnd (this.dragAction, 13) && this.haveSelection) this.vwr.moveSelected (2147483647, 0, -2147483648, -2147483648, -2147483648, null, false, false);
if (dragRelease && this.checkUserAction (this.pressAction, x, y, 0, 0, time, 5)) return;
if (this.vwr.getBoolean (603979780)) {
if (this.bnd (this.dragAction, 44)) {
var speed = this.getExitRate ();
if (speed > 0) this.vwr.spinXYBy (this.dragGesture.getDX (4, 2), this.dragGesture.getDY (4, 2), speed * 30 * this.gestureSwipeFactor);
if (this.vwr.g.logGestures) this.vwr.log ("$NOW$ swipe " + this.dragGesture + " " + speed);
return;
}}}, "~N,~N,~N,~B");
Clazz_defineMethod (c$, "checkClickAction", 
 function (x, y, time, clickedCount) {
if (clickedCount > 0) {
if (this.checkUserAction (this.clickAction, x, y, 0, 0, time, 32768)) return;
this.clickAction = this.vwr.notifyMouseClicked (x, y, this.clickAction, 32768);
if (this.clickAction == 0) return;
}if (JU.Logger.debugging) JU.Logger.debug (JV.binding.Binding.getMouseActionName (this.clickAction, false));
if (this.bnd (this.clickAction, 2)) {
if (this.vwr.frankClicked (x, y)) {
this.vwr.popupMenu (-x, y, 'j');
return;
}if (this.vwr.frankClickedModelKit (x, y)) {
this.vwr.popupMenu (0, 0, 'm');
return;
}}var nearestPoint = null;
var isBond = false;
var isIsosurface = false;
var t = null;
if (!this.drawMode) {
t = this.vwr.checkObjectClicked (x, y, this.clickAction);
if (t != null) {
isBond = "bond".equals (t.get ("type"));
isIsosurface = "isosurface".equals (t.get ("type"));
nearestPoint = this.getPoint (t);
}}if (isBond) clickedCount = 1;
if (nearestPoint != null && Float.isNaN (nearestPoint.x)) return;
var nearestAtomIndex = this.findNearestAtom (x, y, nearestPoint, clickedCount > 0);
if (clickedCount == 0 && this.apm != 32) {
if (this.mp == null) return;
if (nearestPoint != null || this.mp.getIndexOf (nearestAtomIndex) == 0) this.mp.addPoint (nearestAtomIndex, nearestPoint, false);
if (this.mp.haveModified) this.vwr.setPendingMeasurement (this.mp);
this.vwr.refresh (3, "measurementPending");
return;
}this.setMouseMode ();
if (this.bnd (this.clickAction, 43)) {
this.vwr.tm.stopMotion ();
}if (this.vwr.getBoolean (603979887) && this.apm == 23 && this.bnd (this.clickAction, 21)) {
this.vwr.navTranslatePercent (x * 100 / this.vwr.getScreenWidth () - 50, y * 100 / this.vwr.getScreenHeight () - 50);
return;
}if (isBond) {
if (this.bnd (this.clickAction, this.bondPickingMode == 34 || this.bondPickingMode == 33 ? 0 : 5)) {
this.bondPicked ((t.get ("index")).intValue ());
return;
}} else if (isIsosurface) {
return;
} else {
if (this.apm != 32 && this.mp != null && this.bnd (this.clickAction, 20)) {
this.atomOrPointPicked (nearestAtomIndex, nearestPoint);
if (this.addToMeasurement (nearestAtomIndex, nearestPoint, false) == 4) this.toggleMeasurement ();
return;
}if (this.bnd (this.clickAction, 37)) {
if (this.mp != null) {
this.addToMeasurement (nearestAtomIndex, nearestPoint, true);
this.toggleMeasurement ();
} else if (!this.drawMode && !this.labelMode && !this.dragSelectedMode && this.measuresEnabled) {
this.enterMeasurementMode (nearestAtomIndex);
this.addToMeasurement (nearestAtomIndex, nearestPoint, true);
}this.atomOrPointPicked (nearestAtomIndex, nearestPoint);
return;
}}if (this.isSelectAction (this.clickAction)) {
if (!isIsosurface) this.atomOrPointPicked (nearestAtomIndex, nearestPoint);
return;
}if (this.bnd (this.clickAction, 24)) {
if (nearestAtomIndex < 0) this.reset ();
return;
}}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "checkUserAction", 
 function (mouseAction, x, y, deltaX, deltaY, time, mode) {
if (!this.b.isUserAction (mouseAction)) return false;
var passThrough = false;
var obj;
var ht = this.b.getBindings ();
var mkey = mouseAction + "\t";
for (var key, $key = ht.keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) {
if (key.indexOf (mkey) != 0 || !JU.PT.isAS (obj = ht.get (key))) continue;
var script = (obj)[1];
var nearestPoint = null;
if (script.indexOf ("_ATOM") >= 0) {
var iatom = this.findNearestAtom (x, y, null, true);
script = JU.PT.rep (script, "_ATOM", "({" + (iatom >= 0 ? "" + iatom : "") + "})");
if (iatom >= 0) script = JU.PT.rep (script, "_POINT", JU.Escape.eP (this.vwr.ms.at[iatom]));
}if (!this.drawMode && (script.indexOf ("_POINT") >= 0 || script.indexOf ("_OBJECT") >= 0 || script.indexOf ("_BOND") >= 0)) {
var t = this.vwr.checkObjectClicked (x, y, mouseAction);
if (t != null && (nearestPoint = t.get ("pt")) != null) {
var isBond = t.get ("type").equals ("bond");
if (isBond) script = JU.PT.rep (script, "_BOND", "[{" + t.get ("index") + "}]");
script = JU.PT.rep (script, "_POINT", JU.Escape.eP (nearestPoint));
script = JU.PT.rep (script, "_OBJECT", JU.Escape.escapeMap (t));
}script = JU.PT.rep (script, "_BOND", "[{}]");
script = JU.PT.rep (script, "_OBJECT", "{}");
}script = JU.PT.rep (script, "_POINT", "{}");
script = JU.PT.rep (script, "_ACTION", "" + mouseAction);
script = JU.PT.rep (script, "_X", "" + x);
script = JU.PT.rep (script, "_Y", "" + (this.vwr.getScreenHeight () - y));
script = JU.PT.rep (script, "_DELTAX", "" + deltaX);
script = JU.PT.rep (script, "_DELTAY", "" + deltaY);
script = JU.PT.rep (script, "_TIME", "" + time);
script = JU.PT.rep (script, "_MODE", "" + mode);
if (script.startsWith ("+:")) {
passThrough = true;
script = script.substring (2);
}this.vwr.evalStringQuiet (script);
}
return !passThrough;
}, "~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "checkMotionRotateZoom", 
 function (mouseAction, x, deltaX, deltaY, isDrag) {
var isSlideZoom = this.checkSlideZoom (mouseAction);
var isRotateXY = this.bnd (mouseAction, 25);
var isRotateZorZoom = this.bnd (mouseAction, 29);
if (!isSlideZoom && !isRotateXY && !isRotateZorZoom) return false;
var isZoom = (isRotateZorZoom && (deltaX == 0 || Math.abs (deltaY) > 5 * Math.abs (deltaX)));
var cursor = (isZoom || this.isZoomArea (this.moved.x) || this.bnd (mouseAction, 46) ? 8 : isRotateXY || isRotateZorZoom ? 13 : this.bnd (mouseAction, 1) ? 12 : 0);
this.setMotion (cursor, isDrag);
return (isZoom || isSlideZoom);
}, "~N,~N,~N,~N,~B");
Clazz_defineMethod (c$, "getExitRate", 
 function () {
var dt = this.dragGesture.getTimeDifference (2);
return (this.isMultiTouch ? (dt > (80) ? 0 : this.dragGesture.getSpeedPixelsPerMillisecond (2, 1)) : (dt > 10 ? 0 : this.dragGesture.getSpeedPixelsPerMillisecond (4, 2)));
});
Clazz_defineMethod (c$, "isRubberBandSelect", 
 function (action) {
action = action & -8193 | 32768;
return this.rubberbandSelectionMode && (this.bnd (action, 35) || this.bnd (action, 34) || this.bnd (action, 32));
}, "~N");
Clazz_defineMethod (c$, "getRubberBand", 
function () {
return (this.rubberbandSelectionMode && this.rectRubber.x != 2147483647 ? this.rectRubber : null);
});
Clazz_defineMethod (c$, "calcRectRubberBand", 
 function () {
var factor = (this.vwr.antialiased ? 2 : 1);
if (this.current.x < this.pressed.x) {
this.rectRubber.x = this.current.x * factor;
this.rectRubber.width = (this.pressed.x - this.current.x) * factor;
} else {
this.rectRubber.x = this.pressed.x * factor;
this.rectRubber.width = (this.current.x - this.pressed.x) * factor;
}if (this.current.y < this.pressed.y) {
this.rectRubber.y = this.current.y * factor;
this.rectRubber.height = (this.pressed.y - this.current.y) * factor;
} else {
this.rectRubber.y = this.pressed.y * factor;
this.rectRubber.height = (this.current.y - this.pressed.y) * factor;
}});
Clazz_defineMethod (c$, "getDegrees", 
function (delta, isX) {
return delta / Math.min (500, isX ? this.vwr.getScreenWidth () : this.vwr.getScreenHeight ()) * 180 * this.mouseDragFactor;
}, "~N,~B");
Clazz_defineMethod (c$, "checkSlideZoom", 
 function (action) {
return this.bnd (action, 40) && this.isZoomArea (this.pressed.x);
}, "~N");
Clazz_defineMethod (c$, "isZoomArea", 
 function (x) {
return x > this.vwr.getScreenWidth () * (this.vwr.isStereoDouble () ? 2 : 1) * 98 / 100;
}, "~N");
Clazz_defineMethod (c$, "getPoint", 
 function (t) {
var pt =  new JU.Point3fi ();
pt.setT (t.get ("pt"));
pt.mi = (t.get ("modelIndex")).intValue ();
return pt;
}, "java.util.Map");
Clazz_defineMethod (c$, "findNearestAtom", 
 function (x, y, nearestPoint, isClicked) {
var index = (this.drawMode || nearestPoint != null ? -1 : this.vwr.findNearestAtomIndexMovable (x, y, false));
return (index >= 0 && (isClicked || this.mp == null) && !this.vwr.slm.isInSelectionSubset (index) ? -1 : index);
}, "~N,~N,JU.Point3fi,~B");
Clazz_defineMethod (c$, "isSelectAction", 
 function (action) {
return (this.bnd (action, 17) || !this.drawMode && !this.labelMode && this.apm == 1 && this.bnd (action, 1) || this.dragSelectedMode && (this.bnd (this.dragAction, 27) || this.bnd (this.dragAction, 13)) || this.bnd (action, 22) || this.bnd (action, 35) || this.bnd (action, 32) || this.bnd (action, 34) || this.bnd (action, 36) || this.bnd (action, 30));
}, "~N");
Clazz_defineMethod (c$, "enterMeasurementMode", 
 function (iAtom) {
this.vwr.setPicked (-1);
this.vwr.setPicked (iAtom);
this.vwr.setCursor (1);
this.vwr.setPendingMeasurement (this.mp = this.getMP ());
this.measurementQueued = this.mp;
}, "~N");
Clazz_defineMethod (c$, "getMP", 
 function () {
return (J.api.Interface.getInterface ("JM.MeasurementPending", this.vwr, "mouse")).set (this.vwr.ms);
});
Clazz_defineMethod (c$, "addToMeasurement", 
 function (atomIndex, nearestPoint, dblClick) {
if (atomIndex == -1 && nearestPoint == null || this.mp == null) {
this.exitMeasurementMode (null);
return 0;
}var measurementCount = this.mp.count;
if (this.mp.traceX != -2147483648 && measurementCount == 2) this.mp.setCount (measurementCount = 1);
return (measurementCount == 4 && !dblClick ? measurementCount : this.mp.addPoint (atomIndex, nearestPoint, true));
}, "~N,JU.Point3fi,~B");
Clazz_defineMethod (c$, "resetMeasurement", 
 function () {
this.exitMeasurementMode (null);
this.measurementQueued = this.getMP ();
});
Clazz_defineMethod (c$, "exitMeasurementMode", 
 function (refreshWhy) {
if (this.mp == null) return;
this.vwr.setPendingMeasurement (this.mp = null);
this.vwr.setCursor (0);
if (refreshWhy != null) this.vwr.refresh (3, refreshWhy);
}, "~S");
Clazz_defineMethod (c$, "getSequence", 
 function () {
var a1 = this.measurementQueued.getAtomIndex (1);
var a2 = this.measurementQueued.getAtomIndex (2);
if (a1 < 0 || a2 < 0) return;
try {
var sequence = this.vwr.getSmilesOpt (null, a1, a2, false, true, false, false, false);
this.vwr.setStatusMeasuring ("measureSequence", -2, sequence, 0);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error (e.toString ());
} else {
throw e;
}
}
});
Clazz_defineMethod (c$, "minimize", 
 function (dragDone) {
var iAtom = this.dragAtomIndex;
if (dragDone) this.dragAtomIndex = -1;
this.vwr.dragMinimizeAtom (iAtom);
}, "~B");
Clazz_defineMethod (c$, "queueAtom", 
 function (atomIndex, ptClicked) {
var n = this.measurementQueued.addPoint (atomIndex, ptClicked, true);
if (atomIndex >= 0) this.vwr.setStatusAtomPicked (atomIndex, "Atom #" + n + ":" + this.vwr.getAtomInfo (atomIndex), null);
return n;
}, "~N,JU.Point3fi");
Clazz_defineMethod (c$, "setMotion", 
function (cursor, inMotion) {
switch (this.vwr.currentCursor) {
case 3:
break;
default:
this.vwr.setCursor (cursor);
}
if (inMotion) this.vwr.setInMotion (true);
}, "~N,~B");
Clazz_defineMethod (c$, "zoomByFactor", 
function (dz, x, y) {
if (dz == 0) return;
this.setMotion (8, true);
this.vwr.zoomByFactor (Math.pow (this.mouseWheelFactor, dz), x, y);
this.vwr.setInMotion (false);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "runScript", 
 function (script) {
this.vwr.script (script);
}, "~S");
Clazz_defineMethod (c$, "atomOrPointPicked", 
 function (atomIndex, ptClicked) {
if (atomIndex < 0) {
this.resetMeasurement ();
if (this.bnd (this.clickAction, 33)) {
this.runScript ("select none");
return;
}if (this.apm != 5 && this.apm != 6) return;
}var n = 2;
switch (this.apm) {
case 28:
case 29:
return;
case 0:
return;
case 25:
case 24:
case 8:
var isDelete = (this.apm == 8);
var isStruts = (this.apm == 25);
if (!this.bnd (this.clickAction, (isDelete ? 5 : 3))) return;
if (this.measurementQueued == null || this.measurementQueued.count == 0 || this.measurementQueued.count > 2) {
this.resetMeasurement ();
this.enterMeasurementMode (atomIndex);
}this.addToMeasurement (atomIndex, ptClicked, true);
if (this.queueAtom (atomIndex, ptClicked) != 2) return;
var cAction = (isDelete || this.measurementQueued.isConnected (this.vwr.ms.at, 2) ? " DELETE" : isStruts ? "STRUTS" : "");
this.runScript ("connect " + this.measurementQueued.getMeasurementScript (" ", true) + cAction);
this.resetMeasurement ();
return;
case 21:
n++;
case 20:
n++;
case 18:
case 19:
case 22:
if (!this.bnd (this.clickAction, 20)) return;
if (this.measurementQueued == null || this.measurementQueued.count == 0 || this.measurementQueued.count > n) {
this.resetMeasurement ();
this.enterMeasurementMode (atomIndex);
}this.addToMeasurement (atomIndex, ptClicked, true);
this.queueAtom (atomIndex, ptClicked);
var i = this.measurementQueued.count;
if (i == 1) {
this.vwr.setPicked (-1);
this.vwr.setPicked (atomIndex);
}if (i < n) return;
if (this.apm == 22) {
this.getSequence ();
} else {
this.vwr.setStatusMeasuring ("measurePicked", n, this.measurementQueued.getStringDetail (), this.measurementQueued.value);
if (this.apm == 18 || this.pickingStyleMeasure == 4) {
this.runScript ("measure " + this.measurementQueued.getMeasurementScript (" ", true));
}}this.resetMeasurement ();
return;
}
var mode = (this.mp != null && this.apm != 1 ? 1 : this.apm);
switch (mode) {
case 3:
if (!this.bnd (this.clickAction, 17)) return;
if (ptClicked == null) {
this.zoomTo (atomIndex);
} else {
this.runScript ("zoomTo " + JU.Escape.eP (ptClicked));
}return;
case 5:
case 6:
if (this.bnd (this.clickAction, 17)) this.checkTwoAtomAction (ptClicked, atomIndex);
}
if (ptClicked != null) return;
var bs;
switch (mode) {
case 1:
if (!this.drawMode && !this.labelMode && this.bnd (this.clickAction, 1)) this.zoomTo (atomIndex);
 else if (this.bnd (this.clickAction, 17)) this.vwr.setStatusAtomPicked (atomIndex, null, null);
return;
case 2:
if (this.bnd (this.clickAction, 19)) {
this.runScript ("set labeltoggle {atomindex=" + atomIndex + "}");
this.vwr.setStatusAtomPicked (atomIndex, null, null);
}return;
case 31:
if (this.bnd (this.clickAction, 0)) {
bs = this.vwr.getAtomBitSet ("connected(atomIndex=" + atomIndex + ") and !within(SMARTS,'[r50,R]')");
var nb = bs.cardinality ();
switch (nb) {
case 0:
case 1:
return;
case 2:
break;
case 3:
case 4:
var lengths =  Clazz_newIntArray (nb, 0);
var points =  Clazz_newIntArray (nb, 0);
var ni = 0;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1), ni++) {
lengths[ni] = this.vwr.getBranchBitSet (i, atomIndex, true).cardinality ();
points[ni] = i;
}
for (var j = 0; j < nb - 2; j++) {
var max = -2147483648;
var imax = 0;
for (var i = 0; i < nb; i++) if (lengths[i] >= max && bs.get (points[i])) {
imax = points[i];
max = lengths[i];
}
bs.clear (imax);
}
}
this.vwr.undoMoveActionClear (atomIndex, 2, true);
this.vwr.invertSelected (null, null, atomIndex, bs);
this.vwr.setStatusAtomPicked (atomIndex, "inverted: " + JU.Escape.eBS (bs), null);
}return;
case 7:
if (this.bnd (this.clickAction, 4)) {
bs = JU.BSUtil.newAndSetBit (atomIndex);
this.vwr.deleteAtoms (bs, false);
this.vwr.setStatusAtomPicked (atomIndex, "deleted: " + JU.Escape.eBS (bs), null);
}return;
}
var spec = "atomindex=" + atomIndex;
switch (this.apm) {
default:
return;
case 9:
this.selectAtoms (spec);
break;
case 10:
this.selectAtoms ("within(group, " + spec + ")");
break;
case 11:
this.selectAtoms ("within(chain, " + spec + ")");
break;
case 13:
this.selectAtoms ("within(polymer, " + spec + ")");
break;
case 14:
this.selectAtoms ("within(structure, " + spec + ")");
break;
case 12:
this.selectAtoms ("within(molecule, " + spec + ")");
break;
case 16:
this.selectAtoms ("within(model, " + spec + ")");
break;
case 17:
this.selectAtoms ("visible and within(element, " + spec + ")");
break;
case 15:
this.selectAtoms ("visible and within(site, " + spec + ")");
break;
}
this.vwr.clearClickCount ();
this.vwr.setStatusAtomPicked (atomIndex, null, null);
}, "~N,JU.Point3fi");
Clazz_defineMethod (c$, "assignNew", 
 function (x, y) {
if (this.mp.count == 2) {
this.vwr.undoMoveActionClear (-1, 4146, true);
this.runScript ("assign connect " + this.mp.getMeasurementScript (" ", false));
} else if (this.pickAtomAssignType.equals ("Xx")) {
this.exitMeasurementMode ("bond dropped");
} else {
if (this.pressed.inRange (this.xyRange, this.dragged.x, this.dragged.y)) {
var s = "assign atom ({" + this.dragAtomIndex + "}) \"" + this.pickAtomAssignType + "\"";
if (this.isPickAtomAssignCharge) {
s += ";{atomindex=" + this.dragAtomIndex + "}.label='%C'; ";
this.vwr.undoMoveActionClear (this.dragAtomIndex, 4, true);
} else {
this.vwr.undoMoveActionClear (-1, 4146, true);
}this.runScript (s);
} else if (!this.isPickAtomAssignCharge) {
this.vwr.undoMoveActionClear (-1, 4146, true);
var a = this.vwr.ms.at[this.dragAtomIndex];
if (a.getElementNumber () == 1) {
this.runScript ("assign atom ({" + this.dragAtomIndex + "}) \"X\"");
} else {
var ptNew = JU.P3.new3 (x, y, a.sZ);
this.vwr.tm.unTransformPoint (ptNew, ptNew);
this.runScript ("assign atom ({" + this.dragAtomIndex + "}) \"" + this.pickAtomAssignType + "\" " + JU.Escape.eP (ptNew));
}}}this.exitMeasurementMode (null);
}, "~N,~N");
Clazz_defineMethod (c$, "bondPicked", 
 function (index) {
if (this.bondPickingMode == 33) this.vwr.undoMoveActionClear (-1, 4146, true);
switch (this.bondPickingMode) {
case 33:
this.runScript ("assign bond [{" + index + "}] \"" + this.pickBondAssignType + "\"");
break;
case 34:
this.vwr.setRotateBondIndex (index);
break;
case 8:
this.vwr.deleteBonds (JU.BSUtil.newAndSetBit (index));
}
}, "~N");
Clazz_defineMethod (c$, "checkTwoAtomAction", 
 function (ptClicked, atomIndex) {
var isSpin = (this.apm == 5);
if (this.vwr.tm.spinOn || this.vwr.tm.navOn || this.vwr.getPendingMeasurement () != null) {
this.resetMeasurement ();
if (this.vwr.tm.spinOn) this.runScript ("spin off");
return;
}if (this.measurementQueued.count >= 2) this.resetMeasurement ();
var queuedAtomCount = this.measurementQueued.count;
if (queuedAtomCount == 1) {
if (ptClicked == null) {
if (this.measurementQueued.getAtomIndex (1) == atomIndex) return;
} else {
if (this.measurementQueued.getAtom (1).distance (ptClicked) == 0) return;
}}if (atomIndex >= 0 || ptClicked != null) queuedAtomCount = this.queueAtom (atomIndex, ptClicked);
if (queuedAtomCount < 2) {
if (isSpin) this.vwr.scriptStatus (queuedAtomCount == 1 ? J.i18n.GT._ ("pick one more atom in order to spin the model around an axis") : J.i18n.GT._ ("pick two atoms in order to spin the model around an axis"));
 else this.vwr.scriptStatus (queuedAtomCount == 1 ? J.i18n.GT._ ("pick one more atom in order to display the symmetry relationship") : J.i18n.GT._ ("pick two atoms in order to display the symmetry relationship between them"));
return;
}var s = this.measurementQueued.getMeasurementScript (" ", false);
if (isSpin) this.runScript ("spin" + s + " " + this.vwr.getInt (553648157));
 else this.runScript ("draw symop" + s + ";show symop" + s);
}, "JU.Point3fi,~N");
Clazz_defineMethod (c$, "reset", 
 function () {
this.runScript ("!reset");
});
Clazz_defineMethod (c$, "selectAtoms", 
 function (item) {
if (this.mp != null || this.selectionWorking) return;
this.selectionWorking = true;
var s = (this.rubberbandSelectionMode || this.bnd (this.clickAction, 35) ? "selected and not (" + item + ") or (not selected) and " : this.bnd (this.clickAction, 32) ? "selected and not " : this.bnd (this.clickAction, 34) ? "selected or " : this.clickAction == 0 || this.bnd (this.clickAction, 36) ? "selected tog " : this.bnd (this.clickAction, 30) ? "" : null);
if (s != null) {
s += "(" + item + ")";
try {
var bs = this.vwr.getAtomBitSetEval (null, s);
this.vwr.select (bs, false, 0, false);
this.vwr.refresh (3, "selections set");
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}this.selectionWorking = false;
}, "~S");
Clazz_defineMethod (c$, "selectRb", 
 function (action) {
var bs = this.vwr.ms.findAtomsInRectangle (this.rectRubber);
if (bs.length () > 0) {
var s = JU.Escape.eBS (bs);
if (this.bnd (action, 34)) this.runScript ("selectionHalos on;select selected or " + s);
 else if (this.bnd (action, 32)) this.runScript ("selectionHalos on;select selected and not " + s);
 else this.runScript ("selectionHalos on;select selected tog " + s);
}this.vwr.refresh (3, "mouseReleased");
}, "~N");
Clazz_defineMethod (c$, "toggleMeasurement", 
 function () {
if (this.mp == null) return;
var measurementCount = this.mp.count;
if (measurementCount >= 2 && measurementCount <= 4) this.runScript ("!measure " + this.mp.getMeasurementScript (" ", true));
this.exitMeasurementMode (null);
});
Clazz_defineMethod (c$, "zoomTo", 
 function (atomIndex) {
this.runScript ("zoomTo (atomindex=" + atomIndex + ")");
this.vwr.setStatusAtomPicked (atomIndex, null, null);
}, "~N");
Clazz_overrideMethod (c$, "keyTyped", 
function (keyChar, modifiers) {
return false;
}, "~N,~N");
Clazz_defineStatics (c$,
"ACTION_assignNew", 0,
"ACTION_center", 1,
"ACTION_clickFrank", 2,
"ACTION_connectAtoms", 3,
"ACTION_deleteAtom", 4,
"ACTION_deleteBond", 5,
"ACTION_depth", 6,
"ACTION_dragAtom", 7,
"ACTION_dragDrawObject", 8,
"ACTION_dragDrawPoint", 9,
"ACTION_dragLabel", 10,
"ACTION_dragMinimize", 11,
"ACTION_dragMinimizeMolecule", 12,
"ACTION_dragSelected", 13,
"ACTION_dragZ", 14,
"ACTION_multiTouchSimulation", 15,
"ACTION_navTranslate", 16,
"ACTION_pickAtom", 17,
"ACTION_pickIsosurface", 18,
"ACTION_pickLabel", 19,
"ACTION_pickMeasure", 20,
"ACTION_pickNavigate", 21,
"ACTION_pickPoint", 22,
"ACTION_popupMenu", 23,
"ACTION_reset", 24,
"ACTION_rotate", 25,
"ACTION_rotateBranch", 26,
"ACTION_rotateSelected", 27,
"ACTION_rotateZ", 28,
"ACTION_rotateZorZoom", 29,
"ACTION_select", 30,
"ACTION_selectAndDrag", 31,
"ACTION_selectAndNot", 32,
"ACTION_selectNone", 33,
"ACTION_selectOr", 34,
"ACTION_selectToggle", 35,
"ACTION_selectToggleExtended", 36,
"ACTION_setMeasure", 37,
"ACTION_slab", 38,
"ACTION_slabAndDepth", 39,
"ACTION_slideZoom", 40,
"ACTION_spinDrawObjectCCW", 41,
"ACTION_spinDrawObjectCW", 42,
"ACTION_stopMotion", 43,
"ACTION_swipe", 44,
"ACTION_translate", 45,
"ACTION_wheelZoom", 46,
"ACTION_count", 47);
c$.actionInfo = c$.prototype.actionInfo =  new Array (47);
c$.actionNames = c$.prototype.actionNames =  new Array (47);
{
JV.ActionManager.newAction (0, "_assignNew", J.i18n.GT.o (J.i18n.GT._ ("assign/new atom or bond (requires {0})"), "set picking assignAtom_??/assignBond_?"));
JV.ActionManager.newAction (1, "_center", J.i18n.GT._ ("center"));
JV.ActionManager.newAction (2, "_clickFrank", J.i18n.GT._ ("pop up recent context menu (click on Jmol frank)"));
JV.ActionManager.newAction (4, "_deleteAtom", J.i18n.GT.o (J.i18n.GT._ ("delete atom (requires {0})"), "set picking DELETE ATOM"));
JV.ActionManager.newAction (5, "_deleteBond", J.i18n.GT.o (J.i18n.GT._ ("delete bond (requires {0})"), "set picking DELETE BOND"));
JV.ActionManager.newAction (6, "_depth", J.i18n.GT.o (J.i18n.GT._ ("adjust depth (back plane; requires {0})"), "SLAB ON"));
JV.ActionManager.newAction (7, "_dragAtom", J.i18n.GT.o (J.i18n.GT._ ("move atom (requires {0})"), "set picking DRAGATOM"));
JV.ActionManager.newAction (8, "_dragDrawObject", J.i18n.GT.o (J.i18n.GT._ ("move whole DRAW object (requires {0})"), "set picking DRAW"));
JV.ActionManager.newAction (9, "_dragDrawPoint", J.i18n.GT.o (J.i18n.GT._ ("move specific DRAW point (requires {0})"), "set picking DRAW"));
JV.ActionManager.newAction (10, "_dragLabel", J.i18n.GT.o (J.i18n.GT._ ("move label (requires {0})"), "set picking LABEL"));
JV.ActionManager.newAction (11, "_dragMinimize", J.i18n.GT.o (J.i18n.GT._ ("move atom and minimize molecule (requires {0})"), "set picking DRAGMINIMIZE"));
JV.ActionManager.newAction (12, "_dragMinimizeMolecule", J.i18n.GT.o (J.i18n.GT._ ("move and minimize molecule (requires {0})"), "set picking DRAGMINIMIZEMOLECULE"));
JV.ActionManager.newAction (13, "_dragSelected", J.i18n.GT.o (J.i18n.GT._ ("move selected atoms (requires {0})"), "set DRAGSELECTED"));
JV.ActionManager.newAction (14, "_dragZ", J.i18n.GT.o (J.i18n.GT._ ("drag atoms in Z direction (requires {0})"), "set DRAGSELECTED"));
JV.ActionManager.newAction (15, "_multiTouchSimulation", J.i18n.GT._ ("simulate multi-touch using the mouse)"));
JV.ActionManager.newAction (16, "_navTranslate", J.i18n.GT.o (J.i18n.GT._ ("translate navigation point (requires {0} and {1})"), ["set NAVIGATIONMODE", "set picking NAVIGATE"]));
JV.ActionManager.newAction (17, "_pickAtom", J.i18n.GT._ ("pick an atom"));
JV.ActionManager.newAction (3, "_pickConnect", J.i18n.GT.o (J.i18n.GT._ ("connect atoms (requires {0})"), "set picking CONNECT"));
JV.ActionManager.newAction (18, "_pickIsosurface", J.i18n.GT.o (J.i18n.GT._ ("pick an ISOSURFACE point (requires {0}"), "set DRAWPICKING"));
JV.ActionManager.newAction (19, "_pickLabel", J.i18n.GT.o (J.i18n.GT._ ("pick a label to toggle it hidden/displayed (requires {0})"), "set picking LABEL"));
JV.ActionManager.newAction (20, "_pickMeasure", J.i18n.GT.o (J.i18n.GT._ ("pick an atom to include it in a measurement (after starting a measurement or after {0})"), "set picking DISTANCE/ANGLE/TORSION"));
JV.ActionManager.newAction (21, "_pickNavigate", J.i18n.GT.o (J.i18n.GT._ ("pick a point or atom to navigate to (requires {0})"), "set NAVIGATIONMODE"));
JV.ActionManager.newAction (22, "_pickPoint", J.i18n.GT.o (J.i18n.GT._ ("pick a DRAW point (for measurements) (requires {0}"), "set DRAWPICKING"));
JV.ActionManager.newAction (23, "_popupMenu", J.i18n.GT._ ("pop up the full context menu"));
JV.ActionManager.newAction (24, "_reset", J.i18n.GT._ ("reset (when clicked off the model)"));
JV.ActionManager.newAction (25, "_rotate", J.i18n.GT._ ("rotate"));
JV.ActionManager.newAction (26, "_rotateBranch", J.i18n.GT.o (J.i18n.GT._ ("rotate branch around bond (requires {0})"), "set picking ROTATEBOND"));
JV.ActionManager.newAction (27, "_rotateSelected", J.i18n.GT.o (J.i18n.GT._ ("rotate selected atoms (requires {0})"), "set DRAGSELECTED"));
JV.ActionManager.newAction (28, "_rotateZ", J.i18n.GT._ ("rotate Z"));
JV.ActionManager.newAction (29, "_rotateZorZoom", J.i18n.GT._ ("rotate Z (horizontal motion of mouse) or zoom (vertical motion of mouse)"));
JV.ActionManager.newAction (30, "_select", J.i18n.GT.o (J.i18n.GT._ ("select an atom (requires {0})"), "set pickingStyle EXTENDEDSELECT"));
JV.ActionManager.newAction (31, "_selectAndDrag", J.i18n.GT.o (J.i18n.GT._ ("select and drag atoms (requires {0})"), "set DRAGSELECTED"));
JV.ActionManager.newAction (32, "_selectAndNot", J.i18n.GT.o (J.i18n.GT._ ("unselect this group of atoms (requires {0})"), "set pickingStyle DRAG/EXTENDEDSELECT"));
JV.ActionManager.newAction (33, "_selectNone", J.i18n.GT.o (J.i18n.GT._ ("select NONE (requires {0})"), "set pickingStyle EXTENDEDSELECT"));
JV.ActionManager.newAction (34, "_selectOr", J.i18n.GT.o (J.i18n.GT._ ("add this group of atoms to the set of selected atoms (requires {0})"), "set pickingStyle DRAG/EXTENDEDSELECT"));
JV.ActionManager.newAction (35, "_selectToggle", J.i18n.GT.o (J.i18n.GT._ ("toggle selection (requires {0})"), "set pickingStyle DRAG/EXTENDEDSELECT/RASMOL"));
JV.ActionManager.newAction (36, "_selectToggleOr", J.i18n.GT.o (J.i18n.GT._ ("if all are selected, unselect all, otherwise add this group of atoms to the set of selected atoms (requires {0})"), "set pickingStyle DRAG"));
JV.ActionManager.newAction (37, "_setMeasure", J.i18n.GT._ ("pick an atom to initiate or conclude a measurement"));
JV.ActionManager.newAction (38, "_slab", J.i18n.GT.o (J.i18n.GT._ ("adjust slab (front plane; requires {0})"), "SLAB ON"));
JV.ActionManager.newAction (39, "_slabAndDepth", J.i18n.GT.o (J.i18n.GT._ ("move slab/depth window (both planes; requires {0})"), "SLAB ON"));
JV.ActionManager.newAction (40, "_slideZoom", J.i18n.GT._ ("zoom (along right edge of window)"));
JV.ActionManager.newAction (41, "_spinDrawObjectCCW", J.i18n.GT.o (J.i18n.GT._ ("click on two points to spin around axis counterclockwise (requires {0})"), "set picking SPIN"));
JV.ActionManager.newAction (42, "_spinDrawObjectCW", J.i18n.GT.o (J.i18n.GT._ ("click on two points to spin around axis clockwise (requires {0})"), "set picking SPIN"));
JV.ActionManager.newAction (43, "_stopMotion", J.i18n.GT.o (J.i18n.GT._ ("stop motion (requires {0})"), "set waitForMoveTo FALSE"));
JV.ActionManager.newAction (44, "_swipe", J.i18n.GT._ ("spin model (swipe and release button and stop motion simultaneously)"));
JV.ActionManager.newAction (45, "_translate", J.i18n.GT._ ("translate"));
JV.ActionManager.newAction (46, "_wheelZoom", J.i18n.GT._ ("zoom"));
}Clazz_defineStatics (c$,
"PICKING_OFF", 0,
"PICKING_IDENTIFY", 1,
"PICKING_LABEL", 2,
"PICKING_CENTER", 3,
"PICKING_DRAW", 4,
"PICKING_SPIN", 5,
"PICKING_SYMMETRY", 6,
"PICKING_DELETE_ATOM", 7,
"PICKING_DELETE_BOND", 8,
"PICKING_SELECT_ATOM", 9,
"PICKING_SELECT_GROUP", 10,
"PICKING_SELECT_CHAIN", 11,
"PICKING_SELECT_MOLECULE", 12,
"PICKING_SELECT_POLYMER", 13,
"PICKING_SELECT_STRUCTURE", 14,
"PICKING_SELECT_SITE", 15,
"PICKING_SELECT_MODEL", 16,
"PICKING_SELECT_ELEMENT", 17,
"PICKING_MEASURE", 18,
"PICKING_MEASURE_DISTANCE", 19,
"PICKING_MEASURE_ANGLE", 20,
"PICKING_MEASURE_TORSION", 21,
"PICKING_MEASURE_SEQUENCE", 22,
"PICKING_NAVIGATE", 23,
"PICKING_CONNECT", 24,
"PICKING_STRUTS", 25,
"PICKING_DRAG_SELECTED", 26,
"PICKING_DRAG_MOLECULE", 27,
"PICKING_DRAG_ATOM", 28,
"PICKING_DRAG_MINIMIZE", 29,
"PICKING_DRAG_MINIMIZE_MOLECULE", 30,
"PICKING_INVERT_STEREO", 31,
"PICKING_ASSIGN_ATOM", 32,
"PICKING_ASSIGN_BOND", 33,
"PICKING_ROTATE_BOND", 34,
"PICKING_IDENTIFY_BOND", 35,
"PICKING_DRAG_LIGAND", 36,
"PICKINGSTYLE_SELECT_JMOL", 0,
"PICKINGSTYLE_SELECT_CHIME", 0,
"PICKINGSTYLE_SELECT_RASMOL", 1,
"PICKINGSTYLE_SELECT_PFAAT", 2,
"PICKINGSTYLE_SELECT_DRAG", 3,
"PICKINGSTYLE_MEASURE_ON", 4,
"PICKINGSTYLE_MEASURE_OFF", 5,
"pickingModeNames", null);
{
JV.ActionManager.pickingModeNames = "off identify label center draw spin symmetry deleteatom deletebond atom group chain molecule polymer structure site model element measure distance angle torsion sequence navigate connect struts dragselected dragmolecule dragatom dragminimize dragminimizemolecule invertstereo assignatom assignbond rotatebond identifybond dragligand".$plit (" ");
}Clazz_defineStatics (c$,
"pickingStyleNames", null);
{
JV.ActionManager.pickingStyleNames = "toggle selectOrToggle extendedSelect drag measure measureoff".$plit (" ");
}Clazz_defineStatics (c$,
"MAX_DOUBLE_CLICK_MILLIS", 700,
"MININUM_GESTURE_DELAY_MILLISECONDS", 10,
"SLIDE_ZOOM_X_PERCENT", 98,
"DEFAULT_MOUSE_DRAG_FACTOR", 1,
"DEFAULT_MOUSE_WHEEL_FACTOR", 1.15,
"DEFAULT_GESTURE_SWIPE_FACTOR", 1);
c$ = Clazz_decorateAsClass (function () {
this.index = 0;
this.x = 0;
this.y = 0;
this.time = 0;
Clazz_instantialize (this, arguments);
}, JV, "MotionPoint");
Clazz_defineMethod (c$, "set", 
function (index, x, y, time) {
this.index = index;
this.x = x;
this.y = y;
this.time = time;
}, "~N,~N,~N,~N");
Clazz_overrideMethod (c$, "toString", 
function () {
return "[x = " + this.x + " y = " + this.y + " time = " + this.time + " ]";
});
c$ = Clazz_decorateAsClass (function () {
this.action = 0;
this.nodes = null;
this.ptNext = 0;
this.time0 = 0;
this.vwr = null;
Clazz_instantialize (this, arguments);
}, JV, "Gesture");
Clazz_makeConstructor (c$, 
function (nPoints, vwr) {
this.vwr = vwr;
this.nodes =  new Array (nPoints);
for (var i = 0; i < nPoints; i++) this.nodes[i] =  new JV.MotionPoint ();

}, "~N,JV.Viewer");
Clazz_defineMethod (c$, "setAction", 
function (action, time) {
this.action = action;
this.ptNext = 0;
this.time0 = time;
for (var i = 0; i < this.nodes.length; i++) this.nodes[i].index = -1;

}, "~N,~N");
Clazz_defineMethod (c$, "add", 
function (action, x, y, time) {
this.action = action;
this.getNode (this.ptNext).set (this.ptNext, x, y, time - this.time0);
this.ptNext++;
return this.ptNext;
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "getTimeDifference", 
function (nPoints) {
nPoints = this.getPointCount2 (nPoints, 0);
if (nPoints < 2) return 0;
var mp1 = this.getNode (this.ptNext - 1);
var mp0 = this.getNode (this.ptNext - nPoints);
return mp1.time - mp0.time;
}, "~N");
Clazz_defineMethod (c$, "getSpeedPixelsPerMillisecond", 
function (nPoints, nPointsPrevious) {
nPoints = this.getPointCount2 (nPoints, nPointsPrevious);
if (nPoints < 2) return 0;
var mp1 = this.getNode (this.ptNext - 1 - nPointsPrevious);
var mp0 = this.getNode (this.ptNext - nPoints - nPointsPrevious);
var dx = ((mp1.x - mp0.x)) / this.vwr.getScreenWidth () * 360;
var dy = ((mp1.y - mp0.y)) / this.vwr.getScreenHeight () * 360;
return Math.sqrt (dx * dx + dy * dy) / (mp1.time - mp0.time);
}, "~N,~N");
Clazz_defineMethod (c$, "getDX", 
function (nPoints, nPointsPrevious) {
nPoints = this.getPointCount2 (nPoints, nPointsPrevious);
if (nPoints < 2) return 0;
var mp1 = this.getNode (this.ptNext - 1 - nPointsPrevious);
var mp0 = this.getNode (this.ptNext - nPoints - nPointsPrevious);
return mp1.x - mp0.x;
}, "~N,~N");
Clazz_defineMethod (c$, "getDY", 
function (nPoints, nPointsPrevious) {
nPoints = this.getPointCount2 (nPoints, nPointsPrevious);
if (nPoints < 2) return 0;
var mp1 = this.getNode (this.ptNext - 1 - nPointsPrevious);
var mp0 = this.getNode (this.ptNext - nPoints - nPointsPrevious);
return mp1.y - mp0.y;
}, "~N,~N");
Clazz_defineMethod (c$, "getPointCount", 
function () {
return this.ptNext;
});
Clazz_defineMethod (c$, "getPointCount2", 
 function (nPoints, nPointsPrevious) {
if (nPoints > this.nodes.length - nPointsPrevious) nPoints = this.nodes.length - nPointsPrevious;
var n = nPoints + 1;
for (; --n >= 0; ) if (this.getNode (this.ptNext - n - nPointsPrevious).index >= 0) break;

return n;
}, "~N,~N");
Clazz_defineMethod (c$, "getNode", 
function (i) {
return this.nodes[(i + this.nodes.length + this.nodes.length) % this.nodes.length];
}, "~N");
Clazz_overrideMethod (c$, "toString", 
function () {
if (this.nodes.length == 0) return "" + this;
return JV.binding.Binding.getMouseActionName (this.action, false) + " nPoints = " + this.ptNext + " " + this.nodes[0];
});
});
Clazz_declarePackage ("JV");
Clazz_load (["JU.BS"], "JV.AnimationManager", ["J.api.Interface", "JU.BSUtil"], function () {
c$ = Clazz_decorateAsClass (function () {
this.animationThread = null;
this.vwr = null;
this.animationOn = false;
this.animationFps = 0;
this.firstFrameDelayMs = 0;
this.lastFrameDelayMs = 0;
this.bsVisibleModels = null;
this.animationReplayMode = 1073742070;
this.bsDisplay = null;
this.animationFrames = null;
this.isMovie = false;
this.animationPaused = false;
this.cmi = 0;
this.caf = 0;
this.morphCount = 0;
this.animationDirection = 1;
this.currentDirection = 1;
this.firstFrameIndex = 0;
this.lastFrameIndex = 0;
this.frameStep = 0;
this.backgroundModelIndex = -1;
this.currentMorphModel = 0;
this.firstFrameDelay = 0;
this.lastFrameDelay = 1;
this.lastFramePainted = 0;
this.lastModelPainted = 0;
this.intAnimThread = 0;
this.cai = -1;
Clazz_instantialize (this, arguments);
}, JV, "AnimationManager");
Clazz_prepareFields (c$, function () {
this.bsVisibleModels =  new JU.BS ();
});
Clazz_makeConstructor (c$, 
function (vwr) {
this.vwr = vwr;
}, "JV.Viewer");
Clazz_defineMethod (c$, "setAnimationOn", 
function (animationOn) {
if (animationOn == this.animationOn) return;
if (!animationOn || this.vwr.headless) {
this.stopThread (false);
return;
}if (!this.vwr.tm.spinOn) this.vwr.refresh (3, "Anim:setAnimationOn");
this.setAnimationRange (-1, -1);
this.resumeAnimation ();
}, "~B");
Clazz_defineMethod (c$, "stopThread", 
function (isPaused) {
var stopped = false;
if (this.animationThread != null) {
this.animationThread.interrupt ();
this.animationThread = null;
stopped = true;
}this.animationPaused = isPaused;
if (stopped && !this.vwr.tm.spinOn) this.vwr.refresh (3, "Viewer:setAnimationOff");
this.animation (false);
this.vwr.setStatusFrameChanged (false, true);
}, "~B");
Clazz_defineMethod (c$, "setAnimationNext", 
function () {
return this.setAnimationRelative (this.animationDirection);
});
Clazz_defineMethod (c$, "currentIsLast", 
function () {
return (this.isMovie ? this.lastFramePainted == this.caf : this.lastModelPainted == this.cmi);
});
Clazz_defineMethod (c$, "currentFrameIs", 
function (f) {
var i = this.cmi;
return (this.morphCount == 0 ? i == f : Math.abs (this.currentMorphModel - f) < 0.001);
}, "~N");
Clazz_defineMethod (c$, "clear", 
function () {
this.setMovie (null);
this.initializePointers (0);
this.setAnimationOn (false);
this.setModel (0, true);
this.currentDirection = 1;
this.cai = -1;
this.setAnimationDirection (1);
this.setAnimationFps (10);
this.setAnimationReplayMode (1073742070, 0, 0);
this.initializePointers (0);
});
Clazz_defineMethod (c$, "getModelSpecial", 
function (i) {
switch (i) {
case -1:
i = this.firstFrameIndex;
break;
case 0:
if (this.morphCount > 0) return "-" + (1 + this.currentMorphModel);
i = this.cmi;
break;
case 1:
i = this.lastFrameIndex;
break;
}
return this.vwr.getModelNumberDotted (i);
}, "~N");
Clazz_defineMethod (c$, "setDisplay", 
function (bs) {
this.bsDisplay = (bs == null || bs.cardinality () == 0 ? null : JU.BSUtil.copy (bs));
}, "JU.BS");
Clazz_defineMethod (c$, "setMorphCount", 
function (n) {
this.morphCount = (this.isMovie ? 0 : n);
}, "~N");
Clazz_defineMethod (c$, "morph", 
function (modelIndex) {
var m = Clazz_floatToInt (modelIndex);
if (Math.abs (m - modelIndex) < 0.001) modelIndex = m;
 else if (Math.abs (m - modelIndex) > 0.999) modelIndex = m = m + 1;
var f = modelIndex - m;
m -= 1;
if (f == 0) {
this.currentMorphModel = m;
this.setModel (m, true);
return;
}var m1;
this.setModel (m, true);
m1 = m + 1;
this.currentMorphModel = m + f;
if (m1 == m || m1 < 0 || m < 0) return;
this.vwr.ms.morphTrajectories (m, m1, f);
}, "~N");
Clazz_defineMethod (c$, "setModel", 
function (modelIndex, clearBackgroundModel) {
if (modelIndex < 0) this.stopThread (false);
var formerModelIndex = this.cmi;
var modelSet = this.vwr.ms;
var modelCount = (modelSet == null ? 0 : modelSet.mc);
if (modelCount == 1) this.cmi = modelIndex = 0;
 else if (modelIndex < 0 || modelIndex >= modelCount) modelIndex = -1;
var ids = null;
var isSameSource = false;
if (this.cmi != modelIndex) {
if (modelCount > 0) {
var ms = this.vwr.ms;
var toDataModel = ms.isJmolDataFrameForModel (modelIndex);
var fromDataModel = ms.isJmolDataFrameForModel (this.cmi);
if (fromDataModel) ms.setJmolDataFrame (null, -1, this.cmi);
if (this.cmi != -1) this.vwr.saveModelOrientation ();
if (fromDataModel || toDataModel) {
ids = ms.getJmolFrameType (modelIndex) + " " + modelIndex + " <-- " + " " + this.cmi + " " + ms.getJmolFrameType (this.cmi);
isSameSource = (ms.getJmolDataSourceFrame (modelIndex) == ms.getJmolDataSourceFrame (this.cmi));
}}this.cmi = modelIndex;
if (ids != null) {
if (modelIndex >= 0) this.vwr.restoreModelOrientation (modelIndex);
if (isSameSource && (ids.indexOf ("quaternion") >= 0 || ids.indexOf ("plot") < 0 && ids.indexOf ("ramachandran") < 0 && ids.indexOf (" property ") < 0)) {
this.vwr.restoreModelRotation (formerModelIndex);
}}}this.setViewer (clearBackgroundModel);
}, "~N,~B");
Clazz_defineMethod (c$, "setBackgroundModelIndex", 
function (modelIndex) {
var modelSet = this.vwr.ms;
if (modelSet == null || modelIndex < 0 || modelIndex >= modelSet.mc) modelIndex = -1;
this.backgroundModelIndex = modelIndex;
if (modelIndex >= 0) this.vwr.ms.setTrajectory (modelIndex);
this.vwr.setTainted (true);
this.setFrameRangeVisible ();
}, "~N");
Clazz_defineMethod (c$, "initializePointers", 
function (frameStep) {
this.firstFrameIndex = 0;
this.lastFrameIndex = (frameStep == 0 ? 0 : this.getFrameCount ()) - 1;
this.frameStep = frameStep;
this.vwr.setFrameVariables ();
}, "~N");
Clazz_defineMethod (c$, "setAnimationDirection", 
function (animationDirection) {
this.animationDirection = animationDirection;
}, "~N");
Clazz_defineMethod (c$, "setAnimationFps", 
function (fps) {
if (fps < 1) fps = 1;
if (fps > 50) fps = 50;
this.animationFps = fps;
this.vwr.setFrameVariables ();
}, "~N");
Clazz_defineMethod (c$, "setAnimationReplayMode", 
function (animationReplayMode, firstFrameDelay, lastFrameDelay) {
this.firstFrameDelay = firstFrameDelay > 0 ? firstFrameDelay : 0;
this.firstFrameDelayMs = Clazz_floatToInt (this.firstFrameDelay * 1000);
this.lastFrameDelay = lastFrameDelay > 0 ? lastFrameDelay : 0;
this.lastFrameDelayMs = Clazz_floatToInt (this.lastFrameDelay * 1000);
this.animationReplayMode = animationReplayMode;
this.vwr.setFrameVariables ();
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setAnimationRange", 
function (framePointer, framePointer2) {
var frameCount = this.getFrameCount ();
if (framePointer < 0) framePointer = 0;
if (framePointer2 < 0) framePointer2 = frameCount;
if (framePointer >= frameCount) framePointer = frameCount - 1;
if (framePointer2 >= frameCount) framePointer2 = frameCount - 1;
this.firstFrameIndex = framePointer;
this.currentMorphModel = this.firstFrameIndex;
this.lastFrameIndex = framePointer2;
this.frameStep = (framePointer2 < framePointer ? -1 : 1);
this.rewindAnimation ();
}, "~N,~N");
Clazz_defineMethod (c$, "pauseAnimation", 
function () {
this.stopThread (true);
});
Clazz_defineMethod (c$, "reverseAnimation", 
function () {
this.currentDirection = -this.currentDirection;
if (!this.animationOn) this.resumeAnimation ();
});
Clazz_defineMethod (c$, "repaintDone", 
function () {
this.lastModelPainted = this.cmi;
this.lastFramePainted = this.caf;
});
Clazz_defineMethod (c$, "resumeAnimation", 
function () {
if (this.cmi < 0) this.setAnimationRange (this.firstFrameIndex, this.lastFrameIndex);
if (this.getFrameCount () <= 1) {
this.animation (false);
return;
}this.animation (true);
this.animationPaused = false;
if (this.animationThread == null) {
this.intAnimThread++;
this.animationThread = J.api.Interface.getOption ("thread.AnimationThread", this.vwr, "script");
this.animationThread.setManager (this, this.vwr, [this.firstFrameIndex, this.lastFrameIndex, this.intAnimThread]);
this.animationThread.start ();
}});
Clazz_defineMethod (c$, "setAnimationLast", 
function () {
this.setFrame (this.animationDirection > 0 ? this.lastFrameIndex : this.firstFrameIndex);
});
Clazz_defineMethod (c$, "rewindAnimation", 
function () {
this.setFrame (this.animationDirection > 0 ? this.firstFrameIndex : this.lastFrameIndex);
this.currentDirection = 1;
this.vwr.setFrameVariables ();
});
Clazz_defineMethod (c$, "setAnimationPrevious", 
function () {
return this.setAnimationRelative (-this.animationDirection);
});
Clazz_defineMethod (c$, "getAnimRunTimeSeconds", 
function () {
var frameCount = this.getFrameCount ();
if (this.firstFrameIndex == this.lastFrameIndex || this.lastFrameIndex < 0 || this.firstFrameIndex < 0 || this.lastFrameIndex >= frameCount || this.firstFrameIndex >= frameCount) return 0;
var i0 = Math.min (this.firstFrameIndex, this.lastFrameIndex);
var i1 = Math.max (this.firstFrameIndex, this.lastFrameIndex);
var nsec = 1 * (i1 - i0) / this.animationFps + this.firstFrameDelay + this.lastFrameDelay;
for (var i = i0; i <= i1; i++) nsec += this.vwr.ms.getFrameDelayMs (this.modelIndexForFrame (i)) / 1000;

return nsec;
});
Clazz_defineMethod (c$, "setMovie", 
function (info) {
this.isMovie = (info != null && info.get ("scripts") == null);
if (this.isMovie) {
this.animationFrames = info.get ("frames");
if (this.animationFrames == null || this.animationFrames.length == 0) {
this.isMovie = false;
} else {
this.caf = (info.get ("currentFrame")).intValue ();
if (this.caf < 0 || this.caf >= this.animationFrames.length) this.caf = 0;
}this.setFrame (this.caf);
}if (!this.isMovie) {
this.animationFrames = null;
}this.vwr.setBooleanProperty ("_ismovie", this.isMovie);
this.bsDisplay = null;
this.currentMorphModel = this.morphCount = 0;
}, "java.util.Map");
Clazz_defineMethod (c$, "modelIndexForFrame", 
function (i) {
return (this.isMovie ? this.animationFrames[i] - 1 : i);
}, "~N");
Clazz_defineMethod (c$, "getFrameCount", 
function () {
return (this.isMovie ? this.animationFrames.length : this.vwr.ms.mc);
});
Clazz_defineMethod (c$, "setFrame", 
function (i) {
try {
if (this.isMovie) {
var iModel = this.modelIndexForFrame (i);
this.caf = i;
i = iModel;
} else {
this.caf = i;
}this.setModel (i, true);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}, "~N");
Clazz_defineMethod (c$, "setViewer", 
 function (clearBackgroundModel) {
this.vwr.ms.setTrajectory (this.cmi);
this.vwr.tm.setFrameOffset (this.cmi);
if (this.cmi == -1 && clearBackgroundModel) this.setBackgroundModelIndex (-1);
this.vwr.setTainted (true);
this.setFrameRangeVisible ();
this.vwr.setStatusFrameChanged (false, true);
if (this.vwr.ms != null && !this.vwr.g.selectAllModels) this.vwr.slm.setSelectionSubset (this.vwr.getModelUndeletedAtomsBitSet (this.cmi));
}, "~B");
Clazz_defineMethod (c$, "setFrameRangeVisible", 
 function () {
this.bsVisibleModels.clearAll ();
if (this.backgroundModelIndex >= 0) this.bsVisibleModels.set (this.backgroundModelIndex);
if (this.cmi >= 0) {
this.bsVisibleModels.set (this.cmi);
return;
}if (this.frameStep == 0) return;
var nDisplayed = 0;
var frameDisplayed = 0;
for (var iframe = this.firstFrameIndex; iframe != this.lastFrameIndex; iframe += this.frameStep) {
var i = this.modelIndexForFrame (iframe);
if (!this.vwr.ms.isJmolDataFrameForModel (i)) {
this.bsVisibleModels.set (i);
nDisplayed++;
frameDisplayed = iframe;
}}
var i = this.modelIndexForFrame (this.lastFrameIndex);
if (this.firstFrameIndex == this.lastFrameIndex || !this.vwr.ms.isJmolDataFrameForModel (i) || nDisplayed == 0) {
this.bsVisibleModels.set (i);
if (nDisplayed == 0) this.firstFrameIndex = this.lastFrameIndex;
nDisplayed = 0;
}if (nDisplayed == 1 && this.cmi < 0) this.setFrame (frameDisplayed);
});
Clazz_defineMethod (c$, "animation", 
 function (TF) {
this.animationOn = TF;
this.vwr.setBooleanProperty ("_animating", TF);
}, "~B");
Clazz_defineMethod (c$, "setAnimationRelative", 
 function (direction) {
var frameStep = this.getFrameStep (direction);
var thisFrame = (this.isMovie ? this.caf : this.cmi);
var frameNext = thisFrame + frameStep;
var morphStep = 0;
var nextMorphFrame = 0;
var isDone;
if (this.morphCount > 0) {
morphStep = 1 / (this.morphCount + 1);
nextMorphFrame = this.currentMorphModel + frameStep * morphStep;
isDone = this.isNotInRange (nextMorphFrame);
} else {
isDone = this.isNotInRange (frameNext);
}if (isDone) {
switch (this.animationReplayMode) {
case 1073742070:
return false;
case 528410:
nextMorphFrame = frameNext = (this.animationDirection == this.currentDirection ? this.firstFrameIndex : this.lastFrameIndex);
break;
case 1073742082:
this.currentDirection = -this.currentDirection;
frameNext -= 2 * frameStep;
nextMorphFrame -= 2 * frameStep * morphStep;
}
}if (this.morphCount < 1) {
if (frameNext < 0 || frameNext >= this.getFrameCount ()) return false;
this.setFrame (frameNext);
return true;
}this.morph (nextMorphFrame + 1);
return true;
}, "~N");
Clazz_defineMethod (c$, "isNotInRange", 
 function (frameNext) {
var f = frameNext - 0.001;
return (f > this.firstFrameIndex && f > this.lastFrameIndex || (f = frameNext + 0.001) < this.firstFrameIndex && f < this.lastFrameIndex);
}, "~N");
Clazz_defineMethod (c$, "getFrameStep", 
 function (direction) {
return this.frameStep * direction * this.currentDirection;
}, "~N");
Clazz_defineStatics (c$,
"FRAME_FIRST", -1,
"FRAME_LAST", 1,
"MODEL_CURRENT", 0);
});
Clazz_declarePackage ("JV.binding");
Clazz_load (["java.util.Hashtable"], "JV.binding.Binding", ["java.lang.Boolean", "java.util.Arrays", "JU.Lst", "$.PT", "$.SB", "J.api.Interface", "JU.Escape", "$.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.name = null;
this.bindings = null;
Clazz_instantialize (this, arguments);
}, JV.binding, "Binding");
Clazz_prepareFields (c$, function () {
this.bindings =  new java.util.Hashtable ();
});
c$.getMouseAction = Clazz_defineMethod (c$, "getMouseAction", 
function (clickCount, modifiers, mode) {
if (clickCount > 2) clickCount = 2;
switch (clickCount) {
case 0:
break;
case 1:
clickCount = 256;
break;
default:
clickCount = 512;
}
switch (mode) {
case 4:
mode = 4096;
break;
case 1:
mode = 8192;
break;
case 5:
mode = 16384;
break;
case 2:
mode = 32768;
break;
case 3:
mode = 32;
}
return (modifiers & 63) | clickCount | mode;
}, "~N,~N,~N");
c$.getMouseActionStr = Clazz_defineMethod (c$, "getMouseActionStr", 
function (desc) {
if (desc == null) return 0;
var mouseAction = 0;
desc = desc.toUpperCase ();
if (desc.indexOf ("MIDDLE") >= 0) mouseAction = 8;
 else if (desc.indexOf ("RIGHT") >= 0) mouseAction = 4;
 else if (desc.indexOf ("WHEEL") >= 0) mouseAction = 32;
 else mouseAction = 16;
if (desc.indexOf ("DOWN") >= 0) mouseAction |= 4096;
 else if (desc.indexOf ("DRAG") >= 0) mouseAction |= 8192;
 else if (desc.indexOf ("UP") >= 0) mouseAction |= 16384;
 else if (mouseAction != 32) mouseAction |= 32768;
if (mouseAction != 32 && desc.indexOf ("DOUBLE") >= 0) mouseAction |= 512;
 else if (mouseAction > 0) mouseAction |= 256;
if (mouseAction != (288) && desc.indexOf ("ALT") >= 0) mouseAction |= 8;
if (desc.indexOf ("CTRL") >= 0) mouseAction |= 2;
if (desc.indexOf ("SHIFT") >= 0) mouseAction |= 1;
return mouseAction;
}, "~S");
c$.getButtonMods = Clazz_defineMethod (c$, "getButtonMods", 
function (mouseAction) {
return mouseAction & 63;
}, "~N");
c$.getClickCount = Clazz_defineMethod (c$, "getClickCount", 
function (mouseAction) {
return (mouseAction & 768) >> 8;
}, "~N");
c$.getMouseActionName = Clazz_defineMethod (c$, "getMouseActionName", 
function (mouseAction, addSortCode) {
var sb =  new JU.SB ();
if (mouseAction == 0) return "";
var isMiddle = (JV.binding.Binding.includes (mouseAction, 8) && !JV.binding.Binding.includes (mouseAction, 16) && !JV.binding.Binding.includes (mouseAction, 4));
var code = "      ".toCharArray ();
if (JV.binding.Binding.includes (mouseAction, 2)) {
sb.append ("CTRL+");
code[5] = 'C';
}if (!isMiddle && JV.binding.Binding.includes (mouseAction, 8)) {
sb.append ("ALT+");
code[4] = 'A';
}if (JV.binding.Binding.includes (mouseAction, 1)) {
sb.append ("SHIFT+");
code[3] = 'S';
}if (JV.binding.Binding.includes (mouseAction, 16)) {
code[2] = 'L';
sb.append ("LEFT");
} else if (JV.binding.Binding.includes (mouseAction, 4)) {
code[2] = 'R';
sb.append ("RIGHT");
} else if (isMiddle) {
code[2] = 'M';
sb.append ("MIDDLE");
} else if (JV.binding.Binding.includes (mouseAction, 32)) {
code[2] = 'W';
sb.append ("WHEEL");
}if (JV.binding.Binding.includes (mouseAction, 512)) {
sb.append ("+double");
code[1] = '2';
}if (JV.binding.Binding.includes (mouseAction, 4096)) {
sb.append ("+down");
code[0] = '1';
} else if (JV.binding.Binding.includes (mouseAction, 8192)) {
sb.append ("+drag");
code[0] = '2';
} else if (JV.binding.Binding.includes (mouseAction, 16384)) {
sb.append ("+up");
code[0] = '3';
} else if (JV.binding.Binding.includes (mouseAction, 32768)) {
sb.append ("+click");
code[0] = '4';
}return (addSortCode ?  String.instantialize (code) + ":" + sb.toString () : sb.toString ());
}, "~N,~B");
Clazz_defineMethod (c$, "getBindings", 
function () {
return this.bindings;
});
Clazz_makeConstructor (c$, 
function () {
});
Clazz_defineMethod (c$, "bindAction", 
function (mouseAction, jmolAction) {
this.addBinding (mouseAction + "\t" + jmolAction, [mouseAction, jmolAction]);
}, "~N,~N");
Clazz_defineMethod (c$, "bindName", 
function (mouseAction, name) {
this.addBinding (mouseAction + "\t", Boolean.TRUE);
this.addBinding (mouseAction + "\t" + name, [JV.binding.Binding.getMouseActionName (mouseAction, false), name]);
}, "~N,~S");
Clazz_defineMethod (c$, "unbindAction", 
function (mouseAction, jmolAction) {
if (mouseAction == 0) this.unbindJmolAction (jmolAction);
 else this.removeBinding (null, mouseAction + "\t" + jmolAction);
}, "~N,~N");
Clazz_defineMethod (c$, "unbindName", 
function (mouseAction, name) {
if (name == null) this.unbindMouseAction (mouseAction);
 else this.removeBinding (null, mouseAction + "\t" + name);
}, "~N,~S");
Clazz_defineMethod (c$, "unbindJmolAction", 
function (jmolAction) {
var e = this.bindings.keySet ().iterator ();
var skey = "\t" + jmolAction;
while (e.hasNext ()) {
var key = e.next ();
if (key.endsWith (skey)) this.removeBinding (e, key);
}
}, "~N");
Clazz_defineMethod (c$, "addBinding", 
 function (key, value) {
if (JU.Logger.debugging) JU.Logger.debug ("adding binding " + key + "\t==\t" + JU.Escape.e (value));
this.bindings.put (key, value);
}, "~S,~O");
Clazz_defineMethod (c$, "removeBinding", 
 function (e, key) {
if (JU.Logger.debugging) JU.Logger.debug ("removing binding " + key);
if (e == null) this.bindings.remove (key);
 else e.remove ();
}, "java.util.Iterator,~S");
Clazz_defineMethod (c$, "unbindUserAction", 
function (script) {
var e = this.bindings.keySet ().iterator ();
var skey = "\t" + script;
while (e.hasNext ()) {
var key = e.next ();
if (key.endsWith (skey)) this.removeBinding (e, key);
}
}, "~S");
Clazz_defineMethod (c$, "unbindMouseAction", 
function (mouseAction) {
var e = this.bindings.keySet ().iterator ();
var skey = mouseAction + "\t";
while (e.hasNext ()) {
var key = e.next ();
if (key.startsWith (skey)) this.removeBinding (e, key);
}
}, "~N");
Clazz_defineMethod (c$, "isBound", 
function (mouseAction, jmolAction) {
return this.bindings.containsKey (mouseAction + "\t" + jmolAction);
}, "~N,~N");
Clazz_defineMethod (c$, "isUserAction", 
function (mouseAction) {
return this.bindings.containsKey (mouseAction + "\t");
}, "~N");
Clazz_defineMethod (c$, "getBindingInfo", 
function (actionInfo, actionNames, qualifiers) {
var sb =  new JU.SB ();
var qlow = (qualifiers == null || qualifiers.equalsIgnoreCase ("all") ? null : qualifiers.toLowerCase ());
var names =  new Array (actionInfo.length);
var user =  new JU.Lst ();
for (var obj, $obj = this.bindings.values ().iterator (); $obj.hasNext () && ((obj = $obj.next ()) || true);) {
if (JU.PT.isAI (obj)) {
var info = obj;
var i = info[1];
if (names[i] == null) names[i] =  new JU.Lst ();
var name = JV.binding.Binding.getMouseActionName (info[0], true);
if (qlow == null || (actionNames[i] + ";" + actionInfo[i] + ";" + name).toLowerCase ().indexOf (qlow) >= 0) names[i].addLast (name);
} else if (JU.PT.isAS (obj)) {
var action = (obj)[0];
var script = (obj)[1];
if (qlow == null || qlow.indexOf ("user") >= 0 || action.indexOf (qlow) >= 0 || script.indexOf (qlow) >= 0) user.addLast (obj);
}}
for (var i = 0; i < actionInfo.length; i++) {
var n;
if (names[i] == null || (n = names[i].size ()) == 0) continue;
this.addInfo (sb, names[i].toArray ( new Array (n)), actionNames[i], actionInfo[i]);
}
for (var i = 0; i < user.size (); i++) {
var info = user.get (i);
this.addInfo (sb, ["USER:::" + info[0]], "user-defined", info[1]);
}
return sb.toString ();
}, "~A,~A,~S");
Clazz_defineMethod (c$, "addInfo", 
 function (sb, list, name, info) {
java.util.Arrays.sort (list);
JU.PT.leftJustify (sb, "                      ", name);
sb.append ("\t");
var sep = "";
var len = sb.length ();
for (var j = 0; j < list.length; j++) {
sb.append (sep).append (list[j].substring (7));
sep = ", ";
}
len = sb.length () - len;
if (len < 20) sb.append ("                 ".substring (0, 20 - len));
sb.append ("\t").append (info).appendC ('\n');
}, "JU.SB,~A,~S,~S");
c$.includes = Clazz_defineMethod (c$, "includes", 
 function (mouseAction, mod) {
return ((mouseAction & mod) == mod);
}, "~N,~N");
c$.newBinding = Clazz_defineMethod (c$, "newBinding", 
function (vwr, name) {
return J.api.Interface.getInterface ("JV.binding." + name + "Binding", vwr, "script");
}, "JV.Viewer,~S");
Clazz_defineStatics (c$,
"LEFT", 16,
"MIDDLE", 8,
"RIGHT", 4,
"WHEEL", 32,
"ALT", 8,
"CTRL", 2,
"SHIFT", 1,
"CTRL_ALT", 10,
"CTRL_SHIFT", 3,
"MAC_COMMAND", 20,
"BUTTON_MASK", 28,
"BUTTON_MODIFIER_MASK", 63,
"SINGLE", 256,
"DOUBLE", 512,
"COUNT_MASK", 768,
"DOWN", 4096,
"DRAG", 8192,
"UP", 16384,
"CLICK", 32768,
"MODE_MASK", 61440);
});
Clazz_declarePackage ("JV.binding");
Clazz_load (["JV.binding.JmolBinding"], "JV.binding.DragBinding", null, function () {
c$ = Clazz_declareType (JV.binding, "DragBinding", JV.binding.JmolBinding);
Clazz_makeConstructor (c$, 
function () {
Clazz_superConstructor (this, JV.binding.DragBinding, []);
this.set ("drag");
});
Clazz_overrideMethod (c$, "setSelectBindings", 
function () {
this.bindAction (33040, 30);
this.bindAction (33041, 35);
this.bindAction (33048, 34);
this.bindAction (33049, 32);
this.bindAction (4368, 31);
this.bindAction (8464, 13);
this.bindAction (33040, 17);
});
});
Clazz_declarePackage ("JV.binding");
Clazz_load (["JV.binding.Binding"], "JV.binding.JmolBinding", null, function () {
c$ = Clazz_declareType (JV.binding, "JmolBinding", JV.binding.Binding);
Clazz_makeConstructor (c$, 
function () {
Clazz_superConstructor (this, JV.binding.JmolBinding, []);
this.set ("toggle");
});
Clazz_defineMethod (c$, "set", 
function (name) {
this.name = name;
this.setGeneralBindings ();
this.setSelectBindings ();
}, "~S");
Clazz_defineMethod (c$, "setSelectBindings", 
function () {
this.bindAction (33296, 30);
this.bindAction (33040, 36);
});
Clazz_defineMethod (c$, "setGeneralBindings", 
 function () {
this.bindAction (8474, 45);
this.bindAction (8454, 45);
this.bindAction (8721, 45);
this.bindAction (8712, 45);
this.bindAction (8464, 25);
this.bindAction (8720, 25);
this.bindAction (8472, 28);
this.bindAction (8453, 28);
this.bindAction (8465, 29);
this.bindAction (8456, 29);
this.bindAction (288, 46);
this.bindAction (8464, 40);
this.bindAction (8464, 16);
this.bindAction (4370, 23);
this.bindAction (4356, 23);
this.bindAction (33040, 2);
this.bindAction (8467, 38);
this.bindAction (8723, 6);
this.bindAction (8475, 39);
this.bindAction (8464, 44);
this.bindAction (8464, 41);
this.bindAction (8465, 42);
this.bindAction (8473, 13);
this.bindAction (8465, 14);
this.bindAction (8472, 27);
this.bindAction (8465, 26);
this.bindAction (8465, 10);
this.bindAction (8472, 9);
this.bindAction (8465, 8);
this.bindAction (33297, 24);
this.bindAction (33288, 24);
this.bindAction (33296, 43);
this.bindAction (8464, 7);
this.bindAction (8464, 11);
this.bindAction (8464, 12);
this.bindAction (33040, 17);
this.bindAction (33040, 22);
this.bindAction (33040, 19);
this.bindAction (33040, 20);
this.bindAction (33296, 37);
this.bindAction (33040, 18);
this.bindAction (33043, 21);
this.bindAction (33040, 4);
this.bindAction (33040, 5);
this.bindAction (33040, 3);
this.bindAction (33040, 0);
this.bindAction (33043, 1);
});
});
Clazz_declarePackage ("JV");
Clazz_load (null, "JV.ColorManager", ["java.lang.Float", "JU.AU", "J.c.PAL", "JU.C", "$.ColorEncoder", "$.Elements", "$.Logger", "JV.JC"], function () {
c$ = Clazz_decorateAsClass (function () {
this.ce = null;
this.vwr = null;
this.g3d = null;
this.argbsCpk = null;
this.altArgbsCpk = null;
this.colorData = null;
this.isDefaultColorRasmol = false;
this.colixRubberband = 22;
this.colixBackgroundContrast = 0;
Clazz_instantialize (this, arguments);
}, JV, "ColorManager");
Clazz_makeConstructor (c$, 
function (vwr, gdata) {
this.vwr = vwr;
this.ce =  new JU.ColorEncoder (null, vwr);
this.g3d = gdata;
this.argbsCpk = J.c.PAL.argbsCpk;
this.altArgbsCpk = JU.AU.arrayCopyRangeI (JV.JC.altArgbsCpk, 0, -1);
}, "JV.Viewer,JU.GData");
Clazz_defineMethod (c$, "setDefaultColors", 
function (isRasmol) {
if (isRasmol) {
this.isDefaultColorRasmol = true;
this.argbsCpk = JU.AU.arrayCopyI (JU.ColorEncoder.getRasmolScale (), -1);
} else {
this.isDefaultColorRasmol = false;
this.argbsCpk = J.c.PAL.argbsCpk;
}this.altArgbsCpk = JU.AU.arrayCopyRangeI (JV.JC.altArgbsCpk, 0, -1);
this.ce.createColorScheme ((isRasmol ? "Rasmol=" : "Jmol="), true, true);
for (var i = J.c.PAL.argbsCpk.length; --i >= 0; ) this.g3d.changeColixArgb (i, this.argbsCpk[i]);

for (var i = JV.JC.altArgbsCpk.length; --i >= 0; ) this.g3d.changeColixArgb (JU.Elements.elementNumberMax + i, this.altArgbsCpk[i]);

}, "~B");
Clazz_defineMethod (c$, "setRubberbandArgb", 
function (argb) {
this.colixRubberband = (argb == 0 ? 0 : JU.C.getColix (argb));
}, "~N");
Clazz_defineMethod (c$, "setColixBackgroundContrast", 
function (argb) {
this.colixBackgroundContrast = JU.C.getBgContrast (argb);
}, "~N");
Clazz_defineMethod (c$, "getColixBondPalette", 
function (bond, pid) {
var argb = 0;
switch (pid) {
case 19:
return this.ce.getColorIndexFromPalette (bond.getEnergy (), -2.5, -0.5, 7, false);
}
return (argb == 0 ? 10 : JU.C.getColix (argb));
}, "JM.Bond,~N");
Clazz_defineMethod (c$, "getColixAtomPalette", 
function (atom, pid) {
var argb = 0;
var index;
var id;
var modelSet = this.vwr.ms;
var modelIndex;
var lo;
var hi;
switch (pid) {
case 84:
return (this.colorData == null || atom.i >= this.colorData.length ? 12 : this.ce.getColorIndex (this.colorData[atom.i]));
case 0:
case 1:
id = atom.getAtomicAndIsotopeNumber ();
if (id < JU.Elements.elementNumberMax) return this.g3d.getChangeableColix (id, this.argbsCpk[id]);
var id0 = id;
id = JU.Elements.altElementIndexFromNumber (id);
if (id > 0) return this.g3d.getChangeableColix (JU.Elements.elementNumberMax + id, this.altArgbsCpk[id]);
id = JU.Elements.getElementNumber (id0);
return this.g3d.getChangeableColix (id, this.argbsCpk[id]);
case 2:
index = JU.ColorEncoder.quantize4 (atom.getPartialCharge (), -1, 1, JV.JC.PARTIAL_CHARGE_RANGE_SIZE);
return this.g3d.getChangeableColix (JV.JC.PARTIAL_CHARGE_COLIX_RED + index, JV.JC.argbsRwbScale[index]);
case 3:
index = atom.getFormalCharge () - -4;
return this.g3d.getChangeableColix (JV.JC.FORMAL_CHARGE_COLIX_RED + index, JV.JC.argbsFormalCharge[index]);
case 68:
case 5:
if (pid == 68) {
lo = this.vwr.ms.getBfactor100Lo ();
hi = this.vwr.ms.getBfactor100Hi ();
} else {
lo = 0;
hi = 10000;
}return this.ce.getColorIndexFromPalette (atom.getBfactor100 (), lo, hi, 7, false);
case 86:
return this.ce.getColorIndexFromPalette (atom.getGroupParameter (1112539150), -1, 1, 7, false);
case 70:
hi = this.vwr.ms.getSurfaceDistanceMax ();
return this.ce.getColorIndexFromPalette (atom.getSurfaceDistance100 (), 0, hi, 7, false);
case 8:
return this.ce.getColorIndexFromPalette (atom.getGroupID (), 0, 0, 5, false);
case 9:
return this.ce.getColorIndexFromPalette (atom.getGroupID (), 0, 0, 4, false);
case 75:
return this.ce.getColorIndexFromPalette (atom.getSelectedGroupIndexWithinChain (), 0, atom.getSelectedGroupCountWithinChain () - 1, 1, false);
case 87:
var m = this.vwr.ms.am[atom.mi];
return this.ce.getColorIndexFromPalette (atom.getPolymerIndexInModel (), 0, m.getBioPolymerCount () - 1, 1, false);
case 76:
return this.ce.getColorIndexFromPalette (atom.getSelectedMonomerIndexWithinPolymer (), 0, atom.getSelectedMonomerCountWithinPolymer () - 1, 1, false);
case 77:
return this.ce.getColorIndexFromPalette (modelSet.getMoleculeIndex (atom.i, true), 0, modelSet.getMoleculeCountInModel (atom.mi) - 1, 0, false);
case 14:
modelIndex = atom.mi;
return this.ce.getColorIndexFromPalette (modelSet.getAltLocIndexInModel (modelIndex, atom.altloc), 0, modelSet.getAltLocCountInModel (modelIndex), 0, false);
case 15:
modelIndex = atom.mi;
return this.ce.getColorIndexFromPalette (modelSet.getInsertionCodeIndexInModel (modelIndex, atom.getInsertionCode ()), 0, modelSet.getInsertionCountInModel (modelIndex), 0, false);
case 16:
id = atom.getAtomicAndIsotopeNumber ();
argb = this.getJmolOrRasmolArgb (id, 1073741991);
break;
case 17:
id = atom.getAtomicAndIsotopeNumber ();
argb = this.getJmolOrRasmolArgb (id, 1073742116);
break;
case 7:
argb = atom.getProteinStructureSubType ().getColor ();
break;
case 10:
var chain = atom.getChainID ();
if (JU.ColorEncoder.argbsChainAtom == null) {
JU.ColorEncoder.argbsChainAtom = this.getArgbs (1141899265);
JU.ColorEncoder.argbsChainHetero = this.getArgbs (1613758470);
}chain = ((chain < 0 ? 0 : chain >= 256 ? chain - 256 : chain) & 0x1F) % JU.ColorEncoder.argbsChainAtom.length;
argb = (atom.isHetero () ? JU.ColorEncoder.argbsChainHetero : JU.ColorEncoder.argbsChainAtom)[chain];
break;
}
return (argb == 0 ? 22 : JU.C.getColix (argb));
}, "JM.Atom,~N");
Clazz_defineMethod (c$, "getArgbs", 
 function (tok) {
return this.vwr.getJBR ().getArgbs (tok);
}, "~N");
Clazz_defineMethod (c$, "getJmolOrRasmolArgb", 
 function (id, argb) {
switch (argb) {
case 1073741991:
if (id >= JU.Elements.elementNumberMax) break;
return this.ce.getArgbFromPalette (id, 0, 0, 2);
case 1073742116:
if (id >= JU.Elements.elementNumberMax) break;
return this.ce.getArgbFromPalette (id, 0, 0, 3);
default:
return argb;
}
return JV.JC.altArgbsCpk[JU.Elements.altElementIndexFromNumber (id)];
}, "~N,~N");
Clazz_defineMethod (c$, "setElementArgb", 
function (id, argb) {
if (argb == 1073741991 && this.argbsCpk === J.c.PAL.argbsCpk) return;
argb = this.getJmolOrRasmolArgb (id, argb);
if (this.argbsCpk === J.c.PAL.argbsCpk) {
this.argbsCpk = JU.AU.arrayCopyRangeI (J.c.PAL.argbsCpk, 0, -1);
this.altArgbsCpk = JU.AU.arrayCopyRangeI (JV.JC.altArgbsCpk, 0, -1);
}if (id < JU.Elements.elementNumberMax) {
this.argbsCpk[id] = argb;
this.g3d.changeColixArgb (id, argb);
return;
}id = JU.Elements.altElementIndexFromNumber (id);
this.altArgbsCpk[id] = argb;
this.g3d.changeColixArgb (JU.Elements.elementNumberMax + id, argb);
}, "~N,~N");
Clazz_defineMethod (c$, "getPropertyColorRange", 
function () {
return (this.ce.isReversed ? [this.ce.hi, this.ce.lo] : [this.ce.lo, this.ce.hi]);
});
Clazz_defineMethod (c$, "setPropertyColorRangeData", 
function (data, bs) {
this.colorData = data;
this.ce.currentPalette = this.ce.createColorScheme (this.vwr.g.propertyColorScheme, true, false);
this.ce.hi = -3.4028235E38;
this.ce.lo = 3.4028235E38;
if (data == null) return;
var isAll = (bs == null);
var d;
var i0 = (isAll ? data.length - 1 : bs.nextSetBit (0));
for (var i = i0; i >= 0; i = (isAll ? i - 1 : bs.nextSetBit (i + 1))) {
if (Float.isNaN (d = data[i])) continue;
this.ce.hi = Math.max (this.ce.hi, d);
this.ce.lo = Math.min (this.ce.lo, d);
}
this.setPropertyColorRange (this.ce.lo, this.ce.hi);
}, "~A,JU.BS");
Clazz_defineMethod (c$, "setPropertyColorRange", 
function (min, max) {
this.ce.setRange (min, max, min > max);
if (JU.Logger.debugging) JU.Logger.debug ("ColorManager: color \"" + this.ce.getCurrentColorSchemeName () + "\" range " + min + " " + max);
}, "~N,~N");
Clazz_defineMethod (c$, "setPropertyColorScheme", 
function (colorScheme, isTranslucent, isOverloaded) {
var isReset = (colorScheme.length == 0);
if (isReset) colorScheme = "=";
var range = this.getPropertyColorRange ();
this.ce.currentPalette = this.ce.createColorScheme (colorScheme, true, isOverloaded);
if (!isReset) this.setPropertyColorRange (range[0], range[1]);
this.ce.isTranslucent = isTranslucent;
}, "~S,~B,~B");
Clazz_defineMethod (c$, "getColorSchemeList", 
function (colorScheme) {
var iPt = (colorScheme == null || colorScheme.length == 0) ? this.ce.currentPalette : this.ce.createColorScheme (colorScheme, true, false);
return JU.ColorEncoder.getColorSchemeList (this.ce.getColorSchemeArray (iPt));
}, "~S");
Clazz_defineMethod (c$, "getColorEncoder", 
function (colorScheme) {
if (colorScheme == null || colorScheme.length == 0) return this.ce;
var c =  new JU.ColorEncoder (this.ce, this.vwr);
c.currentPalette = c.createColorScheme (colorScheme, false, true);
return (c.currentPalette == 2147483647 ? null : c);
}, "~S");
});
Clazz_declarePackage ("JV");
Clazz_load (["javajs.api.BytePoster", "java.util.Hashtable"], "JV.FileManager", ["java.io.BufferedInputStream", "$.BufferedReader", "java.lang.Boolean", "java.net.URL", "$.URLEncoder", "java.util.Map", "JU.AU", "$.BArray", "$.Base64", "$.Lst", "$.OC", "$.PT", "$.Rdr", "$.SB", "J.api.Interface", "J.io.FileReader", "$.JmolBinary", "JS.SV", "JU.Logger", "JV.Viewer"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.jmb = null;
this.pathForAllFiles = "";
this.nameAsGiven = "zapped";
this.fullPathName = null;
this.lastFullPathName = null;
this.lastNameAsGiven = "zapped";
this.fileName = null;
this.appletDocumentBaseURL = null;
this.appletProxy = null;
this.cache = null;
Clazz_instantialize (this, arguments);
}, JV, "FileManager", null, javajs.api.BytePoster);
Clazz_prepareFields (c$, function () {
this.cache =  new java.util.Hashtable ();
});
Clazz_makeConstructor (c$, 
function (vwr) {
this.vwr = vwr;
this.jmb =  new J.io.JmolBinary (this);
this.clear ();
}, "JV.Viewer");
Clazz_defineMethod (c$, "clear", 
function () {
this.setFileInfo ([this.vwr.getZapName ()]);
this.jmb.spardirCache = null;
});
Clazz_defineMethod (c$, "clearPngjCache", 
function (fileName) {
this.jmb.clearPngjCache (fileName == null ? null : this.getCanonicalName (JU.Rdr.getZipRoot (fileName)));
}, "~S");
Clazz_defineMethod (c$, "setLoadState", 
 function (htParams) {
if (this.vwr.getPreserveState ()) {
htParams.put ("loadState", this.vwr.g.getLoadState (htParams));
}}, "java.util.Map");
Clazz_defineMethod (c$, "getPathForAllFiles", 
function () {
return this.pathForAllFiles;
});
Clazz_defineMethod (c$, "setPathForAllFiles", 
function (value) {
if (value.length > 0 && !value.endsWith ("/") && !value.endsWith ("|")) value += "/";
return this.pathForAllFiles = value;
}, "~S");
Clazz_defineMethod (c$, "setFileInfo", 
function (fileInfo) {
this.fullPathName = fileInfo[0];
this.fileName = fileInfo[Math.min (1, fileInfo.length - 1)];
this.nameAsGiven = fileInfo[Math.min (2, fileInfo.length - 1)];
if (!this.nameAsGiven.equals ("zapped")) {
this.lastNameAsGiven = this.nameAsGiven;
this.lastFullPathName = this.fullPathName;
}}, "~A");
Clazz_defineMethod (c$, "getFileInfo", 
function () {
return [this.fullPathName, this.fileName, this.nameAsGiven];
});
Clazz_defineMethod (c$, "getFullPathName", 
function (orPrevious) {
var f = (this.fullPathName != null ? this.fullPathName : this.nameAsGiven);
return (!orPrevious || !f.equals ("zapped") ? f : this.lastFullPathName != null ? this.lastFullPathName : this.lastNameAsGiven);
}, "~B");
Clazz_defineMethod (c$, "getFileName", 
function () {
return this.fileName != null ? this.fileName : this.nameAsGiven;
});
Clazz_defineMethod (c$, "getAppletDocumentBase", 
function () {
return (this.appletDocumentBaseURL == null ? "" : this.appletDocumentBaseURL.toString ());
});
Clazz_defineMethod (c$, "setAppletContext", 
function (documentBase) {
try {
System.out.println ("setting document base to \"" + documentBase + "\"");
this.appletDocumentBaseURL = (documentBase.length == 0 ? null :  new java.net.URL (Clazz_castNullAs ("java.net.URL"), documentBase, null));
} catch (e) {
if (Clazz_exceptionOf (e, java.net.MalformedURLException)) {
System.out.println ("error setting document base to " + documentBase);
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod (c$, "setAppletProxy", 
function (appletProxy) {
this.appletProxy = (appletProxy == null || appletProxy.length == 0 ? null : appletProxy);
}, "~S");
Clazz_defineMethod (c$, "createAtomSetCollectionFromFile", 
function (name, htParams, isAppend) {
if (htParams.get ("atomDataOnly") == null) this.setLoadState (htParams);
name = this.vwr.resolveDatabaseFormat (name);
var pt = name.indexOf ("::");
var nameAsGiven = (pt >= 0 ? name.substring (pt + 2) : name);
var fileType = (pt >= 0 ? name.substring (0, pt) : null);
JU.Logger.info ("\nFileManager.getAtomSetCollectionFromFile(" + nameAsGiven + ")" + (name.equals (nameAsGiven) ? "" : " //" + name));
var names = this.getClassifiedName (nameAsGiven, true);
if (names.length == 1) return names[0];
var fullPathName = names[0];
var fileName = names[1];
htParams.put ("fullPathName", (fileType == null ? "" : fileType + "::") + fullPathName.$replace ('\\', '/'));
if (this.vwr.getBoolean (603979880) && this.vwr.getBoolean (603979825)) this.vwr.scriptStatus ("Requesting " + fullPathName);
var fileReader =  new J.io.FileReader (this, this.vwr, fileName, fullPathName, nameAsGiven, fileType, null, htParams, isAppend);
fileReader.run ();
return fileReader.getAtomSetCollection ();
}, "~S,java.util.Map,~B");
Clazz_defineMethod (c$, "createAtomSetCollectionFromFiles", 
function (fileNames, htParams, isAppend) {
this.setLoadState (htParams);
var fullPathNames =  new Array (fileNames.length);
var namesAsGiven =  new Array (fileNames.length);
var fileTypes =  new Array (fileNames.length);
for (var i = 0; i < fileNames.length; i++) {
var pt = fileNames[i].indexOf ("::");
var nameAsGiven = (pt >= 0 ? fileNames[i].substring (pt + 2) : fileNames[i]);
var fileType = (pt >= 0 ? fileNames[i].substring (0, pt) : null);
var names = this.getClassifiedName (nameAsGiven, true);
if (names.length == 1) return names[0];
fullPathNames[i] = names[0];
fileNames[i] = names[0].$replace ('\\', '/');
fileTypes[i] = fileType;
namesAsGiven[i] = nameAsGiven;
}
htParams.put ("fullPathNames", fullPathNames);
htParams.put ("fileTypes", fileTypes);
var filesReader = this.newFilesReader (fullPathNames, namesAsGiven, fileTypes, null, htParams, isAppend);
filesReader.run ();
return filesReader.getAtomSetCollection ();
}, "~A,java.util.Map,~B");
Clazz_defineMethod (c$, "createAtomSetCollectionFromString", 
function (strModel, htParams, isAppend) {
this.setLoadState (htParams);
var isAddH = (strModel.indexOf ("Viewer.AddHydrogens") >= 0);
var fnames = (isAddH ? this.getFileInfo () : null);
var fileReader =  new J.io.FileReader (this, this.vwr, "string", "string", "string", null, JU.Rdr.getBR (strModel), htParams, isAppend);
fileReader.run ();
if (fnames != null) this.setFileInfo (fnames);
if (!isAppend && !(Clazz_instanceOf (fileReader.getAtomSetCollection (), String))) {
this.vwr.zap (false, true, false);
this.setFileInfo ([strModel === "5\n\nC 0 0 0\nH .63 .63 .63\nH -.63 -.63 .63\nH -.63 .63 -.63\nH .63 -.63 -.63" ? "Jmol Model Kit" : "string"]);
}return fileReader.getAtomSetCollection ();
}, "~S,java.util.Map,~B");
Clazz_defineMethod (c$, "createAtomSeCollectionFromStrings", 
function (arrayModels, loadScript, htParams, isAppend) {
if (!htParams.containsKey ("isData")) {
var oldSep = "\"" + this.vwr.getDataSeparator () + "\"";
var tag = "\"" + (isAppend ? "append" : "model") + " inline\"";
var sb =  new JU.SB ();
sb.append ("set dataSeparator \"~~~next file~~~\";\ndata ").append (tag);
for (var i = 0; i < arrayModels.length; i++) {
if (i > 0) sb.append ("~~~next file~~~");
sb.append (arrayModels[i]);
}
sb.append ("end ").append (tag).append (";set dataSeparator ").append (oldSep);
loadScript.appendSB (sb);
}this.setLoadState (htParams);
JU.Logger.info ("FileManager.getAtomSetCollectionFromStrings(string[])");
var fullPathNames =  new Array (arrayModels.length);
var readers =  new Array (arrayModels.length);
for (var i = 0; i < arrayModels.length; i++) {
fullPathNames[i] = "string[" + i + "]";
readers[i] = JV.FileManager.newDataReader (this.vwr, arrayModels[i]);
}
var filesReader = this.newFilesReader (fullPathNames, fullPathNames, null, readers, htParams, isAppend);
filesReader.run ();
return filesReader.getAtomSetCollection ();
}, "~A,JU.SB,java.util.Map,~B");
Clazz_defineMethod (c$, "createAtomSeCollectionFromArrayData", 
function (arrayData, htParams, isAppend) {
JU.Logger.info ("FileManager.getAtomSetCollectionFromArrayData(Vector)");
var nModels = arrayData.size ();
var fullPathNames =  new Array (nModels);
var readers =  new Array (nModels);
for (var i = 0; i < nModels; i++) {
fullPathNames[i] = "String[" + i + "]";
readers[i] = JV.FileManager.newDataReader (this.vwr, arrayData.get (i));
}
var filesReader = this.newFilesReader (fullPathNames, fullPathNames, null, readers, htParams, isAppend);
filesReader.run ();
return filesReader.getAtomSetCollection ();
}, "JU.Lst,java.util.Map,~B");
c$.newDataReader = Clazz_defineMethod (c$, "newDataReader", 
function (vwr, data) {
var reader = (Clazz_instanceOf (data, String) ? "String" : JU.PT.isAS (data) ? "Array" : Clazz_instanceOf (data, JU.Lst) ? "List" : null);
if (reader == null) return null;
var dr = J.api.Interface.getInterface ("JU." + reader + "DataReader", vwr, "file");
return dr.setData (data);
}, "JV.Viewer,~O");
Clazz_defineMethod (c$, "newFilesReader", 
 function (fullPathNames, namesAsGiven, fileTypes, readers, htParams, isAppend) {
var fr = J.api.Interface.getOption ("io.FilesReader", this.vwr, "file");
fr.set (this, this.vwr, fullPathNames, namesAsGiven, fileTypes, readers, htParams, isAppend);
return fr;
}, "~A,~A,~A,~A,java.util.Map,~B");
Clazz_defineMethod (c$, "createAtomSetCollectionFromDOM", 
function (DOMNode, htParams) {
var aDOMReader = J.api.Interface.getOption ("io.DOMReadaer", this.vwr, "file");
aDOMReader.set (this, this.vwr, DOMNode, htParams);
aDOMReader.run ();
return aDOMReader.getAtomSetCollection ();
}, "~O,java.util.Map");
Clazz_defineMethod (c$, "createAtomSetCollectionFromReader", 
function (fullPathName, name, reader, htParams) {
var fileReader =  new J.io.FileReader (this, this.vwr, name, fullPathName, name, null, reader, htParams, false);
fileReader.run ();
return fileReader.getAtomSetCollection ();
}, "~S,~S,~O,java.util.Map");
Clazz_defineMethod (c$, "getBufferedInputStream", 
function (fullPathName) {
var ret = this.getBufferedReaderOrErrorMessageFromName (fullPathName,  new Array (2), true, true);
return (Clazz_instanceOf (ret, java.io.BufferedInputStream) ? ret : null);
}, "~S");
Clazz_defineMethod (c$, "getBufferedInputStreamOrErrorMessageFromName", 
function (name, fullName, showMsg, checkOnly, outputBytes, allowReader, allowCached) {
var cacheBytes = null;
if (allowCached && outputBytes == null) {
cacheBytes = (fullName == null || this.jmb.pngjCache == null ? null : this.jmb.getCachedPngjBytes (fullName));
if (cacheBytes == null) cacheBytes = this.cacheGet (name, true);
}var bis = null;
var ret = null;
var errorMessage = null;
try {
if (cacheBytes == null) {
var isPngjBinaryPost = (name.indexOf ("?POST?_PNGJBIN_") >= 0);
var isPngjPost = (isPngjBinaryPost || name.indexOf ("?POST?_PNGJ_") >= 0);
if (name.indexOf ("?POST?_PNG_") > 0 || isPngjPost) {
var errMsg =  new Array (1);
var bytes = this.vwr.getImageAsBytes (isPngjPost ? "PNGJ" : "PNG", 0, 0, -1, errMsg);
if (errMsg[0] != null) return errMsg[0];
if (isPngjBinaryPost) {
outputBytes = bytes;
name = JU.PT.rep (name, "?_", "=_");
} else {
name =  new JU.SB ().append (name).append ("=").appendSB (JU.Base64.getBase64 (bytes)).toString ();
}}var iurl = JU.OC.urlTypeIndex (name);
var isURL = (iurl >= 0);
var post = null;
if (isURL && (iurl = name.indexOf ("?POST?")) >= 0) {
post = name.substring (iurl + 6);
name = name.substring (0, iurl);
}var isApplet = (this.appletDocumentBaseURL != null);
if (allowCached && name.indexOf (".png") >= 0 && this.jmb.pngjCache == null && this.vwr.cachePngFiles ()) this.jmb.clearAndCachePngjFile (null);
if (isApplet || isURL) {
if (isApplet && isURL && this.appletProxy != null) name = this.appletProxy + "?url=" + this.urlEncode (name);
var url = (isApplet ?  new java.net.URL (this.appletDocumentBaseURL, name, null) :  new java.net.URL (Clazz_castNullAs ("java.net.URL"), name, null));
if (checkOnly) return null;
name = url.toString ();
if (showMsg && name.toLowerCase ().indexOf ("password") < 0) JU.Logger.info ("FileManager opening 1 " + name);
ret = this.vwr.apiPlatform.getURLContents (url, outputBytes, post, false);
var bytes = null;
if (Clazz_instanceOf (ret, JU.SB)) {
var sb = ret;
if (allowReader && !JU.Rdr.isBase64 (sb)) return JU.Rdr.getBR (sb.toString ());
bytes = JU.Rdr.getBytesFromSB (sb);
} else if (JU.PT.isAB (ret)) {
bytes = ret;
}if (bytes != null) ret = JU.Rdr.getBIS (bytes);
} else if (!allowCached || (cacheBytes = this.cacheGet (name, true)) == null) {
if (showMsg) JU.Logger.info ("FileManager opening 2 " + name);
ret = this.vwr.apiPlatform.getBufferedFileInputStream (name);
}if (Clazz_instanceOf (ret, String)) return ret;
}bis = (cacheBytes == null ? ret : JU.Rdr.getBIS (cacheBytes));
if (checkOnly) {
bis.close ();
bis = null;
}return bis;
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
try {
if (bis != null) bis.close ();
} catch (e1) {
if (Clazz_exceptionOf (e1, java.io.IOException)) {
} else {
throw e1;
}
}
errorMessage = "" + e;
} else {
throw e;
}
}
return errorMessage;
}, "~S,~S,~B,~B,~A,~B,~B");
Clazz_defineMethod (c$, "urlEncode", 
 function (name) {
try {
return java.net.URLEncoder.encode (name, "utf-8");
} catch (e) {
if (Clazz_exceptionOf (e, java.io.UnsupportedEncodingException)) {
return name;
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod (c$, "getEmbeddedFileState", 
function (fileName, allowCached) {
var dir = null;
dir = this.getZipDirectory (fileName, false, allowCached);
if (dir.length == 0) {
var state = this.vwr.getFileAsString4 (fileName, -1, false, true, false, "file");
return (state.indexOf ("**** Jmol Embedded Script ****") < 0 ? "" : J.io.JmolBinary.getEmbeddedScript (state));
}for (var i = 0; i < dir.length; i++) if (dir[i].indexOf (".spt") >= 0) {
var data = [fileName + "|" + dir[i], null];
this.getFileDataAsString (data, -1, false, false, false);
return data[1];
}
return "";
}, "~S,~B");
Clazz_defineMethod (c$, "getFullPathNameOrError", 
function (filename, getStream, ret) {
var names = this.getClassifiedName (filename, true);
if (names == null || names[0] == null || names.length < 2) return [null, "cannot read file name: " + filename];
var name = names[0];
var fullPath = names[0].$replace ('\\', '/');
name = JU.Rdr.getZipRoot (name);
var errMsg = this.getBufferedInputStreamOrErrorMessageFromName (name, fullPath, false, !getStream, null, false, !getStream);
ret[0] = fullPath;
if (Clazz_instanceOf (errMsg, String)) ret[1] = errMsg;
return errMsg;
}, "~S,~B,~A");
Clazz_defineMethod (c$, "getBufferedReaderOrErrorMessageFromName", 
function (name, fullPathNameReturn, isBinary, doSpecialLoad) {
var data = this.cacheGet (name, false);
var isBytes = JU.PT.isAB (data);
var bytes = (isBytes ? data : null);
if (name.startsWith ("cache://")) {
if (data == null) return "cannot read " + name;
if (isBytes) {
bytes = data;
} else {
return JU.Rdr.getBR (data);
}}var names = this.getClassifiedName (name, true);
if (names == null) return "cannot read file name: " + name;
if (fullPathNameReturn != null) fullPathNameReturn[0] = names[0].$replace ('\\', '/');
return this.getUnzippedReaderOrStreamFromName (names[0], bytes, false, isBinary, false, doSpecialLoad, null);
}, "~S,~A,~B,~B");
Clazz_defineMethod (c$, "getUnzippedReaderOrStreamFromName", 
function (name, bytes, allowZipStream, forceInputStream, isTypeCheckOnly, doSpecialLoad, htParams) {
var subFileList = null;
var info = (bytes == null && doSpecialLoad ? this.getSpartanFileList (name) : null);
var name00 = name;
if (info != null) {
if (isTypeCheckOnly) return info;
if (info[2] != null) {
var header = info[1];
var fileData =  new java.util.Hashtable ();
if (info.length == 3) {
var name0 = this.getObjectAsSections (info[2], header, fileData);
fileData.put ("OUTPUT", name0);
info = this.jmb.spartanFileList (name, fileData.get (name0));
if (info.length == 3) {
name0 = this.getObjectAsSections (info[2], header, fileData);
fileData.put ("OUTPUT", name0);
info = this.jmb.spartanFileList (info[1], fileData.get (name0));
}}var sb =  new JU.SB ();
if (fileData.get ("OUTPUT") != null) sb.append (fileData.get (fileData.get ("OUTPUT")));
var s;
for (var i = 2; i < info.length; i++) {
name = info[i];
name = this.getObjectAsSections (name, header, fileData);
JU.Logger.info ("reading " + name);
s = fileData.get (name);
sb.append (s);
}
s = sb.toString ();
this.jmb.spardirPut (name00.$replace ('\\', '/'), s.getBytes ());
return JU.Rdr.getBR (s);
}}if (bytes == null && this.jmb.pngjCache != null) {
bytes = this.jmb.getCachedPngjBytes (name);
if (bytes != null && htParams != null) htParams.put ("sourcePNGJ", Boolean.TRUE);
}var fullName = name;
if (name.indexOf ("|") >= 0) {
subFileList = JU.PT.split (name.$replace ('\\', '/'), "|");
if (bytes == null) JU.Logger.info ("FileManager opening 3 " + name);
name = subFileList[0];
}var t = (bytes == null ? this.getBufferedInputStreamOrErrorMessageFromName (name, fullName, true, false, null, !forceInputStream, true) : JU.Rdr.getBIS (bytes));
try {
if (Clazz_instanceOf (t, String)) return t;
if (Clazz_instanceOf (t, java.io.BufferedReader)) return t;
var bis = t;
if (JU.Rdr.isGzipS (bis)) bis = JU.Rdr.getUnzippedInputStream (this.vwr.getJzt (), bis);
if (JU.Rdr.isCompoundDocumentS (bis)) {
var doc = J.api.Interface.getInterface ("JU.CompoundDocument", this.vwr, "file");
doc.setStream (this.vwr.getJzt (), bis, true);
return JU.Rdr.getBR (doc.getAllDataFiles ("Molecule", "Input").toString ());
}if (JU.Rdr.isPickleS (bis)) return bis;
bis = JU.Rdr.getPngZipStream (bis, true);
if (JU.Rdr.isZipS (bis)) {
if (allowZipStream) return JU.Rdr.newZipInputStream (this.vwr.getJzt (), bis);
var o = JU.Rdr.getZipFileDirectory (this.vwr.getJzt (), bis, subFileList, 1, forceInputStream);
return (Clazz_instanceOf (o, String) ? JU.Rdr.getBR (o) : o);
}return (forceInputStream ? bis : JU.Rdr.getBufferedReader (bis, null));
} catch (ioe) {
if (Clazz_exceptionOf (ioe, Exception)) {
return ioe.toString ();
} else {
throw ioe;
}
}
}, "~S,~A,~B,~B,~B,~B,java.util.Map");
Clazz_defineMethod (c$, "getSpartanFileList", 
 function (name) {
if (name.endsWith (".spt")) return [null, null, null];
if (name.endsWith (".spardir.zip")) return ["SpartanSmol", "Directory Entry ", name + "|output"];
name = name.$replace ('\\', '/');
if (!name.endsWith (".spardir") && name.indexOf (".spardir/") < 0) return null;
var pt = name.lastIndexOf (".spardir");
if (pt < 0) return null;
if (name.lastIndexOf ("/") > pt) {
return ["SpartanSmol", "Directory Entry ", name + "/input", name + "/archive", name + "/Molecule:asBinaryString", name + "/proparc"];
}return ["SpartanSmol", "Directory Entry ", name + "/output"];
}, "~S");
Clazz_defineMethod (c$, "getObjectAsSections", 
 function (name, header, fileData) {
if (name == null) return null;
var subFileList = null;
var asBinaryString = false;
var name0 = name.$replace ('\\', '/');
if (name.indexOf (":asBinaryString") >= 0) {
asBinaryString = true;
name = name.substring (0, name.indexOf (":asBinaryString"));
}var sb = null;
if (fileData.containsKey (name0)) return name0;
if (name.indexOf ("#JMOL_MODEL ") >= 0) {
fileData.put (name0, name0 + "\n");
return name0;
}var fullName = name;
if (name.indexOf ("|") >= 0) {
subFileList = JU.PT.split (name, "|");
name = subFileList[0];
}var bis = null;
try {
var t = this.getBufferedInputStreamOrErrorMessageFromName (name, fullName, false, false, null, false, true);
if (Clazz_instanceOf (t, String)) {
fileData.put (name0, t + "\n");
return name0;
}bis = t;
if (JU.Rdr.isCompoundDocumentS (bis)) {
var doc = J.api.Interface.getInterface ("JU.CompoundDocument", this.vwr, "file");
doc.setStream (this.vwr.getJzt (), bis, true);
doc.getAllDataMapped (name.$replace ('\\', '/'), "Molecule", fileData);
} else if (JU.Rdr.isZipS (bis)) {
JU.Rdr.getAllZipData (this.vwr.getJzt (), bis, subFileList, name.$replace ('\\', '/'), "Molecule", fileData);
} else if (asBinaryString) {
var bd = J.api.Interface.getInterface ("JU.BinaryDocument", this.vwr, "file");
bd.setStream (this.vwr.getJzt (), bis, false);
sb =  new JU.SB ();
if (header != null) sb.append ("BEGIN Directory Entry " + name0 + "\n");
try {
while (true) sb.append (Integer.toHexString (bd.readByte () & 0xFF)).appendC (' ');

} catch (e1) {
if (Clazz_exceptionOf (e1, Exception)) {
sb.appendC ('\n');
} else {
throw e1;
}
}
if (header != null) sb.append ("\nEND Directory Entry " + name0 + "\n");
fileData.put (name0, sb.toString ());
} else {
var br = JU.Rdr.getBufferedReader (JU.Rdr.isGzipS (bis) ?  new java.io.BufferedInputStream (JU.Rdr.newGZIPInputStream (this.vwr.getJzt (), bis)) : bis, null);
var line;
sb =  new JU.SB ();
if (header != null) sb.append ("BEGIN Directory Entry " + name0 + "\n");
while ((line = br.readLine ()) != null) {
sb.append (line);
sb.appendC ('\n');
}
br.close ();
if (header != null) sb.append ("\nEND Directory Entry " + name0 + "\n");
fileData.put (name0, sb.toString ());
}} catch (ioe) {
if (Clazz_exceptionOf (ioe, Exception)) {
fileData.put (name0, ioe.toString ());
} else {
throw ioe;
}
}
if (bis != null) try {
bis.close ();
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
if (!fileData.containsKey (name0)) fileData.put (name0, "FILE NOT FOUND: " + name0 + "\n");
return name0;
}, "~S,~S,java.util.Map");
Clazz_defineMethod (c$, "getZipDirectory", 
function (fileName, addManifest, allowCached) {
var t = this.getBufferedInputStreamOrErrorMessageFromName (fileName, fileName, false, false, null, false, allowCached);
return JU.Rdr.getZipDirectoryAndClose (this.vwr.getJzt (), t, addManifest ? "JmolManifest" : null);
}, "~S,~B,~B");
Clazz_defineMethod (c$, "getFileAsBytes", 
function (name, out) {
if (name == null) return null;
var fullName = name;
var subFileList = null;
if (name.indexOf ("|") >= 0) {
subFileList = JU.PT.split (name, "|");
name = subFileList[0];
}var t = this.getBufferedInputStreamOrErrorMessageFromName (name, fullName, false, false, null, false, true);
if (Clazz_instanceOf (t, String)) return "Error:" + t;
try {
var bis = t;
var bytes = (out != null || subFileList == null || subFileList.length <= 1 || !JU.Rdr.isZipS (bis) && !JU.Rdr.isPngZipStream (bis) ? JU.Rdr.getStreamAsBytes (bis, out) : JU.Rdr.getZipFileContentsAsBytes (this.vwr.getJzt (), bis, subFileList, 1));
bis.close ();
return bytes;
} catch (ioe) {
if (Clazz_exceptionOf (ioe, Exception)) {
return ioe.toString ();
} else {
throw ioe;
}
}
}, "~S,JU.OC");
Clazz_defineMethod (c$, "getFileAsMap", 
function (name) {
var bdata =  new java.util.Hashtable ();
var t;
if (name == null) {
var errMsg =  new Array (1);
var bytes = this.vwr.getImageAsBytes ("PNGJ", -1, -1, -1, errMsg);
if (errMsg[0] != null) {
bdata.put ("_ERROR_", errMsg[0]);
return bdata;
}t = JU.Rdr.getBIS (bytes);
} else {
var data =  new Array (2);
t = this.getFullPathNameOrError (name, true, data);
if (Clazz_instanceOf (t, String)) {
bdata.put ("_ERROR_", t);
return bdata;
}if (!this.checkSecurity (data[0])) {
bdata.put ("_ERROR_", "java.io. Security exception: cannot read file " + data[0]);
return bdata;
}}try {
JU.Rdr.readFileAsMap (this.vwr.getJzt (), t, bdata, name);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
bdata.clear ();
bdata.put ("_ERROR_", "" + e);
} else {
throw e;
}
}
return bdata;
}, "~S");
Clazz_defineMethod (c$, "getFileDataAsString", 
function (data, nBytesMax, doSpecialLoad, allowBinary, checkProtected) {
data[1] = "";
var name = data[0];
if (name == null) return false;
var t = this.getBufferedReaderOrErrorMessageFromName (name, data, false, doSpecialLoad);
if (Clazz_instanceOf (t, String)) {
data[1] = t;
return false;
}if (checkProtected && !this.checkSecurity (data[0])) {
data[1] = "java.io. Security exception: cannot read file " + data[0];
return false;
}try {
return JU.Rdr.readAllAsString (t, nBytesMax, allowBinary, data, 1);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return false;
} else {
throw e;
}
}
}, "~A,~N,~B,~B,~B");
Clazz_defineMethod (c$, "checkSecurity", 
 function (f) {
if (!f.startsWith ("file:")) return true;
var pt = f.lastIndexOf ('/');
if (f.lastIndexOf (":/") == pt - 1 || f.indexOf ("/.") >= 0 || f.lastIndexOf ('.') < f.lastIndexOf ('/')) return false;
return true;
}, "~S");
Clazz_defineMethod (c$, "loadImage", 
function (nameOrBytes, echoName) {
var image = null;
var nameOrError = null;
var bytes = null;
if (Clazz_instanceOf (nameOrBytes, java.util.Map)) {
if ((nameOrBytes).containsKey ("_DATA_")) nameOrBytes = (nameOrBytes).get ("_DATA_");
 else nameOrBytes = (nameOrBytes).get ("_IMAGE_");
}if (Clazz_instanceOf (nameOrBytes, JS.SV)) nameOrBytes = (nameOrBytes).value;
var name = (Clazz_instanceOf (nameOrBytes, String) ? nameOrBytes : null);
if (name != null && name.startsWith (";base64,")) {
bytes = JU.Base64.decodeBase64 (name);
} else if (Clazz_instanceOf (nameOrBytes, JU.BArray)) {
bytes = (nameOrBytes).data;
} else {
var names = this.getClassifiedName (nameOrBytes, true);
nameOrError = (names == null ? "cannot read file name: " + nameOrBytes : names[0].$replace ('\\', '/'));
if (names != null) image = this.jmb.getImage (this.vwr, nameOrError, echoName);
}if (bytes != null) image = this.jmb.getImage (this.vwr, bytes, echoName);
if (Clazz_instanceOf (image, String)) {
nameOrError = image;
image = null;
}if (!this.vwr.isJS) {
if (image != null && bytes != null) nameOrError = ";base64," + JU.Base64.getBase64 (bytes).toString ();
this.vwr.loadImageData (image, nameOrError, echoName, null);
}}, "~O,~S");
Clazz_defineMethod (c$, "getClassifiedName", 
 function (name, isFullLoad) {
if (name == null) return [null];
var doSetPathForAllFiles = (this.pathForAllFiles.length > 0);
if (name.startsWith ("?") || name.startsWith ("http://?")) {
if ((name = this.vwr.dialogAsk ("Load", name)) == null) return [isFullLoad ? "#CANCELED#" : null];
doSetPathForAllFiles = false;
}var file = null;
var url = null;
var names = null;
if (name.startsWith ("cache://")) {
names =  new Array (3);
names[0] = names[2] = name;
names[1] = JV.FileManager.stripPath (names[0]);
return names;
}name = this.vwr.resolveDatabaseFormat (name);
if (name.indexOf (":") < 0 && name.indexOf ("/") != 0) name = JV.FileManager.addDirectory (this.vwr.getDefaultDirectory (), name);
if (this.appletDocumentBaseURL == null) {
if (JU.OC.urlTypeIndex (name) >= 0 || this.vwr.haveAccess (JV.Viewer.ACCESS.NONE) || this.vwr.haveAccess (JV.Viewer.ACCESS.READSPT) && !name.endsWith (".spt") && !name.endsWith ("/")) {
try {
url =  new java.net.URL (Clazz_castNullAs ("java.net.URL"), name, null);
} catch (e) {
if (Clazz_exceptionOf (e, java.net.MalformedURLException)) {
return [isFullLoad ? e.toString () : null];
} else {
throw e;
}
}
} else {
file = this.vwr.apiPlatform.newFile (name);
var s = file.getFullPath ();
var fname = file.getName ();
names = [(s == null ? fname : s), fname, (s == null ? fname : "file:/" + s.$replace ('\\', '/'))];
}} else {
try {
if (name.indexOf (":\\") == 1 || name.indexOf (":/") == 1) name = "file:/" + name;
url =  new java.net.URL (this.appletDocumentBaseURL, name, null);
} catch (e) {
if (Clazz_exceptionOf (e, java.net.MalformedURLException)) {
return [isFullLoad ? e.toString () : null];
} else {
throw e;
}
}
}if (url != null) {
names =  new Array (3);
names[0] = names[2] = url.toString ();
names[1] = JV.FileManager.stripPath (names[0]);
}if (doSetPathForAllFiles) {
var name0 = names[0];
names[0] = this.pathForAllFiles + names[1];
JU.Logger.info ("FileManager substituting " + name0 + " --> " + names[0]);
}if (isFullLoad && (file != null || JU.OC.urlTypeIndex (names[0]) == 4)) {
var path = (file == null ? JU.PT.trim (names[0].substring (5), "/") : names[0]);
var pt = path.length - names[1].length - 1;
if (pt > 0) {
path = path.substring (0, pt);
JV.FileManager.setLocalPath (this.vwr, path, true);
}}return names;
}, "~S,~B");
c$.addDirectory = Clazz_defineMethod (c$, "addDirectory", 
 function (defaultDirectory, name) {
if (defaultDirectory.length == 0) return name;
var ch = (name.length > 0 ? name.charAt (0) : ' ');
var s = defaultDirectory.toLowerCase ();
if ((s.endsWith (".zip") || s.endsWith (".tar")) && ch != '|' && ch != '/') defaultDirectory += "|";
return defaultDirectory + (ch == '/' || ch == '/' || (ch = defaultDirectory.charAt (defaultDirectory.length - 1)) == '|' || ch == '/' ? "" : "/") + name;
}, "~S,~S");
Clazz_defineMethod (c$, "getDefaultDirectory", 
function (name) {
var names = this.getClassifiedName (name, true);
if (names == null) return "";
name = JV.FileManager.fixPath (names[0]);
return (name == null ? "" : name.substring (0, name.lastIndexOf ("/")));
}, "~S");
c$.fixPath = Clazz_defineMethod (c$, "fixPath", 
 function (path) {
path = path.$replace ('\\', '/');
path = JU.PT.rep (path, "/./", "/");
var pt = path.lastIndexOf ("//") + 1;
if (pt < 1) pt = path.indexOf (":/") + 1;
if (pt < 1) pt = path.indexOf ("/");
if (pt < 0) return null;
var protocol = path.substring (0, pt);
path = path.substring (pt);
while ((pt = path.lastIndexOf ("/../")) >= 0) {
var pt0 = path.substring (0, pt).lastIndexOf ("/");
if (pt0 < 0) return JU.PT.rep (protocol + path, "/../", "/");
path = path.substring (0, pt0) + path.substring (pt + 3);
}
if (path.length == 0) path = "/";
return protocol + path;
}, "~S");
Clazz_defineMethod (c$, "getFilePath", 
function (name, addUrlPrefix, asShortName) {
var names = this.getClassifiedName (name, false);
return (names == null || names.length == 1 ? "" : asShortName ? names[1] : addUrlPrefix ? names[2] : names[0] == null ? "" : names[0].$replace ('\\', '/'));
}, "~S,~B,~B");
c$.getLocalDirectory = Clazz_defineMethod (c$, "getLocalDirectory", 
function (vwr, forDialog) {
var localDir = vwr.getP (forDialog ? "currentLocalPath" : "defaultDirectoryLocal");
if (forDialog && localDir.length == 0) localDir = vwr.getP ("defaultDirectoryLocal");
if (localDir.length == 0) return (vwr.isApplet ? null : vwr.apiPlatform.newFile (System.getProperty ("user.dir", ".")));
if (vwr.isApplet && localDir.indexOf ("file:/") == 0) localDir = localDir.substring (6);
var f = vwr.apiPlatform.newFile (localDir);
try {
return f.isDirectory () ? f : f.getParentAsFile ();
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return null;
} else {
throw e;
}
}
}, "JV.Viewer,~B");
c$.setLocalPath = Clazz_defineMethod (c$, "setLocalPath", 
function (vwr, path, forDialog) {
while (path.endsWith ("/") || path.endsWith ("\\")) path = path.substring (0, path.length - 1);

vwr.setStringProperty ("currentLocalPath", path);
if (!forDialog) vwr.setStringProperty ("defaultDirectoryLocal", path);
}, "JV.Viewer,~S,~B");
c$.getLocalPathForWritingFile = Clazz_defineMethod (c$, "getLocalPathForWritingFile", 
function (vwr, file) {
if (file.startsWith ("http://")) return file;
file = JU.PT.rep (file, "?", "");
if (file.indexOf ("file:/") == 0) return file.substring (6);
if (file.indexOf ("/") == 0 || file.indexOf (":") >= 0) return file;
var dir = null;
try {
dir = JV.FileManager.getLocalDirectory (vwr, false);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
return (dir == null ? file : JV.FileManager.fixPath (dir.toString () + "/" + file));
}, "JV.Viewer,~S");
c$.setScriptFileReferences = Clazz_defineMethod (c$, "setScriptFileReferences", 
function (script, localPath, remotePath, scriptPath) {
if (localPath != null) script = JV.FileManager.setScriptFileRefs (script, localPath, true);
if (remotePath != null) script = JV.FileManager.setScriptFileRefs (script, remotePath, false);
script = JU.PT.rep (script, "\1\"", "\"");
if (scriptPath != null) {
while (scriptPath.endsWith ("/")) scriptPath = scriptPath.substring (0, scriptPath.length - 1);

for (var ipt = 0; ipt < JV.FileManager.scriptFilePrefixes.length; ipt++) {
var tag = JV.FileManager.scriptFilePrefixes[ipt];
script = JU.PT.rep (script, tag + ".", tag + scriptPath);
}
}return script;
}, "~S,~S,~S,~S");
c$.setScriptFileRefs = Clazz_defineMethod (c$, "setScriptFileRefs", 
 function (script, dataPath, isLocal) {
if (dataPath == null) return script;
var noPath = (dataPath.length == 0);
var fileNames =  new JU.Lst ();
J.io.JmolBinary.getFileReferences (script, fileNames);
var oldFileNames =  new JU.Lst ();
var newFileNames =  new JU.Lst ();
var nFiles = fileNames.size ();
for (var iFile = 0; iFile < nFiles; iFile++) {
var name0 = fileNames.get (iFile);
var name = name0;
if (isLocal == JU.OC.isLocal (name)) {
var pt = (noPath ? -1 : name.indexOf ("/" + dataPath + "/"));
if (pt >= 0) {
name = name.substring (pt + 1);
} else {
pt = name.lastIndexOf ("/");
if (pt < 0 && !noPath) name = "/" + name;
if (pt < 0 || noPath) pt++;
name = dataPath + name.substring (pt);
}}JU.Logger.info ("FileManager substituting " + name0 + " --> " + name);
oldFileNames.addLast ("\"" + name0 + "\"");
newFileNames.addLast ("\1\"" + name + "\"");
}
return JU.PT.replaceStrings (script, oldFileNames, newFileNames);
}, "~S,~S,~B");
c$.stripPath = Clazz_defineMethod (c$, "stripPath", 
function (name) {
var pt = Math.max (name.lastIndexOf ("|"), name.lastIndexOf ("/"));
return name.substring (pt + 1);
}, "~S");
c$.fixFileNameVariables = Clazz_defineMethod (c$, "fixFileNameVariables", 
function (format, fname) {
var str = JU.PT.rep (format, "%FILE", fname);
if (str.indexOf ("%LC") < 0) return str;
fname = fname.toLowerCase ();
str = JU.PT.rep (str, "%LCFILE", fname);
if (fname.length == 4) str = JU.PT.rep (str, "%LC13", fname.substring (1, 3));
return str;
}, "~S,~S");
Clazz_defineMethod (c$, "cachePut", 
function (key, data) {
key = key.$replace ('\\', '/');
if (JU.Logger.debugging) JU.Logger.debug ("cachePut " + key);
if (data == null || "".equals (data)) {
this.cache.remove (key);
return;
}this.cache.put (key, data);
this.jmb.getCachedPngjBytes (key);
}, "~S,~O");
Clazz_defineMethod (c$, "cacheGet", 
function (key, bytesOnly) {
key = key.$replace ('\\', '/');
var pt = key.indexOf ("|");
if (pt >= 0) key = key.substring (0, pt);
key = this.getFilePath (key, true, false);
var data = null;
{
(data = Jmol.Cache.get(key)) || (data = this.cache.get(key));
}return (bytesOnly && (Clazz_instanceOf (data, String)) ? null : data);
}, "~S,~B");
Clazz_defineMethod (c$, "cacheClear", 
function () {
JU.Logger.info ("cache cleared");
this.cache.clear ();
this.clearPngjCache (null);
});
Clazz_defineMethod (c$, "cacheFileByNameAdd", 
function (fileName, isAdd) {
if (fileName == null || !isAdd && fileName.equalsIgnoreCase ("")) {
this.cacheClear ();
return -1;
}var data;
if (isAdd) {
fileName = this.vwr.resolveDatabaseFormat (fileName);
data = this.getFileAsBytes (fileName, null);
if (Clazz_instanceOf (data, String)) return 0;
this.cachePut (fileName, data);
} else {
if (fileName.endsWith ("*")) return JU.AU.removeMapKeys (this.cache, fileName.substring (0, fileName.length - 1));
data = this.cache.remove (fileName.$replace ('\\', '/'));
}return (data == null ? 0 : Clazz_instanceOf (data, String) ? (data).length : (data).length);
}, "~S,~B");
Clazz_defineMethod (c$, "cacheList", 
function () {
var map =  new java.util.Hashtable ();
for (var entry, $entry = this.cache.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) map.put (entry.getKey (), Integer.$valueOf (JU.PT.isAB (entry.getValue ()) ? (entry.getValue ()).length : entry.getValue ().toString ().length));

return map;
});
Clazz_defineMethod (c$, "getCanonicalName", 
function (pathName) {
var names = this.getClassifiedName (pathName, true);
return (names == null ? pathName : names[2]);
}, "~S");
Clazz_overrideMethod (c$, "postByteArray", 
function (fileName, bytes) {
var ret = this.getBufferedInputStreamOrErrorMessageFromName (fileName, null, false, false, bytes, false, true);
if (Clazz_instanceOf (ret, String)) return ret;
try {
ret = JU.Rdr.getStreamAsBytes (ret, null);
} catch (e) {
if (Clazz_exceptionOf (e, java.io.IOException)) {
try {
(ret).close ();
} catch (e1) {
if (Clazz_exceptionOf (e1, java.io.IOException)) {
} else {
throw e1;
}
}
} else {
throw e;
}
}
return (ret == null ? "" : JU.Rdr.fixUTF (ret));
}, "~S,~A");
Clazz_defineStatics (c$,
"SIMULATION_PROTOCOL", "http://SIMULATION/");
c$.scriptFilePrefixes = c$.prototype.scriptFilePrefixes = ["/*file*/\"", "FILE0=\"", "FILE1=\""];
});
Clazz_declarePackage ("JV");
Clazz_load (["java.util.Hashtable", "JU.P3", "J.c.CBK"], "JV.GlobalSettings", ["java.lang.Boolean", "$.Float", "JU.DF", "$.PT", "$.SB", "J.c.STR", "JS.SV", "JU.Escape", "$.Logger", "JV.JC", "$.StateManager", "$.Viewer"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.htNonbooleanParameterValues = null;
this.htBooleanParameterFlags = null;
this.htPropertyFlagsRemoved = null;
this.htUserVariables = null;
this.databases = null;
this.zDepth = 0;
this.zShadePower = 3;
this.zSlab = 50;
this.slabByMolecule = false;
this.slabByAtom = false;
this.allowEmbeddedScripts = true;
this.appendNew = true;
this.appletProxy = "";
this.applySymmetryToBonds = false;
this.atomTypes = "";
this.autoBond = true;
this.axesOrientationRasmol = false;
this.bondRadiusMilliAngstroms = 150;
this.bondTolerance = 0.45;
this.defaultDirectory = "";
this.defaultStructureDSSP = true;
this.ptDefaultLattice = null;
this.defaultLoadScript = "";
this.defaultLoadFilter = "";
this.defaultDropScript = "zap; load SYNC \"%FILE\";if (%ALLOWCARTOONS && _loadScript == '' && defaultLoadScript == '' && _filetype == 'Pdb') {if ({(protein or nucleic)&*/1.1} && {*/1.1}[1].groupindex != {*/1.1}[0].groupindex){select protein or nucleic;cartoons only;}if ({visible}){color structure}else{wireframe -0.1};if (!{visible}){spacefill 23%};select *}";
this.forceAutoBond = false;
this.fractionalRelative = true;
this.inlineNewlineChar = '|';
this.loadFormat = null;
this.loadLigandFormat = null;
this.nmrUrlFormat = null;
this.nmrPredictFormat = null;
this.smilesUrlFormat = null;
this.nihResolverFormat = null;
this.pubChemFormat = null;
this.edsUrlFormat = "http://eds.bmc.uu.se/eds/dfs/%LC13/%LCFILE/%LCFILE.omap";
this.edsUrlFormatDiff = "http://eds.bmc.uu.se/eds/dfs/%LC13/%LCFILE/%LCFILE_diff.omap";
this.edsUrlCutoff = "http://eds.bmc.uu.se/eds/dfs/%LC13/%LCFILE/%LCFILE.sfdat";
this.minBondDistance = 0.4;
this.minPixelSelRadius = 6;
this.pdbAddHydrogens = false;
this.pdbGetHeader = false;
this.pdbSequential = false;
this.percentVdwAtom = 23;
this.smallMoleculeMaxAtoms = 40000;
this.smartAromatic = true;
this.zeroBasedXyzRasmol = false;
this.legacyAutoBonding = false;
this.legacyHAddition = false;
this.legacyJavaFloat = false;
this.allowRotateSelected = false;
this.allowMoveAtoms = false;
this.solventOn = false;
this.defaultAngleLabel = "%VALUE %UNITS";
this.defaultDistanceLabel = "%VALUE %UNITS";
this.defaultTorsionLabel = "%VALUE %UNITS";
this.justifyMeasurements = false;
this.measureAllModels = false;
this.minimizationSteps = 100;
this.minimizationRefresh = true;
this.minimizationSilent = false;
this.minimizationCriterion = 0.001;
this.antialiasDisplay = false;
this.antialiasImages = true;
this.imageState = true;
this.antialiasTranslucent = true;
this.displayCellParameters = true;
this.dotsSelectedOnly = false;
this.dotSurface = true;
this.dotDensity = 3;
this.dotScale = 1;
this.meshScale = 1;
this.greyscaleRendering = false;
this.isosurfaceKey = false;
this.isosurfacePropertySmoothing = true;
this.isosurfacePropertySmoothingPower = 7;
this.platformSpeed = 10;
this.repaintWaitMs = 1000;
this.showHiddenSelectionHalos = false;
this.showKeyStrokes = true;
this.showMeasurements = true;
this.showTiming = false;
this.zoomLarge = true;
this.zoomHeight = false;
this.backgroundImageFileName = null;
this.partialDots = false;
this.bondModeOr = false;
this.hbondsBackbone = false;
this.hbondsAngleMinimum = 90;
this.hbondsDistanceMaximum = 3.25;
this.hbondsRasmol = true;
this.hbondsSolid = false;
this.modeMultipleBond = 2;
this.showHydrogens = true;
this.showMultipleBonds = true;
this.ssbondsBackbone = false;
this.multipleBondSpacing = -1;
this.multipleBondRadiusFactor = 0;
this.cartoonBaseEdges = false;
this.cartoonRockets = false;
this.backboneSteps = false;
this.cartoonFancy = false;
this.cartoonLadders = false;
this.cartoonRibose = false;
this.chainCaseSensitive = false;
this.hermiteLevel = 0;
this.highResolutionFlag = false;
this.rangeSelected = false;
this.rasmolHydrogenSetting = true;
this.rasmolHeteroSetting = true;
this.ribbonAspectRatio = 16;
this.ribbonBorder = false;
this.rocketBarrels = false;
this.sheetSmoothing = 1;
this.traceAlpha = true;
this.translucent = true;
this.twistedSheets = false;
this.allowGestures = false;
this.allowModelkit = true;
this.allowMultiTouch = true;
this.allowKeyStrokes = false;
this.animationFps = 10;
this.atomPicking = true;
this.autoFps = false;
this.axesMode = 603979810;
this.axesScale = 2;
this.starWidth = 0.05;
this.bondPicking = false;
this.dataSeparator = "~~~";
this.debugScript = false;
this.defaultDrawArrowScale = 0.5;
this.defaultLabelXYZ = "%a";
this.defaultLabelPDB = "%m%r";
this.defaultTranslucent = 0.5;
this.delayMaximumMs = 0;
this.dipoleScale = 1;
this.drawFontSize = 14;
this.disablePopupMenu = false;
this.dragSelected = false;
this.drawHover = false;
this.drawPicking = false;
this.dsspCalcHydrogen = true;
this.energyUnits = "kJ";
this.exportScale = 1;
this.helpPath = "http://chemapps.stolaf.edu/jmol/docs/index.htm";
this.fontScaling = false;
this.fontCaching = true;
this.forceField = "MMFF";
this.helixStep = 1;
this.hideNameInPopup = false;
this.hoverDelayMs = 500;
this.loadAtomDataTolerance = 0.01;
this.logCommands = false;
this.logGestures = false;
this.measureDistanceUnits = "nanometers";
this.measurementLabels = true;
this.messageStyleChime = false;
this.monitorEnergy = false;
this.modulationScale = 1;
this.multiProcessor = true;
this.particleRadius = 20;
this.pickingSpinRate = 10;
this.pickLabel = "";
this.pointGroupDistanceTolerance = 0.2;
this.pointGroupLinearTolerance = 8.0;
this.preserveState = true;
this.propertyColorScheme = "roygb";
this.quaternionFrame = "p";
this.saveProteinStructureState = true;
this.showModVecs = false;
this.showUnitCellDetails = true;
this.solventProbeRadius = 1.2;
this.scriptDelay = 0;
this.selectAllModels = true;
this.statusReporting = true;
this.strandCountForStrands = 5;
this.strandCountForMeshRibbon = 7;
this.strutSpacing = 6;
this.strutLengthMaximum = 7.0;
this.strutDefaultRadius = 0.3;
this.strutsMultiple = false;
this.useMinimizationThread = true;
this.useNumberLocalization = true;
this.useScriptQueue = true;
this.waitForMoveTo = true;
this.vectorScale = 1;
this.vectorSymmetry = false;
this.vectorsCentered = false;
this.vibrationPeriod = 1;
this.vibrationScale = 1;
this.wireframeRotation = false;
this.hideNavigationPoint = false;
this.navigationMode = false;
this.navigationPeriodic = false;
this.navigationSpeed = 5;
this.showNavigationPointAlways = false;
this.stereoState = null;
this.modelKitMode = false;
this.objColors = null;
this.objStateOn = null;
this.objMad = null;
this.ellipsoidAxes = false;
this.ellipsoidDots = false;
this.ellipsoidArcs = false;
this.ellipsoidArrows = false;
this.ellipsoidFill = false;
this.ellipsoidBall = true;
this.ellipsoidDotCount = 200;
this.ellipsoidAxisDiameter = 0.02;
this.testFlag1 = false;
this.testFlag2 = false;
this.testFlag3 = false;
this.testFlag4 = false;
this.structureList = null;
this.haveSetStructureList = false;
this.userDatabases = null;
this.bondingVersion = 0;
Clazz_instantialize (this, arguments);
}, JV, "GlobalSettings");
Clazz_prepareFields (c$, function () {
this.htUserVariables =  new java.util.Hashtable ();
this.ptDefaultLattice =  new JU.P3 ();
this.objColors =  Clazz_newIntArray (8, 0);
this.objStateOn =  Clazz_newBooleanArray (8, false);
this.objMad =  Clazz_newIntArray (8, 0);
this.structureList =  new java.util.Hashtable ();
{
this.structureList.put (J.c.STR.TURN, [30, 90, -15, 95]);
this.structureList.put (J.c.STR.SHEET, [-180, -10, 70, 180, -180, -45, -180, -130, 140, 180, 90, 180]);
this.structureList.put (J.c.STR.HELIX, [-160, 0, -100, 45]);
}});
Clazz_makeConstructor (c$, 
function (vwr, g, clearUserVariables) {
this.vwr = vwr;
this.htNonbooleanParameterValues =  new java.util.Hashtable ();
this.htBooleanParameterFlags =  new java.util.Hashtable ();
this.htPropertyFlagsRemoved =  new java.util.Hashtable ();
if (g != null) {
if (!clearUserVariables) this.htUserVariables = g.htUserVariables;
this.debugScript = g.debugScript;
this.disablePopupMenu = g.disablePopupMenu;
this.messageStyleChime = g.messageStyleChime;
this.defaultDirectory = g.defaultDirectory;
this.allowGestures = g.allowGestures;
this.allowModelkit = g.allowModelkit;
this.allowMultiTouch = g.allowMultiTouch;
this.allowKeyStrokes = g.allowKeyStrokes;
this.legacyAutoBonding = g.legacyAutoBonding;
this.legacyHAddition = g.legacyHAddition;
this.legacyJavaFloat = g.legacyJavaFloat;
this.bondingVersion = g.bondingVersion;
this.platformSpeed = g.platformSpeed;
this.useScriptQueue = g.useScriptQueue;
this.databases = g.databases;
this.showTiming = g.showTiming;
this.wireframeRotation = g.wireframeRotation;
this.testFlag1 = g.testFlag1;
this.testFlag2 = g.testFlag2;
this.testFlag3 = g.testFlag3;
this.testFlag4 = g.testFlag4;
}if (this.databases == null) {
this.databases =  new java.util.Hashtable ();
this.getDataBaseList (JV.JC.databases);
this.getDataBaseList (this.userDatabases);
}this.loadFormat = this.databases.get ("pdb");
this.loadLigandFormat = this.databases.get ("ligand");
this.nmrUrlFormat = this.databases.get ("nmr");
this.nmrPredictFormat = this.databases.get ("nmrdb");
this.smilesUrlFormat = this.databases.get ("nci") + "/file?format=sdf&get3d=True";
this.nihResolverFormat = this.databases.get ("nci");
this.pubChemFormat = this.databases.get ("pubchem");
for (var item, $item = 0, $$item = J.c.CBK.values (); $item < $$item.length && ((item = $$item[$item]) || true); $item++) this.resetValue (item.name () + "Callback", g);

this.setI ("historyLevel", 0);
this.setF ("cameraDepth", 3.0);
this.setI ("depth", 0);
this.setF ("gestureSwipeFactor", 1.0);
this.setB ("hideNotSelected", false);
this.setO ("hoverLabel", "");
this.setB ("isKiosk", vwr.isKiosk ());
this.setO ("logFile", vwr.getLogFileName ());
this.setI ("logLevel", JU.Logger.getLogLevel ());
this.setF ("mouseWheelFactor", 1.15);
this.setF ("mouseDragFactor", 1.0);
this.setI ("navFps", 10);
this.setI ("navigationDepth", 0);
this.setI ("navigationSlab", 0);
this.setI ("navX", 0);
this.setI ("navY", 0);
this.setI ("navZ", 0);
this.setO ("pathForAllFiles", "");
this.setB ("perspectiveDepth", true);
this.setI ("perspectiveModel", 11);
this.setO ("picking", "identify");
this.setO ("pickingStyle", "toggle");
this.setB ("refreshing", true);
this.setI ("rotationRadius", 0);
this.setI ("scaleAngstromsPerInch", 0);
this.setI ("scriptReportingLevel", 0);
this.setB ("selectionHalos", false);
this.setB ("showaxes", false);
this.setB ("showboundbox", false);
this.setB ("showfrank", false);
this.setB ("showUnitcell", false);
this.setI ("slab", 100);
this.setB ("slabEnabled", false);
this.setF ("slabrange", 0);
this.setI ("spinX", 0);
this.setI ("spinY", 30);
this.setI ("spinZ", 0);
this.setI ("spinFps", 30);
this.setF ("visualRange", 5.0);
this.setI ("stereoDegrees", -5);
this.setI ("stateversion", 0);
this.setB ("syncScript", vwr.sm.syncingScripts);
this.setB ("syncMouse", vwr.sm.syncingMouse);
this.setB ("syncStereo", vwr.sm.stereoSync);
this.setB ("windowCentered", true);
this.setB ("zoomEnabled", true);
this.setI ("_version", JV.JC.versionInt);
this.setB ("axesWindow", true);
this.setB ("axesMolecular", false);
this.setB ("axesPosition", false);
this.setB ("axesUnitcell", false);
this.setI ("backgroundModel", 0);
this.setB ("colorRasmol", false);
this.setO ("currentLocalPath", "");
this.setO ("defaultLattice", "{0 0 0}");
this.setO ("defaultColorScheme", "Jmol");
this.setO ("defaultDirectoryLocal", "");
this.setO ("defaults", "Jmol");
this.setO ("defaultVDW", "Jmol");
this.setO ("exportDrivers", "Idtf;Maya;Povray;Vrml;X3d;Tachyon;Obj");
this.setI ("propertyAtomNumberColumnCount", 0);
this.setI ("propertyAtomNumberField", 0);
this.setI ("propertyDataColumnCount", 0);
this.setI ("propertyDataField", 0);
this.setB ("undo", true);
this.setB ("allowEmbeddedScripts", this.allowEmbeddedScripts);
this.setB ("allowGestures", this.allowGestures);
this.setB ("allowKeyStrokes", this.allowKeyStrokes);
this.setB ("allowModelkit", this.allowModelkit);
this.setB ("allowMultiTouch", this.allowMultiTouch);
this.setB ("allowRotateSelected", this.allowRotateSelected);
this.setB ("allowMoveAtoms", this.allowMoveAtoms);
this.setI ("animationFps", this.animationFps);
this.setB ("antialiasImages", this.antialiasImages);
this.setB ("antialiasDisplay", this.antialiasDisplay);
this.setB ("antialiasTranslucent", this.antialiasTranslucent);
this.setB ("appendNew", this.appendNew);
this.setO ("appletProxy", this.appletProxy);
this.setB ("applySymmetryToBonds", this.applySymmetryToBonds);
this.setB ("atomPicking", this.atomPicking);
this.setO ("atomTypes", this.atomTypes);
this.setB ("autoBond", this.autoBond);
this.setB ("autoFps", this.autoFps);
this.setI ("axesMode", this.axesMode == 603979808 ? 2 : this.axesMode == 603979804 ? 1 : 0);
this.setF ("axesScale", this.axesScale);
this.setB ("axesOrientationRasmol", this.axesOrientationRasmol);
this.setB ("backboneSteps", this.backboneSteps);
this.setB ("bondModeOr", this.bondModeOr);
this.setB ("bondPicking", this.bondPicking);
this.setI ("bondRadiusMilliAngstroms", this.bondRadiusMilliAngstroms);
this.setF ("bondTolerance", this.bondTolerance);
this.setB ("cartoonBaseEdges", this.cartoonBaseEdges);
this.setB ("cartoonFancy", this.cartoonFancy);
this.setB ("cartoonLadders", this.cartoonLadders);
this.setB ("cartoonLadders", this.cartoonRibose);
this.setB ("cartoonRockets", this.cartoonRockets);
this.setB ("chainCaseSensitive", this.chainCaseSensitive);
this.setI ("bondingVersion", this.bondingVersion);
this.setO ("dataSeparator", this.dataSeparator);
this.setB ("debugScript", this.debugScript);
this.setO ("defaultAngleLabel", this.defaultAngleLabel);
this.setF ("defaultDrawArrowScale", this.defaultDrawArrowScale);
this.setO ("defaultDirectory", this.defaultDirectory);
this.setO ("defaultDistanceLabel", this.defaultDistanceLabel);
this.setO ("defaultDropScript", this.defaultDropScript);
this.setO ("defaultLabelPDB", this.defaultLabelPDB);
this.setO ("defaultLabelXYZ", this.defaultLabelXYZ);
this.setO ("defaultLoadFilter", this.defaultLoadFilter);
this.setO ("defaultLoadScript", this.defaultLoadScript);
this.setB ("defaultStructureDSSP", this.defaultStructureDSSP);
this.setO ("defaultTorsionLabel", this.defaultTorsionLabel);
this.setF ("defaultTranslucent", this.defaultTranslucent);
this.setI ("delayMaximumMs", this.delayMaximumMs);
this.setF ("dipoleScale", this.dipoleScale);
this.setB ("disablePopupMenu", this.disablePopupMenu);
this.setB ("displayCellParameters", this.displayCellParameters);
this.setI ("dotDensity", this.dotDensity);
this.setI ("dotScale", this.dotScale);
this.setB ("dotsSelectedOnly", this.dotsSelectedOnly);
this.setB ("dotSurface", this.dotSurface);
this.setB ("dragSelected", this.dragSelected);
this.setB ("drawHover", this.drawHover);
this.setF ("drawFontSize", this.drawFontSize);
this.setB ("drawPicking", this.drawPicking);
this.setB ("dsspCalculateHydrogenAlways", this.dsspCalcHydrogen);
this.setO ("edsUrlFormat", this.edsUrlFormat);
this.setO ("edsUrlFormatDiff", this.edsUrlFormatDiff);
this.setO ("edsUrlCutoff", this.edsUrlCutoff);
this.setB ("ellipsoidArcs", this.ellipsoidArcs);
this.setB ("ellipsoidArrows", this.ellipsoidArrows);
this.setB ("ellipsoidAxes", this.ellipsoidAxes);
this.setF ("ellipsoidAxisDiameter", this.ellipsoidAxisDiameter);
this.setB ("ellipsoidBall", this.ellipsoidBall);
this.setI ("ellipsoidDotCount", this.ellipsoidDotCount);
this.setB ("ellipsoidDots", this.ellipsoidDots);
this.setB ("ellipsoidFill", this.ellipsoidFill);
this.setO ("energyUnits", this.energyUnits);
this.setF ("exportScale", this.exportScale);
this.setB ("fontScaling", this.fontScaling);
this.setB ("fontCaching", this.fontCaching);
this.setB ("forceAutoBond", this.forceAutoBond);
this.setO ("forceField", this.forceField);
this.setB ("fractionalRelative", this.fractionalRelative);
this.setF ("particleRadius", this.particleRadius);
this.setB ("greyscaleRendering", this.greyscaleRendering);
this.setF ("hbondsAngleMinimum", this.hbondsAngleMinimum);
this.setF ("hbondsDistanceMaximum", this.hbondsDistanceMaximum);
this.setB ("hbondsBackbone", this.hbondsBackbone);
this.setB ("hbondsRasmol", this.hbondsRasmol);
this.setB ("hbondsSolid", this.hbondsSolid);
this.setI ("helixStep", this.helixStep);
this.setO ("helpPath", this.helpPath);
this.setI ("hermiteLevel", this.hermiteLevel);
this.setB ("hideNameInPopup", this.hideNameInPopup);
this.setB ("hideNavigationPoint", this.hideNavigationPoint);
this.setB ("highResolution", this.highResolutionFlag);
this.setF ("hoverDelay", this.hoverDelayMs / 1000);
this.setB ("imageState", this.imageState);
this.setB ("isosurfaceKey", this.isosurfaceKey);
this.setB ("isosurfacePropertySmoothing", this.isosurfacePropertySmoothing);
this.setI ("isosurfacePropertySmoothingPower", this.isosurfacePropertySmoothingPower);
this.setB ("justifyMeasurements", this.justifyMeasurements);
this.setB ("legacyAutoBonding", this.legacyAutoBonding);
this.setB ("legacyHAddition", this.legacyHAddition);
this.setB ("legacyJavaFloat", this.legacyJavaFloat);
this.setF ("loadAtomDataTolerance", this.loadAtomDataTolerance);
this.setO ("loadFormat", this.loadFormat);
this.setO ("loadLigandFormat", this.loadLigandFormat);
this.setB ("logCommands", this.logCommands);
this.setB ("logGestures", this.logGestures);
this.setB ("measureAllModels", this.measureAllModels);
this.setB ("measurementLabels", this.measurementLabels);
this.setO ("measurementUnits", this.measureDistanceUnits);
this.setI ("meshScale", this.meshScale);
this.setB ("messageStyleChime", this.messageStyleChime);
this.setF ("minBondDistance", this.minBondDistance);
this.setI ("minPixelSelRadius", this.minPixelSelRadius);
this.setI ("minimizationSteps", this.minimizationSteps);
this.setB ("minimizationRefresh", this.minimizationRefresh);
this.setB ("minimizationSilent", this.minimizationSilent);
this.setF ("minimizationCriterion", this.minimizationCriterion);
this.setB ("modelKitMode", this.modelKitMode);
this.setF ("modulationScale", this.modulationScale);
this.setB ("monitorEnergy", this.monitorEnergy);
this.setF ("multipleBondRadiusFactor", this.multipleBondRadiusFactor);
this.setF ("multipleBondSpacing", this.multipleBondSpacing);
this.setB ("multiProcessor", this.multiProcessor && (JV.Viewer.nProcessors > 1));
this.setB ("navigationMode", this.navigationMode);
this.setB ("navigationPeriodic", this.navigationPeriodic);
this.setF ("navigationSpeed", this.navigationSpeed);
this.setO ("nmrPredictFormat", this.nmrPredictFormat);
this.setO ("nmrUrlFormat", this.nmrUrlFormat);
this.setB ("partialDots", this.partialDots);
this.setB ("pdbAddHydrogens", this.pdbAddHydrogens);
this.setB ("pdbGetHeader", this.pdbGetHeader);
this.setB ("pdbSequential", this.pdbSequential);
this.setI ("percentVdwAtom", this.percentVdwAtom);
this.setI ("pickingSpinRate", this.pickingSpinRate);
this.setO ("pickLabel", this.pickLabel);
this.setI ("platformSpeed", this.platformSpeed);
this.setF ("pointGroupLinearTolerance", this.pointGroupLinearTolerance);
this.setF ("pointGroupDistanceTolerance", this.pointGroupDistanceTolerance);
this.setB ("preserveState", this.preserveState);
this.setO ("propertyColorScheme", this.propertyColorScheme);
this.setO ("quaternionFrame", this.quaternionFrame);
this.setB ("rangeSelected", this.rangeSelected);
this.setI ("repaintWaitMs", this.repaintWaitMs);
this.setI ("ribbonAspectRatio", this.ribbonAspectRatio);
this.setB ("ribbonBorder", this.ribbonBorder);
this.setB ("rocketBarrels", this.rocketBarrels);
this.setB ("saveProteinStructureState", this.saveProteinStructureState);
this.setB ("scriptqueue", this.useScriptQueue);
this.setB ("selectAllModels", this.selectAllModels);
this.setB ("selectHetero", this.rasmolHeteroSetting);
this.setB ("selectHydrogen", this.rasmolHydrogenSetting);
this.setF ("sheetSmoothing", this.sheetSmoothing);
this.setB ("showHiddenSelectionHalos", this.showHiddenSelectionHalos);
this.setB ("showHydrogens", this.showHydrogens);
this.setB ("showKeyStrokes", this.showKeyStrokes);
this.setB ("showMeasurements", this.showMeasurements);
this.setB ("showModulationVectors", this.showModVecs);
this.setB ("showMultipleBonds", this.showMultipleBonds);
this.setB ("showNavigationPointAlways", this.showNavigationPointAlways);
this.setI ("showScript", this.scriptDelay);
this.setB ("showtiming", this.showTiming);
this.setB ("slabByMolecule", this.slabByMolecule);
this.setB ("slabByAtom", this.slabByAtom);
this.setB ("smartAromatic", this.smartAromatic);
this.setI ("smallMoleculeMaxAtoms", this.smallMoleculeMaxAtoms);
this.setO ("smilesUrlFormat", this.smilesUrlFormat);
this.setO ("nihResolverFormat", this.nihResolverFormat);
this.setO ("pubChemFormat", this.pubChemFormat);
this.setB ("showUnitCellDetails", this.showUnitCellDetails);
this.setB ("solventProbe", this.solventOn);
this.setF ("solventProbeRadius", this.solventProbeRadius);
this.setB ("ssbondsBackbone", this.ssbondsBackbone);
this.setF ("starWidth", this.starWidth);
this.setB ("statusReporting", this.statusReporting);
this.setI ("strandCount", this.strandCountForStrands);
this.setI ("strandCountForStrands", this.strandCountForStrands);
this.setI ("strandCountForMeshRibbon", this.strandCountForMeshRibbon);
this.setF ("strutDefaultRadius", this.strutDefaultRadius);
this.setF ("strutLengthMaximum", this.strutLengthMaximum);
this.setI ("strutSpacing", this.strutSpacing);
this.setB ("strutsMultiple", this.strutsMultiple);
this.setB ("testFlag1", this.testFlag1);
this.setB ("testFlag2", this.testFlag2);
this.setB ("testFlag3", this.testFlag3);
this.setB ("testFlag4", this.testFlag4);
this.setB ("traceAlpha", this.traceAlpha);
this.setB ("translucent", this.translucent);
this.setB ("twistedSheets", this.twistedSheets);
this.setB ("useMinimizationThread", this.useMinimizationThread);
this.setB ("useNumberLocalization", this.useNumberLocalization);
this.setB ("vectorsCentered", this.vectorsCentered);
this.setF ("vectorScale", this.vectorScale);
this.setB ("vectorSymmetry", this.vectorSymmetry);
this.setF ("vibrationPeriod", this.vibrationPeriod);
this.setF ("vibrationScale", this.vibrationScale);
this.setB ("waitForMoveTo", this.waitForMoveTo);
this.setB ("wireframeRotation", this.wireframeRotation);
this.setI ("zDepth", this.zDepth);
this.setB ("zeroBasedXyzRasmol", this.zeroBasedXyzRasmol);
this.setB ("zoomHeight", this.zoomHeight);
this.setB ("zoomLarge", this.zoomLarge);
this.setI ("zShadePower", this.zShadePower);
this.setI ("zSlab", this.zSlab);
}, "JV.Viewer,JV.GlobalSettings,~B");
Clazz_defineMethod (c$, "clear", 
function () {
var e = this.htUserVariables.keySet ().iterator ();
while (e.hasNext ()) {
var key = e.next ();
if (key.charAt (0) == '@' || key.startsWith ("site_")) e.remove ();
}
this.vwr.setPicked (-1);
this.setI ("_atomhovered", -1);
this.setO ("_pickinfo", "");
this.setB ("selectionhalos", false);
this.setB ("hidenotselected", false);
this.setB ("measurementlabels", this.measurementLabels = true);
this.setB ("drawHover", this.drawHover = false);
this.vwr.stm.saveScene ("DELETE", null);
});
Clazz_defineMethod (c$, "setUnits", 
function (units) {
var mu = this.measureDistanceUnits;
var eu = this.energyUnits;
if (units.equalsIgnoreCase ("angstroms")) this.measureDistanceUnits = "angstroms";
 else if (units.equalsIgnoreCase ("nanometers") || units.equalsIgnoreCase ("nm")) this.measureDistanceUnits = "nanometers";
 else if (units.equalsIgnoreCase ("picometers") || units.equalsIgnoreCase ("pm")) this.measureDistanceUnits = "picometers";
 else if (units.equalsIgnoreCase ("bohr") || units.equalsIgnoreCase ("au")) this.measureDistanceUnits = "au";
 else if (units.equalsIgnoreCase ("vanderwaals") || units.equalsIgnoreCase ("vdw")) this.measureDistanceUnits = "vdw";
 else if (units.toLowerCase ().endsWith ("hz") || units.toLowerCase ().endsWith ("khz")) this.measureDistanceUnits = units.toLowerCase ();
 else if (units.equalsIgnoreCase ("kj")) this.energyUnits = "kJ";
 else if (units.equalsIgnoreCase ("kcal")) this.energyUnits = "kcal";
if (!mu.equalsIgnoreCase (this.measureDistanceUnits)) this.setO ("measurementUnits", this.measureDistanceUnits);
 else if (!eu.equalsIgnoreCase (this.energyUnits)) this.setO ("energyUnits", this.energyUnits);
}, "~S");
Clazz_defineMethod (c$, "isJmolVariable", 
function (key) {
return key.charAt (0) == '_' || this.htNonbooleanParameterValues.containsKey (key = key.toLowerCase ()) || this.htBooleanParameterFlags.containsKey (key) || JV.GlobalSettings.unreportedProperties.indexOf (";" + key + ";") >= 0;
}, "~S");
Clazz_defineMethod (c$, "resetValue", 
 function (name, g) {
this.setO (name, g == null ? "" : g.getParameter (name, true));
}, "~S,JV.GlobalSettings");
Clazz_defineMethod (c$, "setB", 
function (name, value) {
name = name.toLowerCase ();
if (this.htNonbooleanParameterValues.containsKey (name)) return;
this.htBooleanParameterFlags.put (name, value ? Boolean.TRUE : Boolean.FALSE);
}, "~S,~B");
Clazz_defineMethod (c$, "setI", 
function (name, value) {
if (value != 2147483647) this.setO (name, Integer.$valueOf (value));
}, "~S,~N");
Clazz_defineMethod (c$, "setF", 
function (name, value) {
if (!Float.isNaN (value)) this.setO (name, Float.$valueOf (value));
}, "~S,~N");
Clazz_defineMethod (c$, "setO", 
function (name, value) {
name = name.toLowerCase ();
if (value == null || this.htBooleanParameterFlags.containsKey (name)) return;
this.htNonbooleanParameterValues.put (name, value);
}, "~S,~O");
Clazz_defineMethod (c$, "removeParam", 
function (key) {
key = key.toLowerCase ();
if (this.htBooleanParameterFlags.containsKey (key)) {
this.htBooleanParameterFlags.remove (key);
if (!this.htPropertyFlagsRemoved.containsKey (key)) this.htPropertyFlagsRemoved.put (key, Boolean.FALSE);
return;
}if (this.htNonbooleanParameterValues.containsKey (key)) this.htNonbooleanParameterValues.remove (key);
}, "~S");
Clazz_defineMethod (c$, "setUserVariable", 
function (key, $var) {
if ($var != null) {
key = key.toLowerCase ();
this.htUserVariables.put (key, $var.setName (key));
}return $var;
}, "~S,JS.SV");
Clazz_defineMethod (c$, "unsetUserVariable", 
function (key) {
if (key.equals ("all") || key.equals ("variables")) {
this.htUserVariables.clear ();
JU.Logger.info ("all user-defined variables deleted");
} else if (this.htUserVariables.containsKey (key)) {
JU.Logger.info ("variable " + key + " deleted");
this.htUserVariables.remove (key);
}}, "~S");
Clazz_defineMethod (c$, "removeUserVariable", 
function (key) {
this.htUserVariables.remove (key);
}, "~S");
Clazz_defineMethod (c$, "getUserVariable", 
function (name) {
if (name == null) return null;
name = name.toLowerCase ();
return this.htUserVariables.get (name);
}, "~S");
Clazz_defineMethod (c$, "getParameterEscaped", 
function (name, nMax) {
name = name.toLowerCase ();
if (this.htNonbooleanParameterValues.containsKey (name)) {
var v = this.htNonbooleanParameterValues.get (name);
return JV.StateManager.varClip (name, JU.Escape.e (v), nMax);
}if (this.htBooleanParameterFlags.containsKey (name)) return this.htBooleanParameterFlags.get (name).toString ();
if (this.htUserVariables.containsKey (name)) return this.htUserVariables.get (name).escape ();
if (this.htPropertyFlagsRemoved.containsKey (name)) return "false";
return "<not defined>";
}, "~S,~N");
Clazz_defineMethod (c$, "getParameter", 
function (name, nullAsString) {
var v = this.getParam (name, false);
return (v == null && nullAsString ? "" : v);
}, "~S,~B");
Clazz_defineMethod (c$, "getOrSetNewVariable", 
function (name, doSet) {
if (name == null || name.length == 0) name = "x";
var v = this.getParam (name, true);
return (v == null && doSet && name.charAt (0) != '_' ? this.setUserVariable (name, JS.SV.newV (4, "")) : JS.SV.getVariable (v));
}, "~S,~B");
Clazz_defineMethod (c$, "getParam", 
function (name, asVariable) {
name = name.toLowerCase ();
if (name.equals ("_memory")) {
var bTotal = 0;
var bFree = 0;
{
}var value = JU.DF.formatDecimal (bTotal - bFree, 1) + "/" + JU.DF.formatDecimal (bTotal, 1);
this.htNonbooleanParameterValues.put ("_memory", value);
}if (this.htNonbooleanParameterValues.containsKey (name)) return this.htNonbooleanParameterValues.get (name);
if (this.htBooleanParameterFlags.containsKey (name)) return this.htBooleanParameterFlags.get (name);
if (this.htPropertyFlagsRemoved.containsKey (name)) return Boolean.FALSE;
if (this.htUserVariables.containsKey (name)) {
var v = this.htUserVariables.get (name);
return (asVariable ? v : JS.SV.oValue (v));
}return null;
}, "~S,~B");
Clazz_defineMethod (c$, "getVariableList", 
function () {
return JV.StateManager.getVariableList (this.htUserVariables, 0, true, false);
});
Clazz_defineMethod (c$, "setStructureList", 
function (list, type) {
this.haveSetStructureList = true;
this.structureList.put (type, list);
}, "~A,J.c.STR");
Clazz_defineMethod (c$, "getStructureList", 
function () {
return this.structureList;
});
Clazz_defineMethod (c$, "resolveDataBase", 
function (database, id) {
var format = this.databases.get (database.toLowerCase ());
if (format == null) return null;
if (id.indexOf ("/") < 0) {
if (database.equals ("pubchem")) id = "name/" + id;
 else if (database.equals ("nci")) id += "/file?format=sdf&get3d=True";
}return (format.indexOf ("%FILE") < 0 ? format + id : JU.PT.formatStringS (format, "FILE", id));
}, "~S,~S");
c$.doReportProperty = Clazz_defineMethod (c$, "doReportProperty", 
function (name) {
return (name.charAt (0) != '_' && JV.GlobalSettings.unreportedProperties.indexOf (";" + name + ";") < 0);
}, "~S");
Clazz_defineMethod (c$, "getDataBaseList", 
 function (list) {
if (list == null) return;
for (var i = 0; i < list.length; i += 2) this.databases.put (list[i].toLowerCase (), list[i + 1]);

}, "~A");
Clazz_defineMethod (c$, "getAllVariables", 
function () {
var map =  new java.util.Hashtable ();
map.putAll (this.htBooleanParameterFlags);
map.putAll (this.htNonbooleanParameterValues);
map.putAll (this.htUserVariables);
return map;
});
Clazz_defineMethod (c$, "getLoadState", 
function (htParams) {
var str =  new JU.SB ();
this.app (str, "set allowEmbeddedScripts false");
if (this.allowEmbeddedScripts) this.setB ("allowEmbeddedScripts", true);
this.app (str, "set appendNew " + this.appendNew);
this.app (str, "set appletProxy " + JU.PT.esc (this.appletProxy));
this.app (str, "set applySymmetryToBonds " + this.applySymmetryToBonds);
if (this.atomTypes.length > 0) this.app (str, "set atomTypes " + JU.PT.esc (this.atomTypes));
this.app (str, "set autoBond " + this.autoBond);
if (this.axesOrientationRasmol) this.app (str, "set axesOrientationRasmol true");
this.app (str, "set bondRadiusMilliAngstroms " + this.bondRadiusMilliAngstroms);
this.app (str, "set bondTolerance " + this.bondTolerance);
this.app (str, "set defaultLattice " + JU.Escape.eP (this.ptDefaultLattice));
this.app (str, "set defaultLoadFilter " + JU.PT.esc (this.defaultLoadFilter));
this.app (str, "set defaultLoadScript \"\"");
if (this.defaultLoadScript.length > 0) this.setO ("defaultLoadScript", this.defaultLoadScript);
this.app (str, "set defaultStructureDssp " + this.defaultStructureDSSP);
var sMode = this.vwr.getDefaultVdwNameOrData (-2147483648, null, null);
this.app (str, "set defaultVDW " + sMode);
if (sMode.equals ("User")) this.app (str, this.vwr.getDefaultVdwNameOrData (2147483647, null, null));
this.app (str, "set forceAutoBond " + this.forceAutoBond);
this.app (str, "#set defaultDirectory " + JU.PT.esc (this.defaultDirectory));
this.app (str, "#set loadFormat " + JU.PT.esc (this.loadFormat));
this.app (str, "#set loadLigandFormat " + JU.PT.esc (this.loadLigandFormat));
this.app (str, "#set smilesUrlFormat " + JU.PT.esc (this.smilesUrlFormat));
this.app (str, "#set nihResolverFormat " + JU.PT.esc (this.nihResolverFormat));
this.app (str, "#set pubChemFormat " + JU.PT.esc (this.pubChemFormat));
this.app (str, "#set edsUrlFormat " + JU.PT.esc (this.edsUrlFormat));
this.app (str, "#set edsUrlFormatDiff " + JU.PT.esc (this.edsUrlFormatDiff));
this.app (str, "#set edsUrlCutoff " + JU.PT.esc (this.edsUrlCutoff));
this.app (str, "set bondingVersion " + this.bondingVersion);
this.app (str, "set legacyAutoBonding " + this.legacyAutoBonding);
this.app (str, "set legacyHAddition " + this.legacyHAddition);
this.app (str, "set legacyJavaFloat " + this.legacyJavaFloat);
this.app (str, "set minBondDistance " + this.minBondDistance);
this.app (str, "set minimizationCriterion  " + this.minimizationCriterion);
this.app (str, "set minimizationSteps  " + this.minimizationSteps);
this.app (str, "set pdbAddHydrogens " + (htParams != null && htParams.get ("pdbNoHydrogens") !== Boolean.TRUE ? this.pdbAddHydrogens : false));
this.app (str, "set pdbGetHeader " + this.pdbGetHeader);
this.app (str, "set pdbSequential " + this.pdbSequential);
this.app (str, "set percentVdwAtom " + this.percentVdwAtom);
this.app (str, "set smallMoleculeMaxAtoms " + this.smallMoleculeMaxAtoms);
this.app (str, "set smartAromatic " + this.smartAromatic);
if (this.zeroBasedXyzRasmol) this.app (str, "set zeroBasedXyzRasmol true");
return str.toString ();
}, "java.util.Map");
Clazz_defineMethod (c$, "app", 
 function (s, cmd) {
if (cmd.length == 0) return;
s.append ("  ").append (cmd).append (";\n");
}, "JU.SB,~S");
c$.unreportedProperties = c$.prototype.unreportedProperties = (";ambientpercent;animationfps;antialiasdisplay;antialiasimages;antialiastranslucent;appendnew;axescolor;axesposition;axesmolecular;axesorientationrasmol;axesunitcell;axeswindow;axis1color;axis2color;axis3color;backgroundcolor;backgroundmodel;bondsymmetryatoms;boundboxcolor;cameradepth;bondingversion;debug;debugscript;defaultlatttice;defaults;defaultdropscript;diffusepercent;;exportdrivers;exportscale;_filecaching;_filecache;fontcaching;fontscaling;forcefield;language;legacyautobonding;legacyhaddition;legacyjavafloat;loglevel;logfile;loggestures;logcommands;measurestylechime;loadformat;loadligandformat;smilesurlformat;pubchemformat;nihresolverformat;edsurlformat;edsurlcutoff;multiprocessor;navigationmode;;pathforallfiles;perspectivedepth;phongexponent;perspectivemodel;platformspeed;preservestate;refreshing;repaintwaitms;rotationradius;showaxes;showaxis1;showaxis2;showaxis3;showboundbox;showfrank;showtiming;showunitcell;slabenabled;slab;slabrange;depth;zshade;zshadepower;specular;specularexponent;specularpercent;celshading;celshadingpower;specularpower;stateversion;statusreporting;stereo;stereostate;vibrationperiod;unitcellcolor;visualrange;windowcentered;zerobasedxyzrasmol;zoomenabled;mousedragfactor;mousewheelfactor;scriptqueue;scriptreportinglevel;syncscript;syncmouse;syncstereo;;defaultdirectory;currentlocalpath;defaultdirectorylocal;ambient;bonds;colorrasmol;diffuse;fractionalrelative;frank;hetero;hidenotselected;hoverlabel;hydrogen;languagetranslation;measurementunits;navigationdepth;navigationslab;picking;pickingstyle;propertycolorschemeoverload;radius;rgbblue;rgbgreen;rgbred;scaleangstromsperinch;selectionhalos;showscript;showselections;solvent;strandcount;spinx;spiny;spinz;spinfps;navx;navy;navz;navfps;" + J.c.CBK.getNameList () + ";undo;atompicking;drawpicking;bondpicking;pickspinrate;picklabel" + ";modelkitmode;allowgestures;allowkeystrokes;allowmultitouch;allowmodelkit" + ";dodrop;hovered" + ";").toLowerCase ();
});
Clazz_declarePackage ("JV");
Clazz_load (["JU.SB", "$.V3", "JU.Elements"], "JV.JC", ["JU.PT"], function () {
c$ = Clazz_declareType (JV, "JC");
c$.embedScript = Clazz_defineMethod (c$, "embedScript", 
function (s) {
return "\n/**" + "**** Jmol Embedded Script ****" + " \n" + s + "\n**/";
}, "~S");
c$.isShapeSecondary = Clazz_defineMethod (c$, "isShapeSecondary", 
function (i) {
return i >= 9 && i < 16;
}, "~N");
c$.getShapeVisibilityFlag = Clazz_defineMethod (c$, "getShapeVisibilityFlag", 
function (shapeID) {
return 16 << Math.min (shapeID, 26);
}, "~N");
c$.shapeTokenIndex = Clazz_defineMethod (c$, "shapeTokenIndex", 
function (tok) {
switch (tok) {
case 1141899265:
case 1073741860:
return 0;
case 1678770178:
case 659488:
return 1;
case 1612189718:
return 2;
case 1611141176:
return 3;
case 1708058:
return 4;
case 1826248716:
return 5;
case 1746538509:
case 537006096:
return 6;
case 1113200652:
return 7;
case 1113200646:
return 8;
case 1115297793:
return 9;
case 1113200654:
return 10;
case 1113200642:
return 11;
case 1650071565:
return 12;
case 1113200647:
return 13;
case 1113200649:
return 14;
case 1113200650:
return 15;
case 1113198595:
return 16;
case 135175:
return 17;
case 135198:
return 18;
case 1113198597:
return 19;
case 1113198596:
return 20;
case 135192:
return 21;
case 135174:
return 23;
case 135176:
return 22;
case 135180:
return 24;
case 135402505:
return 25;
case 135182:
return 26;
case 1073877010:
return 27;
case 1073877011:
return 28;
case 135188:
return 29;
case 135190:
return 30;
case 537022465:
return 31;
case 1611272194:
return 34;
case 1679429641:
return 32;
case 1614417948:
return 33;
case 544771:
return 35;
case 1611272202:
return 36;
}
return -1;
}, "~N");
c$.getShapeClassName = Clazz_defineMethod (c$, "getShapeClassName", 
function (shapeID, isRenderer) {
if (shapeID < 0) return JV.JC.shapeClassBases[~shapeID];
return "J." + (isRenderer ? "render" : "shape") + (shapeID >= 9 && shapeID < 16 ? "bio." : shapeID >= 16 && shapeID < 23 ? "special." : shapeID >= 24 && shapeID < 30 ? "surface." : shapeID == 23 ? "cgo." : ".") + JV.JC.shapeClassBases[shapeID];
}, "~N,~B");
c$.isScriptType = Clazz_defineMethod (c$, "isScriptType", 
function (fname) {
return JU.PT.isOneOf (fname.substring (fname.lastIndexOf (".") + 1), ";pse;spt;png;pngj;jmol;zip;");
}, "~S");
c$.getOffset = Clazz_defineMethod (c$, "getOffset", 
function (xOffset, yOffset) {
xOffset = Math.min (Math.max (xOffset, -127), 127);
yOffset = Math.min (Math.max (yOffset, -127), 127);
return ((xOffset & 0xFF) << 8) | (yOffset & 0xFF);
}, "~N,~N");
c$.getXOffset = Clazz_defineMethod (c$, "getXOffset", 
function (offset) {
switch (offset) {
case 0:
return 4;
case 32767:
return 0;
default:
return ((offset << 48) >> 56);
}
}, "~N");
c$.getYOffset = Clazz_defineMethod (c$, "getYOffset", 
function (offset) {
switch (offset) {
case 0:
return -4;
case 32767:
return 0;
default:
return -((offset << 56) >> 56);
}
}, "~N");
c$.getAlignmentName = Clazz_defineMethod (c$, "getAlignmentName", 
function (align) {
return JV.JC.hAlignNames[align & 3];
}, "~N");
c$.getPointer = Clazz_defineMethod (c$, "getPointer", 
function (pointer) {
return ((pointer & 1) == 0 ? "" : (pointer & 2) > 0 ? "background" : "on");
}, "~N");
c$.getJSVSyncSignal = Clazz_defineMethod (c$, "getJSVSyncSignal", 
function (script) {
return (script.length < 7 ? -1 : ("JSPECVIPEAKS: SELECT:JSVSTR:H1SIMUL").indexOf (script.substring (0, 7).toUpperCase ()));
}, "~S");
Clazz_defineStatics (c$,
"databases", ["dssr", "http://x3dna.bio.columbia.edu/dssr/report.php?id=%FILE&opts=--jmol%20--more", "dssrModel", "http://x3dna.bio.columbia.edu/dssr/report.php?POST?opts=--jmol --more&model=", "ligand", "http://www.rcsb.org/pdb/files/ligand/%FILE.cif", "mp", "http://www.materialsproject.org/materials/%FILE/cif", "nci", "http://cactus.nci.nih.gov/chemical/structure/%FILE", "nmr", "http://www.nmrdb.org/new_predictor?POST?molfile=", "nmrdb", "http://www.nmrdb.org/service/predictor?POST?molfile=", "pdb", "http://www.rcsb.org/pdb/files/%FILE.pdb.gz", "pdbe", "http://www.ebi.ac.uk/pdbe/entry-files/download/%FILE.cif", "pubchem", "http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d", "map", "http://wwwdev.ebi.ac.uk/pdbe/api/%TYPE/%FILE?pretty=false&metadata=true", "rna3d", "http://rna.bgsu.edu/rna3dhub/%TYPE/download/%FILE"],
"copyright", "(C) 2012 Jmol Development",
"version", null,
"date", null,
"versionInt", 0);
{
var tmpVersion = null;
var tmpDate = null;
{
tmpVersion = Jmol.___JmolVersion; tmpDate = Jmol.___JmolDate;
}if (tmpDate != null) {
tmpDate = tmpDate.substring (7, 23);
}JV.JC.version = (tmpVersion != null ? tmpVersion : "(Unknown version)");
JV.JC.date = (tmpDate != null ? tmpDate : "(Unknown date)");
var v = -1;
try {
var s = JV.JC.version;
var i = s.indexOf (".");
if (i < 0) {
v = 100000 * Integer.parseInt (s);
s = null;
}if (s != null) {
v = 100000 * Integer.parseInt (s.substring (0, i));
s = s.substring (i + 1);
i = s.indexOf (".");
if (i < 0) {
v += 1000 * Integer.parseInt (s);
s = null;
}if (s != null) {
v += 1000 * Integer.parseInt (s.substring (0, i));
s = s.substring (i + 1);
i = s.indexOf ("_");
if (i >= 0) s = s.substring (0, i);
i = s.indexOf (" ");
if (i >= 0) s = s.substring (0, i);
v += Integer.parseInt (s);
}}} catch (e) {
if (Clazz_exceptionOf (e, NumberFormatException)) {
} else {
throw e;
}
}
JV.JC.versionInt = v;
}Clazz_defineStatics (c$,
"officialRelease", false,
"DEFAULT_HELP_PATH", "http://chemapps.stolaf.edu/jmol/docs/index.htm",
"STATE_VERSION_STAMP", "# Jmol state version ",
"EMBEDDED_SCRIPT_TAG", "**** Jmol Embedded Script ****",
"NOTE_SCRIPT_FILE", "NOTE: file recognized as a script file: ",
"SCRIPT_EDITOR_IGNORE", "\1## EDITOR_IGNORE ##",
"REPAINT_IGNORE", "\1## REPAINT_IGNORE ##",
"LOAD_ATOM_DATA_TYPES", ";xyz;vxyz;vibration;temperature;occupancy;partialcharge;",
"radiansPerDegree", (0.017453292519943295),
"allowedQuaternionFrames", "RC;RP;a;b;c;n;p;q;x;",
"EXPORT_DRIVER_LIST", "Idtf;Maya;Povray;Vrml;X3d;Tachyon;Obj");
c$.center = c$.prototype.center = JU.V3.new3 (0, 0, 0);
c$.axisX = c$.prototype.axisX = JU.V3.new3 (1, 0, 0);
c$.axisY = c$.prototype.axisY = JU.V3.new3 (0, 1, 0);
c$.axisZ = c$.prototype.axisZ = JU.V3.new3 (0, 0, 1);
c$.axisNX = c$.prototype.axisNX = JU.V3.new3 (-1, 0, 0);
c$.axisNY = c$.prototype.axisNY = JU.V3.new3 (0, -1, 0);
c$.axisNZ = c$.prototype.axisNZ = JU.V3.new3 (0, 0, -1);
c$.unitAxisVectors = c$.prototype.unitAxisVectors = [JV.JC.axisX, JV.JC.axisY, JV.JC.axisZ, JV.JC.axisNX, JV.JC.axisNY, JV.JC.axisNZ];
Clazz_defineStatics (c$,
"XY_ZTOP", 100,
"DEFAULT_PERCENT_VDW_ATOM", 23,
"DEFAULT_BOND_RADIUS", 0.15,
"DEFAULT_BOND_MILLIANGSTROM_RADIUS", Clazz_floatToShort (150.0),
"DEFAULT_STRUT_RADIUS", 0.3,
"DEFAULT_BOND_TOLERANCE", 0.45,
"DEFAULT_MIN_BOND_DISTANCE", 0.4,
"DEFAULT_MAX_CONNECT_DISTANCE", 100000000,
"DEFAULT_MIN_CONNECT_DISTANCE", 0.1,
"MINIMIZATION_ATOM_MAX", 200,
"MINIMIZE_FIXED_RANGE", 5.0,
"ENC_CALC_MAX_DIST", 3,
"ENV_CALC_MAX_LEVEL", 3,
"LABEL_FRONT_FLAG", 0x20,
"LABEL_GROUP_FLAG", 0x10,
"LABEL_POINTER_FLAGS", 0x03,
"LABEL_ALIGN_FLAGS", 0x0C,
"LABEL_ZPOS_FLAGS", 0x30,
"LABEL_SCALE_FLAG", 0x40,
"LABEL_EXACT_OFFSET_FLAG", 0x80,
"LABEL_FLAGS", 0xFF,
"LABEL_FLAG_OFFSET", 8,
"MOUSE_NONE", -1,
"MULTIBOND_NEVER", 0,
"MULTIBOND_WIREFRAME", 1,
"MULTIBOND_NOTSMALL", 2,
"MULTIBOND_ALWAYS", 3,
"MAXIMUM_AUTO_BOND_COUNT", 20,
"madMultipleBondSmallMaximum", 500,
"ANGSTROMS_PER_BOHR", 0.5291772,
"altArgbsCpk", [0xFFFF1493, 0xFFBFA6A6, 0xFFFFFF30, 0xFF57178F, 0xFFFFFFC0, 0xFFFFFFA0, 0xFFD8D8D8, 0xFF505050, 0xFF404040, 0xFF105050],
"argbsFormalCharge", [0xFFFF0000, 0xFFFF4040, 0xFFFF8080, 0xFFFFC0C0, 0xFFFFFFFF, 0xFFD8D8FF, 0xFFB4B4FF, 0xFF9090FF, 0xFF6C6CFF, 0xFF4848FF, 0xFF2424FF, 0xFF0000FF],
"argbsRwbScale", [0xFFFF0000, 0xFFFF1010, 0xFFFF2020, 0xFFFF3030, 0xFFFF4040, 0xFFFF5050, 0xFFFF6060, 0xFFFF7070, 0xFFFF8080, 0xFFFF9090, 0xFFFFA0A0, 0xFFFFB0B0, 0xFFFFC0C0, 0xFFFFD0D0, 0xFFFFE0E0, 0xFFFFFFFF, 0xFFE0E0FF, 0xFFD0D0FF, 0xFFC0C0FF, 0xFFB0B0FF, 0xFFA0A0FF, 0xFF9090FF, 0xFF8080FF, 0xFF7070FF, 0xFF6060FF, 0xFF5050FF, 0xFF4040FF, 0xFF3030FF, 0xFF2020FF, 0xFF1010FF, 0xFF0000FF]);
c$.FORMAL_CHARGE_COLIX_RED = c$.prototype.FORMAL_CHARGE_COLIX_RED = JU.Elements.elementSymbols.length + JV.JC.altArgbsCpk.length;
c$.PARTIAL_CHARGE_COLIX_RED = c$.prototype.PARTIAL_CHARGE_COLIX_RED = JV.JC.FORMAL_CHARGE_COLIX_RED + JV.JC.argbsFormalCharge.length;
c$.PARTIAL_CHARGE_RANGE_SIZE = c$.prototype.PARTIAL_CHARGE_RANGE_SIZE = JV.JC.argbsRwbScale.length;
Clazz_defineStatics (c$,
"argbsRoygbScale", [0xFFFF0000, 0xFFFF2000, 0xFFFF4000, 0xFFFF6000, 0xFFFF8000, 0xFFFFA000, 0xFFFFC000, 0xFFFFE000, 0xFFFFF000, 0xFFFFFF00, 0xFFF0F000, 0xFFE0FF00, 0xFFC0FF00, 0xFFA0FF00, 0xFF80FF00, 0xFF60FF00, 0xFF40FF00, 0xFF20FF00, 0xFF00FF00, 0xFF00FF20, 0xFF00FF40, 0xFF00FF60, 0xFF00FF80, 0xFF00FFA0, 0xFF00FFC0, 0xFF00FFE0, 0xFF00FFFF, 0xFF00E0FF, 0xFF00C0FF, 0xFF00A0FF, 0xFF0080FF, 0xFF0060FF, 0xFF0040FF, 0xFF0020FF, 0xFF0000FF],
"argbsIsosurfacePositive", 0xFF5020A0,
"argbsIsosurfaceNegative", 0xFFA02050,
"ATOMID_AMINO_NITROGEN", 1,
"ATOMID_ALPHA_CARBON", 2,
"ATOMID_CARBONYL_CARBON", 3,
"ATOMID_CARBONYL_OXYGEN", 4,
"ATOMID_O1", 5,
"ATOMID_ALPHA_ONLY_MASK", 4,
"ATOMID_PROTEIN_MASK", 14,
"ATOMID_O5_PRIME", 6,
"ATOMID_C5_PRIME", 7,
"ATOMID_C4_PRIME", 8,
"ATOMID_C3_PRIME", 9,
"ATOMID_O3_PRIME", 10,
"ATOMID_C2_PRIME", 11,
"ATOMID_C1_PRIME", 12,
"ATOMID_O4_PRIME", 78,
"ATOMID_NUCLEIC_MASK", 8128,
"ATOMID_NUCLEIC_PHOSPHORUS", 13,
"ATOMID_PHOSPHORUS_ONLY_MASK", 8192,
"ATOMID_DISTINGUISHING_ATOM_MAX", 14,
"ATOMID_CARBONYL_OD1", 14,
"ATOMID_CARBONYL_OD2", 15,
"ATOMID_CARBONYL_OE1", 16,
"ATOMID_CARBONYL_OE2", 17,
"ATOMID_N1", 32,
"ATOMID_C2", 33,
"ATOMID_N3", 34,
"ATOMID_C4", 35,
"ATOMID_C5", 36,
"ATOMID_C6", 37,
"ATOMID_O2", 38,
"ATOMID_N7", 39,
"ATOMID_C8", 40,
"ATOMID_N9", 41,
"ATOMID_N4", 42,
"ATOMID_N2", 43,
"ATOMID_N6", 44,
"ATOMID_C5M", 45,
"ATOMID_O6", 46,
"ATOMID_O4", 47,
"ATOMID_S4", 48,
"ATOMID_C7", 49,
"ATOMID_TERMINATING_OXT", 64,
"ATOMID_H5T_TERMINUS", 72,
"ATOMID_O5T_TERMINUS", 73,
"ATOMID_O1P", 74,
"ATOMID_OP1", 75,
"ATOMID_O2P", 76,
"ATOMID_OP2", 77,
"ATOMID_O2_PRIME", 79,
"ATOMID_H3T_TERMINUS", 88,
"ATOMID_HO3_PRIME", 89,
"ATOMID_HO5_PRIME", 90,
"GROUPID_ARGININE", 2,
"GROUPID_ASPARAGINE", 3,
"GROUPID_ASPARTATE", 4,
"GROUPID_CYSTEINE", 5,
"GROUPID_GLUTAMINE", 6,
"GROUPID_GLUTAMATE", 7,
"GROUPID_HISTIDINE", 9,
"GROUPID_LYSINE", 12,
"GROUPID_PROLINE", 15,
"GROUPID_TRYPTOPHAN", 19,
"GROUPID_AMINO_MAX", 24,
"GROUPID_NUCLEIC_MAX", 42,
"GROUPID_WATER", 42,
"GROUPID_SOLVENT_MIN", 45,
"GROUPID_ION_MIN", 46,
"GROUPID_ION_MAX", 48,
"predefinedVariable", ["@_1H _H & !(_2H,_3H)", "@_12C _C & !(_13C,_14C)", "@_14N _N & !(_15N)", "@solvent water, (_g>=45 & _g<48)", "@ligand _g=0|!(_g<46,protein,nucleic,water)", "@turn structure=1", "@sheet structure=2", "@helix structure=3", "@helix310 substructure=7", "@helixalpha substructure=8", "@helixpi substructure=9", "@bonded bondcount>0"],
"predefinedStatic", ["@amino _g>0 & _g<=23", "@acidic asp,glu", "@basic arg,his,lys", "@charged acidic,basic", "@negative acidic", "@positive basic", "@neutral amino&!(acidic,basic)", "@polar amino&!hydrophobic", "@cyclic his,phe,pro,trp,tyr", "@acyclic amino&!cyclic", "@aliphatic ala,gly,ile,leu,val", "@aromatic his,phe,trp,tyr", "@cystine within(group, (cys.sg or cyx.sg) and connected(cys.sg or cyx.sg))", "@buried ala,cys,ile,leu,met,phe,trp,val", "@surface amino&!buried", "@hydrophobic ala,gly,ile,leu,met,phe,pro,trp,tyr,val", "@mainchain backbone", "@small ala,gly,ser", "@medium asn,asp,cys,pro,thr,val", "@large arg,glu,gln,his,ile,leu,lys,met,phe,trp,tyr", "@c nucleic & ([C] or [DC] or within(group,_a=42))", "@g nucleic & ([G] or [DG] or within(group,_a=43))", "@cg c,g", "@a nucleic & ([A] or [DA] or within(group,_a=44))", "@t nucleic & ([T] or [DT] or within(group,_a=45 | _a=49))", "@at a,t", "@i nucleic & ([I] or [DI] or within(group,_a=46) & !g)", "@u nucleic & ([U] or [DU] or within(group,_a=47) & !t)", "@tu nucleic & within(group,_a=48)", "@ions _g>=46&_g<48", "@alpha _a=2", "@backbone protein&(_a>=1&_a<6|_a>=64&_a<72)|nucleic&(_a>=6&_a<14|_a>=72)", "@spine protein&_a>=1&_a<4|nucleic&_a>=6&_a<14&_a!=12", "@sidechain (protein,nucleic) & !backbone", "@base nucleic & !backbone", "@dynamic_flatring search('[a]')"],
"MODELKIT_ZAP_STRING", "5\n\nC 0 0 0\nH .63 .63 .63\nH -.63 -.63 .63\nH -.63 .63 -.63\nH .63 -.63 -.63",
"MODELKIT_ZAP_TITLE", "Jmol Model Kit",
"ZAP_TITLE", "zapped",
"ADD_HYDROGEN_TITLE", "Viewer.AddHydrogens",
"DEFAULT_FONTFACE", "SansSerif",
"DEFAULT_FONTSTYLE", "Plain",
"LABEL_MINIMUM_FONTSIZE", 6,
"LABEL_MAXIMUM_FONTSIZE", 63,
"LABEL_DEFAULT_FONTSIZE", 13,
"LABEL_DEFAULT_X_OFFSET", 4,
"LABEL_DEFAULT_Y_OFFSET", 4,
"MEASURE_DEFAULT_FONTSIZE", 15,
"AXES_DEFAULT_FONTSIZE", 14,
"SHAPE_BALLS", 0,
"SHAPE_STICKS", 1,
"SHAPE_HSTICKS", 2,
"SHAPE_SSSTICKS", 3,
"SHAPE_STRUTS", 4,
"SHAPE_LABELS", 5,
"SHAPE_MEASURES", 6,
"SHAPE_STARS", 7,
"SHAPE_MIN_HAS_SETVIS", 8,
"SHAPE_HALOS", 8,
"SHAPE_MIN_SECONDARY", 9,
"SHAPE_BACKBONE", 9,
"SHAPE_TRACE", 10,
"SHAPE_CARTOON", 11,
"SHAPE_STRANDS", 12,
"SHAPE_MESHRIBBON", 13,
"SHAPE_RIBBONS", 14,
"SHAPE_ROCKETS", 15,
"SHAPE_MAX_SECONDARY", 16,
"SHAPE_MIN_SPECIAL", 16,
"SHAPE_DOTS", 16,
"SHAPE_DIPOLES", 17,
"SHAPE_VECTORS", 18,
"SHAPE_GEOSURFACE", 19,
"SHAPE_ELLIPSOIDS", 20,
"SHAPE_MAX_SIZE_ZERO_ON_RESTRICT", 21,
"SHAPE_POLYHEDRA", 21,
"SHAPE_MIN_HAS_ID", 22,
"SHAPE_MIN_MESH_COLLECTION", 22,
"SHAPE_DRAW", 22,
"SHAPE_MAX_SPECIAL", 23,
"SHAPE_CGO", 23,
"SHAPE_MIN_SURFACE", 24,
"SHAPE_ISOSURFACE", 24,
"SHAPE_CONTACT", 25,
"SHAPE_LCAOCARTOON", 26,
"SHAPE_LAST_ATOM_VIS_FLAG", 26,
"SHAPE_MO", 27,
"SHAPE_NBO", 28,
"SHAPE_PMESH", 29,
"SHAPE_PLOT3D", 30,
"SHAPE_MAX_SURFACE", 30,
"SHAPE_MAX_MESH_COLLECTION", 30,
"SHAPE_ECHO", 31,
"SHAPE_MAX_HAS_ID", 32,
"SHAPE_BBCAGE", 32,
"SHAPE_MAX_HAS_SETVIS", 33,
"SHAPE_UCCAGE", 33,
"SHAPE_AXES", 34,
"SHAPE_HOVER", 35,
"SHAPE_FRANK", 36,
"SHAPE_MAX", 37,
"ATOM_INFRAME", 1,
"ATOM_VISSET", 2,
"ATOM_VISIBLE", 4,
"ATOM_NOTHIDDEN", 8,
"ATOM_NOFLAGS", -64,
"ATOM_INFRAME_NOTHIDDEN", 9,
"ATOM_SHAPE_VIS_MASK", -10,
"VIS_BOND_FLAG", 32,
"VIS_BALLS_FLAG", 16,
"VIS_LABEL_FLAG", 512,
"VIS_BACKBONE_FLAG", 8192,
"VIS_CARTOON_FLAG", 32768,
"ALPHA_CARBON_VISIBILITY_FLAG", 1040384,
"shapeClassBases", ["Balls", "Sticks", "Hsticks", "Sssticks", "Struts", "Labels", "Measures", "Stars", "Halos", "Backbone", "Trace", "Cartoon", "Strands", "MeshRibbon", "Ribbons", "Rockets", "Dots", "Dipoles", "Vectors", "GeoSurface", "Ellipsoids", "Polyhedra", "Draw", "CGO", "Isosurface", "Contact", "LcaoCartoon", "MolecularOrbital", "NBO", "Pmesh", "Plot3D", "Echo", "Bbcage", "Uccage", "Axes", "Hover", "Frank"],
"SCRIPT_COMPLETED", "Script completed",
"JPEG_EXTENSIONS", ";jpg;jpeg;jpg64;jpeg64;");
c$.IMAGE_TYPES = c$.prototype.IMAGE_TYPES = ";jpg;jpeg;jpg64;jpeg64;gif;gift;pdf;ppm;png;pngj;pngt;";
c$.IMAGE_OR_SCENE = c$.prototype.IMAGE_OR_SCENE = ";jpg;jpeg;jpg64;jpeg64;gif;gift;pdf;ppm;png;pngj;pngt;scene;";
{
{
}}Clazz_defineStatics (c$,
"hAlignNames", ["", "left", "center", "right", ""],
"vAlignNames", ["xy", "top", "bottom", "middle"],
"POINTER_NONE", 0,
"POINTER_ON", 1,
"POINTER_BACKGROUND", 2,
"VALIGN_XY", 0,
"VALIGN_TOP", 1,
"VALIGN_BOTTOM", 2,
"VALIGN_MIDDLE", 3,
"VALIGN_XYZ", 4,
"ALIGN_NONE", 0,
"ALIGN_LEFT", 1,
"ALIGN_CENTER", 2,
"ALIGN_RIGHT", 3,
"JSV_NOT", -1,
"JSV_SEND_JDXMOL", 0,
"JSV_SETPEAKS", 7,
"JSV_SELECT", 14,
"JSV_STRUCTURE", 21,
"JSV_SEND_H1SIMULATE", 28,
"READER_NOT_FOUND", "File reader was not found:");
});
Clazz_declarePackage ("JV");
Clazz_load (["java.io.IOException"], "JV.JmolAsyncException", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.fileName = null;
Clazz_instantialize (this, arguments);
}, JV, "JmolAsyncException", java.io.IOException);
Clazz_makeConstructor (c$, 
function (cacheName) {
Clazz_superConstructor (this, JV.JmolAsyncException, []);
this.fileName = cacheName;
}, "~S");
Clazz_defineMethod (c$, "getFileName", 
function () {
return this.fileName;
});
});
Clazz_declarePackage ("JV");
Clazz_load (null, "JV.ModelManager", ["JM.ModelLoader"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.modelSet = null;
this.modelSetPathName = null;
this.fileName = null;
Clazz_instantialize (this, arguments);
}, JV, "ModelManager");
Clazz_makeConstructor (c$, 
function (vwr) {
this.vwr = vwr;
}, "JV.Viewer");
Clazz_defineMethod (c$, "zap", 
function () {
this.modelSetPathName = this.fileName = null;
 new JM.ModelLoader (this.vwr, this.vwr.getZapName (), null, null, null, null);
});
Clazz_defineMethod (c$, "createModelSet", 
function (fullPathName, fileName, loadScript, atomSetCollection, bsNew, isAppend) {
var modelSetName = null;
if (isAppend) {
modelSetName = this.modelSet.modelSetName;
if (modelSetName.equals ("zapped")) modelSetName = null;
 else if (modelSetName.indexOf (" (modified)") < 0) modelSetName += " (modified)";
} else if (atomSetCollection == null) {
this.zap ();
} else {
this.modelSetPathName = fullPathName;
this.fileName = fileName;
}if (atomSetCollection != null) {
if (modelSetName == null) {
modelSetName = this.vwr.getModelAdapter ().getAtomSetCollectionName (atomSetCollection);
if (modelSetName != null) {
modelSetName = modelSetName.trim ();
if (modelSetName.length == 0) modelSetName = null;
}if (modelSetName == null) modelSetName = JV.ModelManager.reduceFilename (fileName);
} new JM.ModelLoader (this.vwr, modelSetName, loadScript, atomSetCollection, (isAppend ? this.modelSet : null), bsNew);
}if (this.modelSet.ac == 0 && !this.modelSet.getMSInfoB ("isPyMOL")) this.zap ();
}, "~S,~S,JU.SB,~O,JU.BS,~B");
c$.reduceFilename = Clazz_defineMethod (c$, "reduceFilename", 
 function (fileName) {
if (fileName == null) return null;
var ichDot = fileName.indexOf ('.');
if (ichDot > 0) fileName = fileName.substring (0, ichDot);
if (fileName.length > 24) fileName = fileName.substring (0, 20) + " ...";
return fileName;
}, "~S");
Clazz_defineMethod (c$, "createAtomDataSet", 
function (atomSetCollection, tokType) {
return JM.ModelLoader.createAtomDataSet (this.vwr, this.modelSet, tokType, atomSetCollection, this.vwr.bsA ());
}, "~O,~N");
});
Clazz_declarePackage ("JV");
c$ = Clazz_decorateAsClass (function () {
this.x = -1000;
this.y = -1000;
this.modifiers = 0;
this.time = -1;
this.name = null;
Clazz_instantialize (this, arguments);
}, JV, "MouseState");
Clazz_makeConstructor (c$, 
function (name) {
this.name = name;
}, "~S");
Clazz_defineMethod (c$, "set", 
function (time, x, y, modifiers) {
this.time = time;
this.x = x;
this.y = y;
this.modifiers = modifiers;
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "setCurrent", 
function (current, clickCount) {
this.time = current.time;
if (clickCount < 2) {
this.x = current.x;
this.y = current.y;
}this.modifiers = current.modifiers;
}, "JV.MouseState,~N");
Clazz_defineMethod (c$, "inRange", 
function (xyRange, x, y) {
return (Math.abs (this.x - x) <= xyRange && Math.abs (this.y - y) <= xyRange);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "check", 
function (xyRange, x, y, modifiers, time, delayMax) {
return (this.modifiers == modifiers && (delayMax >= 2147483647 ? this.inRange (xyRange, x, y) : time - this.time < delayMax && time - this.time > 20));
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "is", 
function (current) {
return (current.x == this.x && current.y == this.y && current.time == this.time);
}, "JV.MouseState");
Clazz_defineStatics (c$,
"MIN_DELAY_MS", 20);
Clazz_declarePackage ("JV");
Clazz_load (["JU.BS"], "JV.SelectionManager", ["JU.AU", "J.i18n.GT", "JU.BSUtil"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.listeners = null;
this.bsHidden = null;
this.bsSelection = null;
this.bsFixed = null;
this.bsSubset = null;
this.bsDeleted = null;
this.noneSelected = null;
this.empty = 1;
this.hideNotSelected = false;
this.bsTemp = null;
Clazz_instantialize (this, arguments);
}, JV, "SelectionManager");
Clazz_prepareFields (c$, function () {
this.listeners =  new Array (0);
this.bsHidden =  new JU.BS ();
this.bsSelection =  new JU.BS ();
this.bsFixed =  new JU.BS ();
this.bsTemp =  new JU.BS ();
});
Clazz_makeConstructor (c$, 
function (vwr) {
this.vwr = vwr;
}, "JV.Viewer");
Clazz_defineMethod (c$, "processDeletedModelAtoms", 
function (bsAtoms) {
if (this.bsDeleted != null) JU.BSUtil.deleteBits (this.bsDeleted, bsAtoms);
if (this.bsSubset != null) JU.BSUtil.deleteBits (this.bsSubset, bsAtoms);
JU.BSUtil.deleteBits (this.bsFixed, bsAtoms);
JU.BSUtil.deleteBits (this.bsHidden, bsAtoms);
var bs = JU.BSUtil.copy (this.bsSelection);
JU.BSUtil.deleteBits (bs, bsAtoms);
this.setSelectionSet (bs, 0);
}, "JU.BS");
Clazz_defineMethod (c$, "clear", 
function () {
this.clearSelection (true);
this.hide (null, null, 0, true);
this.setSelectionSubset (null);
this.bsDeleted = null;
this.setMotionFixedAtoms (null);
});
Clazz_defineMethod (c$, "display", 
function (modelSet, bs, addRemove, isQuiet) {
switch (addRemove) {
default:
var bsAll = modelSet.getModelAtomBitSetIncludingDeleted (-1, false);
this.bsHidden.or (bsAll);
case 1276118017:
if (bs != null) this.bsHidden.andNot (bs);
break;
case 1073742119:
if (bs != null) this.bsHidden.or (bs);
break;
}
JU.BSUtil.andNot (this.bsHidden, this.bsDeleted);
modelSet.setBsHidden (this.bsHidden);
if (!isQuiet) this.vwr.reportSelection (J.i18n.GT.i (J.i18n.GT._ ("{0} atoms hidden"), this.bsHidden.cardinality ()));
}, "JM.ModelSet,JU.BS,~N,~B");
Clazz_defineMethod (c$, "hide", 
function (modelSet, bs, addRemove, isQuiet) {
JV.SelectionManager.setBitSet (this.bsHidden, bs, addRemove);
if (modelSet != null) modelSet.setBsHidden (this.bsHidden);
if (!isQuiet) this.vwr.reportSelection (J.i18n.GT.i (J.i18n.GT._ ("{0} atoms hidden"), this.bsHidden.cardinality ()));
}, "JM.ModelSet,JU.BS,~N,~B");
Clazz_defineMethod (c$, "setSelectionSet", 
function (set, addRemove) {
JV.SelectionManager.setBitSet (this.bsSelection, set, addRemove);
this.empty = -1;
this.selectionChanged (false);
}, "JU.BS,~N");
c$.setBitSet = Clazz_defineMethod (c$, "setBitSet", 
 function (bsWhat, bs, addRemove) {
switch (addRemove) {
default:
bsWhat.clearAll ();
case 1276118017:
if (bs != null) bsWhat.or (bs);
break;
case 1073742119:
if (bs != null) bsWhat.andNot (bs);
break;
}
}, "JU.BS,JU.BS,~N");
Clazz_defineMethod (c$, "getHiddenSet", 
function () {
return this.bsHidden;
});
Clazz_defineMethod (c$, "getHideNotSelected", 
function () {
return this.hideNotSelected;
});
Clazz_defineMethod (c$, "setHideNotSelected", 
function (TF) {
this.hideNotSelected = TF;
if (TF) this.selectionChanged (false);
}, "~B");
Clazz_defineMethod (c$, "isSelected", 
function (atomIndex) {
return (atomIndex >= 0 && this.bsSelection.get (atomIndex));
}, "~N");
Clazz_defineMethod (c$, "select", 
function (bs, addRemove, isQuiet) {
if (bs == null) {
this.selectAll (true);
if (!this.vwr.getBoolean (1613758476)) this.excludeSelectionSet (this.vwr.ms.getAtoms (1613758476, null));
if (!this.vwr.getBoolean (1613758470)) this.excludeSelectionSet (this.vwr.ms.getAtoms (1613758470, null));
this.selectionChanged (false);
} else {
this.setSelectionSet (bs, addRemove);
}var reportChime = this.vwr.getBoolean (603979880);
if (!reportChime && isQuiet) return;
var n = this.getSelectionCount ();
if (reportChime) this.vwr.reportSelection ((n == 0 ? "No atoms" : n == 1 ? "1 atom" : n + " atoms") + " selected!");
 else if (!isQuiet) this.vwr.reportSelection (J.i18n.GT.i (J.i18n.GT._ ("{0} atoms selected"), n));
}, "JU.BS,~N,~B");
Clazz_defineMethod (c$, "selectAll", 
function (isQuiet) {
var count = this.vwr.ms.ac;
this.empty = (count == 0) ? 1 : 0;
for (var i = count; --i >= 0; ) this.bsSelection.set (i);

JU.BSUtil.andNot (this.bsSelection, this.bsDeleted);
this.selectionChanged (isQuiet);
}, "~B");
Clazz_defineMethod (c$, "clearSelection", 
function (isQuiet) {
this.setHideNotSelected (false);
this.bsSelection.clearAll ();
this.empty = 1;
this.selectionChanged (isQuiet);
}, "~B");
Clazz_defineMethod (c$, "isAtomSelected", 
function (atomIndex) {
return ((this.bsSubset == null || this.bsSubset.get (atomIndex)) && this.bsDeleted == null || !this.bsDeleted.get (atomIndex)) && this.bsSelection.get (atomIndex);
}, "~N");
Clazz_defineMethod (c$, "setSelectedAtom", 
function (atomIndex, TF) {
if (atomIndex < 0) {
this.selectionChanged (true);
return;
}if (this.bsSubset != null && !this.bsSubset.get (atomIndex) || this.bsDeleted != null && this.bsDeleted.get (atomIndex)) return;
this.bsSelection.setBitTo (atomIndex, TF);
if (TF) this.empty = 0;
 else this.empty = -1;
}, "~N,~B");
Clazz_defineMethod (c$, "setSelectionSubset", 
function (bs) {
this.bsSubset = bs;
}, "JU.BS");
Clazz_defineMethod (c$, "isInSelectionSubset", 
function (atomIndex) {
return (atomIndex < 0 || this.bsSubset == null || this.bsSubset.get (atomIndex));
}, "~N");
Clazz_defineMethod (c$, "invertSelection", 
function () {
JU.BSUtil.invertInPlace (this.bsSelection, this.vwr.ms.ac);
this.empty = (this.bsSelection.length () > 0 ? 0 : 1);
this.selectionChanged (false);
});
Clazz_defineMethod (c$, "excludeSelectionSet", 
 function (setExclude) {
if (setExclude == null || this.empty == 1) return;
this.bsSelection.andNot (setExclude);
this.empty = -1;
}, "JU.BS");
Clazz_defineMethod (c$, "getSelectionCount", 
function () {
if (this.empty == 1) return 0;
this.empty = 1;
var bs;
if (this.bsSubset != null) {
this.bsTemp.clearAll ();
this.bsTemp.or (this.bsSubset);
this.bsTemp.and (this.bsSelection);
bs = this.bsTemp;
} else {
bs = this.bsSelection;
}var count = bs.cardinality ();
if (count > 0) this.empty = 0;
return count;
});
Clazz_defineMethod (c$, "addListener", 
function (listener) {
for (var i = this.listeners.length; --i >= 0; ) if (this.listeners[i] === listener) {
this.listeners[i] = null;
break;
}
var len = this.listeners.length;
for (var i = len; --i >= 0; ) if (this.listeners[i] == null) {
this.listeners[i] = listener;
return;
}
if (this.listeners.length == 0) this.listeners =  new Array (1);
 else this.listeners = JU.AU.doubleLength (this.listeners);
this.listeners[len] = listener;
}, "J.api.JmolSelectionListener");
Clazz_defineMethod (c$, "selectionChanged", 
 function (isQuiet) {
if (this.hideNotSelected) this.hide (this.vwr.ms, JU.BSUtil.copyInvert (this.bsSelection, this.vwr.ms.ac), 0, isQuiet);
if (isQuiet || this.listeners.length == 0) return;
for (var i = this.listeners.length; --i >= 0; ) if (this.listeners[i] != null) this.listeners[i].selectionChanged (this.bsSelection);

}, "~B");
Clazz_defineMethod (c$, "deleteAtoms", 
function (bs) {
var bsNew = JU.BSUtil.copy (bs);
if (this.bsDeleted == null) {
this.bsDeleted = bsNew;
} else {
bsNew.andNot (this.bsDeleted);
this.bsDeleted.or (bs);
}this.bsHidden.andNot (this.bsDeleted);
this.bsSelection.andNot (this.bsDeleted);
return bsNew.cardinality ();
}, "JU.BS");
Clazz_defineMethod (c$, "getSelectedAtoms", 
function () {
if (this.bsSubset == null) return this.bsSelection;
var bs = JU.BSUtil.copy (this.bsSelection);
bs.and (this.bsSubset);
return bs;
});
Clazz_defineMethod (c$, "getSelectedAtomsNoSubset", 
function () {
return JU.BSUtil.copy (this.bsSelection);
});
Clazz_defineMethod (c$, "excludeAtoms", 
function (bs, ignoreSubset) {
if (this.bsDeleted != null) bs.andNot (this.bsDeleted);
if (!ignoreSubset && this.bsSubset != null) (bs = JU.BSUtil.copy (bs)).and (this.bsSubset);
return bs;
}, "JU.BS,~B");
Clazz_defineMethod (c$, "setMotionFixedAtoms", 
function (bs) {
this.bsFixed.clearAll ();
if (bs != null) this.bsFixed.or (bs);
}, "JU.BS");
Clazz_defineMethod (c$, "getMotionFixedAtoms", 
function () {
return this.bsFixed;
});
Clazz_defineStatics (c$,
"TRUE", 1,
"FALSE", 0,
"UNKNOWN", -1);
});
Clazz_declarePackage ("JV");
Clazz_load (null, "JV.ShapeManager", ["java.lang.Boolean", "JU.BS", "$.P3", "J.api.Interface", "J.c.PAL", "$.VDW", "JM.Atom", "JU.BSUtil", "JV.JC"], function () {
c$ = Clazz_decorateAsClass (function () {
this.ms = null;
this.shapes = null;
this.vwr = null;
this.bsRenderableAtoms = null;
this.navMinMax = null;
Clazz_instantialize (this, arguments);
}, JV, "ShapeManager");
Clazz_prepareFields (c$, function () {
this.navMinMax =  Clazz_newIntArray (4, 0);
});
Clazz_makeConstructor (c$, 
function (vwr) {
this.vwr = vwr;
this.bsRenderableAtoms =  new JU.BS ();
}, "JV.Viewer");
Clazz_defineMethod (c$, "findNearestShapeAtomIndex", 
function (x, y, closest, bsNot) {
if (this.shapes != null) for (var i = 0; i < this.shapes.length && closest[0] == null; ++i) if (this.shapes[i] != null) this.shapes[i].findNearestAtomIndex (x, y, closest, bsNot);

}, "~N,~N,~A,JU.BS");
Clazz_defineMethod (c$, "getShapes", 
function () {
return this.shapes;
});
Clazz_defineMethod (c$, "getShapePropertyIndex", 
function (shapeID, propertyName, index) {
if (this.shapes == null || this.shapes[shapeID] == null) return null;
this.vwr.setShapeErrorState (shapeID, "get " + propertyName);
var result = this.shapes[shapeID].getProperty (propertyName, index);
this.vwr.setShapeErrorState (-1, null);
return result;
}, "~N,~S,~N");
Clazz_defineMethod (c$, "getShapePropertyData", 
function (shapeID, propertyName, data) {
if (this.shapes == null || this.shapes[shapeID] == null) return false;
this.vwr.setShapeErrorState (shapeID, "get " + propertyName);
var result = this.shapes[shapeID].getPropertyData (propertyName, data);
this.vwr.setShapeErrorState (-1, null);
return result;
}, "~N,~S,~A");
Clazz_defineMethod (c$, "getShapeIdFromObjectName", 
function (objectName) {
if (this.shapes != null) for (var i = 16; i < 30; ++i) if (this.shapes[i] != null && this.shapes[i].getIndexFromName (objectName) >= 0) return i;

return -1;
}, "~S");
Clazz_defineMethod (c$, "loadDefaultShapes", 
function (newModelSet) {
this.ms = newModelSet;
if (this.shapes != null) for (var i = 0; i < this.shapes.length; ++i) if (this.shapes[i] != null) this.shapes[i].setModelSet (newModelSet);

this.loadShape (0);
this.loadShape (1);
}, "JM.ModelSet");
Clazz_defineMethod (c$, "loadShape", 
function (shapeID) {
if (this.shapes == null) return null;
if (this.shapes[shapeID] != null) return this.shapes[shapeID];
if (shapeID == 2 || shapeID == 3 || shapeID == 4) return null;
var className = JV.JC.getShapeClassName (shapeID, false);
var shape;
if ((shape = J.api.Interface.getInterface (className, this.vwr, "shape")) == null) return null;
this.vwr.setShapeErrorState (shapeID, "allocate");
shape.initializeShape (this.vwr, this.ms, shapeID);
this.vwr.setShapeErrorState (-1, null);
return this.shapes[shapeID] = shape;
}, "~N");
Clazz_defineMethod (c$, "refreshShapeTrajectories", 
function (baseModel, bs, mat) {
var Imodel = Integer.$valueOf (baseModel);
var bsModelAtoms = this.vwr.getModelUndeletedAtomsBitSet (baseModel);
for (var i = 0; i < 37; i++) if (this.shapes[i] != null) this.setShapePropertyBs (i, "refreshTrajectories", [Imodel, bs, mat], bsModelAtoms);

}, "~N,JU.BS,JU.M4");
Clazz_defineMethod (c$, "releaseShape", 
function (shapeID) {
if (this.shapes != null) this.shapes[shapeID] = null;
}, "~N");
Clazz_defineMethod (c$, "resetShapes", 
function () {
if (!this.vwr.noGraphicsAllowed) this.shapes =  new Array (37);
});
Clazz_defineMethod (c$, "setShapeSizeBs", 
function (shapeID, size, rd, bsSelected) {
if (this.shapes == null) return;
if (bsSelected == null && (shapeID != 1 || size != 2147483647)) bsSelected = this.vwr.bsA ();
if (rd != null && rd.value != 0 && rd.vdwType === J.c.VDW.TEMP) this.ms.getBfactor100Lo ();
this.vwr.setShapeErrorState (shapeID, "set size");
if (rd == null ? size != 0 : rd.value != 0) this.loadShape (shapeID);
if (this.shapes[shapeID] != null) {
this.shapes[shapeID].setShapeSizeRD (size, rd, bsSelected);
}this.vwr.setShapeErrorState (-1, null);
}, "~N,~N,J.atomdata.RadiusData,JU.BS");
Clazz_defineMethod (c$, "setLabel", 
function (strLabel, bsSelection) {
if (strLabel == null) {
if (this.shapes[5] == null) return;
} else {
this.loadShape (5);
this.setShapeSizeBs (5, 0, null, bsSelection);
}this.setShapePropertyBs (5, "label", strLabel, bsSelection);
}, "~O,JU.BS");
Clazz_defineMethod (c$, "setShapePropertyBs", 
function (shapeID, propertyName, value, bsSelected) {
if (this.shapes == null || this.shapes[shapeID] == null) return;
if (bsSelected == null) bsSelected = this.vwr.bsA ();
this.vwr.setShapeErrorState (shapeID, "set " + propertyName);
this.shapes[shapeID].setProperty (propertyName.intern (), value, bsSelected);
this.vwr.setShapeErrorState (-1, null);
}, "~N,~S,~O,JU.BS");
Clazz_defineMethod (c$, "checkFrankclicked", 
function (x, y) {
var frankShape = this.shapes[36];
return (frankShape != null && frankShape.wasClicked (x, y));
}, "~N,~N");
Clazz_defineMethod (c$, "checkObjectClicked", 
function (x, y, modifiers, bsVisible, drawPicking) {
var shape;
var map = null;
if (modifiers != 0 && this.vwr.getBondPicking () && (map = this.shapes[1].checkObjectClicked (x, y, modifiers, bsVisible, false)) != null) return map;
for (var i = 0; i < JV.ShapeManager.clickableMax; i++) if ((shape = this.shapes[JV.ShapeManager.hoverable[i]]) != null && (map = shape.checkObjectClicked (x, y, modifiers, bsVisible, drawPicking)) != null) return map;

return null;
}, "~N,~N,~N,JU.BS,~B");
Clazz_defineMethod (c$, "checkObjectDragged", 
function (prevX, prevY, x, y, modifiers, bsVisible, iShape) {
var found = false;
var n = (iShape > 0 ? iShape + 1 : 37);
for (var i = iShape; !found && i < n; ++i) if (this.shapes[i] != null) found = this.shapes[i].checkObjectDragged (prevX, prevY, x, y, modifiers, bsVisible);

return found;
}, "~N,~N,~N,~N,~N,JU.BS,~N");
Clazz_defineMethod (c$, "checkObjectHovered", 
function (x, y, bsVisible, checkBonds) {
var shape = this.shapes[1];
if (checkBonds && shape != null && shape.checkObjectHovered (x, y, bsVisible)) return true;
for (var i = 0; i < JV.ShapeManager.hoverable.length; i++) {
shape = this.shapes[JV.ShapeManager.hoverable[i]];
if (shape != null && shape.checkObjectHovered (x, y, bsVisible)) return true;
}
return false;
}, "~N,~N,JU.BS,~B");
Clazz_defineMethod (c$, "deleteShapeAtoms", 
function (value, bs) {
if (this.shapes != null) for (var j = 0; j < 37; j++) if (this.shapes[j] != null) this.setShapePropertyBs (j, "deleteModelAtoms", value, bs);

}, "~A,JU.BS");
Clazz_defineMethod (c$, "deleteVdwDependentShapes", 
function (bs) {
if (bs == null) bs = this.vwr.bsA ();
if (this.shapes[24] != null) this.shapes[24].setProperty ("deleteVdw", null, bs);
if (this.shapes[25] != null) this.shapes[25].setProperty ("deleteVdw", null, bs);
}, "JU.BS");
Clazz_defineMethod (c$, "getAtomShapeValue", 
function (tok, group, atomIndex) {
var iShape = JV.JC.shapeTokenIndex (tok);
if (iShape < 0 || this.shapes[iShape] == null) return 0;
var mad = this.shapes[iShape].getSize (atomIndex);
if (mad == 0) {
if ((group.shapeVisibilityFlags & this.shapes[iShape].vf) == 0) return 0;
mad = this.shapes[iShape].getSizeG (group);
}return mad / 2000;
}, "~N,JM.Group,~N");
Clazz_defineMethod (c$, "getObjectMap", 
function (map, withDollar) {
if (this.shapes == null) return;
var bDollar = Boolean.$valueOf (withDollar);
for (var i = 16; i < 30; ++i) this.getShapePropertyData (i, "getNames", [map, bDollar]);

}, "java.util.Map,~B");
Clazz_defineMethod (c$, "getProperty", 
function (paramInfo) {
if (paramInfo.equals ("getShapes")) return this.shapes;
return null;
}, "~O");
Clazz_defineMethod (c$, "getShape", 
function (i) {
return (this.shapes == null ? null : this.shapes[i]);
}, "~N");
Clazz_defineMethod (c$, "mergeShapes", 
function (newShapes) {
if (newShapes == null) return;
if (this.shapes == null) this.shapes = newShapes;
 else for (var i = 0; i < newShapes.length; ++i) if (newShapes[i] != null) {
if (this.shapes[i] == null) this.loadShape (i);
this.shapes[i].merge (newShapes[i]);
}
}, "~A");
Clazz_defineMethod (c$, "resetBioshapes", 
function (bsAllAtoms) {
if (this.shapes == null) return;
for (var i = 0; i < this.shapes.length; ++i) if (this.shapes[i] != null && this.shapes[i].isBioShape) {
this.shapes[i].setModelSet (this.ms);
this.shapes[i].setShapeSizeRD (0, null, bsAllAtoms);
this.shapes[i].setProperty ("color", J.c.PAL.NONE, bsAllAtoms);
}
}, "JU.BS");
Clazz_defineMethod (c$, "setAtomLabel", 
function (strLabel, i) {
if (this.shapes == null) return;
this.loadShape (5);
this.shapes[5].setProperty ("label:" + strLabel, Integer.$valueOf (i), null);
}, "~S,~N");
Clazz_defineMethod (c$, "setModelVisibility", 
function () {
var shapes = this.shapes;
if (shapes == null || shapes[0] == null) return;
var bs = this.vwr.getVisibleFramesBitSet ();
for (var i = 8; i < 33; i++) if (shapes[i] != null) shapes[i].setModelVisibilityFlags (bs);

var showHydrogens = this.vwr.getBoolean (603979922);
var bsDeleted = this.vwr.slm.bsDeleted;
var atoms = this.ms.at;
for (var i = this.ms.ac; --i >= 0; ) {
var atom = atoms[i];
atom.shapeVisibilityFlags &= -64;
if (bsDeleted != null && bsDeleted.get (i) || !showHydrogens && atom.getElementNumber () == 1) continue;
if (bs.get (atom.mi)) {
var f = 1;
if (!this.ms.isAtomHidden (i)) {
f |= 8;
if (atom.madAtom != 0) f |= 16;
atom.setShapeVisibility (f, true);
}}}
this.ms.clearVisibleSets ();
for (var i = 0; i < 37; ++i) {
var shape = shapes[i];
if (shape != null) shape.setAtomClickability ();
}
});
Clazz_defineMethod (c$, "finalizeAtoms", 
function (bsAtoms, ptOffset) {
var vwr = this.vwr;
var tm = vwr.tm;
var bs = this.bsRenderableAtoms;
if (bsAtoms != null) {
var ptCenter = this.ms.getAtomSetCenter (bsAtoms);
var pt =  new JU.P3 ();
tm.transformPt3f (ptCenter, pt);
pt.add (ptOffset);
tm.unTransformPoint (pt, pt);
pt.sub (ptCenter);
vwr.setAtomCoordsRelative (pt, bsAtoms);
ptOffset.set (0, 0, 0);
}this.ms.getRenderable (bs);
var vibrationVectors = this.ms.vibrations;
var vibs = (vibrationVectors != null && tm.vibrationOn);
var atoms = this.ms.at;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var atom = atoms[i];
var screen = (vibs && atom.hasVibration () ? tm.transformPtVib (atom, vibrationVectors[i]) : tm.transformPt (atom));
atom.sX = screen.x;
atom.sY = screen.y;
atom.sZ = screen.z;
var d = Math.abs (atom.madAtom);
if (d == JM.Atom.MAD_GLOBAL) d = Clazz_floatToInt (vwr.getFloat (1141899265) * 2000);
atom.sD = Clazz_floatToShort (vwr.tm.scaleToScreen (screen.z, d));
}
var gdata = vwr.gdata;
if (tm.slabEnabled) {
var slabByMolecule = vwr.getBoolean (603979940);
var slabByAtom = vwr.getBoolean (603979939);
var minZ = gdata.slab;
var maxZ = gdata.depth;
if (slabByMolecule) {
var molecules = this.ms.getMolecules ();
var moleculeCount = this.ms.getMoleculeCountInModel (-1);
for (var i = 0; i < moleculeCount; i++) {
var m = molecules[i];
var j = 0;
var pt = m.firstAtomIndex;
if (!bs.get (pt)) continue;
for (; j < m.ac; j++, pt++) if (gdata.isClippedZ (atoms[pt].sZ - (atoms[pt].sD >> 1))) break;

if (j != m.ac) {
pt = m.firstAtomIndex;
for (var k = 0; k < m.ac; k++) {
bs.clear (pt);
atoms[pt++].sZ = 0;
}
}}
}for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var atom = atoms[i];
if (gdata.isClippedZ (atom.sZ - (slabByAtom ? atoms[i].sD >> 1 : 0))) {
atom.setClickable (0);
var r = Clazz_doubleToInt ((slabByAtom ? -1 : 1) * atom.sD / 2);
if (atom.sZ + r < minZ || atom.sZ - r > maxZ || !gdata.isInDisplayRange (atom.sX, atom.sY)) {
bs.clear (i);
}}}
}if (this.ms.ac == 0 || !vwr.getShowNavigationPoint ()) return null;
var minX = 2147483647;
var maxX = -2147483648;
var minY = 2147483647;
var maxY = -2147483648;
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
var atom = atoms[i];
if (atom.sX < minX) minX = atom.sX;
if (atom.sX > maxX) maxX = atom.sX;
if (atom.sY < minY) minY = atom.sY;
if (atom.sY > maxY) maxY = atom.sY;
}
this.navMinMax[0] = minX;
this.navMinMax[1] = maxX;
this.navMinMax[2] = minY;
this.navMinMax[3] = maxY;
return this.navMinMax;
}, "JU.BS,JU.P3");
Clazz_defineMethod (c$, "setModelSet", 
function (modelSet) {
this.ms = this.vwr.ms = modelSet;
}, "JM.ModelSet");
Clazz_defineMethod (c$, "checkInheritedShapes", 
function () {
if (this.shapes[24] == null) return;
this.setShapePropertyBs (24, "remapInherited", null, null);
});
Clazz_defineMethod (c$, "restrictSelected", 
function (isBond, doInvert) {
var bsSelected = this.vwr.slm.getSelectedAtomsNoSubset ();
if (doInvert) {
this.vwr.slm.invertSelection ();
var bsSubset = this.vwr.slm.bsSubset;
if (bsSubset != null) {
bsSelected = this.vwr.slm.getSelectedAtomsNoSubset ();
bsSelected.and (bsSubset);
this.vwr.select (bsSelected, false, 0, true);
JU.BSUtil.invertInPlace (bsSelected, this.vwr.ms.ac);
bsSelected.and (bsSubset);
}}JU.BSUtil.andNot (bsSelected, this.vwr.slm.bsDeleted);
var bondmode = this.vwr.getBoolean (603979812);
if (!isBond) this.vwr.setBooleanProperty ("bondModeOr", true);
this.setShapeSizeBs (1, 0, null, null);
this.setShapePropertyBs (1, "type", Integer.$valueOf (32768), null);
this.setShapeSizeBs (1, 0, null, null);
this.setShapePropertyBs (1, "type", Integer.$valueOf (1023), null);
var bs = this.vwr.bsA ();
for (var iShape = 21; --iShape >= 0; ) if (iShape != 6 && this.getShape (iShape) != null) this.setShapeSizeBs (iShape, 0, null, bs);

if (this.getShape (21) != null) this.setShapePropertyBs (21, "delete", bs, null);
this.setLabel (null, bs);
if (!isBond) this.vwr.setBooleanProperty ("bondModeOr", bondmode);
this.vwr.select (bsSelected, false, 0, true);
}, "~B,~B");
Clazz_defineStatics (c$,
"hoverable", [31, 25, 24, 22, 36]);
c$.clickableMax = c$.prototype.clickableMax = JV.ShapeManager.hoverable.length - 1;
});
Clazz_declarePackage ("JV");
Clazz_load (["java.util.Hashtable"], ["JV.Connections", "$.Connection", "$.StateManager", "$.Scene"], ["java.util.Arrays", "JU.BS", "$.SB", "JM.Orientation", "JU.BSUtil"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.saved = null;
this.lastOrientation = "";
this.lastContext = "";
this.lastConnections = "";
this.lastScene = "";
this.lastSelected = "";
this.lastState = "";
this.lastShape = "";
this.lastCoordinates = "";
Clazz_instantialize (this, arguments);
}, JV, "StateManager");
Clazz_prepareFields (c$, function () {
this.saved =  new java.util.Hashtable ();
});
c$.getVariableList = Clazz_defineMethod (c$, "getVariableList", 
function (htVariables, nMax, withSites, definedOnly) {
var sb =  new JU.SB ();
var n = 0;
var list =  new Array (htVariables.size ());
for (var entry, $entry = htVariables.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var key = entry.getKey ();
var $var = entry.getValue ();
if ((withSites || !key.startsWith ("site_")) && (!definedOnly || key.charAt (0) == '@')) list[n++] = key + (key.charAt (0) == '@' ? " " + $var.asString () : " = " + JV.StateManager.varClip (key, $var.escape (), nMax));
}
java.util.Arrays.sort (list, 0, n);
for (var i = 0; i < n; i++) if (list[i] != null) sb.append ("  ").append (list[i]).append (";\n");

if (n == 0 && !definedOnly) sb.append ("# --no global user variables defined--;\n");
return sb.toString ();
}, "java.util.Map,~N,~B,~B");
c$.getObjectIdFromName = Clazz_defineMethod (c$, "getObjectIdFromName", 
function (name) {
if (name == null) return -1;
var objID = "background axis1      axis2      axis3      boundbox   unitcell   frank      ".indexOf (name.toLowerCase ());
return (objID < 0 ? objID : Clazz_doubleToInt (objID / 11));
}, "~S");
c$.getObjectNameFromId = Clazz_defineMethod (c$, "getObjectNameFromId", 
function (objId) {
if (objId < 0 || objId >= 8) return null;
return "background axis1      axis2      axis3      boundbox   unitcell   frank      ".substring (objId * 11, objId * 11 + 11).trim ();
}, "~N");
Clazz_makeConstructor (c$, 
function (vwr) {
this.vwr = vwr;
}, "JV.Viewer");
Clazz_defineMethod (c$, "clear", 
function (global) {
this.vwr.setShowAxes (false);
this.vwr.setShowBbcage (false);
this.vwr.setShowUnitCell (false);
global.clear ();
}, "JV.GlobalSettings");
Clazz_defineMethod (c$, "resetLighting", 
function () {
this.vwr.setIntProperty ("ambientPercent", 45);
this.vwr.setIntProperty ("celShadingPower", 10);
this.vwr.setIntProperty ("diffusePercent", 84);
this.vwr.setIntProperty ("phongExponent", 64);
this.vwr.setIntProperty ("specularExponent", 6);
this.vwr.setIntProperty ("specularPercent", 22);
this.vwr.setIntProperty ("specularPower", 40);
this.vwr.setIntProperty ("zDepth", 0);
this.vwr.setIntProperty ("zShadePower", 3);
this.vwr.setIntProperty ("zSlab", 50);
this.vwr.setBooleanProperty ("specular", true);
this.vwr.setBooleanProperty ("celShading", false);
this.vwr.setBooleanProperty ("zshade", false);
});
Clazz_defineMethod (c$, "setCrystallographicDefaults", 
function () {
this.vwr.setAxesMode (603979808);
this.vwr.setShowAxes (true);
this.vwr.setShowUnitCell (true);
this.vwr.setBooleanProperty ("perspectiveDepth", false);
});
Clazz_defineMethod (c$, "setCommonDefaults", 
 function () {
this.vwr.setBooleanProperty ("perspectiveDepth", true);
this.vwr.setFloatProperty ("bondTolerance", 0.45);
this.vwr.setFloatProperty ("minBondDistance", 0.4);
this.vwr.setIntProperty ("bondingVersion", 0);
this.vwr.setBooleanProperty ("translucent", true);
});
Clazz_defineMethod (c$, "setJmolDefaults", 
function () {
this.setCommonDefaults ();
this.vwr.setStringProperty ("defaultColorScheme", "Jmol");
this.vwr.setBooleanProperty ("axesOrientationRasmol", false);
this.vwr.setBooleanProperty ("zeroBasedXyzRasmol", false);
this.vwr.setIntProperty ("percentVdwAtom", 23);
this.vwr.setIntProperty ("bondRadiusMilliAngstroms", 150);
this.vwr.setVdwStr ("auto");
});
Clazz_defineMethod (c$, "setRasMolDefaults", 
function () {
this.setCommonDefaults ();
this.vwr.setStringProperty ("defaultColorScheme", "RasMol");
this.vwr.setBooleanProperty ("axesOrientationRasmol", true);
this.vwr.setBooleanProperty ("zeroBasedXyzRasmol", true);
this.vwr.setIntProperty ("percentVdwAtom", 0);
this.vwr.setIntProperty ("bondRadiusMilliAngstroms", 1);
this.vwr.setVdwStr ("Rasmol");
});
Clazz_defineMethod (c$, "setPyMOLDefaults", 
function () {
this.setCommonDefaults ();
this.vwr.setStringProperty ("measurementUnits", "ANGSTROMS");
this.vwr.setBooleanProperty ("zoomHeight", true);
});
c$.getNoCase = Clazz_defineMethod (c$, "getNoCase", 
 function (saved, name) {
for (var e, $e = saved.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) if (e.getKey ().equalsIgnoreCase (name)) return e.getValue ();

return null;
}, "java.util.Map,~S");
Clazz_defineMethod (c$, "listSavedStates", 
function () {
var names = "";
for (var name, $name = this.saved.keySet ().iterator (); $name.hasNext () && ((name = $name.next ()) || true);) names += "\n" + name;

return names;
});
Clazz_defineMethod (c$, "deleteSavedType", 
 function (type) {
var e = this.saved.keySet ().iterator ();
while (e.hasNext ()) if (e.next ().startsWith (type)) e.remove ();

}, "~S");
Clazz_defineMethod (c$, "deleteSaved", 
function (namelike) {
var e = this.saved.keySet ().iterator ();
while (e.hasNext ()) {
var name = e.next ();
if (name.startsWith (namelike) || name.endsWith ("_" + namelike) && name.indexOf ("_") == name.lastIndexOf ("_" + namelike)) e.remove ();
}
}, "~S");
Clazz_defineMethod (c$, "saveSelection", 
function (saveName, bsSelected) {
if (saveName.equalsIgnoreCase ("DELETE")) {
this.deleteSavedType ("Selected_");
return;
}saveName = this.lastSelected = "Selected_" + saveName;
this.saved.put (saveName, JU.BSUtil.copy (bsSelected));
}, "~S,JU.BS");
Clazz_defineMethod (c$, "restoreSelection", 
function (saveName) {
var name = (saveName.length > 0 ? "Selected_" + saveName : this.lastSelected);
var bsSelected = JV.StateManager.getNoCase (this.saved, name);
if (bsSelected == null) {
this.vwr.select ( new JU.BS (), false, 0, false);
return false;
}this.vwr.select (bsSelected, false, 0, false);
return true;
}, "~S");
Clazz_defineMethod (c$, "saveState", 
function (saveName) {
if (saveName.equalsIgnoreCase ("DELETE")) {
this.deleteSavedType ("State_");
return;
}saveName = this.lastState = "State_" + saveName;
this.saved.put (saveName, this.vwr.getStateInfo ());
}, "~S");
Clazz_defineMethod (c$, "getSavedState", 
function (saveName) {
var name = (saveName.length > 0 ? "State_" + saveName : this.lastState);
var script = JV.StateManager.getNoCase (this.saved, name);
return (script == null ? "" : script);
}, "~S");
Clazz_defineMethod (c$, "saveStructure", 
function (saveName) {
if (saveName.equalsIgnoreCase ("DELETE")) {
this.deleteSavedType ("Shape_");
return;
}saveName = this.lastShape = "Shape_" + saveName;
this.saved.put (saveName, this.vwr.getStructureState ());
}, "~S");
Clazz_defineMethod (c$, "getSavedStructure", 
function (saveName) {
var name = (saveName.length > 0 ? "Shape_" + saveName : this.lastShape);
var script = JV.StateManager.getNoCase (this.saved, name);
return (script == null ? "" : script);
}, "~S");
Clazz_defineMethod (c$, "saveCoordinates", 
function (saveName, bsSelected) {
if (saveName.equalsIgnoreCase ("DELETE")) {
this.deleteSavedType ("Coordinates_");
return;
}saveName = this.lastCoordinates = "Coordinates_" + saveName;
this.saved.put (saveName, this.vwr.getCoordinateState (bsSelected));
}, "~S,JU.BS");
Clazz_defineMethod (c$, "getSavedCoordinates", 
function (saveName) {
var name = (saveName.length > 0 ? "Coordinates_" + saveName : this.lastCoordinates);
var script = JV.StateManager.getNoCase (this.saved, name);
return (script == null ? "" : script);
}, "~S");
Clazz_defineMethod (c$, "getOrientation", 
function () {
return  new JM.Orientation (this.vwr, false, null);
});
Clazz_defineMethod (c$, "getSavedOrientationText", 
function (saveName) {
var o;
if (saveName != null) {
o = this.getOrientationFor (saveName);
return (o == null ? "" : o.getMoveToText (true));
}var sb =  new JU.SB ();
for (var e, $e = this.saved.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
var name = e.getKey ();
if (name.startsWith ("Orientation_")) sb.append ((e.getValue ()).getMoveToText (true));
}
return sb.toString ();
}, "~S");
Clazz_defineMethod (c$, "saveScene", 
function (saveName, scene) {
if (saveName.equalsIgnoreCase ("DELETE")) {
this.deleteSavedType ("Scene_");
return;
}var o =  new JV.Scene (scene);
o.saveName = this.lastScene = "Scene_" + saveName;
this.saved.put (o.saveName, o);
}, "~S,java.util.Map");
Clazz_defineMethod (c$, "restoreScene", 
function (saveName, timeSeconds) {
var o = JV.StateManager.getNoCase (this.saved, (saveName.length > 0 ? "Scene_" + saveName : this.lastScene));
return (o != null && o.restore (this.vwr, timeSeconds));
}, "~S,~N");
Clazz_defineMethod (c$, "saveOrientation", 
function (saveName, pymolView) {
if (saveName.equalsIgnoreCase ("DELETE")) {
this.deleteSavedType ("Orientation_");
return;
}var o =  new JM.Orientation (this.vwr, saveName.equalsIgnoreCase ("default"), pymolView);
o.saveName = this.lastOrientation = "Orientation_" + saveName;
this.saved.put (o.saveName, o);
}, "~S,~A");
Clazz_defineMethod (c$, "restoreOrientation", 
function (saveName, timeSeconds, isAll) {
var o = this.getOrientationFor (saveName);
return (o != null && o.restore (timeSeconds, isAll));
}, "~S,~N,~B");
Clazz_defineMethod (c$, "getOrientationFor", 
 function (saveName) {
var name = (saveName.length > 0 ? "Orientation_" + saveName : this.lastOrientation);
return JV.StateManager.getNoCase (this.saved, name);
}, "~S");
Clazz_defineMethod (c$, "saveContext", 
function (saveName, context) {
if (saveName.equalsIgnoreCase ("DELETE")) {
this.deleteSavedType ("Context_");
return;
}this.saved.put ((this.lastContext = "Context_" + saveName), context);
}, "~S,~O");
Clazz_defineMethod (c$, "getContext", 
function (saveName) {
return this.saved.get (saveName.length == 0 ? this.lastContext : "Context_" + saveName);
}, "~S");
Clazz_defineMethod (c$, "saveBonds", 
function (saveName) {
if (saveName.equalsIgnoreCase ("DELETE")) {
this.deleteSavedType ("Bonds_");
return;
}var b =  new JV.Connections (this.vwr);
b.saveName = this.lastConnections = "Bonds_" + saveName;
this.saved.put (b.saveName, b);
}, "~S");
Clazz_defineMethod (c$, "restoreBonds", 
function (saveName) {
this.vwr.clearModelDependentObjects ();
var name = (saveName.length > 0 ? "Bonds_" + saveName : this.lastConnections);
var c = JV.StateManager.getNoCase (this.saved, name);
return (c != null && c.restore ());
}, "~S");
c$.varClip = Clazz_defineMethod (c$, "varClip", 
function (name, sv, nMax) {
if (nMax > 0 && sv.length > nMax) sv = sv.substring (0, nMax) + " #...more (" + sv.length + " bytes -- use SHOW " + name + " or MESSAGE @" + name + " to view)";
return sv;
}, "~S,~S,~N");
Clazz_defineStatics (c$,
"OBJ_BACKGROUND", 0,
"OBJ_AXIS1", 1,
"OBJ_AXIS2", 2,
"OBJ_AXIS3", 3,
"OBJ_BOUNDBOX", 4,
"OBJ_UNITCELL", 5,
"OBJ_FRANK", 6,
"OBJ_MAX", 8,
"objectNameList", "background axis1      axis2      axis3      boundbox   unitcell   frank      ");
c$ = Clazz_decorateAsClass (function () {
this.saveName = null;
this.scene = null;
Clazz_instantialize (this, arguments);
}, JV, "Scene");
Clazz_makeConstructor (c$, 
function (scene) {
this.scene = scene;
}, "java.util.Map");
Clazz_defineMethod (c$, "restore", 
function (vwr, timeSeconds) {
var gen = this.scene.get ("generator");
if (gen != null) gen.generateScene (this.scene);
var pv = this.scene.get ("pymolView");
return (pv != null && vwr.tm.moveToPyMOL (vwr.eval, timeSeconds, pv));
}, "JV.Viewer,~N");
c$ = Clazz_decorateAsClass (function () {
this.saveName = null;
this.bondCount = 0;
this.connections = null;
this.vwr = null;
Clazz_instantialize (this, arguments);
}, JV, "Connections");
Clazz_makeConstructor (c$, 
function (vwr) {
var modelSet = vwr.ms;
if (modelSet == null) return;
this.vwr = vwr;
this.bondCount = modelSet.bondCount;
this.connections =  new Array (this.bondCount + 1);
var bonds = modelSet.bo;
for (var i = this.bondCount; --i >= 0; ) {
var b = bonds[i];
this.connections[i] =  new JV.Connection (b.atom1.i, b.atom2.i, b.mad, b.colix, b.order, b.getEnergy (), b.shapeVisibilityFlags);
}
}, "JV.Viewer");
Clazz_defineMethod (c$, "restore", 
function () {
var modelSet = this.vwr.ms;
if (modelSet == null) return false;
modelSet.deleteAllBonds ();
for (var i = this.bondCount; --i >= 0; ) {
var c = this.connections[i];
var ac = modelSet.ac;
if (c.atomIndex1 >= ac || c.atomIndex2 >= ac) continue;
var b = modelSet.bondAtoms (modelSet.at[c.atomIndex1], modelSet.at[c.atomIndex2], c.order, c.mad, null, c.energy, false, true);
b.colix = c.colix;
b.shapeVisibilityFlags = c.shapeVisibilityFlags;
}
for (var i = this.bondCount; --i >= 0; ) modelSet.bo[i].index = i;

this.vwr.setShapeProperty (1, "reportAll", null);
return true;
});
c$ = Clazz_decorateAsClass (function () {
this.atomIndex1 = 0;
this.atomIndex2 = 0;
this.mad = 0;
this.colix = 0;
this.order = 0;
this.energy = 0;
this.shapeVisibilityFlags = 0;
Clazz_instantialize (this, arguments);
}, JV, "Connection");
Clazz_makeConstructor (c$, 
function (atom1, atom2, mad, colix, order, energy, shapeVisibilityFlags) {
this.atomIndex1 = atom1;
this.atomIndex2 = atom2;
this.mad = mad;
this.colix = colix;
this.order = order;
this.energy = energy;
this.shapeVisibilityFlags = shapeVisibilityFlags;
}, "~N,~N,~N,~N,~N,~N,~N");
});
Clazz_declarePackage ("JV");
Clazz_load (["java.util.Hashtable"], "JV.StatusManager", ["java.lang.Boolean", "$.Float", "javajs.awt.Dimension", "JU.Lst", "$.PT", "J.api.Interface", "J.c.CBK", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.jsl = null;
this.cbl = null;
this.statusList = "";
this.allowStatusReporting = false;
this.messageQueue = null;
this.statusPtr = 0;
this.jmolScriptCallbacks = null;
this.minSyncRepeatMs = 100;
this.syncingScripts = false;
this.syncingMouse = false;
this.drivingSync = false;
this.isSynced = false;
this.syncDisabled = false;
this.stereoSync = false;
this.qualityJPG = -1;
this.qualityPNG = -1;
this.imageType = null;
Clazz_instantialize (this, arguments);
}, JV, "StatusManager");
Clazz_prepareFields (c$, function () {
this.messageQueue =  new java.util.Hashtable ();
this.jmolScriptCallbacks =  new java.util.Hashtable ();
});
Clazz_makeConstructor (c$, 
function (vwr) {
this.vwr = vwr;
}, "JV.Viewer");
Clazz_defineMethod (c$, "recordStatus", 
 function (statusName) {
return (this.allowStatusReporting && this.statusList.length > 0 && (this.statusList.equals ("all") || this.statusList.indexOf (statusName) >= 0));
}, "~S");
Clazz_defineMethod (c$, "setStatusChanged", 
 function (statusName, intInfo, statusInfo, isReplace) {
if (!this.recordStatus (statusName)) return;
var msgRecord =  new JU.Lst ();
msgRecord.addLast (Integer.$valueOf (++this.statusPtr));
msgRecord.addLast (statusName);
msgRecord.addLast (Integer.$valueOf (intInfo));
msgRecord.addLast (statusInfo);
var statusRecordSet = (isReplace ? null : this.messageQueue.get (statusName));
if (statusRecordSet == null) this.messageQueue.put (statusName, statusRecordSet =  new JU.Lst ());
 else if (statusRecordSet.size () == JV.StatusManager.MAXIMUM_QUEUE_LENGTH) statusRecordSet.remove (0);
statusRecordSet.addLast (msgRecord);
}, "~S,~N,~O,~B");
Clazz_defineMethod (c$, "getStatusChanged", 
function (newStatusList) {
var isRemove = (newStatusList.length > 0 && newStatusList.charAt (0) == '-');
var isAdd = (newStatusList.length > 0 && newStatusList.charAt (0) == '+');
var getList = false;
if (isRemove) {
this.statusList = JU.PT.rep (this.statusList, newStatusList.substring (1, newStatusList.length), "");
} else {
newStatusList = JU.PT.rep (newStatusList, "+", "");
if (this.statusList.equals (newStatusList) || isAdd && this.statusList.indexOf (newStatusList) >= 0) {
getList = true;
} else {
if (!isAdd) this.statusList = "";
this.statusList += newStatusList;
if (JU.Logger.debugging) JU.Logger.debug ("StatusManager messageQueue = " + this.statusList);
}}var list =  new JU.Lst ();
if (getList) for (var e, $e = this.messageQueue.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) list.addLast (e.getValue ());

this.messageQueue.clear ();
this.statusPtr = 0;
return list;
}, "~S");
Clazz_defineMethod (c$, "setJmolStatusListener", 
function (jmolStatusListener, jmolCallbackListener) {
this.jsl = jmolStatusListener;
this.cbl = (jmolCallbackListener == null ? jmolStatusListener : jmolCallbackListener);
}, "J.api.JmolStatusListener,J.api.JmolCallbackListener");
Clazz_defineMethod (c$, "setJmolCallbackListener", 
function (jmolCallbackListener) {
this.cbl = jmolCallbackListener;
}, "J.api.JmolCallbackListener");
Clazz_defineMethod (c$, "jmolScriptCallback", 
 function (callback) {
var s = this.jmolScriptCallbacks.get (callback);
if (s != null) this.vwr.evalStringQuietSync (s, true, false);
return s;
}, "J.c.CBK");
Clazz_defineMethod (c$, "setCallbackFunction", 
function (callbackType, callbackFunction) {
var callback = J.c.CBK.getCallback (callbackType);
System.out.println ("callback set for " + callbackType + " " + callbackFunction + " " + callback);
if (callback != null) {
var pt = (callbackFunction == null ? 0 : callbackFunction.length > 7 && callbackFunction.toLowerCase ().indexOf ("script:") == 0 ? 7 : callbackFunction.length > 11 && callbackFunction.toLowerCase ().indexOf ("jmolscript:") == 0 ? 11 : 0);
if (pt == 0) this.jmolScriptCallbacks.remove (callback);
 else this.jmolScriptCallbacks.put (callback, callbackFunction.substring (pt).trim ());
}if (this.cbl != null) this.cbl.setCallbackFunction (callbackType, callbackFunction);
}, "~S,~S");
Clazz_defineMethod (c$, "notifyEnabled", 
 function (type) {
return this.cbl != null && this.cbl.notifyEnabled (type);
}, "J.c.CBK");
Clazz_defineMethod (c$, "setStatusAppletReady", 
function (htmlName, isReady) {
var sJmol = (isReady ? this.jmolScriptCallback (J.c.CBK.APPLETREADY) : null);
if (this.notifyEnabled (J.c.CBK.APPLETREADY)) this.cbl.notifyCallback (J.c.CBK.APPLETREADY, [sJmol, htmlName, Boolean.$valueOf (isReady), null]);
}, "~S,~B");
Clazz_defineMethod (c$, "setStatusAtomMoved", 
function (bsMoved) {
var sJmol = this.jmolScriptCallback (J.c.CBK.ATOMMOVED);
this.setStatusChanged ("atomMoved", -1, bsMoved, false);
if (this.notifyEnabled (J.c.CBK.ATOMMOVED)) this.cbl.notifyCallback (J.c.CBK.ATOMMOVED, [sJmol, bsMoved]);
}, "JU.BS");
Clazz_defineMethod (c$, "setStatusAtomPicked", 
function (atomIndex, strInfo, map) {
var sJmol = this.jmolScriptCallback (J.c.CBK.PICK);
JU.Logger.info ("setStatusAtomPicked(" + atomIndex + "," + strInfo + ")");
this.setStatusChanged ("atomPicked", atomIndex, strInfo, false);
if (this.notifyEnabled (J.c.CBK.PICK)) this.cbl.notifyCallback (J.c.CBK.PICK, [sJmol, strInfo, Integer.$valueOf (atomIndex), map]);
}, "~N,~S,java.util.Map");
Clazz_defineMethod (c$, "setStatusClicked", 
function (x, y, action, clickCount, mode) {
var sJmol = this.jmolScriptCallback (J.c.CBK.CLICK);
if (!this.notifyEnabled (J.c.CBK.CLICK)) return action;
var m = [action, mode];
this.cbl.notifyCallback (J.c.CBK.CLICK, [sJmol, Integer.$valueOf (x), Integer.$valueOf (y), Integer.$valueOf (action), Integer.$valueOf (clickCount), m]);
return m[0];
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "setStatusResized", 
function (width, height) {
var sJmol = this.jmolScriptCallback (J.c.CBK.RESIZE);
if (this.notifyEnabled (J.c.CBK.RESIZE)) this.cbl.notifyCallback (J.c.CBK.RESIZE, [sJmol, Integer.$valueOf (width), Integer.$valueOf (height)]);
}, "~N,~N");
Clazz_defineMethod (c$, "haveHoverCallback", 
function () {
return (this.jmolScriptCallbacks.containsKey (J.c.CBK.HOVER) || this.notifyEnabled (J.c.CBK.HOVER));
});
Clazz_defineMethod (c$, "setStatusAtomHovered", 
function (iatom, strInfo) {
var sJmol = this.jmolScriptCallback (J.c.CBK.HOVER);
if (this.notifyEnabled (J.c.CBK.HOVER)) this.cbl.notifyCallback (J.c.CBK.HOVER, [sJmol, strInfo, Integer.$valueOf (iatom)]);
}, "~N,~S");
Clazz_defineMethod (c$, "setStatusObjectHovered", 
function (id, strInfo, pt) {
var sJmol = this.jmolScriptCallback (J.c.CBK.HOVER);
if (this.notifyEnabled (J.c.CBK.HOVER)) this.cbl.notifyCallback (J.c.CBK.HOVER, [sJmol, strInfo, Integer.$valueOf (-1), id, Float.$valueOf (pt.x), Float.$valueOf (pt.y), Float.$valueOf (pt.z)]);
}, "~S,~S,JU.T3");
Clazz_defineMethod (c$, "setFileLoadStatus", 
function (fullPathName, fileName, modelName, errorMsg, ptLoad, doCallback, isAsync) {
if (fullPathName == null && "resetUndo".equals (fileName)) {
var appConsole = this.vwr.getProperty ("DATA_API", "getAppConsole", null);
if (appConsole != null) appConsole.zap ();
fileName = this.vwr.getZapName ();
}this.setStatusChanged ("fileLoaded", ptLoad, fullPathName, false);
if (errorMsg != null) this.setStatusChanged ("fileLoadError", ptLoad, errorMsg, false);
var sJmol = this.jmolScriptCallback (J.c.CBK.LOADSTRUCT);
if (doCallback && this.notifyEnabled (J.c.CBK.LOADSTRUCT)) {
var name = this.vwr.getP ("_smilesString");
if (name.length != 0) fileName = name;
this.cbl.notifyCallback (J.c.CBK.LOADSTRUCT, [sJmol, fullPathName, fileName, modelName, errorMsg, Integer.$valueOf (ptLoad), this.vwr.getP ("_modelNumber"), this.vwr.getModelNumberDotted (this.vwr.ms.mc - 1), isAsync]);
}}, "~S,~S,~S,~S,~N,~B,Boolean");
Clazz_defineMethod (c$, "setStatusFrameChanged", 
function (fileNo, modelNo, firstNo, lastNo, currentFrame, currentMorphModel, entryName) {
if (this.vwr.ms == null) return;
var animating = this.vwr.am.animationOn;
var frameNo = (animating ? -2 - currentFrame : currentFrame);
this.setStatusChanged ("frameChanged", frameNo, (currentFrame >= 0 ? this.vwr.getModelNumberDotted (currentFrame) : ""), false);
var sJmol = this.jmolScriptCallback (J.c.CBK.ANIMFRAME);
if (this.notifyEnabled (J.c.CBK.ANIMFRAME)) this.cbl.notifyCallback (J.c.CBK.ANIMFRAME, [sJmol, [frameNo, fileNo, modelNo, firstNo, lastNo, currentFrame], entryName, Float.$valueOf (currentMorphModel)]);
if (!animating) this.vwr.checkMenuUpdate ();
}, "~N,~N,~N,~N,~N,~N,~S");
Clazz_defineMethod (c$, "setStatusDragDropped", 
function (mode, x, y, fileName) {
this.setStatusChanged ("dragDrop", 0, "", false);
var sJmol = this.jmolScriptCallback (J.c.CBK.DRAGDROP);
if (!this.notifyEnabled (J.c.CBK.DRAGDROP)) return false;
this.cbl.notifyCallback (J.c.CBK.DRAGDROP, [sJmol, Integer.$valueOf (mode), Integer.$valueOf (x), Integer.$valueOf (y), fileName]);
return true;
}, "~N,~N,~N,~S");
Clazz_defineMethod (c$, "setScriptEcho", 
function (strEcho, isScriptQueued) {
if (strEcho == null) return;
this.setStatusChanged ("scriptEcho", 0, strEcho, false);
var sJmol = this.jmolScriptCallback (J.c.CBK.ECHO);
if (this.notifyEnabled (J.c.CBK.ECHO)) this.cbl.notifyCallback (J.c.CBK.ECHO, [sJmol, strEcho, Integer.$valueOf (isScriptQueued ? 1 : 0)]);
}, "~S,~B");
Clazz_defineMethod (c$, "setStatusMeasuring", 
function (status, intInfo, strMeasure, value) {
this.setStatusChanged (status, intInfo, strMeasure, false);
var sJmol = null;
if (status.equals ("measureCompleted")) {
JU.Logger.info ("measurement[" + intInfo + "] = " + strMeasure);
sJmol = this.jmolScriptCallback (J.c.CBK.MEASURE);
} else if (status.equals ("measurePicked")) {
this.setStatusChanged ("measurePicked", intInfo, strMeasure, false);
JU.Logger.info ("measurePicked " + intInfo + " " + strMeasure);
}if (this.notifyEnabled (J.c.CBK.MEASURE)) this.cbl.notifyCallback (J.c.CBK.MEASURE, [sJmol, strMeasure, Integer.$valueOf (intInfo), status, Float.$valueOf (value)]);
}, "~S,~N,~S,~N");
Clazz_defineMethod (c$, "notifyError", 
function (errType, errMsg, errMsgUntranslated) {
var sJmol = this.jmolScriptCallback (J.c.CBK.ERROR);
if (this.notifyEnabled (J.c.CBK.ERROR)) this.cbl.notifyCallback (J.c.CBK.ERROR, [sJmol, errType, errMsg, this.vwr.getShapeErrorState (), errMsgUntranslated]);
}, "~S,~S,~S");
Clazz_defineMethod (c$, "notifyMinimizationStatus", 
function (minStatus, minSteps, minEnergy, minEnergyDiff, ff) {
var sJmol = this.jmolScriptCallback (J.c.CBK.MINIMIZATION);
if (this.notifyEnabled (J.c.CBK.MINIMIZATION)) this.cbl.notifyCallback (J.c.CBK.MINIMIZATION, [sJmol, minStatus, minSteps, minEnergy, minEnergyDiff, ff]);
}, "~S,Integer,Float,Float,~S");
Clazz_defineMethod (c$, "setScriptStatus", 
function (strStatus, statusMessage, msWalltime, strErrorMessageUntranslated) {
if (msWalltime < -1) {
var iscript = -2 - msWalltime;
this.setStatusChanged ("scriptStarted", iscript, statusMessage, false);
strStatus = "script " + iscript + " started";
} else if (strStatus == null) {
return;
}var sJmol = (msWalltime == 0 ? this.jmolScriptCallback (J.c.CBK.SCRIPT) : null);
var isScriptCompletion = (strStatus === "Script completed");
if (this.recordStatus ("script")) {
var isError = (strErrorMessageUntranslated != null);
this.setStatusChanged ((isError ? "scriptError" : "scriptStatus"), 0, strStatus, false);
if (isError || isScriptCompletion) this.setStatusChanged ("scriptTerminated", 1, "Jmol script terminated" + (isError ? " unsuccessfully: " + strStatus : " successfully"), false);
}var data;
if (isScriptCompletion && this.vwr.getBoolean (603979880) && this.vwr.getBoolean (603979825)) {
data = [null, "script <exiting>", statusMessage, Integer.$valueOf (-1), strErrorMessageUntranslated];
if (this.notifyEnabled (J.c.CBK.SCRIPT)) this.cbl.notifyCallback (J.c.CBK.SCRIPT, data);
this.processScript (data);
strStatus = "Jmol script completed.";
}data = [sJmol, strStatus, statusMessage, Integer.$valueOf (isScriptCompletion ? -1 : msWalltime), strErrorMessageUntranslated];
if (this.notifyEnabled (J.c.CBK.SCRIPT)) this.cbl.notifyCallback (J.c.CBK.SCRIPT, data);
this.processScript (data);
}, "~S,~S,~N,~S");
Clazz_defineMethod (c$, "processScript", 
 function (data) {
var msWalltime = (data[3]).intValue ();
if (this.vwr.scriptEditor != null) {
if (msWalltime > 0) {
this.vwr.scriptEditor.notifyScriptTermination ();
} else if (msWalltime < 0) {
if (msWalltime == -2) this.vwr.scriptEditor.notifyScriptStart ();
} else if (this.vwr.scriptEditor.isVisible () && (data[2]).length > 0) {
this.vwr.scriptEditor.notifyContext (this.vwr.getScriptContext ("SE notify"), data);
}}if (this.vwr.appConsole != null) {
if (msWalltime == 0) {
var strInfo = (data[1] == null ? null : data[1].toString ());
this.vwr.appConsole.sendConsoleMessage (strInfo);
}}}, "~A");
Clazz_defineMethod (c$, "doSync", 
function () {
return (this.isSynced && this.drivingSync && !this.syncDisabled);
});
Clazz_defineMethod (c$, "setSync", 
function (mouseCommand) {
if (this.syncingMouse) {
if (mouseCommand != null) this.syncSend (mouseCommand, "*", 0);
} else if (!this.syncingScripts) this.syncSend ("!" + this.vwr.tm.getMoveToText (this.minSyncRepeatMs / 1000, false), "*", 0);
}, "~S");
Clazz_defineMethod (c$, "setSyncDriver", 
function (syncMode) {
if (this.stereoSync && syncMode != 4) {
this.syncSend ("SET_GRAPHICS_OFF", "*", 0);
this.stereoSync = false;
}switch (syncMode) {
case 4:
if (!this.syncDisabled) return;
this.syncDisabled = false;
break;
case 3:
this.syncDisabled = true;
break;
case 5:
this.drivingSync = true;
this.isSynced = true;
this.stereoSync = true;
break;
case 1:
this.drivingSync = true;
this.isSynced = true;
break;
case 2:
this.drivingSync = false;
this.isSynced = true;
break;
default:
this.drivingSync = false;
this.isSynced = false;
}
if (JU.Logger.debugging) {
JU.Logger.debug (this.vwr.appletName + " sync mode=" + syncMode + "; synced? " + this.isSynced + "; driving? " + this.drivingSync + "; disabled? " + this.syncDisabled);
}}, "~N");
Clazz_defineMethod (c$, "syncSend", 
function (script, appletName, port) {
if (port != 0 || this.notifyEnabled (J.c.CBK.SYNC)) this.cbl.notifyCallback (J.c.CBK.SYNC, [null, script, appletName, Integer.$valueOf (port)]);
}, "~S,~S,~N");
Clazz_defineMethod (c$, "modifySend", 
function (atomIndex, modelIndex, mode, msg) {
if (this.notifyEnabled (J.c.CBK.STRUCTUREMODIFIED)) this.cbl.notifyCallback (J.c.CBK.STRUCTUREMODIFIED, [null, Integer.$valueOf (mode), Integer.$valueOf (atomIndex), Integer.$valueOf (modelIndex), msg]);
}, "~N,~N,~N,~S");
Clazz_defineMethod (c$, "getSyncMode", 
function () {
return (!this.isSynced ? 0 : this.drivingSync ? 1 : 2);
});
Clazz_defineMethod (c$, "showUrl", 
function (urlString) {
if (this.jsl != null) this.jsl.showUrl (urlString);
}, "~S");
Clazz_defineMethod (c$, "clearConsole", 
function () {
if (this.vwr.appConsole != null) {
this.vwr.appConsole.sendConsoleMessage (null);
}if (this.jsl != null) this.cbl.notifyCallback (J.c.CBK.MESSAGE, null);
});
Clazz_defineMethod (c$, "functionXY", 
function (functionName, nX, nY) {
return (this.jsl == null ?  Clazz_newFloatArray (Math.abs (nX), Math.abs (nY), 0) : this.jsl.functionXY (functionName, nX, nY));
}, "~S,~N,~N");
Clazz_defineMethod (c$, "functionXYZ", 
function (functionName, nX, nY, nZ) {
return (this.jsl == null ?  Clazz_newFloatArray (Math.abs (nX), Math.abs (nY), Math.abs (nY), 0) : this.jsl.functionXYZ (functionName, nX, nY, nZ));
}, "~S,~N,~N,~N");
Clazz_defineMethod (c$, "jsEval", 
function (strEval) {
return (this.jsl == null ? "" : this.jsl.eval (strEval));
}, "~S");
Clazz_defineMethod (c$, "createImage", 
function (fileNameOrError, type, text, bytes, quality) {
return (this.jsl == null ? null : this.jsl.createImage (fileNameOrError, type, text == null ? bytes : text, quality));
}, "~S,~S,~S,~A,~N");
Clazz_defineMethod (c$, "getRegistryInfo", 
function () {
return (this.jsl == null ? null : this.jsl.getRegistryInfo ());
});
Clazz_defineMethod (c$, "dialogAsk", 
function (type, fileName) {
var isImage = type.equals ("Save Image");
var sd = J.api.Interface.getOption ("dialog.Dialog", this.vwr, "status");
if (sd == null) return null;
sd.setupUI (false);
if (isImage) sd.setImageInfo (this.qualityJPG, this.qualityPNG, this.imageType);
var outputFileName = sd.getFileNameFromDialog (this.vwr, type, fileName);
if (isImage && outputFileName != null) {
this.qualityJPG = sd.getQuality ("JPG");
this.qualityPNG = sd.getQuality ("PNG");
var sType = sd.getType ();
if (sType != null) this.imageType = sType;
}return outputFileName;
}, "~S,~S");
Clazz_defineMethod (c$, "getJspecViewProperties", 
function (myParam) {
return (this.jsl == null ? null : this.jsl.getJSpecViewProperty (myParam == null || myParam.length == 0 ? "" : ":" + myParam));
}, "~S");
Clazz_defineMethod (c$, "resizeInnerPanel", 
function (width, height) {
return (this.jsl == null ?  new javajs.awt.Dimension (width, height) : this.jsl.resizeInnerPanel ("preferredWidthHeight " + width + " " + height + ";"));
}, "~N,~N");
Clazz_defineStatics (c$,
"MAXIMUM_QUEUE_LENGTH", 16,
"SYNC_OFF", 0,
"SYNC_DRIVER", 1,
"SYNC_SLAVE", 2,
"SYNC_DISABLE", 3,
"SYNC_ENABLE", 4,
"SYNC_STEREO", 5);
});
Clazz_declarePackage ("JV");
Clazz_load (["JU.A4", "$.M3", "$.M4", "$.P3", "$.P3i", "$.V3", "J.c.STER", "JU.Point3fi"], "JV.TransformManager", ["java.lang.Boolean", "$.Float", "java.util.Hashtable", "JU.P4", "$.Quat", "$.SB", "J.api.Interface", "JU.Escape", "$.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vwr = null;
this.movetoThread = null;
this.vibrationThread = null;
this.spinThread = null;
this.perspectiveModel = 11;
this.cameraScaleFactor = 0;
this.referencePlaneOffset = 0;
this.aperatureAngle = 0;
this.cameraDistanceFromCenter = 0;
this.modelCenterOffset = 0;
this.modelRadius = 0;
this.modelRadiusPixels = 0;
this.navigationCenter = null;
this.navigationOffset = null;
this.navigationShiftXY = null;
this.navigationDepthPercent = 0;
this.matrixTemp = null;
this.vectorTemp = null;
this.haveNotifiedNaN = false;
this.spinX = 0;
this.spinY = 30;
this.spinZ = 0;
this.spinFps = 30;
this.navX = 0;
this.navY = 0;
this.navZ = 0;
this.navFps = NaN;
this.isSpinInternal = false;
this.isSpinFixed = false;
this.isSpinSelected = false;
this.doTransform4D = false;
this.fixedRotationOffset = null;
this.fixedRotationCenter = null;
this.perspectiveOffset = null;
this.perspectiveShiftXY = null;
this.rotationCenterDefault = null;
this.rotationRadiusDefault = 0;
this.fixedRotationAxis = null;
this.internalRotationAxis = null;
this.internalTranslation = null;
this.internalRotationCenter = null;
this.internalRotationAngle = 0;
this.matrixRotate = null;
this.matrixTemp3 = null;
this.matrixTemp4 = null;
this.axisangleT = null;
this.vectorT = null;
this.vectorT2 = null;
this.pointT2 = null;
this.rotationAxis = null;
this.rotationRate = 0;
this.fixedTranslation = null;
this.camera = null;
this.cameraSetting = null;
this.xTranslationFraction = 0.5;
this.yTranslationFraction = 0.5;
this.prevZoomSetting = 0;
this.previousX = 0;
this.previousY = 0;
this.zoomEnabled = true;
this.zmPct = 100;
this.zmPctSet = 100;
this.zoomRatio = 0;
this.slabEnabled = false;
this.zShadeEnabled = false;
this.internalSlab = false;
this.slabPercentSetting = 0;
this.depthPercentSetting = 0;
this.slabValue = 0;
this.depthValue = 0;
this.zSlabPercentSetting = 50;
this.zDepthPercentSetting = 0;
this.zSlabPoint = null;
this.zSlabValue = 0;
this.zDepthValue = 0;
this.slabRange = 0;
this.slabPlane = null;
this.depthPlane = null;
this.perspectiveDepth = true;
this.scale3D = false;
this.cameraDepth = 3;
this.cameraDepthSetting = 3;
this.visualRangeAngstroms = 0;
this.cameraDistance = 1000;
this.width = 0;
this.height = 0;
this.screenPixelCount = 0;
this.scalePixelsPerAngstrom = 0;
this.scaleDefaultPixelsPerAngstrom = 0;
this.scale3DAngstromsPerInch = 0;
this.antialias = false;
this.useZoomLarge = false;
this.zoomHeight = false;
this.screenWidth = 0;
this.screenHeight = 0;
this.matrixTransform = null;
this.matrixTransformInv = null;
this.point3fScreenTemp = null;
this.point3iScreenTemp = null;
this.ptVibTemp = null;
this.navigating = false;
this.mode = 0;
this.defaultMode = 0;
this.untransformedPoint = null;
this.ptTest1 = null;
this.ptTest2 = null;
this.ptTest3 = null;
this.aaTest1 = null;
this.matrixTest = null;
this.spinOn = false;
this.navOn = false;
this.spinIsGesture = false;
this.vibrationOn = false;
this.vibrationPeriod = 0;
this.vibrationPeriodMs = 0;
this.vibrationScale = 0;
this.vibrationT = null;
this.stereoMode = null;
this.stereoColors = null;
this.stereoDegrees = NaN;
this.stereoRadians = 0;
this.stereoFrame = false;
this.matrixStereo = null;
this.windowCentered = false;
this.frameOffset = null;
this.bsSelectedAtoms = null;
this.ptOffset = null;
this.navMode = 1;
this.zoomFactor = 3.4028235E38;
this.navigationSlabOffset = 0;
this.nav = null;
Clazz_instantialize (this, arguments);
}, JV, "TransformManager");
Clazz_prepareFields (c$, function () {
this.navigationCenter =  new JU.P3 ();
this.navigationOffset =  new JU.P3 ();
this.navigationShiftXY =  new JU.P3 ();
this.matrixTemp =  new JU.M4 ();
this.vectorTemp =  new JU.V3 ();
this.fixedRotationOffset =  new JU.P3 ();
this.fixedRotationCenter =  new JU.P3 ();
this.perspectiveOffset =  new JU.P3 ();
this.perspectiveShiftXY =  new JU.P3 ();
this.rotationCenterDefault =  new JU.P3 ();
this.fixedRotationAxis =  new JU.A4 ();
this.internalRotationAxis =  new JU.A4 ();
this.internalRotationCenter = JU.P3.new3 (0, 0, 0);
this.matrixRotate =  new JU.M3 ();
this.matrixTemp3 =  new JU.M3 ();
this.matrixTemp4 =  new JU.M4 ();
this.axisangleT =  new JU.A4 ();
this.vectorT =  new JU.V3 ();
this.vectorT2 =  new JU.V3 ();
this.pointT2 =  new JU.P3 ();
this.rotationAxis =  new JU.V3 ();
this.fixedTranslation =  new JU.P3 ();
this.camera =  new JU.P3 ();
this.cameraSetting =  new JU.P3 ();
this.matrixTransform =  new JU.M4 ();
this.matrixTransformInv =  new JU.M4 ();
this.point3fScreenTemp =  new JU.P3 ();
this.point3iScreenTemp =  new JU.P3i ();
this.ptVibTemp =  new JU.Point3fi ();
this.untransformedPoint =  new JU.P3 ();
this.ptTest1 =  new JU.P3 ();
this.ptTest2 =  new JU.P3 ();
this.ptTest3 =  new JU.P3 ();
this.aaTest1 =  new JU.A4 ();
this.matrixTest =  new JU.M3 ();
this.vibrationT =  new JU.P3 ();
this.stereoMode = J.c.STER.NONE;
this.matrixStereo =  new JU.M3 ();
this.frameOffset =  new JU.P3 ();
this.ptOffset =  new JU.P3 ();
});
Clazz_makeConstructor (c$, 
function () {
});
c$.getTransformManager = Clazz_defineMethod (c$, "getTransformManager", 
function (vwr, width, height, is4D) {
var me = (is4D ? J.api.Interface.getInterface ("JV.TransformManager4D", vwr, "tm") :  new JV.TransformManager ());
me.vwr = vwr;
me.setScreenParameters (width, height, true, false, true, true);
return me;
}, "JV.Viewer,~N,~N,~B");
Clazz_defineMethod (c$, "setDefaultPerspective", 
function () {
this.setCameraDepthPercent (3.0, true);
this.setPerspectiveDepth (true);
this.setStereoDegrees (-5);
this.visualRangeAngstroms = 5.0;
this.setSpinOff ();
this.setVibrationPeriod (0);
});
Clazz_defineMethod (c$, "homePosition", 
function (resetSpin) {
if (resetSpin) this.setSpinOff ();
this.setNavOn (false);
this.navFps = 10;
this.navX = this.navY = this.navZ = 0;
this.rotationCenterDefault.setT (this.vwr.getBoundBoxCenter ());
this.setFixedRotationCenter (this.rotationCenterDefault);
this.rotationRadiusDefault = this.setRotationRadius (0, true);
this.windowCentered = true;
this.setRotationCenterAndRadiusXYZ (null, true);
this.resetRotation ();
var m = this.vwr.ms.getInfoM ("defaultOrientationMatrix");
if (m != null) this.setRotation (m);
this.setZoomEnabled (true);
this.zoomToPercent (this.vwr.g.modelKitMode ? 50 : 100);
this.zmPct = this.zmPctSet;
this.slabReset ();
this.resetFitToScreen (true);
if (this.vwr.isJmolDataFrame ()) {
this.fixedRotationCenter.set (0, 0, 0);
} else {
if (this.vwr.g.axesOrientationRasmol) this.matrixRotate.setAsXRotation (3.141592653589793);
}this.vwr.stm.saveOrientation ("default", null);
if (this.mode == 1) this.setNavigationMode (true);
}, "~B");
Clazz_defineMethod (c$, "setRotation", 
function (m) {
if (m.isRotation ()) this.matrixRotate.setM3 (m);
 else this.resetRotation ();
}, "JU.M3");
Clazz_defineMethod (c$, "resetRotation", 
function () {
this.matrixRotate.setScale (1);
});
Clazz_defineMethod (c$, "clearThreads", 
function () {
this.clearVibration ();
this.clearSpin ();
this.setNavOn (false);
this.stopMotion ();
});
Clazz_defineMethod (c$, "clear", 
function () {
this.fixedRotationCenter.set (0, 0, 0);
this.navigating = false;
this.slabPlane = null;
this.depthPlane = null;
this.zSlabPoint = null;
this.resetNavigationPoint (true);
});
Clazz_defineMethod (c$, "setFixedRotationCenter", 
 function (center) {
if (center == null) return;
this.fixedRotationCenter.setT (center);
}, "JU.T3");
Clazz_defineMethod (c$, "setRotationPointXY", 
function (center) {
var newCenterScreen = this.transformPt (center);
this.fixedTranslation.set (newCenterScreen.x, newCenterScreen.y, 0);
}, "JU.P3");
Clazz_defineMethod (c$, "spinXYBy", 
function (xDelta, yDelta, speed) {
if (xDelta == 0 && yDelta == 0) {
if (this.spinThread != null && this.spinIsGesture) this.clearSpin ();
return;
}this.clearSpin ();
var pt1 = JU.P3.newP (this.fixedRotationCenter);
var ptScreen =  new JU.P3 ();
this.transformPt3f (pt1, ptScreen);
var pt2 = JU.P3.new3 (-yDelta, xDelta, 0);
pt2.add (ptScreen);
this.unTransformPoint (pt2, pt2);
this.vwr.setInMotion (false);
this.rotateAboutPointsInternal (null, pt2, pt1, 10 * speed, NaN, false, true, null, true, null, null, null, null);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "rotateXYBy", 
function (degX, degY, bsAtoms) {
this.rotate3DBall (degX, degY, bsAtoms);
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "rotateZBy", 
function (zDelta, x, y) {
if (x != 2147483647 && y != 2147483647) this.resetXYCenter (x, y);
this.rotateZRadians ((zDelta / 57.29577951308232));
}, "~N,~N,~N");
Clazz_defineMethod (c$, "applyRotation", 
 function (mNew, isInternal, bsAtoms, translation, translationOnly, m4) {
if (bsAtoms == null) {
this.matrixRotate.mul2 (mNew, this.matrixRotate);
return;
}this.vwr.moveAtoms (m4, mNew, this.matrixRotate, translation, this.internalRotationCenter, isInternal, bsAtoms, translationOnly);
if (translation != null) {
this.internalRotationCenter.add (translation);
}}, "JU.M3,~B,JU.BS,JU.V3,~B,JU.M4");
Clazz_defineMethod (c$, "rotate3DBall", 
function (xDeg, yDeg, bsAtoms) {
if (this.matrixTemp3.setAsBallRotation (0.017453292, -yDeg, -xDeg)) this.applyRotation (this.matrixTemp3, false, bsAtoms, null, false, null);
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "rotateXRadians", 
function (angleRadians, bsAtoms) {
this.applyRotation (this.matrixTemp3.setAsXRotation (angleRadians), false, bsAtoms, null, false, null);
}, "~N,JU.BS");
Clazz_defineMethod (c$, "rotateYRadians", 
function (angleRadians, bsAtoms) {
this.applyRotation (this.matrixTemp3.setAsYRotation (angleRadians), false, bsAtoms, null, false, null);
}, "~N,JU.BS");
Clazz_defineMethod (c$, "rotateZRadians", 
function (angleRadians) {
this.applyRotation (this.matrixTemp3.setAsZRotation (angleRadians), false, null, null, false, null);
}, "~N");
Clazz_defineMethod (c$, "rotateAxisAngle", 
function (rotAxis, radians) {
this.axisangleT.setVA (rotAxis, radians);
this.rotateAxisAngle2 (this.axisangleT, null);
}, "JU.V3,~N");
Clazz_defineMethod (c$, "rotateAxisAngle2", 
 function (axisAngle, bsAtoms) {
this.applyRotation (this.matrixTemp3.setAA (axisAngle), false, bsAtoms, null, false, null);
}, "JU.A4,JU.BS");
Clazz_defineMethod (c$, "rotateAxisAngleAtCenter", 
function (eval, rotCenter, rotAxis, degreesPerSecond, endDegrees, isSpin, bsAtoms) {
if (rotCenter != null) this.moveRotationCenter (rotCenter, true);
this.setSpinOff ();
this.setNavOn (false);
if (this.vwr.headless) {
if (isSpin && endDegrees == 3.4028235E38) return false;
isSpin = false;
}if (Float.isNaN (degreesPerSecond) || degreesPerSecond == 0 || endDegrees == 0) return false;
if (rotCenter != null) {
this.setRotationPointXY (rotCenter);
}this.setFixedRotationCenter (rotCenter);
this.rotationAxis.setT (rotAxis);
this.rotationRate = degreesPerSecond;
if (isSpin) {
this.fixedRotationAxis.setVA (rotAxis, degreesPerSecond * 0.017453292);
this.isSpinInternal = false;
this.isSpinFixed = true;
this.isSpinSelected = (bsAtoms != null);
this.setSpin (eval, true, endDegrees, null, null, bsAtoms, false);
return (endDegrees != 3.4028235E38);
}var radians = endDegrees * 0.017453292;
this.fixedRotationAxis.setVA (rotAxis, endDegrees);
this.rotateAxisAngleRadiansFixed (radians, bsAtoms);
return true;
}, "J.api.JmolScriptEvaluator,JU.P3,JU.V3,~N,~N,~B,JU.BS");
Clazz_defineMethod (c$, "rotateAxisAngleRadiansFixed", 
function (angleRadians, bsAtoms) {
this.axisangleT.setAA (this.fixedRotationAxis);
this.axisangleT.angle = angleRadians;
this.rotateAxisAngle2 (this.axisangleT, bsAtoms);
}, "~N,JU.BS");
Clazz_defineMethod (c$, "rotateAboutPointsInternal", 
function (eval, point1, point2, degreesPerSecond, endDegrees, isClockwise, isSpin, bsAtoms, isGesture, translation, finalPoints, dihedralList, m4) {
this.setSpinOff ();
this.setNavOn (false);
if (dihedralList == null && (translation == null || translation.length () < 0.001) && (isSpin ? Float.isNaN (degreesPerSecond) || degreesPerSecond == 0 : endDegrees == 0)) return false;
var axis = null;
if (dihedralList == null) {
axis = JU.V3.newVsub (point2, point1);
if (isClockwise) axis.scale (-1.0);
this.internalRotationCenter.setT (point1);
this.rotationAxis.setT (axis);
this.internalTranslation = (translation == null ? null : JU.V3.newV (translation));
}var isSelected = (bsAtoms != null);
if (isSpin) {
if (dihedralList == null) {
if (endDegrees == 0) endDegrees = NaN;
if (Float.isNaN (endDegrees)) {
this.rotationRate = degreesPerSecond;
} else {
var nFrames = Clazz_doubleToInt (Math.abs (endDegrees) / Math.abs (degreesPerSecond) * this.spinFps + 0.5);
this.rotationRate = degreesPerSecond = endDegrees / nFrames * this.spinFps;
if (translation != null) this.internalTranslation.scale (1 / nFrames);
}this.internalRotationAxis.setVA (axis, (Float.isNaN (this.rotationRate) ? 0 : this.rotationRate) * 0.017453292);
this.isSpinInternal = true;
this.isSpinFixed = false;
this.isSpinSelected = isSelected;
} else {
endDegrees = degreesPerSecond;
}this.setSpin (eval, true, endDegrees, finalPoints, dihedralList, bsAtoms, isGesture);
return !Float.isNaN (endDegrees);
}var radians = endDegrees * 0.017453292;
this.internalRotationAxis.setVA (axis, radians);
this.rotateAxisAngleRadiansInternal (radians, bsAtoms, m4);
return false;
}, "J.api.JmolScriptEvaluator,JU.T3,JU.T3,~N,~N,~B,~B,JU.BS,~B,JU.V3,JU.Lst,~A,JU.M4");
Clazz_defineMethod (c$, "rotateAxisAngleRadiansInternal", 
function (radians, bsAtoms, m4) {
this.internalRotationAngle = radians;
this.vectorT.set (this.internalRotationAxis.x, this.internalRotationAxis.y, this.internalRotationAxis.z);
this.matrixRotate.rotate2 (this.vectorT, this.vectorT2);
this.axisangleT.setVA (this.vectorT2, radians);
this.applyRotation (this.matrixTemp3.setAA (this.axisangleT), true, bsAtoms, this.internalTranslation, radians > 1e6, m4);
if (bsAtoms == null) this.getNewFixedRotationCenter ();
}, "~N,JU.BS,JU.M4");
Clazz_defineMethod (c$, "getNewFixedRotationCenter", 
function () {
this.axisangleT.setAA (this.internalRotationAxis);
this.axisangleT.angle = -this.internalRotationAngle;
this.matrixTemp4.setToAA (this.axisangleT);
this.vectorT.setT (this.internalRotationCenter);
this.pointT2.sub2 (this.fixedRotationCenter, this.vectorT);
var pt = this.matrixTemp4.rotTrans2 (this.pointT2,  new JU.P3 ());
pt.add (this.vectorT);
this.setRotationCenterAndRadiusXYZ (pt, false);
});
Clazz_defineMethod (c$, "setTranslationFractions", 
function () {
this.xTranslationFraction = this.fixedTranslation.x / this.width;
this.yTranslationFraction = this.fixedTranslation.y / this.height;
});
Clazz_defineMethod (c$, "centerAt", 
function (x, y, pt) {
if (pt == null) {
this.translateXYBy (x, y);
return;
}if (this.windowCentered) this.vwr.setBooleanProperty ("windowCentered", false);
this.fixedTranslation.x = x;
this.fixedTranslation.y = y;
this.setFixedRotationCenter (pt);
}, "~N,~N,JU.P3");
Clazz_defineMethod (c$, "percentToPixels", 
function (xyz, percent) {
switch (xyz) {
case 'x':
return Clazz_doubleToInt (Math.floor (percent / 100 * this.width));
case 'y':
return Clazz_doubleToInt (Math.floor (percent / 100 * this.height));
case 'z':
return Clazz_doubleToInt (Math.floor (percent / 100 * this.screenPixelCount));
}
return 0;
}, "~S,~N");
Clazz_defineMethod (c$, "angstromsToPixels", 
function (distance) {
return Clazz_doubleToInt (Math.floor (this.scalePixelsPerAngstrom * distance));
}, "~N");
Clazz_defineMethod (c$, "translateXYBy", 
function (xDelta, yDelta) {
this.fixedTranslation.x += xDelta;
this.fixedTranslation.y += yDelta;
this.setTranslationFractions ();
}, "~N,~N");
Clazz_defineMethod (c$, "setCamera", 
function (x, y) {
this.cameraSetting.set (x, y, (x == 0 && y == 0 ? 0 : 1));
}, "~N,~N");
Clazz_defineMethod (c$, "translateToPercent", 
function (type, percent) {
switch (type) {
case 'x':
this.xTranslationFraction = 0.5 + percent / 100;
this.fixedTranslation.x = this.width * this.xTranslationFraction;
return;
case 'y':
this.yTranslationFraction = 0.5 + percent / 100;
this.fixedTranslation.y = this.height * this.yTranslationFraction;
return;
case 'z':
if (this.mode == 1) this.setNavigationDepthPercent (percent);
return;
}
}, "~S,~N");
Clazz_defineMethod (c$, "getTranslationXPercent", 
function () {
return (this.width == 0 ? 0 : (this.fixedTranslation.x - this.width / 2) * 100 / this.width);
});
Clazz_defineMethod (c$, "getTranslationYPercent", 
function () {
return (this.height == 0 ? 0 : (this.fixedTranslation.y - this.height / 2) * 100 / this.height);
});
Clazz_defineMethod (c$, "getTranslationScript", 
function () {
var info = "";
var f = this.getTranslationXPercent ();
if (f != 0.0) info += "translate x " + f + ";";
f = this.getTranslationYPercent ();
if (f != 0.0) info += "translate y " + f + ";";
return info;
});
Clazz_defineMethod (c$, "getOrientationText", 
function (type) {
switch (type) {
case 4130:
return this.getMoveToText (1, false);
case 1073742132:
return JU.Quat.newM (this.vwr.tm.matrixRotate).toString ();
case 1073742178:
var sb =  new JU.SB ();
JV.TransformManager.truncate2 (sb, this.getTranslationXPercent ());
JV.TransformManager.truncate2 (sb, this.getTranslationYPercent ());
return sb.toString ();
default:
return this.getMoveToText (1, true) + "\n#OR\n" + this.getRotateZyzText (true);
}
}, "~N");
Clazz_defineMethod (c$, "getOrientationInfo", 
function () {
var info =  new java.util.Hashtable ();
info.put ("moveTo", this.getMoveToText (1, false));
info.put ("center", "center " + this.getCenterText ());
info.put ("centerPt", this.fixedRotationCenter);
var aa =  new JU.A4 ();
aa.setM (this.matrixRotate);
info.put ("axisAngle", aa);
info.put ("quaternion", JU.Quat.newM (this.matrixRotate).toPoint4f ());
info.put ("rotationMatrix", this.matrixRotate);
info.put ("rotateZYZ", this.getRotateZyzText (false));
info.put ("rotateXYZ", this.getRotateXyzText ());
info.put ("transXPercent", Float.$valueOf (this.getTranslationXPercent ()));
info.put ("transYPercent", Float.$valueOf (this.getTranslationYPercent ()));
info.put ("zoom", Float.$valueOf (this.zmPct));
info.put ("modelRadius", Float.$valueOf (this.modelRadius));
if (this.mode == 1) {
info.put ("navigationCenter", "navigate center " + JU.Escape.eP (this.navigationCenter));
info.put ("navigationOffsetXPercent", Float.$valueOf (this.getNavigationOffsetPercent ('X')));
info.put ("navigationOffsetYPercent", Float.$valueOf (this.getNavigationOffsetPercent ('Y')));
info.put ("navigationDepthPercent", Float.$valueOf (this.navigationDepthPercent));
}return info;
});
Clazz_defineMethod (c$, "getRotation", 
function (m) {
m.setM3 (this.matrixRotate);
}, "JU.M3");
Clazz_defineMethod (c$, "setZoomHeight", 
function (zoomHeight, zoomLarge) {
this.zoomHeight = zoomHeight;
this.scaleFitToScreen (false, zoomLarge, false, true);
}, "~B,~B");
Clazz_defineMethod (c$, "zoomBy", 
function (pixels) {
if (pixels > 20) pixels = 20;
 else if (pixels < -20) pixels = -20;
var deltaPercent = pixels * this.zmPctSet / 50;
if (deltaPercent == 0) deltaPercent = (pixels > 0 ? 1 : (deltaPercent < 0 ? -1 : 0));
this.zoomRatio = (deltaPercent + this.zmPctSet) / this.zmPctSet;
this.zmPctSet += deltaPercent;
}, "~N");
Clazz_defineMethod (c$, "zoomByFactor", 
function (factor, x, y) {
if (factor <= 0 || !this.zoomEnabled) return;
if (this.mode != 1) {
this.zoomRatio = factor;
this.zmPctSet *= factor;
this.resetXYCenter (x, y);
} else if (this.getNav ()) {
this.nav.zoomByFactor (factor, x, y);
}}, "~N,~N,~N");
Clazz_defineMethod (c$, "zoomToPercent", 
function (percentZoom) {
this.zmPctSet = percentZoom;
this.zoomRatio = 0;
}, "~N");
Clazz_defineMethod (c$, "translateZBy", 
function (pixels) {
if (pixels >= this.screenPixelCount) return;
var sppa = this.scalePixelsPerAngstrom / (1 - pixels * 1.0 / this.screenPixelCount);
if (sppa >= this.screenPixelCount) return;
var newZoomPercent = sppa / this.scaleDefaultPixelsPerAngstrom * 100;
this.zoomRatio = newZoomPercent / this.zmPctSet;
this.zmPctSet = newZoomPercent;
}, "~N");
Clazz_defineMethod (c$, "resetXYCenter", 
 function (x, y) {
if (x == 2147483647 || y == 2147483647) return;
if (this.windowCentered) this.vwr.setBooleanProperty ("windowCentered", false);
var pt =  new JU.P3 ();
this.transformPt3f (this.fixedRotationCenter, pt);
pt.set (x, y, pt.z);
this.unTransformPoint (pt, pt);
this.fixedTranslation.set (x, y, 0);
this.setFixedRotationCenter (pt);
}, "~N,~N");
Clazz_defineMethod (c$, "zoomByPercent", 
function (percentZoom) {
var deltaPercent = percentZoom * this.zmPctSet / 100;
if (deltaPercent == 0) deltaPercent = (percentZoom < 0) ? -1 : 1;
this.zoomRatio = (deltaPercent + this.zmPctSet) / this.zmPctSet;
this.zmPctSet += deltaPercent;
}, "~N");
Clazz_defineMethod (c$, "setScaleAngstromsPerInch", 
function (angstromsPerInch) {
this.scale3D = (angstromsPerInch > 0);
if (this.scale3D) this.scale3DAngstromsPerInch = angstromsPerInch;
this.perspectiveDepth = !this.scale3D;
}, "~N");
Clazz_defineMethod (c$, "setSlabRange", 
function (value) {
this.slabRange = value;
}, "~N");
Clazz_defineMethod (c$, "setSlabEnabled", 
function (slabEnabled) {
this.slabEnabled = slabEnabled;
this.vwr.g.setB ("slabEnabled", slabEnabled);
}, "~B");
Clazz_defineMethod (c$, "setZShadeEnabled", 
function (zShadeEnabled) {
this.zShadeEnabled = zShadeEnabled;
this.vwr.g.setB ("zShade", zShadeEnabled);
}, "~B");
Clazz_defineMethod (c$, "setZoomEnabled", 
function (zoomEnabled) {
this.zoomEnabled = zoomEnabled;
this.vwr.g.setB ("zoomEnabled", zoomEnabled);
}, "~B");
Clazz_defineMethod (c$, "slabReset", 
function () {
this.slabToPercent (100);
this.depthToPercent (0);
this.depthPlane = null;
this.slabPlane = null;
this.setSlabEnabled (false);
this.setZShadeEnabled (false);
});
Clazz_defineMethod (c$, "getSlabPercentSetting", 
function () {
return this.slabPercentSetting;
});
Clazz_defineMethod (c$, "slabByPercentagePoints", 
function (percentage) {
this.slabPlane = null;
this.slabPercentSetting += percentage;
this.slabDepthChanged ();
if (this.depthPercentSetting >= this.slabPercentSetting) this.depthPercentSetting = this.slabPercentSetting - 1;
}, "~N");
Clazz_defineMethod (c$, "slabDepthChanged", 
 function () {
this.vwr.g.setI ("slab", this.slabPercentSetting);
this.vwr.g.setI ("depth", this.depthPercentSetting);
});
Clazz_defineMethod (c$, "depthByPercentagePoints", 
function (percentage) {
this.depthPlane = null;
this.depthPercentSetting += percentage;
if (this.slabPercentSetting <= this.depthPercentSetting) this.slabPercentSetting = this.depthPercentSetting + 1;
this.slabDepthChanged ();
}, "~N");
Clazz_defineMethod (c$, "slabDepthByPercentagePoints", 
function (percentage) {
this.slabPlane = null;
this.depthPlane = null;
this.slabPercentSetting += percentage;
this.depthPercentSetting += percentage;
this.slabDepthChanged ();
}, "~N");
Clazz_defineMethod (c$, "slabToPercent", 
function (percentSlab) {
this.vwr.setFloatProperty ("slabRange", 0);
this.slabPercentSetting = percentSlab;
this.slabPlane = null;
if (this.depthPercentSetting >= this.slabPercentSetting) this.depthPercentSetting = this.slabPercentSetting - 1;
this.slabDepthChanged ();
}, "~N");
Clazz_defineMethod (c$, "depthToPercent", 
function (percentDepth) {
this.vwr.g.setI ("depth", percentDepth);
this.depthPercentSetting = percentDepth;
if (this.slabPercentSetting <= this.depthPercentSetting) this.slabPercentSetting = this.depthPercentSetting + 1;
this.slabDepthChanged ();
}, "~N");
Clazz_defineMethod (c$, "zSlabToPercent", 
function (percentSlab) {
this.zSlabPercentSetting = percentSlab;
if (this.zDepthPercentSetting > this.zSlabPercentSetting) this.zDepthPercentSetting = percentSlab;
}, "~N");
Clazz_defineMethod (c$, "zDepthToPercent", 
function (percentDepth) {
this.zDepthPercentSetting = percentDepth;
if (this.zDepthPercentSetting > this.zSlabPercentSetting) this.zSlabPercentSetting = percentDepth;
}, "~N");
Clazz_defineMethod (c$, "slabInternal", 
function (plane, isDepth) {
if (isDepth) {
this.depthPlane = plane;
this.depthPercentSetting = 0;
} else {
this.slabPlane = plane;
this.slabPercentSetting = 100;
}}, "JU.P4,~B");
Clazz_defineMethod (c$, "setSlabDepthInternal", 
function (isDepth) {
this.finalizeTransformParameters ();
if (isDepth) this.depthPlane = null;
 else this.slabPlane = null;
this.slabInternal (this.getSlabDepthPlane (isDepth), isDepth);
}, "~B");
Clazz_defineMethod (c$, "getSlabDepthPlane", 
function (isDepth) {
if (isDepth) {
if (this.depthPlane != null) return this.depthPlane;
} else {
if (this.slabPlane != null) return this.slabPlane;
}var m = this.matrixTransform;
return JU.P4.new4 (-m.m20, -m.m21, -m.m22, -m.m23 + (isDepth ? this.depthValue : this.slabValue));
}, "~B");
Clazz_defineMethod (c$, "getCameraFactors", 
function () {
this.aperatureAngle = (Math.atan2 (this.screenPixelCount / 2, this.referencePlaneOffset) * 2 * 180 / 3.141592653589793);
this.cameraDistanceFromCenter = this.referencePlaneOffset / this.scalePixelsPerAngstrom;
var ptRef = JU.P3.new3 (Clazz_doubleToInt (this.screenWidth / 2), Clazz_doubleToInt (this.screenHeight / 2), this.referencePlaneOffset);
this.unTransformPoint (ptRef, ptRef);
var ptCamera = JU.P3.new3 (Clazz_doubleToInt (this.screenWidth / 2), Clazz_doubleToInt (this.screenHeight / 2), 0);
this.vwr.tm.unTransformPoint (ptCamera, ptCamera);
ptCamera.sub (this.fixedRotationCenter);
var pt = JU.P3.new3 (Clazz_doubleToInt (this.screenWidth / 2), Clazz_doubleToInt (this.screenHeight / 2), this.cameraDistanceFromCenter * this.scalePixelsPerAngstrom);
this.vwr.tm.unTransformPoint (pt, pt);
pt.sub (this.fixedRotationCenter);
ptCamera.add (pt);
return [ptRef, ptCamera, this.fixedRotationCenter, JU.P3.new3 (this.cameraDistanceFromCenter, this.aperatureAngle, this.scalePixelsPerAngstrom)];
});
Clazz_defineMethod (c$, "setPerspectiveDepth", 
function (perspectiveDepth) {
if (this.perspectiveDepth == perspectiveDepth) return;
this.perspectiveDepth = perspectiveDepth;
this.vwr.g.setB ("perspectiveDepth", perspectiveDepth);
this.resetFitToScreen (false);
}, "~B");
Clazz_defineMethod (c$, "getPerspectiveDepth", 
function () {
return this.perspectiveDepth;
});
Clazz_defineMethod (c$, "setCameraDepthPercent", 
function (percent, resetSlab) {
this.resetNavigationPoint (resetSlab);
var screenMultiples = (percent < 0 ? -percent / 100 : percent);
if (screenMultiples == 0) return;
this.cameraDepthSetting = screenMultiples;
this.vwr.g.setF ("cameraDepth", this.cameraDepthSetting);
this.cameraDepth = NaN;
}, "~N,~B");
Clazz_defineMethod (c$, "getCameraDepth", 
function () {
return this.cameraDepthSetting;
});
Clazz_defineMethod (c$, "setScreenParameters0", 
 function (screenWidth, screenHeight, useZoomLarge, antialias, resetSlab, resetZoom) {
if (screenWidth == 2147483647) return;
this.screenWidth = screenWidth;
this.screenHeight = screenHeight;
this.useZoomLarge = useZoomLarge;
this.antialias = antialias;
this.width = (antialias ? screenWidth * 2 : screenWidth);
this.height = (antialias ? screenHeight * 2 : screenHeight);
this.scaleFitToScreen (false, useZoomLarge, resetSlab, resetZoom);
}, "~N,~N,~B,~B,~B,~B");
Clazz_defineMethod (c$, "setAntialias", 
function (TF) {
var isNew = (this.antialias != TF);
this.antialias = TF;
this.width = (this.antialias ? this.screenWidth * 2 : this.screenWidth);
this.height = (this.antialias ? this.screenHeight * 2 : this.screenHeight);
if (isNew) this.scaleFitToScreen (false, this.useZoomLarge, false, false);
}, "~B");
Clazz_defineMethod (c$, "defaultScaleToScreen", 
function (radius) {
return this.screenPixelCount / 2 / radius;
}, "~N");
Clazz_defineMethod (c$, "resetFitToScreen", 
 function (andCenter) {
this.scaleFitToScreen (andCenter, this.vwr.g.zoomLarge, true, true);
}, "~B");
Clazz_defineMethod (c$, "scaleFitToScreen", 
function (andCenter, zoomLarge, resetSlab, resetZoom) {
if (this.width == 0 || this.height == 0) {
this.screenPixelCount = 1;
} else {
this.fixedTranslation.set (this.width * (andCenter ? 0.5 : this.xTranslationFraction), this.height * (andCenter ? 0.5 : this.yTranslationFraction), 0);
this.setTranslationFractions ();
if (andCenter) this.camera.set (0, 0, 0);
if (resetZoom) this.resetNavigationPoint (resetSlab);
if (this.zoomHeight) zoomLarge = (this.height > this.width);
this.screenPixelCount = (zoomLarge == (this.height > this.width) ? this.height : this.width);
}if (this.screenPixelCount > 2) this.screenPixelCount -= 2;
this.scaleDefaultPixelsPerAngstrom = this.defaultScaleToScreen (this.modelRadius);
}, "~B,~B,~B,~B");
Clazz_defineMethod (c$, "scaleToScreen", 
function (z, milliAngstroms) {
if (milliAngstroms == 0 || z < 2) return 0;
var pixelSize = this.scaleToPerspective (z, milliAngstroms * this.scalePixelsPerAngstrom / 1000);
return (pixelSize > 0 ? pixelSize : 1);
}, "~N,~N");
Clazz_defineMethod (c$, "unscaleToScreen", 
function (z, screenDistance) {
var d = screenDistance / this.scalePixelsPerAngstrom;
return (this.perspectiveDepth ? d / this.getPerspectiveFactor (z) : d);
}, "~N,~N");
Clazz_defineMethod (c$, "scaleToPerspective", 
function (z, sizeAngstroms) {
return (this.perspectiveDepth ? sizeAngstroms * this.getPerspectiveFactor (z) : sizeAngstroms);
}, "~N,~N");
Clazz_defineMethod (c$, "setNavigationMode", 
function (TF) {
this.mode = (TF ? 1 : this.defaultMode);
this.resetNavigationPoint (true);
}, "~B");
Clazz_defineMethod (c$, "isNavigating", 
function () {
return this.navigating || this.navOn;
});
Clazz_defineMethod (c$, "finalizeTransformParameters", 
function () {
this.haveNotifiedNaN = false;
this.fixedRotationOffset.setT (this.fixedTranslation);
this.camera.setT (this.cameraSetting);
this.internalSlab = this.slabEnabled && (this.slabPlane != null || this.depthPlane != null);
var newZoom = this.getZoomSetting ();
if (this.zmPct != newZoom) {
this.zmPct = newZoom;
if (!this.vwr.g.fontCaching) this.vwr.gdata.clearFontCache ();
}this.calcCameraFactors ();
this.calcTransformMatrix ();
if (this.mode == 1) this.calcNavigationPoint ();
 else this.calcSlabAndDepthValues ();
});
Clazz_defineMethod (c$, "getZoomSetting", 
function () {
if (this.zmPctSet < 5) this.zmPctSet = 5;
if (this.zmPctSet > 200000) this.zmPctSet = 200000;
return (this.zoomEnabled || this.mode == 1 ? this.zmPctSet : 100);
});
Clazz_defineMethod (c$, "calcSlabAndDepthValues", 
function () {
if (this.slabRange < 1) this.slabValue = this.zValueFromPercent (this.slabPercentSetting);
 else this.slabValue = Clazz_doubleToInt (Math.floor (this.modelCenterOffset * this.slabRange / (2 * this.modelRadius) * (this.zmPctSet / 100)));
this.depthValue = this.zValueFromPercent (this.depthPercentSetting);
if (this.zSlabPercentSetting == this.zDepthPercentSetting) {
this.zSlabValue = this.slabValue;
this.zDepthValue = this.depthValue;
} else {
this.zSlabValue = this.zValueFromPercent (this.zSlabPercentSetting);
this.zDepthValue = this.zValueFromPercent (this.zDepthPercentSetting);
}if (this.zSlabPoint != null) {
try {
this.transformPt3f (this.zSlabPoint, this.pointT2);
this.zSlabValue = Clazz_floatToInt (this.pointT2.z);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}this.vwr.g.setO ("_slabPlane", JU.Escape.eP4 (this.getSlabDepthPlane (false)));
this.vwr.g.setO ("_depthPlane", JU.Escape.eP4 (this.getSlabDepthPlane (true)));
if (this.slabEnabled) return;
this.slabValue = 0;
this.depthValue = 2147483647;
});
Clazz_defineMethod (c$, "zValueFromPercent", 
function (zPercent) {
return Clazz_doubleToInt (Math.floor ((1 - zPercent / 50) * this.modelRadiusPixels + this.modelCenterOffset));
}, "~N");
Clazz_defineMethod (c$, "calcTransformMatrix", 
function () {
this.matrixTransform.setIdentity ();
this.vectorTemp.sub2 (this.frameOffset, this.fixedRotationCenter);
this.matrixTransform.setTranslation (this.vectorTemp);
this.matrixTemp.setToM3 (this.stereoFrame ? this.matrixStereo : this.matrixRotate);
this.matrixTransform.mul2 (this.matrixTemp, this.matrixTransform);
this.matrixTemp.setIdentity ();
this.matrixTemp.m00 = this.matrixTemp.m11 = this.matrixTemp.m22 = this.scalePixelsPerAngstrom;
this.matrixTemp.m11 = this.matrixTemp.m22 = -this.scalePixelsPerAngstrom;
this.matrixTransform.mul2 (this.matrixTemp, this.matrixTransform);
this.matrixTransform.m23 += this.modelCenterOffset;
try {
this.matrixTransformInv.setM4 (this.matrixTransform).invert ();
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
System.out.println ("ERROR INVERTING matrixTransform!");
} else {
throw e;
}
}
});
Clazz_defineMethod (c$, "rotatePoint", 
function (pt, ptRot) {
this.matrixRotate.rotate2 (pt, ptRot);
ptRot.y = -ptRot.y;
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "getScreenTemp", 
function (ptXYZ) {
this.matrixTransform.rotTrans2 (ptXYZ, this.point3fScreenTemp);
}, "JU.T3");
Clazz_defineMethod (c$, "transformPoints", 
function (count, angstroms, screens) {
for (var i = count; --i >= 0; ) screens[i].setT (this.transformPt (angstroms[i]));

}, "~N,~A,~A");
Clazz_defineMethod (c$, "transformPtScr", 
function (ptXYZ, pointScreen) {
pointScreen.setT (this.transformPt (ptXYZ));
}, "JU.T3,JU.P3i");
Clazz_defineMethod (c$, "transformPtNoClip", 
function (ptXYZ, pointScreen) {
this.applyPerspective (ptXYZ, null);
pointScreen.setT (this.point3fScreenTemp);
}, "JU.P3,JU.P3");
Clazz_defineMethod (c$, "transformPt", 
function (ptXYZ) {
return this.applyPerspective (ptXYZ, this.internalSlab ? ptXYZ : null);
}, "JU.T3");
Clazz_defineMethod (c$, "transformPtVib", 
function (ptXYZ, v) {
this.ptVibTemp.setT (ptXYZ);
return this.applyPerspective (this.getVibrationPoint (v, this.ptVibTemp, NaN), ptXYZ);
}, "JU.P3,JU.Vibration");
Clazz_defineMethod (c$, "getVibrationPoint", 
function (v, pt, scale) {
v.setTempPoint (pt, this.vibrationT, (Float.isNaN (scale) ? this.vibrationScale : scale), this.vwr.g.modulationScale);
return pt;
}, "JU.Vibration,JU.T3,~N");
Clazz_defineMethod (c$, "transformPt3f", 
function (ptXYZ, screen) {
this.applyPerspective (ptXYZ, ptXYZ);
screen.setT (this.point3fScreenTemp);
}, "JU.T3,JU.P3");
Clazz_defineMethod (c$, "transformPt2D", 
function (ptXyp) {
if (ptXyp.z == -3.4028235E38) {
this.point3iScreenTemp.x = Clazz_doubleToInt (Math.floor (ptXyp.x / 100 * this.screenWidth));
this.point3iScreenTemp.y = Clazz_doubleToInt (Math.floor ((1 - ptXyp.y / 100) * this.screenHeight));
} else {
this.point3iScreenTemp.x = Clazz_floatToInt (ptXyp.x);
this.point3iScreenTemp.y = (this.screenHeight - Clazz_floatToInt (ptXyp.y));
}if (this.antialias) {
this.point3iScreenTemp.x <<= 1;
this.point3iScreenTemp.y <<= 1;
}this.matrixTransform.rotTrans2 (this.fixedRotationCenter, this.point3fScreenTemp);
this.point3iScreenTemp.z = Clazz_floatToInt (this.point3fScreenTemp.z);
return this.point3iScreenTemp;
}, "JU.T3");
Clazz_defineMethod (c$, "applyPerspective", 
 function (ptXYZ, ptRef) {
this.getScreenTemp (ptXYZ);
var z = this.point3fScreenTemp.z;
if (Float.isNaN (z)) {
if (!this.haveNotifiedNaN && JU.Logger.debugging) JU.Logger.debug ("NaN seen in TransformPoint");
this.haveNotifiedNaN = true;
z = this.point3fScreenTemp.z = 1;
} else if (z <= 0) {
z = this.point3fScreenTemp.z = 1;
}switch (this.mode) {
case 1:
this.point3fScreenTemp.x -= this.navigationShiftXY.x;
this.point3fScreenTemp.y -= this.navigationShiftXY.y;
break;
case 2:
this.point3fScreenTemp.x += this.perspectiveShiftXY.x;
this.point3fScreenTemp.y += this.perspectiveShiftXY.y;
break;
}
if (this.perspectiveDepth) {
var factor = this.getPerspectiveFactor (z);
this.point3fScreenTemp.x *= factor;
this.point3fScreenTemp.y *= factor;
}switch (this.mode) {
case 1:
this.point3fScreenTemp.x += this.navigationOffset.x;
this.point3fScreenTemp.y += this.navigationOffset.y;
break;
case 2:
this.point3fScreenTemp.x -= this.perspectiveShiftXY.x;
this.point3fScreenTemp.y -= this.perspectiveShiftXY.y;
case 0:
this.point3fScreenTemp.x += this.fixedRotationOffset.x;
this.point3fScreenTemp.y += this.fixedRotationOffset.y;
break;
}
if (Float.isNaN (this.point3fScreenTemp.x) && !this.haveNotifiedNaN) {
if (JU.Logger.debugging) JU.Logger.debug ("NaN found in transformPoint ");
this.haveNotifiedNaN = true;
}this.point3iScreenTemp.set (Clazz_floatToInt (this.point3fScreenTemp.x), Clazz_floatToInt (this.point3fScreenTemp.y), Clazz_floatToInt (this.point3fScreenTemp.z));
if (ptRef != null && (this.slabPlane != null && ptRef.x * this.slabPlane.x + ptRef.y * this.slabPlane.y + ptRef.z * this.slabPlane.z + this.slabPlane.w > 0 || this.depthPlane != null && ptRef.x * this.depthPlane.x + ptRef.y * this.depthPlane.y + ptRef.z * this.depthPlane.z + this.depthPlane.w < 0)) this.point3iScreenTemp.z = 1;
return this.point3iScreenTemp;
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "transformVector", 
function (vectorAngstroms, vectorTransformed) {
this.matrixTransform.rotate2 (vectorAngstroms, vectorTransformed);
}, "JU.V3,JU.V3");
Clazz_defineMethod (c$, "move", 
function (eval, dRot, dZoom, dTrans, dSlab, floatSecondsTotal, fps) {
this.movetoThread = J.api.Interface.getOption ("thread.MoveToThread", this.vwr, "tm");
this.movetoThread.setManager (this, this.vwr, [dRot, dTrans, [dZoom, dSlab, floatSecondsTotal, fps]]);
if (floatSecondsTotal > 0) this.movetoThread.setEval (eval);
this.movetoThread.run ();
}, "J.api.JmolScriptEvaluator,JU.V3,~N,JU.V3,~N,~N,~N");
Clazz_defineMethod (c$, "isInPosition", 
function (axis, degrees) {
if (Float.isNaN (degrees)) return true;
this.aaTest1.setVA (axis, (degrees / 57.29577951308232));
this.ptTest1.set (4.321, 1.23456, 3.14159);
this.getRotation (this.matrixTest);
this.matrixTest.rotate2 (this.ptTest1, this.ptTest2);
this.matrixTest.setAA (this.aaTest1).rotate2 (this.ptTest1, this.ptTest3);
return (this.ptTest3.distance (this.ptTest2) < 0.1);
}, "JU.V3,~N");
Clazz_defineMethod (c$, "moveToPyMOL", 
function (eval, floatSecondsTotal, pymolView) {
var m3 = JU.M3.newA9 (pymolView);
m3.invert ();
var cameraX = pymolView[9];
var cameraY = -pymolView[10];
var pymolDistanceToCenter = -pymolView[11];
var center = JU.P3.new3 (pymolView[12], pymolView[13], pymolView[14]);
var pymolDistanceToSlab = pymolView[15];
var pymolDistanceToDepth = pymolView[16];
var fov = pymolView[17];
var isOrtho = (fov >= 0);
this.setPerspectiveDepth (!isOrtho);
var theta = Math.abs (fov) / 2;
var tan = Math.tan (theta * 3.141592653589793 / 180);
var rotationRadius = pymolDistanceToCenter * tan;
var jmolCameraToCenter = 0.5 / tan;
var cameraDepth = jmolCameraToCenter - 0.5;
var f = 50 / rotationRadius;
if (pymolDistanceToSlab > 0) {
var slab = 50 + Clazz_floatToInt ((pymolDistanceToCenter - pymolDistanceToSlab) * f);
var depth = 50 + Clazz_floatToInt ((pymolDistanceToCenter - pymolDistanceToDepth) * f);
this.setSlabEnabled (true);
this.slabToPercent (slab);
this.depthToPercent (depth);
if (pymolView.length == 21) {
var depthCue = (pymolView[18] != 0);
var fog = (pymolView[19] != 0);
var fogStart = pymolView[20];
this.setZShadeEnabled (depthCue);
if (depthCue) {
if (fog) {
this.vwr.setIntProperty ("zSlab", Clazz_floatToInt (Math.min (100, slab + fogStart * (depth - slab))));
} else {
this.vwr.setIntProperty ("zSlab", Clazz_floatToInt ((slab + depth) / 2));
}this.vwr.setIntProperty ("zDepth", depth);
}}}this.moveTo (eval, floatSecondsTotal, center, null, 0, m3, 100, NaN, NaN, rotationRadius, null, NaN, NaN, NaN, cameraDepth, cameraX, cameraY);
return true;
}, "J.api.JmolScriptEvaluator,~N,~A");
Clazz_defineMethod (c$, "moveTo", 
function (eval, floatSecondsTotal, center, rotAxis, degrees, matrixEnd, zoom, xTrans, yTrans, newRotationRadius, navCenter, xNav, yNav, navDepth, cameraDepth, cameraX, cameraY) {
if (matrixEnd == null) {
matrixEnd =  new JU.M3 ();
var axis = JU.V3.newV (rotAxis);
if (Float.isNaN (degrees)) {
matrixEnd.m00 = NaN;
} else if (degrees < 0.01 && degrees > -0.01) {
matrixEnd.setScale (1);
} else {
if (axis.x == 0 && axis.y == 0 && axis.z == 0) {
return;
}var aaMoveTo =  new JU.A4 ();
aaMoveTo.setVA (axis, (degrees / 57.29577951308232));
matrixEnd.setAA (aaMoveTo);
}}if (cameraX == this.cameraSetting.x) cameraX = NaN;
if (cameraY == this.cameraSetting.y) cameraY = NaN;
if (cameraDepth == this.cameraDepth) cameraDepth = NaN;
if (!Float.isNaN (cameraX)) xTrans = cameraX * 50 / newRotationRadius / this.width * this.screenPixelCount;
if (!Float.isNaN (cameraY)) yTrans = cameraY * 50 / newRotationRadius / this.height * this.screenPixelCount;
var pixelScale = (center == null ? this.scaleDefaultPixelsPerAngstrom : this.defaultScaleToScreen (newRotationRadius));
if (floatSecondsTotal <= 0) {
this.setAll (center, matrixEnd, navCenter, zoom, xTrans, yTrans, newRotationRadius, pixelScale, navDepth, xNav, yNav, cameraDepth, cameraX, cameraY);
this.vwr.moveUpdate (floatSecondsTotal);
this.vwr.finalizeTransformParameters ();
return;
}try {
if (this.movetoThread == null) this.movetoThread = J.api.Interface.getOption ("thread.MoveToThread", this.vwr, "tm");
var nSteps = this.movetoThread.setManager (this, this.vwr, [center, matrixEnd, navCenter, [floatSecondsTotal, zoom, xTrans, yTrans, newRotationRadius, pixelScale, navDepth, xNav, yNav, cameraDepth, cameraX, cameraY]]);
if (nSteps <= 0 || this.vwr.g.waitForMoveTo) {
if (nSteps > 0) this.movetoThread.setEval (eval);
this.movetoThread.run ();
if (!this.vwr.isSingleThreaded) this.movetoThread = null;
} else {
this.movetoThread.start ();
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}, "J.api.JmolScriptEvaluator,~N,JU.P3,JU.T3,~N,JU.M3,~N,~N,~N,~N,JU.P3,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "setAll", 
function (center, m, navCenter, zoom, xTrans, yTrans, rotationRadius, pixelScale, navDepth, xNav, yNav, cameraDepth, cameraX, cameraY) {
if (!Float.isNaN (m.m00)) this.setRotation (m);
if (center != null) this.moveRotationCenter (center, !this.windowCentered);
if (navCenter != null && this.mode == 1) this.navigationCenter.setT (navCenter);
if (!Float.isNaN (cameraDepth)) this.setCameraDepthPercent (cameraDepth, false);
if (!Float.isNaN (cameraX) && !Float.isNaN (cameraY)) this.setCamera (cameraX, cameraY);
if (!Float.isNaN (zoom)) this.zoomToPercent (zoom);
if (!Float.isNaN (rotationRadius)) this.modelRadius = rotationRadius;
if (!Float.isNaN (pixelScale)) this.scaleDefaultPixelsPerAngstrom = pixelScale;
if (!Float.isNaN (xTrans) && !Float.isNaN (yTrans)) {
this.translateToPercent ('x', xTrans);
this.translateToPercent ('y', yTrans);
}if (this.mode == 1) {
if (!Float.isNaN (xNav) && !Float.isNaN (yNav)) this.navTranslatePercentOrTo (0, xNav, yNav);
if (!Float.isNaN (navDepth)) this.setNavigationDepthPercent (navDepth);
}}, "JU.P3,JU.M3,JU.P3,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "stopMotion", 
function () {
this.movetoThread = null;
});
Clazz_defineMethod (c$, "getRotationText", 
function () {
this.axisangleT.setM (this.matrixRotate);
var degrees = (this.axisangleT.angle * 57.29577951308232);
var sb =  new JU.SB ();
this.vectorT.set (this.axisangleT.x, this.axisangleT.y, this.axisangleT.z);
if (degrees < 0.01) return "{0 0 1 0}";
this.vectorT.normalize ();
this.vectorT.scale (1000);
sb.append ("{");
JV.TransformManager.truncate0 (sb, this.vectorT.x);
JV.TransformManager.truncate0 (sb, this.vectorT.y);
JV.TransformManager.truncate0 (sb, this.vectorT.z);
JV.TransformManager.truncate2 (sb, degrees);
sb.append ("}");
return sb.toString ();
});
Clazz_defineMethod (c$, "getMoveToText", 
function (timespan, addComments) {
this.finalizeTransformParameters ();
var sb =  new JU.SB ();
sb.append ("moveto ");
if (addComments) sb.append ("/* time, axisAngle */ ");
sb.appendF (timespan);
sb.append (" ").append (this.getRotationText ());
if (addComments) sb.append (" /* zoom, translation */ ");
JV.TransformManager.truncate2 (sb, this.zmPctSet);
JV.TransformManager.truncate2 (sb, this.getTranslationXPercent ());
JV.TransformManager.truncate2 (sb, this.getTranslationYPercent ());
sb.append (" ");
if (addComments) sb.append (" /* center, rotationRadius */ ");
sb.append (this.getCenterText ());
sb.append (" ").appendF (this.modelRadius);
sb.append (this.getNavigationText (addComments));
if (addComments) sb.append (" /* cameraDepth, cameraX, cameraY */ ");
JV.TransformManager.truncate2 (sb, this.cameraDepth);
JV.TransformManager.truncate2 (sb, this.cameraSetting.x);
JV.TransformManager.truncate2 (sb, this.cameraSetting.y);
sb.append (";");
return sb.toString ();
}, "~N,~B");
Clazz_defineMethod (c$, "getCenterText", 
 function () {
return JU.Escape.eP (this.fixedRotationCenter);
});
Clazz_defineMethod (c$, "getRotateXyzText", 
 function () {
var sb =  new JU.SB ();
var m20 = this.matrixRotate.m20;
var rY = -(Math.asin (m20) * 57.29577951308232);
var rX;
var rZ;
if (m20 > .999 || m20 < -0.999) {
rX = -(Math.atan2 (this.matrixRotate.m12, this.matrixRotate.m11) * 57.29577951308232);
rZ = 0;
} else {
rX = (Math.atan2 (this.matrixRotate.m21, this.matrixRotate.m22) * 57.29577951308232);
rZ = (Math.atan2 (this.matrixRotate.m10, this.matrixRotate.m00) * 57.29577951308232);
}sb.append ("reset");
sb.append (";center ").append (this.getCenterText ());
if (rX != 0) {
sb.append ("; rotate x");
JV.TransformManager.truncate2 (sb, rX);
}if (rY != 0) {
sb.append ("; rotate y");
JV.TransformManager.truncate2 (sb, rY);
}if (rZ != 0) {
sb.append ("; rotate z");
JV.TransformManager.truncate2 (sb, rZ);
}sb.append (";");
this.addZoomTranslationNavigationText (sb);
return sb.toString ();
});
Clazz_defineMethod (c$, "addZoomTranslationNavigationText", 
 function (sb) {
if (this.zmPct != 100) {
sb.append (" zoom");
JV.TransformManager.truncate2 (sb, this.zmPct);
sb.append (";");
}var tX = this.getTranslationXPercent ();
if (tX != 0) {
sb.append (" translate x");
JV.TransformManager.truncate2 (sb, tX);
sb.append (";");
}var tY = this.getTranslationYPercent ();
if (tY != 0) {
sb.append (" translate y");
JV.TransformManager.truncate2 (sb, tY);
sb.append (";");
}if (this.modelRadius != this.rotationRadiusDefault || this.modelRadius == 10) {
sb.append (" set rotationRadius");
JV.TransformManager.truncate2 (sb, this.modelRadius);
sb.append (";");
}if (this.mode == 1) {
sb.append ("navigate 0 center ").append (JU.Escape.eP (this.navigationCenter));
sb.append (";navigate 0 translate");
JV.TransformManager.truncate2 (sb, this.getNavigationOffsetPercent ('X'));
JV.TransformManager.truncate2 (sb, this.getNavigationOffsetPercent ('Y'));
sb.append (";navigate 0 depth ");
JV.TransformManager.truncate2 (sb, this.navigationDepthPercent);
sb.append (";");
}}, "JU.SB");
Clazz_defineMethod (c$, "getRotateZyzText", 
 function (iAddComment) {
var sb =  new JU.SB ();
var m = this.vwr.ms.getInfoM ("defaultOrientationMatrix");
if (m == null) {
m = this.matrixRotate;
} else {
m = JU.M3.newM3 (m);
m.invert ();
m.mul2 (this.matrixRotate, m);
}var m22 = m.m22;
var rY = (Math.acos (m22) * 57.29577951308232);
var rZ1;
var rZ2;
if (m22 > .999 || m22 < -0.999) {
rZ1 = (Math.atan2 (m.m10, m.m11) * 57.29577951308232);
rZ2 = 0;
} else {
rZ1 = (Math.atan2 (m.m21, -m.m20) * 57.29577951308232);
rZ2 = (Math.atan2 (m.m12, m.m02) * 57.29577951308232);
}if (rZ1 != 0 && rY != 0 && rZ2 != 0 && iAddComment) sb.append ("#Follows Z-Y-Z convention for Euler angles\n");
sb.append ("reset");
sb.append (";center ").append (this.getCenterText ());
if (rZ1 != 0) {
sb.append ("; rotate z");
JV.TransformManager.truncate2 (sb, rZ1);
}if (rY != 0) {
sb.append ("; rotate y");
JV.TransformManager.truncate2 (sb, rY);
}if (rZ2 != 0) {
sb.append ("; rotate z");
JV.TransformManager.truncate2 (sb, rZ2);
}sb.append (";");
this.addZoomTranslationNavigationText (sb);
return sb.toString ();
}, "~B");
c$.truncate0 = Clazz_defineMethod (c$, "truncate0", 
 function (sb, val) {
sb.appendC (' ');
sb.appendI (Math.round (val));
}, "JU.SB,~N");
c$.truncate2 = Clazz_defineMethod (c$, "truncate2", 
 function (sb, val) {
sb.appendC (' ');
sb.appendF (Math.round (val * 100) / 100);
}, "JU.SB,~N");
Clazz_defineMethod (c$, "setSpinXYZ", 
function (x, y, z) {
if (!Float.isNaN (x)) this.spinX = x;
if (!Float.isNaN (y)) this.spinY = y;
if (!Float.isNaN (z)) this.spinZ = z;
if (this.isSpinInternal || this.isSpinFixed) this.clearSpin ();
}, "~N,~N,~N");
Clazz_defineMethod (c$, "setSpinFps", 
function (value) {
if (value <= 0) value = 1;
 else if (value > 50) value = 50;
this.spinFps = value;
}, "~N");
Clazz_defineMethod (c$, "setNavXYZ", 
function (x, y, z) {
if (!Float.isNaN (x)) this.navX = x;
if (!Float.isNaN (y)) this.navY = y;
if (!Float.isNaN (z)) this.navZ = z;
}, "~N,~N,~N");
Clazz_defineMethod (c$, "clearSpin", 
 function () {
this.setSpinOff ();
this.setNavOn (false);
this.isSpinInternal = false;
this.isSpinFixed = false;
});
Clazz_defineMethod (c$, "setSpinOn", 
function () {
this.setSpin (null, true, 3.4028235E38, null, null, null, false);
});
Clazz_defineMethod (c$, "setSpinOff", 
function () {
this.setSpin (null, false, 3.4028235E38, null, null, null, false);
});
Clazz_defineMethod (c$, "setSpin", 
 function (eval, spinOn, endDegrees, endPositions, dihedralList, bsAtoms, isGesture) {
if (this.navOn && spinOn) this.setNavOn (false);
if (this.spinOn == spinOn) return;
this.spinOn = spinOn;
this.vwr.g.setB ("_spinning", spinOn);
if (spinOn) {
if (this.spinThread == null) {
this.spinThread = J.api.Interface.getOption ("thread.SpinThread", this.vwr, "tm");
this.spinThread.setManager (this, this.vwr, [Float.$valueOf (endDegrees), endPositions, dihedralList, bsAtoms, isGesture ? Boolean.TRUE : null]);
this.spinIsGesture = isGesture;
if ((Float.isNaN (endDegrees) || endDegrees == 3.4028235E38 || !this.vwr.g.waitForMoveTo)) {
this.spinThread.start ();
} else {
this.spinThread.setEval (eval);
this.spinThread.run ();
}}} else if (this.spinThread != null) {
this.spinThread.reset ();
this.spinThread = null;
}}, "J.api.JmolScriptEvaluator,~B,~N,JU.Lst,~A,JU.BS,~B");
Clazz_defineMethod (c$, "setNavOn", 
function (navOn) {
if (Float.isNaN (this.navFps)) return;
var wasOn = this.navOn;
if (navOn && this.spinOn) this.setSpin (null, false, 0, null, null, null, false);
this.navOn = navOn;
this.vwr.g.setB ("_navigating", navOn);
if (!navOn) this.navInterrupt ();
if (navOn) {
if (this.navX == 0 && this.navY == 0 && this.navZ == 0) this.navZ = 1;
if (this.navFps == 0) this.navFps = 10;
if (this.spinThread == null) {
this.spinThread = J.api.Interface.getOption ("thread.SpinThread", this.vwr, "tm");
this.spinThread.setManager (this, this.vwr, null);
this.spinThread.start ();
}} else if (wasOn) {
if (this.spinThread != null) {
this.spinThread.interrupt ();
this.spinThread = null;
}}}, "~B");
Clazz_defineMethod (c$, "setVibrationScale", 
function (scale) {
this.vibrationScale = scale;
}, "~N");
Clazz_defineMethod (c$, "setVibrationPeriod", 
function (period) {
if (Float.isNaN (period)) {
period = this.vibrationPeriod;
} else if (period == 0) {
this.vibrationPeriod = 0;
this.vibrationPeriodMs = 0;
} else {
this.vibrationPeriod = Math.abs (period);
this.vibrationPeriodMs = Clazz_floatToInt (this.vibrationPeriod * 1000);
if (period > 0) return;
period = -period;
}this.setVibrationOn (period > 0 && (this.vwr.ms.getLastVibrationVector (this.vwr.am.cmi, 0) >= 0));
}, "~N");
Clazz_defineMethod (c$, "setVibrationT", 
function (t) {
this.vibrationT.x = t;
if (this.vibrationScale == 0) this.vibrationScale = this.vwr.g.vibrationScale;
}, "~N");
Clazz_defineMethod (c$, "isVibrationOn", 
function () {
return this.vibrationOn;
});
Clazz_defineMethod (c$, "setVibrationOn", 
 function (vibrationOn) {
if (!vibrationOn) {
if (this.vibrationThread != null) {
this.vibrationThread.interrupt ();
this.vibrationThread = null;
}this.vibrationOn = false;
this.vibrationT.x = 0;
return;
}if (this.vwr.ms.mc < 1) {
this.vibrationOn = false;
this.vibrationT.x = 0;
return;
}if (this.vibrationThread == null) {
this.vibrationThread = J.api.Interface.getOption ("thread.VibrationThread", this.vwr, "tm");
this.vibrationThread.setManager (this, this.vwr, null);
this.vibrationThread.start ();
}this.vibrationOn = true;
}, "~B");
Clazz_defineMethod (c$, "clearVibration", 
 function () {
this.setVibrationOn (false);
this.vibrationScale = 0;
});
Clazz_defineMethod (c$, "setStereoMode2", 
function (twoColors) {
this.stereoMode = J.c.STER.CUSTOM;
this.stereoColors = twoColors;
}, "~A");
Clazz_defineMethod (c$, "setStereoMode", 
function (stereoMode) {
this.stereoColors = null;
this.stereoMode = stereoMode;
}, "J.c.STER");
Clazz_defineMethod (c$, "setStereoDegrees", 
function (stereoDegrees) {
this.stereoDegrees = stereoDegrees;
this.stereoRadians = stereoDegrees * 0.017453292;
}, "~N");
Clazz_defineMethod (c$, "getStereoRotationMatrix", 
function (stereoFrame) {
this.stereoFrame = stereoFrame;
if (!stereoFrame) return this.matrixRotate;
this.matrixTemp3.setAsYRotation (-this.stereoRadians);
this.matrixStereo.mul2 (this.matrixTemp3, this.matrixRotate);
return this.matrixStereo;
}, "~B");
Clazz_defineMethod (c$, "isWindowCentered", 
function () {
return this.windowCentered;
});
Clazz_defineMethod (c$, "setWindowCentered", 
function (TF) {
this.windowCentered = TF;
this.resetNavigationPoint (true);
}, "~B");
Clazz_defineMethod (c$, "setRotationRadius", 
function (angstroms, doAll) {
angstroms = (this.modelRadius = (angstroms <= 0 ? this.vwr.ms.calcRotationRadius (this.vwr.am.cmi, this.fixedRotationCenter) : angstroms));
if (doAll) this.vwr.setRotationRadius (angstroms, false);
return angstroms;
}, "~N,~B");
Clazz_defineMethod (c$, "setRotationCenterAndRadiusXYZ", 
 function (newCenterOfRotation, andRadius) {
this.resetNavigationPoint (false);
if (newCenterOfRotation == null) {
this.setFixedRotationCenter (this.rotationCenterDefault);
this.modelRadius = this.rotationRadiusDefault;
return;
}this.setFixedRotationCenter (newCenterOfRotation);
if (andRadius && this.windowCentered) this.modelRadius = this.vwr.ms.calcRotationRadius (this.vwr.am.cmi, this.fixedRotationCenter);
}, "JU.T3,~B");
Clazz_defineMethod (c$, "setNewRotationCenter", 
function (center, doScale) {
if (center == null) center = this.rotationCenterDefault;
if (this.windowCentered) {
this.translateToPercent ('x', 0);
this.translateToPercent ('y', 0);
this.setRotationCenterAndRadiusXYZ (center, true);
if (doScale) this.resetFitToScreen (true);
} else {
this.moveRotationCenter (center, true);
}}, "JU.P3,~B");
Clazz_defineMethod (c$, "moveRotationCenter", 
function (center, toXY) {
this.setRotationCenterAndRadiusXYZ (center, false);
if (toXY) this.setRotationPointXY (this.fixedRotationCenter);
}, "JU.P3,~B");
Clazz_defineMethod (c$, "setCenter", 
function () {
this.setRotationCenterAndRadiusXYZ (this.fixedRotationCenter, true);
});
Clazz_defineMethod (c$, "setCenterAt", 
function (relativeTo, pt) {
var pt1 = JU.P3.newP (pt);
switch (relativeTo) {
case 96:
pt1.add (this.vwr.ms.getAverageAtomPoint ());
break;
case 1679429641:
pt1.add (this.vwr.getBoundBoxCenter ());
break;
case 1073741826:
pt1.setT (this.rotationCenterDefault);
break;
}
this.setRotationCenterAndRadiusXYZ (pt1, true);
this.resetFitToScreen (true);
}, "~N,JU.P3");
Clazz_defineMethod (c$, "setFrameOffset", 
function (modelIndex) {
if (this.vwr.frameOffsets == null || modelIndex < 0 || modelIndex >= this.vwr.frameOffsets.length) this.frameOffset.set (0, 0, 0);
 else this.frameOffset.setT (this.vwr.frameOffsets[modelIndex]);
}, "~N");
Clazz_defineMethod (c$, "setSelectedTranslation", 
function (bsAtoms, xyz, xy) {
this.bsSelectedAtoms = bsAtoms;
switch (xyz) {
case 'X':
case 'x':
this.ptOffset.x += xy;
break;
case 'Y':
case 'y':
this.ptOffset.y += xy;
break;
case 'Z':
case 'z':
this.ptOffset.z += xy;
break;
}
}, "JU.BS,~S,~N");
Clazz_defineMethod (c$, "setNavFps", 
function (navFps) {
this.navFps = navFps;
}, "~N");
Clazz_defineMethod (c$, "calcCameraFactors", 
function () {
if (Float.isNaN (this.cameraDepth)) {
this.cameraDepth = this.cameraDepthSetting;
this.zoomFactor = 3.4028235E38;
}this.cameraDistance = this.cameraDepth * this.screenPixelCount;
this.referencePlaneOffset = this.cameraDistance + this.screenPixelCount / 2;
this.scalePixelsPerAngstrom = (this.scale3D && !this.perspectiveDepth && this.mode != 1 ? 72 / this.scale3DAngstromsPerInch * (this.antialias ? 2 : 1) : this.screenPixelCount / this.visualRangeAngstroms);
if (this.mode != 1) this.mode = (this.camera.z == 0 ? 0 : 2);
this.perspectiveShiftXY.set (this.camera.z == 0 ? 0 : this.camera.x * this.scalePixelsPerAngstrom / this.screenWidth * 100, this.camera.z == 0 ? 0 : this.camera.y * this.scalePixelsPerAngstrom / this.screenHeight * 100, 0);
this.modelRadiusPixels = this.modelRadius * this.scalePixelsPerAngstrom;
var offset100 = (2 * this.modelRadius) / this.visualRangeAngstroms * this.referencePlaneOffset;
if (this.mode == 1) {
this.calcNavCameraFactors (offset100);
return;
}this.zoomFactor = 3.4028235E38;
this.modelCenterOffset = this.referencePlaneOffset;
if (!this.scale3D || this.perspectiveDepth) this.scalePixelsPerAngstrom *= (this.modelCenterOffset / offset100) * this.zmPct / 100;
this.modelRadiusPixels = this.modelRadius * this.scalePixelsPerAngstrom;
});
Clazz_defineMethod (c$, "calcNavCameraFactors", 
 function (offset100) {
if (this.zoomFactor == 3.4028235E38) {
if (this.zmPct > 10000) this.zmPct = 10000;
this.modelCenterOffset = offset100 * 100 / this.zmPct;
} else if (this.prevZoomSetting != this.zmPctSet) {
if (this.zoomRatio == 0) this.modelCenterOffset = offset100 * 100 / this.zmPctSet;
 else this.modelCenterOffset += (1 - this.zoomRatio) * this.referencePlaneOffset;
this.navMode = -1;
}this.prevZoomSetting = this.zmPctSet;
this.zoomFactor = this.modelCenterOffset / this.referencePlaneOffset;
this.zmPct = (this.zoomFactor == 0 ? 10000 : offset100 / this.modelCenterOffset * 100);
}, "~N");
Clazz_defineMethod (c$, "getPerspectiveFactor", 
function (z) {
return (z <= 0 ? this.referencePlaneOffset : this.referencePlaneOffset / z);
}, "~N");
Clazz_defineMethod (c$, "unTransformPoint", 
function (screenPt, coordPt) {
this.untransformedPoint.setT (screenPt);
switch (this.mode) {
case 1:
this.untransformedPoint.x -= this.navigationOffset.x;
this.untransformedPoint.y -= this.navigationOffset.y;
break;
case 2:
this.point3fScreenTemp.x += this.perspectiveShiftXY.x;
this.point3fScreenTemp.y += this.perspectiveShiftXY.y;
case 0:
this.untransformedPoint.x -= this.fixedRotationOffset.x;
this.untransformedPoint.y -= this.fixedRotationOffset.y;
}
if (this.perspectiveDepth) {
var factor = this.getPerspectiveFactor (this.untransformedPoint.z);
this.untransformedPoint.x /= factor;
this.untransformedPoint.y /= factor;
}switch (this.mode) {
case 1:
this.untransformedPoint.x += this.navigationShiftXY.x;
this.untransformedPoint.y += this.navigationShiftXY.y;
break;
case 2:
this.untransformedPoint.x -= this.perspectiveShiftXY.x;
this.untransformedPoint.y -= this.perspectiveShiftXY.y;
break;
}
this.matrixTransformInv.rotTrans2 (this.untransformedPoint, coordPt);
}, "JU.T3,JU.T3");
Clazz_defineMethod (c$, "resetNavigationPoint", 
function (doResetSlab) {
if (this.zmPct < 5 && this.mode != 1) {
this.perspectiveDepth = true;
this.mode = 1;
return;
}if (this.mode == 1) {
this.navMode = 1;
this.slabPercentSetting = 0;
this.perspectiveDepth = true;
} else if (doResetSlab) {
this.slabPercentSetting = 100;
}this.vwr.setFloatProperty ("slabRange", 0);
if (doResetSlab) {
this.setSlabEnabled (this.mode == 1);
}this.zoomFactor = 3.4028235E38;
this.zmPctSet = this.zmPct;
}, "~B");
Clazz_defineMethod (c$, "setNavigatePt", 
function (pt) {
this.navigationCenter.setT (pt);
this.navMode = 3;
this.navigating = true;
this.finalizeTransformParameters ();
this.navigating = false;
}, "JU.P3");
Clazz_defineMethod (c$, "setNavigationSlabOffsetPercent", 
function (percent) {
this.vwr.g.setF ("navigationSlab", percent);
this.calcCameraFactors ();
this.navigationSlabOffset = percent / 50 * this.modelRadiusPixels;
}, "~N");
Clazz_defineMethod (c$, "getNavigationOffset", 
function () {
this.transformPt3f (this.navigationCenter, this.navigationOffset);
return this.navigationOffset;
});
Clazz_defineMethod (c$, "getNavPtHeight", 
function () {
return this.height / 2;
});
Clazz_defineMethod (c$, "getNavigationOffsetPercent", 
function (XorY) {
this.getNavigationOffset ();
if (this.width == 0 || this.height == 0) return 0;
return (XorY == 'X' ? (this.navigationOffset.x - this.width / 2) * 100 / this.width : (this.navigationOffset.y - this.getNavPtHeight ()) * 100 / this.height);
}, "~S");
Clazz_defineMethod (c$, "getNavigationText", 
function (addComments) {
var s = (addComments ? " /* navigation center, translation, depth */ " : " ");
if (this.mode != 1) return s + "{0 0 0} 0 0 0";
this.getNavigationOffset ();
return s + JU.Escape.eP (this.navigationCenter) + " " + this.getNavigationOffsetPercent ('X') + " " + this.getNavigationOffsetPercent ('Y') + " " + this.navigationDepthPercent;
}, "~B");
Clazz_defineMethod (c$, "setScreenParameters", 
function (screenWidth, screenHeight, useZoomLarge, antialias, resetSlab, resetZoom) {
var pt = (this.mode == 1 ? JU.P3.newP (this.navigationCenter) : null);
var ptoff = JU.P3.newP (this.navigationOffset);
ptoff.x = ptoff.x / this.width;
ptoff.y = ptoff.y / this.height;
this.setScreenParameters0 (screenWidth, screenHeight, useZoomLarge, antialias, resetSlab, resetZoom);
if (pt != null) {
this.navigationCenter.setT (pt);
this.navTranslatePercentOrTo (-1, ptoff.x * this.width, ptoff.y * this.height);
this.setNavigatePt (pt);
}}, "~N,~N,~B,~B,~B,~B");
Clazz_defineMethod (c$, "navInterrupt", 
 function () {
if (this.nav != null) this.nav.interrupt ();
});
Clazz_defineMethod (c$, "getNav", 
 function () {
if (this.nav != null) return true;
this.nav = J.api.Interface.getOption ("navigate.Navigator", this.vwr, "tm");
if (this.nav == null) return false;
this.nav.set (this, this.vwr);
return true;
});
Clazz_defineMethod (c$, "navigateList", 
function (eval, list) {
if (this.getNav ()) this.nav.navigateList (eval, list);
}, "J.api.JmolScriptEvaluator,JU.Lst");
Clazz_defineMethod (c$, "navigateAxis", 
function (rotAxis, degrees) {
if (this.getNav ()) this.nav.navigateAxis (rotAxis, degrees);
}, "JU.V3,~N");
Clazz_defineMethod (c$, "setNavigationOffsetRelative", 
function () {
if (this.getNav ()) this.nav.setNavigationOffsetRelative ();
});
Clazz_defineMethod (c$, "navigateKey", 
function (keyCode, modifiers) {
if (this.getNav ()) this.nav.navigateKey (keyCode, modifiers);
}, "~N,~N");
Clazz_defineMethod (c$, "setNavigationDepthPercent", 
function (percent) {
if (this.getNav ()) this.nav.setNavigationDepthPercent (percent);
}, "~N");
Clazz_defineMethod (c$, "navTranslatePercentOrTo", 
function (seconds, x, y) {
if (this.getNav ()) this.nav.navTranslatePercentOrTo (seconds, x, y);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "calcNavigationPoint", 
function () {
if (this.getNav ()) this.nav.calcNavigationPoint ();
});
Clazz_defineMethod (c$, "getNavigationState", 
function () {
return (this.mode == 1 && this.getNav () ? this.nav.getNavigationState () : "");
});
Clazz_defineStatics (c$,
"DEFAULT_SPIN_Y", 30,
"DEFAULT_SPIN_FPS", 30,
"DEFAULT_NAV_FPS", 10,
"DEFAULT_VISUAL_RANGE", 5,
"DEFAULT_STEREO_DEGREES", -5,
"MODE_STANDARD", 0,
"MODE_NAVIGATION", 1,
"MODE_PERSPECTIVE_PYMOL", 2,
"DEFAULT_PERSPECTIVE_MODEL", 11,
"DEFAULT_PERSPECTIVE_DEPTH", true,
"DEFAULT_CAMERA_DEPTH", 3.0,
"degreesPerRadian", 57.29577951308232,
"MAXIMUM_ZOOM_PERCENTAGE", 200000,
"MAXIMUM_ZOOM_PERSPECTIVE_DEPTH", 10000,
"NAV_MODE_IGNORE", -2,
"NAV_MODE_ZOOMED", -1,
"NAV_MODE_NONE", 0,
"NAV_MODE_RESET", 1,
"NAV_MODE_NEWXY", 2,
"NAV_MODE_NEWXYZ", 3,
"NAV_MODE_NEWZ", 4);
});
Clazz_declarePackage ("JV");
Clazz_load (["java.lang.Enum", "javajs.api.PlatformViewer", "J.api.JmolViewer", "J.atomdata.AtomDataServer", "java.util.Hashtable"], "JV.Viewer", ["java.io.Reader", "java.lang.Boolean", "$.Character", "$.Float", "$.NullPointerException", "javajs.awt.Dimension", "JU.BS", "$.CU", "$.DF", "$.Lst", "$.Measure", "$.P3", "$.P3i", "$.PT", "$.Rdr", "$.SB", "$.V3", "J.adapter.smarter.SmarterJmolAdapter", "J.api.Interface", "$.JmolAppConsoleInterface", "J.atomdata.RadiusData", "J.c.FIL", "$.STER", "$.VDW", "J.i18n.GT", "JM.ModelSet", "JS.SV", "$.T", "J.thread.TimeoutThread", "JU.BSUtil", "$.C", "$.CommandHistory", "$.Elements", "$.Escape", "$.GData", "$.JmolMolecule", "$.Logger", "$.Parser", "$.TempArray", "JV.ActionManager", "$.AnimationManager", "$.ColorManager", "$.FileManager", "$.GlobalSettings", "$.JC", "$.ModelManager", "$.SelectionManager", "$.ShapeManager", "$.StateManager", "$.StatusManager", "$.TransformManager", "JV.binding.Binding"], function () {
c$ = Clazz_decorateAsClass (function () {
this.testAsync = false;
this.autoExit = false;
this.haveDisplay = false;
this.isJS = false;
this.isWebGL = false;
this.isSingleThreaded = false;
this.queueOnHold = false;
this.fullName = "";
this.compiler = null;
this.definedAtomSets = null;
this.ms = null;
this.fm = null;
this.isApplet = false;
this.isJNLP = false;
this.isSyntaxAndFileCheck = false;
this.isSyntaxCheck = false;
this.listCommands = false;
this.mustRender = false;
this.htmlName = "";
this.appletName = "";
this.tryPt = 0;
this.insertedCommand = "";
this.gdata = null;
this.html5Applet = null;
this.acm = null;
this.am = null;
this.cm = null;
this.dm = null;
this.shm = null;
this.slm = null;
this.rm = null;
this.g = null;
this.sm = null;
this.tm = null;
this.syncId = "";
this.logFilePath = "";
this.allowScripting = false;
this.isPrintOnly = false;
this.isSignedApplet = false;
this.isSignedAppletLocal = false;
this.isSilent = false;
this.multiTouch = false;
this.noGraphicsAllowed = false;
this.useCommandThread = false;
this.commandOptions = null;
this.vwrOptions = null;
this.display = null;
this.modelAdapter = null;
this.access = null;
this.commandHistory = null;
this.mm = null;
this.stm = null;
this.scm = null;
this.eval = null;
this.tempArray = null;
this.allowArrayDotNotation = false;
this.async = false;
this.dimScreen = null;
this.actionStates = null;
this.actionStatesRedo = null;
this.defaultVdw = null;
this.rd = null;
this.chainMap = null;
this.chainList = null;
this.errorMessage = null;
this.errorMessageUntranslated = null;
this.privateKey = 0;
this.dataOnly = false;
this.isPreviewOnly = false;
this.headless = false;
this.mouse = null;
this.ligandModels = null;
this.ligandModelSet = null;
this.annotationParser = null;
this.minimizer = null;
this.smilesMatcher = null;
this.jsc = null;
this.lastData = null;
this.bsFrameOffsets = null;
this.frameOffsets = null;
this.motionEventNumber = 0;
this.inMotion = false;
this.refreshing = true;
this.axesAreTainted = false;
this.maximumSize = 2147483647;
this.imageFontScaling = 1;
this.gRight = null;
this.isStereoSlave = false;
this.captureParams = null;
this.jsParams = null;
this.antialiased = false;
this.hoverAtomIndex = -1;
this.hoverText = null;
this.hoverEnabled = true;
this.currentCursor = 0;
this.ptTemp = null;
this.prevFrame = -2147483648;
this.prevMorphModel = 0;
this.haveJDX = false;
this.jsv = null;
this.frankOn = true;
this.scriptEditorVisible = false;
this.appConsole = null;
this.scriptEditor = null;
this.jmolpopup = null;
this.modelkitPopup = null;
this.headlessImageParams = null;
this.pm = null;
this.isTainted = true;
this.movingSelected = false;
this.showSelected = false;
this.rotateBondIndex = -1;
this.rotatePrev1 = -1;
this.rotatePrev2 = -1;
this.bsRotateBranch = null;
this.creatingImage = false;
this.outputManager = null;
this.bsUserVdws = null;
this.userVdws = null;
this.userVdwMars = null;
this.currentShapeID = -1;
this.currentShapeState = null;
this.localFunctions = null;
this.$isKiosk = false;
this.executor = null;
this.displayLoadErrors = true;
this.$isParallel = false;
this.stateScriptVersionInt = 0;
this.jsExporter3D = null;
this.timeouts = null;
this.nmrCalculation = null;
this.logFileName = null;
this.jzt = null;
this.jbr = null;
Clazz_instantialize (this, arguments);
}, JV, "Viewer", J.api.JmolViewer, [J.atomdata.AtomDataServer, javajs.api.PlatformViewer]);
Clazz_defineMethod (c$, "finalize", 
function () {
if (JU.Logger.debugging) JU.Logger.debug ("vwr finalize " + this);
Clazz_superCall (this, JV.Viewer, "finalize", []);
});
Clazz_defineMethod (c$, "setInsertedCommand", 
function (strScript) {
this.insertedCommand = strScript;
}, "~S");
c$.getJmolVersion = Clazz_overrideMethod (c$, "getJmolVersion", 
function () {
return (JV.Viewer.version_date == null ? JV.Viewer.version_date = JV.JC.version + "  " + JV.JC.date : JV.Viewer.version_date);
});
c$.allocateViewer = Clazz_defineMethod (c$, "allocateViewer", 
function (display, modelAdapter, fullName, documentBase, codeBase, commandOptions, statusListener, implementedPlatform) {
var info =  new java.util.Hashtable ();
info.put ("display", display);
info.put ("adapter", modelAdapter);
info.put ("statusListener", statusListener);
info.put ("platform", implementedPlatform);
info.put ("options", commandOptions);
info.put ("fullName", fullName);
info.put ("documentBase", documentBase);
info.put ("codeBase", codeBase);
return  new JV.Viewer (info);
}, "~O,J.api.JmolAdapter,~S,java.net.URL,java.net.URL,~S,J.api.JmolStatusListener,javajs.api.GenericPlatform");
Clazz_makeConstructor (c$, 
function (info) {
Clazz_superConstructor (this, JV.Viewer, []);
this.commandHistory =  new JU.CommandHistory ();
this.dimScreen =  new javajs.awt.Dimension (0, 0);
this.rd =  new J.atomdata.RadiusData (null, 0, null, null);
this.defaultVdw = J.c.VDW.JMOL;
this.localFunctions =  new java.util.Hashtable ();
this.privateKey = Math.random ();
this.actionStates =  new JU.Lst ();
this.actionStatesRedo =  new JU.Lst ();
this.chainMap =  new java.util.Hashtable ();
this.chainList =  new JU.Lst ();
this.setOptions (info);
}, "java.util.Map");
Clazz_defineMethod (c$, "haveAccess", 
function (a) {
return this.access === a;
}, "JV.Viewer.ACCESS");
Clazz_overrideMethod (c$, "getModelAdapter", 
function () {
return (this.modelAdapter == null ? this.modelAdapter =  new J.adapter.smarter.SmarterJmolAdapter () : this.modelAdapter);
});
Clazz_overrideMethod (c$, "getSmartsMatch", 
function (smarts, bsSelected) {
if (bsSelected == null) bsSelected = this.bsA ();
return this.getSmilesMatcher ().getSubstructureSet (smarts, this.ms.at, this.ms.ac, bsSelected, true, false);
}, "~S,JU.BS");
Clazz_defineMethod (c$, "setOptions", 
function (info) {
this.vwrOptions = info;
if (JU.Logger.debugging) {
JU.Logger.debug ("Viewer constructor " + this);
}this.modelAdapter = info.get ("adapter");
var statusListener = info.get ("statusListener");
this.fullName = info.get ("fullName");
if (this.fullName == null) this.fullName = "";
var o = info.get ("codePath");
if (o == null) o = "../java/";
JV.Viewer.appletCodeBase = o.toString ();
JV.Viewer.appletIdiomaBase = JV.Viewer.appletCodeBase.substring (0, JV.Viewer.appletCodeBase.lastIndexOf ("/", JV.Viewer.appletCodeBase.length - 2) + 1) + "idioma";
o = info.get ("documentBase");
JV.Viewer.appletDocumentBase = (o == null ? "" : o.toString ());
o = info.get ("options");
this.commandOptions = (o == null ? "" : o.toString ());
if (info.containsKey ("debug") || this.commandOptions.indexOf ("-debug") >= 0) JU.Logger.setLogLevel (5);
if (this.isApplet && info.containsKey ("maximumSize")) this.setMaximumSize ((info.get ("maximumSize")).intValue ());
this.isJNLP = this.checkOption2 ("isJNLP", "-jnlp");
if (this.isJNLP) JU.Logger.info ("setting JNLP mode TRUE");
this.isSignedApplet = this.isJNLP || this.checkOption2 ("signedApplet", "-signed");
this.isApplet = this.isSignedApplet || this.checkOption2 ("applet", "-applet");
this.allowScripting = !this.checkOption2 ("noscripting", "-noscripting");
var i = this.fullName.indexOf ("__");
this.htmlName = (i < 0 ? this.fullName : this.fullName.substring (0, i));
this.appletName = JU.PT.split (this.htmlName + "_", "_")[0];
this.syncId = (i < 0 ? "" : this.fullName.substring (i + 2, this.fullName.length - 2));
this.access = (this.checkOption2 ("access:READSPT", "-r") ? JV.Viewer.ACCESS.READSPT : this.checkOption2 ("access:NONE", "-R") ? JV.Viewer.ACCESS.NONE : JV.Viewer.ACCESS.ALL);
this.isPreviewOnly = info.containsKey ("previewOnly");
if (this.isPreviewOnly) info.remove ("previewOnly");
this.isPrintOnly = this.checkOption2 ("printOnly", "-p");
this.dataOnly = this.checkOption2 ("isDataOnly", "\0");
this.autoExit = this.checkOption2 ("exit", "-x");
o = info.get ("platform");
var platform = "unknown";
if (o == null) {
o = (this.commandOptions.contains ("platform=") ? this.commandOptions.substring (this.commandOptions.indexOf ("platform=") + 9) : "J.awt.Platform");
}if (Clazz_instanceOf (o, String)) {
platform = o;
this.isWebGL = (platform.indexOf (".awtjs.") >= 0);
this.isJS = this.isWebGL || (platform.indexOf (".awtjs2d.") >= 0);
this.async = !this.dataOnly && !this.autoExit && (this.testAsync || this.isJS && info.containsKey ("async"));
var applet = null;
var javaver = "?";
{
if(self.Jmol) {
applet = Jmol._applets[this.htmlName.split("_object")[0]];
javaver = Jmol._version;
}
}if (javaver != null) {
this.html5Applet = applet;
JV.Viewer.strJavaVersion = javaver;
JV.Viewer.strJavaVendor = "Java2Script " + (this.isWebGL ? "(WebGL)" : "(HTML5)");
}o = J.api.Interface.getInterface (platform, this, "setOptions");
}this.apiPlatform = o;
this.display = info.get ("display");
this.isSingleThreaded = this.apiPlatform.isSingleThreaded ();
this.noGraphicsAllowed = this.checkOption2 ("noGraphics", "-n");
this.haveDisplay = (this.isWebGL || this.display != null && !this.noGraphicsAllowed && !this.headless && !this.dataOnly);
this.noGraphicsAllowed = new Boolean (this.noGraphicsAllowed & (this.display == null)).valueOf ();
this.headless = (this.noGraphicsAllowed || this.apiPlatform.isHeadless ());
if (this.haveDisplay) {
this.mustRender = true;
this.multiTouch = this.checkOption2 ("multiTouch", "-multitouch");
{
if (!this.isWebGL) this.display =
document.getElementById(this.display);
}} else {
this.display = null;
}this.apiPlatform.setViewer (this, this.display);
o = info.get ("graphicsAdapter");
if (o == null && !this.isWebGL) o = J.api.Interface.getOption ("g3d.Graphics3D", this, "setOptions");
this.gdata = (o == null && (this.isWebGL || !this.isJS) ?  new JU.GData () : o);
this.gdata.initialize (this, this.apiPlatform);
this.stm =  new JV.StateManager (this);
this.cm =  new JV.ColorManager (this, this.gdata);
this.sm =  new JV.StatusManager (this);
var is4D = info.containsKey ("4DMouse");
this.tm = JV.TransformManager.getTransformManager (this, 2147483647, 0, is4D);
this.slm =  new JV.SelectionManager (this);
if (this.haveDisplay) {
this.acm = (this.multiTouch ? J.api.Interface.getOption ("multitouch.ActionManagerMT", null, null) :  new JV.ActionManager ());
this.acm.setViewer (this, this.commandOptions + "-multitouch-" + info.get ("multiTouch"));
this.mouse = this.apiPlatform.getMouseManager (this.privateKey, this.display);
if (this.multiTouch && !this.checkOption2 ("-simulated", "-simulated")) this.apiPlatform.setTransparentCursor (this.display);
}this.mm =  new JV.ModelManager (this);
this.shm =  new JV.ShapeManager (this);
this.tempArray =  new JU.TempArray ();
this.am =  new JV.AnimationManager (this);
o = info.get ("repaintManager");
if (o == null) o = J.api.Interface.getOption ("render.RepaintManager", this, "setOptions");
if (this.isJS || o != null && !o.equals ("")) (this.rm = o).set (this, this.shm);
this.ms =  new JM.ModelSet (this, null);
this.initialize (true);
this.fm =  new JV.FileManager (this);
this.definedAtomSets =  new java.util.Hashtable ();
this.setJmolStatusListener (statusListener);
if (this.isApplet) {
JU.Logger.info ("vwrOptions: \n" + JU.Escape.escapeMap (this.vwrOptions));
var path = this.vwrOptions.get ("documentLocation");
if (!this.isJS && path != null && path.startsWith ("file:/")) {
path = path.substring (0, path.substring (0, (path + "?").indexOf ("?")).lastIndexOf ("/"));
JU.Logger.info ("setting current directory to " + path);
this.cd (path);
}path = JV.Viewer.appletDocumentBase;
i = path.indexOf ("#");
if (i >= 0) path = path.substring (0, i);
i = path.lastIndexOf ("?");
if (i >= 0) path = path.substring (0, i);
i = path.lastIndexOf ("/");
if (i >= 0) path = path.substring (0, i);
JV.Viewer.jsDocumentBase = path;
this.fm.setAppletContext (JV.Viewer.appletDocumentBase);
var appletProxy = info.get ("appletProxy");
if (appletProxy != null) this.setStringProperty ("appletProxy", appletProxy);
if (this.isSignedApplet) {
this.logFilePath = JU.PT.rep (JV.Viewer.appletCodeBase, "file://", "");
this.logFilePath = JU.PT.rep (this.logFilePath, "file:/", "");
if (this.logFilePath.indexOf ("//") >= 0) this.logFilePath = null;
 else this.isSignedAppletLocal = true;
} else if (!this.isJS) {
this.logFilePath = null;
}} else {
this.gdata.setBackgroundTransparent (this.checkOption2 ("backgroundTransparent", "-b"));
this.isSilent = this.checkOption2 ("silent", "-i");
if (this.isSilent) JU.Logger.setLogLevel (3);
if (this.headless && !this.isSilent) JU.Logger.info ("Operating headless display=" + this.display + " nographicsallowed=" + this.noGraphicsAllowed);
this.isSyntaxAndFileCheck = this.checkOption2 ("checkLoad", "-C");
this.isSyntaxCheck = this.isSyntaxAndFileCheck || this.checkOption2 ("check", "-c");
this.listCommands = this.checkOption2 ("listCommands", "-l");
this.cd (".");
if (this.headless) {
this.headlessImageParams = info.get ("headlessImage");
o = info.get ("headlistMaxTimeMs");
if (o == null) o = Integer.$valueOf (60000);
this.setTimeout ("" + Math.random (), (o).intValue (), "exitJmol");
}}this.useCommandThread = !this.headless && this.checkOption2 ("useCommandThread", "-threaded");
this.setStartupBooleans ();
this.setIntProperty ("_nProcessors", JV.Viewer.nProcessors);
if (!this.isSilent) {
JU.Logger.info ("(C) 2012 Jmol Development" + "\nJmol Version: " + JV.Viewer.getJmolVersion () + "\njava.vendor: " + JV.Viewer.strJavaVendor + "\njava.version: " + JV.Viewer.strJavaVersion + "\nos.name: " + JV.Viewer.strOSName + "\nAccess: " + this.access + "\nmemory: " + this.getP ("_memory") + "\nprocessors available: " + JV.Viewer.nProcessors + "\nuseCommandThread: " + this.useCommandThread + (!this.isApplet ? "" : "\nappletId:" + this.htmlName + (this.isSignedApplet ? " (signed)" : "")));
}if (this.allowScripting) this.getScriptManager ();
this.zap (false, true, false);
this.g.setO ("language", J.i18n.GT.getLanguage ());
this.stm.setJmolDefaults ();
JU.Elements.covalentVersion = 1;
this.allowArrayDotNotation = true;
}, "java.util.Map");
Clazz_defineMethod (c$, "setDisplay", 
function (canvas) {
this.display = canvas;
this.apiPlatform.setViewer (this, canvas);
}, "~O");
Clazz_defineMethod (c$, "newMeasurementData", 
function (id, points) {
return (J.api.Interface.getInterface ("JM.MeasurementData", this, "script")).init (id, this, points);
}, "~S,JU.Lst");
Clazz_defineMethod (c$, "getDataManager", 
 function () {
return (this.dm == null ? (this.dm = (J.api.Interface.getInterface ("JV.DataManager", this, "script")).set (this)) : this.dm);
});
Clazz_defineMethod (c$, "getScriptManager", 
 function () {
if (this.allowScripting && this.scm == null) {
this.scm = J.api.Interface.getInterface ("JS.ScriptManager", this, "setOptions");
if (this.isJS && this.scm == null) throw  new NullPointerException ();
if (this.scm == null) {
this.allowScripting = false;
return null;
}this.eval = this.scm.setViewer (this);
if (this.useCommandThread) this.scm.startCommandWatcher (true);
}return this.scm;
});
Clazz_defineMethod (c$, "checkOption2", 
 function (key1, key2) {
return (this.vwrOptions.containsKey (key1) || this.commandOptions.indexOf (key2) >= 0);
}, "~S,~S");
Clazz_defineMethod (c$, "setStartupBooleans", 
 function () {
this.setBooleanProperty ("_applet", this.isApplet);
this.setBooleanProperty ("_JSpecView".toLowerCase (), false);
this.setBooleanProperty ("_signedApplet", this.isSignedApplet);
this.setBooleanProperty ("_headless", this.headless);
this.setStringProperty ("_restrict", "\"" + this.access + "\"");
this.setBooleanProperty ("_useCommandThread", this.useCommandThread);
});
Clazz_defineMethod (c$, "getExportDriverList", 
function () {
return (this.haveAccess (JV.Viewer.ACCESS.ALL) ? this.g.getParameter ("exportDrivers", true) : "");
});
Clazz_overrideMethod (c$, "dispose", 
function () {
this.gRight = null;
if (this.mouse != null) {
this.acm.dispose ();
this.mouse.dispose ();
this.mouse = null;
}this.clearScriptQueue ();
this.clearThreads ();
this.haltScriptExecution ();
if (this.scm != null) this.scm.clear (true);
this.gdata.destroy ();
if (this.jmolpopup != null) this.jmolpopup.jpiDispose ();
if (this.modelkitPopup != null) this.modelkitPopup.jpiDispose ();
try {
if (this.appConsole != null) {
this.appConsole.dispose ();
this.appConsole = null;
}if (this.scriptEditor != null) {
this.scriptEditor.dispose ();
this.scriptEditor = null;
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
});
Clazz_defineMethod (c$, "reset", 
function (includingSpin) {
this.ms.calcBoundBoxDimensions (null, 1);
this.axesAreTainted = true;
this.tm.homePosition (includingSpin);
if (this.ms.setCrystallographicDefaults ()) this.stm.setCrystallographicDefaults ();
 else this.setAxesMode (603979810);
this.prevFrame = -2147483648;
if (!this.tm.spinOn) this.setSync ();
}, "~B");
Clazz_overrideMethod (c$, "homePosition", 
function () {
this.evalString ("reset spin");
});
Clazz_defineMethod (c$, "initialize", 
function (clearUserVariables) {
this.g =  new JV.GlobalSettings (this, this.g, clearUserVariables);
this.setStartupBooleans ();
this.g.setI ("_width", this.dimScreen.width);
this.g.setI ("_height", this.dimScreen.height);
if (this.haveDisplay) {
this.g.setB ("_is2D", this.isJS && !this.isWebGL);
this.g.setB ("_multiTouchClient", this.acm.isMTClient ());
this.g.setB ("_multiTouchServer", this.acm.isMTServer ());
}this.cm.setDefaultColors (false);
this.setObjectColor ("background", "black");
this.setObjectColor ("axis1", "red");
this.setObjectColor ("axis2", "green");
this.setObjectColor ("axis3", "blue");
this.am.setAnimationOn (false);
this.am.setAnimationFps (this.g.animationFps);
this.sm.allowStatusReporting = this.g.statusReporting;
this.setBooleanProperty ("antialiasDisplay", this.g.antialiasDisplay);
this.stm.resetLighting ();
this.tm.setDefaultPerspective ();
}, "~B");
Clazz_defineMethod (c$, "saveModelOrientation", 
function () {
this.ms.saveModelOrientation (this.am.cmi, this.stm.getOrientation ());
});
Clazz_defineMethod (c$, "restoreModelOrientation", 
function (modelIndex) {
var o = this.ms.getModelOrientation (modelIndex);
if (o != null) o.restore (-1, true);
}, "~N");
Clazz_defineMethod (c$, "restoreModelRotation", 
function (modelIndex) {
var o = this.ms.getModelOrientation (modelIndex);
if (o != null) o.restore (-1, false);
}, "~N");
Clazz_defineMethod (c$, "getGLmolView", 
function () {
var tm = this.tm;
{
return {
center:tm.fixedRotationCenter,
quaternion:tm.getRotationQuaternion(),
xtrans:tm.xTranslationFraction,
ytrans:tm.yTranslationFraction,
scale:tm.scalePixelsPerAngstrom,
zoom:tm.zoomPercent,
cameraDistance:tm.cameraDistance,
pixelCount:tm.screenPixelCount,
perspective:tm.perspectiveDepth,
width:tm.width,
height:tm.height
};
}});
Clazz_defineMethod (c$, "setRotationRadius", 
function (angstroms, doAll) {
if (doAll) angstroms = this.tm.setRotationRadius (angstroms, false);
if (this.ms.setRotationRadius (this.am.cmi, angstroms)) this.g.setF ("rotationRadius", angstroms);
}, "~N,~B");
Clazz_defineMethod (c$, "setCenterBitSet", 
function (bsCenter, doScale) {
if (this.isJmolDataFrame ()) return;
this.tm.setNewRotationCenter ((JU.BSUtil.cardinalityOf (bsCenter) > 0 ? this.ms.getAtomSetCenter (bsCenter) : null), doScale);
}, "JU.BS,~B");
Clazz_defineMethod (c$, "setNewRotationCenter", 
function (center) {
if (!this.isJmolDataFrame ()) this.tm.setNewRotationCenter (center, true);
}, "JU.P3");
Clazz_defineMethod (c$, "navigate", 
function (keyWhere, modifiers) {
if (this.isJmolDataFrame ()) return;
this.tm.navigateKey (keyWhere, modifiers);
if (!this.tm.vibrationOn && keyWhere != 0) this.refresh (1, "Viewer:navigate()");
}, "~N,~N");
Clazz_defineMethod (c$, "move", 
function (eval, dRot, dZoom, dTrans, dSlab, floatSecondsTotal, fps) {
this.tm.move (eval, dRot, dZoom, dTrans, dSlab, floatSecondsTotal, fps);
this.moveUpdate (floatSecondsTotal);
}, "J.api.JmolScriptEvaluator,JU.V3,~N,JU.V3,~N,~N,~N");
Clazz_defineMethod (c$, "moveTo", 
function (eval, floatSecondsTotal, center, rotAxis, degrees, rotationMatrix, zoom, xTrans, yTrans, rotationRadius, navCenter, xNav, yNav, navDepth, cameraDepth, cameraX, cameraY) {
if (!this.haveDisplay) floatSecondsTotal = 0;
this.setTainted (true);
this.tm.moveTo (eval, floatSecondsTotal, center, rotAxis, degrees, rotationMatrix, zoom, xTrans, yTrans, rotationRadius, navCenter, xNav, yNav, navDepth, cameraDepth, cameraX, cameraY);
}, "J.api.JmolScriptEvaluator,~N,JU.P3,JU.V3,~N,JU.M3,~N,~N,~N,~N,JU.P3,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "moveUpdate", 
function (floatSecondsTotal) {
if (floatSecondsTotal > 0) this.requestRepaintAndWait ("moveUpdate");
 else if (floatSecondsTotal == 0) this.setSync ();
}, "~N");
Clazz_defineMethod (c$, "navigatePt", 
function (center) {
this.tm.setNavigatePt (center);
this.setSync ();
}, "JU.P3");
Clazz_defineMethod (c$, "navigateAxis", 
function (rotAxis, degrees) {
this.tm.navigateAxis (rotAxis, degrees);
this.setSync ();
}, "JU.V3,~N");
Clazz_defineMethod (c$, "navTranslatePercent", 
function (x, y) {
if (this.isJmolDataFrame ()) return;
this.tm.navTranslatePercentOrTo (0, x, y);
this.setSync ();
}, "~N,~N");
Clazz_defineMethod (c$, "zoomBy", 
function (pixels) {
this.tm.zoomBy (pixels);
this.refresh (2, this.sm.syncingMouse ? "Mouse: zoomBy " + pixels : "");
}, "~N");
Clazz_defineMethod (c$, "zoomByFactor", 
function (factor, x, y) {
this.tm.zoomByFactor (factor, x, y);
this.refresh (2, !this.sm.syncingMouse ? "" : "Mouse: zoomByFactor " + factor + (x == 2147483647 ? "" : " " + x + " " + y));
}, "~N,~N,~N");
Clazz_defineMethod (c$, "rotateXYBy", 
function (degX, degY) {
this.tm.rotateXYBy (degX, degY, null);
this.refresh (2, this.sm.syncingMouse ? "Mouse: rotateXYBy " + degX + " " + degY : "");
}, "~N,~N");
Clazz_defineMethod (c$, "spinXYBy", 
function (xDelta, yDelta, speed) {
this.tm.spinXYBy (xDelta, yDelta, speed);
if (xDelta == 0 && yDelta == 0) return;
this.refresh (2, this.sm.syncingMouse ? "Mouse: spinXYBy " + xDelta + " " + yDelta + " " + speed : "");
}, "~N,~N,~N");
Clazz_defineMethod (c$, "rotateZBy", 
function (zDelta, x, y) {
this.tm.rotateZBy (zDelta, x, y);
this.refresh (2, this.sm.syncingMouse ? "Mouse: rotateZBy " + zDelta + (x == 2147483647 ? "" : " " + x + " " + y) : "");
}, "~N,~N,~N");
Clazz_defineMethod (c$, "rotateSelected", 
function (deltaX, deltaY, bsSelected) {
if (this.isJmolDataFrame ()) return;
this.tm.rotateXYBy (deltaX, deltaY, this.setMovableBitSet (bsSelected, false));
this.refreshMeasures (true);
this.refresh (2, this.sm.syncingMouse ? "Mouse: rotateMolecule " + deltaX + " " + deltaY : "");
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "setMovableBitSet", 
 function (bsSelected, checkMolecule) {
if (bsSelected == null) bsSelected = this.bsA ();
bsSelected = JU.BSUtil.copy (bsSelected);
JU.BSUtil.andNot (bsSelected, this.getMotionFixedAtoms ());
if (checkMolecule && !this.g.allowMoveAtoms) bsSelected = this.ms.getMoleculeBitSet (bsSelected);
return bsSelected;
}, "JU.BS,~B");
Clazz_defineMethod (c$, "translateXYBy", 
function (xDelta, yDelta) {
this.tm.translateXYBy (xDelta, yDelta);
this.refresh (2, this.sm.syncingMouse ? "Mouse: translateXYBy " + xDelta + " " + yDelta : "");
}, "~N,~N");
Clazz_overrideMethod (c$, "rotateFront", 
function () {
this.tm.resetRotation ();
this.refresh (1, "Viewer:rotateFront()");
});
Clazz_defineMethod (c$, "translate", 
function (xyz, x, type, bsAtoms) {
var xy = (type == '\0' ? Clazz_floatToInt (x) : type == '%' ? this.tm.percentToPixels (xyz, x) : this.tm.angstromsToPixels (x * (type == 'n' ? 10 : 1)));
if (bsAtoms != null) {
if (xy == 0) return;
this.tm.setSelectedTranslation (bsAtoms, xyz, xy);
} else {
switch (xyz) {
case 'X':
case 'x':
if (type == '\0') this.tm.translateToPercent ('x', x);
 else this.tm.translateXYBy (xy, 0);
break;
case 'Y':
case 'y':
if (type == '\0') this.tm.translateToPercent ('y', x);
 else this.tm.translateXYBy (0, xy);
break;
case 'Z':
case 'z':
if (type == '\0') this.tm.translateToPercent ('z', x);
 else this.tm.translateZBy (xy);
break;
}
}this.refresh (1, "Viewer:translate()");
}, "~S,~N,~S,JU.BS");
Clazz_defineMethod (c$, "slabByPixels", 
function (pixels) {
this.tm.slabByPercentagePoints (pixels);
this.refresh (3, "slabByPixels");
}, "~N");
Clazz_defineMethod (c$, "depthByPixels", 
function (pixels) {
this.tm.depthByPercentagePoints (pixels);
this.refresh (3, "depthByPixels");
}, "~N");
Clazz_defineMethod (c$, "slabDepthByPixels", 
function (pixels) {
this.tm.slabDepthByPercentagePoints (pixels);
this.refresh (3, "slabDepthByPixels");
}, "~N");
Clazz_defineMethod (c$, "finalizeTransformParameters", 
function () {
this.tm.finalizeTransformParameters ();
this.gdata.setSlab (this.tm.slabValue);
this.gdata.setDepth (this.tm.depthValue);
this.gdata.setZShade (this.tm.zShadeEnabled, this.tm.zSlabValue, this.tm.zDepthValue, this.g.zShadePower);
});
Clazz_defineMethod (c$, "getScalePixelsPerAngstrom", 
function (asAntialiased) {
return this.tm.scalePixelsPerAngstrom * (asAntialiased || !this.antialiased ? 1 : 0.5);
}, "~B");
Clazz_defineMethod (c$, "setSpin", 
function (key, value) {
if (!JU.PT.isOneOf (key, ";x;y;z;fps;X;Y;Z;FPS;")) return;
var i = "x;y;z;fps;X;Y;Z;FPS".indexOf (key);
switch (i) {
case 0:
this.tm.setSpinXYZ (value, NaN, NaN);
break;
case 2:
this.tm.setSpinXYZ (NaN, value, NaN);
break;
case 4:
this.tm.setSpinXYZ (NaN, NaN, value);
break;
case 6:
default:
this.tm.setSpinFps (value);
break;
case 10:
this.tm.setNavXYZ (value, NaN, NaN);
break;
case 12:
this.tm.setNavXYZ (NaN, value, NaN);
break;
case 14:
this.tm.setNavXYZ (NaN, NaN, value);
break;
case 16:
this.tm.setNavFps (value);
break;
}
this.g.setI ((i < 10 ? "spin" : "nav") + key, value);
}, "~S,~N");
Clazz_defineMethod (c$, "getSpinState", 
function () {
return this.getStateCreator ().getSpinState (false);
});
Clazz_defineMethod (c$, "getOrientationText", 
function (type, name) {
switch (type) {
case 1313866249:
case 1073741863:
case 1112541205:
case 1112541206:
case 1112541207:
case 135270418:
return this.ms.getBoundBoxOrientation (type, this.bsA ());
case 1073742035:
return this.stm.getSavedOrientationText (name);
default:
return this.tm.getOrientationText (type);
}
}, "~N,~S");
Clazz_defineMethod (c$, "getCurrentColorRange", 
function () {
return this.cm.getPropertyColorRange ();
});
Clazz_defineMethod (c$, "setDefaultColors", 
 function (isRasmol) {
this.cm.setDefaultColors (isRasmol);
this.g.setB ("colorRasmol", isRasmol);
this.g.setO ("defaultColorScheme", (isRasmol ? "rasmol" : "jmol"));
}, "~B");
Clazz_defineMethod (c$, "setElementArgb", 
function (elementNumber, argb) {
this.g.setO ("=color " + JU.Elements.elementNameFromNumber (elementNumber), JU.Escape.escapeColor (argb));
this.cm.setElementArgb (elementNumber, argb);
}, "~N,~N");
Clazz_overrideMethod (c$, "setVectorScale", 
function (scale) {
this.g.setF ("vectorScale", scale);
this.g.vectorScale = scale;
}, "~N");
Clazz_overrideMethod (c$, "setVibrationScale", 
function (scale) {
this.tm.setVibrationScale (scale);
this.g.vibrationScale = scale;
this.g.setF ("vibrationScale", scale);
}, "~N");
Clazz_overrideMethod (c$, "setVibrationPeriod", 
function (period) {
this.tm.setVibrationPeriod (period);
period = Math.abs (period);
this.g.vibrationPeriod = period;
this.g.setF ("vibrationPeriod", period);
}, "~N");
Clazz_defineMethod (c$, "setObjectColor", 
function (name, colorName) {
if (colorName == null || colorName.length == 0) return;
this.setObjectArgb (name, JU.CU.getArgbFromString (colorName));
}, "~S,~S");
Clazz_defineMethod (c$, "setObjectVisibility", 
function (name, b) {
var objId = JV.StateManager.getObjectIdFromName (name);
if (objId >= 0) {
this.setShapeProperty (objId, "display", b ? Boolean.TRUE : Boolean.FALSE);
}}, "~S,~B");
Clazz_defineMethod (c$, "setObjectArgb", 
function (name, argb) {
var objId = JV.StateManager.getObjectIdFromName (name);
if (objId < 0) {
if (name.equalsIgnoreCase ("axes")) {
this.setObjectArgb ("axis1", argb);
this.setObjectArgb ("axis2", argb);
this.setObjectArgb ("axis3", argb);
}return;
}this.g.objColors[objId] = argb;
switch (objId) {
case 0:
this.gdata.setBackgroundArgb (argb);
this.cm.setColixBackgroundContrast (argb);
break;
}
this.g.setO (name + "Color", JU.Escape.escapeColor (argb));
}, "~S,~N");
Clazz_defineMethod (c$, "setBackgroundImage", 
function (fileName, image) {
this.g.backgroundImageFileName = fileName;
this.gdata.setBackgroundImage (image);
}, "~S,~O");
Clazz_defineMethod (c$, "getObjectColix", 
function (objId) {
var argb = this.g.objColors[objId];
return (argb == 0 ? this.cm.colixBackgroundContrast : JU.C.getColix (argb));
}, "~N");
Clazz_defineMethod (c$, "getFontState", 
function (myType, font3d) {
return this.getStateCreator ().getFontState (myType, font3d);
}, "~S,javajs.awt.Font");
Clazz_overrideMethod (c$, "setColorBackground", 
function (colorName) {
this.setObjectColor ("background", colorName);
}, "~S");
Clazz_overrideMethod (c$, "getBackgroundArgb", 
function () {
return this.g.objColors[(0)];
});
Clazz_defineMethod (c$, "setObjectMad", 
function (iShape, name, mad) {
var objId = JV.StateManager.getObjectIdFromName (name.equalsIgnoreCase ("axes") ? "axis" : name);
if (objId < 0) return;
if (mad == -2 || mad == -4) {
var m = mad + 3;
mad = this.getObjectMad (objId);
if (mad == 0) mad = m;
}this.g.setB ("show" + name, mad != 0);
this.g.objStateOn[objId] = (mad != 0);
if (mad == 0) return;
this.g.objMad[objId] = mad;
this.setShapeSize (iShape, mad, null);
}, "~N,~S,~N");
Clazz_defineMethod (c$, "getObjectMad", 
function (objId) {
return (this.g.objStateOn[objId] ? this.g.objMad[objId] : 0);
}, "~N");
Clazz_defineMethod (c$, "setPropertyColorScheme", 
function (scheme, isTranslucent, isOverloaded) {
this.g.propertyColorScheme = scheme;
if (scheme.startsWith ("translucent ")) {
isTranslucent = true;
scheme = scheme.substring (12).trim ();
}this.cm.setPropertyColorScheme (scheme, isTranslucent, isOverloaded);
}, "~S,~B,~B");
Clazz_defineMethod (c$, "getLightingState", 
function () {
return this.getStateCreator ().getLightingState (true);
});
Clazz_defineMethod (c$, "getColorPointForPropertyValue", 
function (val) {
return JU.CU.colorPtFromInt (this.gdata.getColorArgbOrGray (this.cm.ce.getColorIndex (val)), null);
}, "~N");
Clazz_defineMethod (c$, "select", 
function (bs, isGroup, addRemove, isQuiet) {
if (isGroup) bs = this.getUndeletedGroupAtomBits (bs);
this.slm.select (bs, addRemove, isQuiet);
this.shm.setShapeSizeBs (1, 2147483647, null, null);
}, "JU.BS,~B,~N,~B");
Clazz_overrideMethod (c$, "setSelectionSet", 
function (set) {
this.select (set, false, 0, true);
}, "JU.BS");
Clazz_defineMethod (c$, "selectBonds", 
function (bs) {
this.shm.setShapeSizeBs (1, 2147483647, null, bs);
}, "JU.BS");
Clazz_defineMethod (c$, "displayAtoms", 
function (bs, isDisplay, isGroup, addRemove, isQuiet) {
if (isGroup) bs = this.getUndeletedGroupAtomBits (bs);
if (isDisplay) this.slm.display (this.ms, bs, addRemove, isQuiet);
 else this.slm.hide (this.ms, bs, addRemove, isQuiet);
}, "JU.BS,~B,~B,~N,~B");
Clazz_defineMethod (c$, "getUndeletedGroupAtomBits", 
 function (bs) {
bs = this.ms.getAtoms (1087373318, bs);
JU.BSUtil.andNot (bs, this.slm.bsDeleted);
return bs;
}, "JU.BS");
Clazz_defineMethod (c$, "reportSelection", 
function (msg) {
if (this.ms.getSelectionHaloEnabled ()) this.setTainted (true);
if (this.isScriptQueued () || this.g.debugScript) this.scriptStatus (msg);
}, "~S");
Clazz_defineMethod (c$, "clearAtomSets", 
 function () {
this.slm.setSelectionSubset (null);
this.definedAtomSets.clear ();
});
Clazz_defineMethod (c$, "getDefinedAtomSet", 
function (name) {
var o = this.definedAtomSets.get (name.toLowerCase ());
return (Clazz_instanceOf (o, JU.BS) ? o :  new JU.BS ());
}, "~S");
Clazz_overrideMethod (c$, "selectAll", 
function () {
this.slm.selectAll (false);
});
Clazz_overrideMethod (c$, "clearSelection", 
function () {
this.slm.clearSelection (true);
this.g.setB ("hideNotSelected", false);
});
Clazz_defineMethod (c$, "bsA", 
function () {
return this.slm.getSelectedAtoms ();
});
Clazz_overrideMethod (c$, "addSelectionListener", 
function (listener) {
this.slm.addListener (listener);
}, "J.api.JmolSelectionListener");
Clazz_overrideMethod (c$, "removeSelectionListener", 
function (listener) {
this.slm.addListener (listener);
}, "J.api.JmolSelectionListener");
Clazz_defineMethod (c$, "getAtomBitSetEval", 
function (eval, atomExpression) {
return (this.allowScripting ? this.getScriptManager ().getAtomBitSetEval (eval, atomExpression) :  new JU.BS ());
}, "J.api.JmolScriptEvaluator,~O");
Clazz_defineMethod (c$, "processTwoPointGesture", 
function (touches) {
this.mouse.processTwoPointGesture (touches);
}, "~A");
Clazz_defineMethod (c$, "processMouseEvent", 
function (id, x, y, modifiers, time) {
return this.mouse.processEvent (id, x, y, modifiers, time);
}, "~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "getRubberBandSelection", 
function () {
return (this.haveDisplay ? this.acm.getRubberBand () : null);
});
Clazz_defineMethod (c$, "isBound", 
function (action, gesture) {
return (this.haveDisplay && this.acm.bnd (action, gesture));
}, "~N,~N");
Clazz_defineMethod (c$, "getCursorX", 
function () {
return (this.haveDisplay ? this.acm.getCurrentX () : 0);
});
Clazz_defineMethod (c$, "getCursorY", 
function () {
return (this.haveDisplay ? this.acm.getCurrentY () : 0);
});
Clazz_defineMethod (c$, "getDefaultDirectory", 
function () {
return this.g.defaultDirectory;
});
Clazz_defineMethod (c$, "getLocalUrl", 
function (fileName) {
return this.apiPlatform.getLocalUrl (fileName);
}, "~S");
Clazz_overrideMethod (c$, "getBufferedInputStream", 
function (fullPathName) {
return this.fm.getBufferedInputStream (fullPathName);
}, "~S");
Clazz_defineMethod (c$, "setLoadParameters", 
 function (htParams, isAppend) {
if (htParams == null) htParams =  new java.util.Hashtable ();
htParams.put ("vwr", this);
if (this.g.atomTypes.length > 0) htParams.put ("atomTypes", this.g.atomTypes);
if (!htParams.containsKey ("lattice")) htParams.put ("lattice", this.g.ptDefaultLattice);
if (this.g.applySymmetryToBonds) htParams.put ("applySymmetryToBonds", Boolean.TRUE);
if (this.g.pdbGetHeader) htParams.put ("getHeader", Boolean.TRUE);
if (this.g.pdbSequential) htParams.put ("isSequential", Boolean.TRUE);
if (this.g.legacyJavaFloat) htParams.put ("legacyJavaFloat", Boolean.TRUE);
htParams.put ("stateScriptVersionInt", Integer.$valueOf (this.stateScriptVersionInt));
if (!htParams.containsKey ("filter")) {
var filter = this.g.defaultLoadFilter;
if (filter.length > 0) htParams.put ("filter", filter);
}var merging = (isAppend && !this.g.appendNew && this.ms.ac > 0);
htParams.put ("baseAtomIndex", Integer.$valueOf (isAppend ? this.ms.ac : 0));
htParams.put ("baseModelIndex", Integer.$valueOf (this.ms.ac == 0 ? 0 : this.ms.mc + (merging ? -1 : 0)));
if (merging) htParams.put ("merging", Boolean.TRUE);
return htParams;
}, "java.util.Map,~B");
Clazz_overrideMethod (c$, "openFileAsyncSpecial", 
function (fileName, flags) {
this.getScriptManager ().openFileAsync (fileName, flags);
}, "~S,~N");
Clazz_overrideMethod (c$, "openFile", 
function (fileName) {
this.zap (true, true, false);
return this.loadModelFromFileRepaint (null, fileName, null, null);
}, "~S");
Clazz_overrideMethod (c$, "openFiles", 
function (fileNames) {
this.zap (true, true, false);
return this.loadModelFromFileRepaint (null, null, fileNames, null);
}, "~A");
Clazz_overrideMethod (c$, "openReader", 
function (fullPathName, fileName, reader) {
this.zap (true, true, false);
return this.loadModelFromFileRepaint (fullPathName, fileName, null, reader);
}, "~S,~S,java.io.Reader");
Clazz_overrideMethod (c$, "openDOM", 
function (DOMNode) {
this.zap (true, true, false);
return this.loadModelFromFileRepaint ("?", "?", null, DOMNode);
}, "~O");
Clazz_defineMethod (c$, "loadModelFromFileRepaint", 
 function (fullPathName, fileName, fileNames, reader) {
var ret = this.loadModelFromFile (fullPathName, fileName, fileNames, reader, false, null, null, null, 0, false);
this.refresh (1, "loadModelFromFileRepaint");
return ret;
}, "~S,~S,~A,~O");
Clazz_defineMethod (c$, "loadModelFromFile", 
function (fullPathName, fileName, fileNames, reader, isAppend, htParams, loadScript, sOptions, tokType, isConcat) {
if (htParams == null) htParams = this.setLoadParameters (null, isAppend);
if (isConcat) htParams.put ("concatenate", Boolean.TRUE);
var atomSetCollection;
var saveInfo = this.fm.getFileInfo ();
if (fileNames != null) {
if (loadScript == null) {
loadScript =  new JU.SB ().append ("load files");
for (var i = 0; i < fileNames.length; i++) loadScript.append (i == 0 || !isConcat ? " " : "+").append ("/*file*/$FILENAME" + (i + 1) + "$");

}if (sOptions.length () > 0) loadScript.append (" /*options*/ ").append (sOptions.toString ());
var timeBegin = System.currentTimeMillis ();
atomSetCollection = this.fm.createAtomSetCollectionFromFiles (fileNames, this.setLoadParameters (htParams, isAppend), isAppend);
var ms = System.currentTimeMillis () - timeBegin;
JU.Logger.info ("openFiles(" + fileNames.length + ") " + ms + " ms");
fileNames = htParams.get ("fullPathNames");
var fileTypes = htParams.get ("fileTypes");
var s = loadScript.toString ();
for (var i = 0; i < fileNames.length; i++) {
var fname = fileNames[i];
if (fileTypes != null && fileTypes[i] != null) fname = fileTypes[i] + "::" + fname;
s = JU.PT.rep (s, "$FILENAME" + (i + 1) + "$", JU.PT.esc (fname.$replace ('\\', '/')));
}
loadScript =  new JU.SB ().append (s);
} else if (reader == null) {
if (loadScript == null) loadScript =  new JU.SB ().append ("load /*file*/$FILENAME$");
atomSetCollection = this.openFileFull (fileName, isAppend, htParams, loadScript);
} else if (Clazz_instanceOf (reader, java.io.Reader)) {
atomSetCollection = this.fm.createAtomSetCollectionFromReader (fullPathName, fileName, reader, htParams);
} else {
atomSetCollection = this.fm.createAtomSetCollectionFromDOM (reader, htParams);
}if (tokType != 0) {
this.fm.setFileInfo (saveInfo);
return this.loadAtomDataAndReturnError (atomSetCollection, tokType);
}if (htParams.containsKey ("isData")) return atomSetCollection;
if (loadScript != null && !(Clazz_instanceOf (atomSetCollection, String))) {
var fname = htParams.get ("fullPathName");
if (fname == null) fname = "";
if (htParams.containsKey ("loadScript")) loadScript = htParams.get ("loadScript");
htParams.put ("loadScript", loadScript =  new JU.SB ().append (JU.PT.rep (loadScript.toString (), "$FILENAME$", JU.PT.esc (fname.$replace ('\\', '/')))));
}return this.createModelSetAndReturnError (atomSetCollection, isAppend, loadScript, htParams);
}, "~S,~S,~A,~O,~B,java.util.Map,JU.SB,JU.SB,~N,~B");
Clazz_defineMethod (c$, "setLigandModel", 
function (key, data) {
if (this.ligandModels == null) this.ligandModels =  new java.util.Hashtable ();
this.ligandModels.put (key, data);
}, "~S,~S");
Clazz_defineMethod (c$, "getLigandModel", 
function (id, prefix, suffix, terminator) {
if (id == null) {
if (this.ligandModelSet != null) {
var e = this.ligandModels.entrySet ().iterator ();
while (e.hasNext ()) {
var entry = e.next ();
if (Clazz_instanceOf (entry.getValue (), Boolean)) e.remove ();
}
}return null;
}var isLigand = prefix.equals ("ligand_");
if (isLigand) id = id.toUpperCase ();
if (this.ligandModelSet == null) this.ligandModelSet =  new java.util.Hashtable ();
this.ligandModelSet.put (id, Boolean.TRUE);
if (this.ligandModels == null) this.ligandModels =  new java.util.Hashtable ();
var isPng = (id.indexOf ("|") > 0);
if (isPng) id = id.substring (id.indexOf ("|") + 1);
var model = (terminator == null ? this.ligandModels.get (id) : null);
var data;
var fname = null;
if (Clazz_instanceOf (model, Boolean)) return null;
if (model == null && (terminator == null || isPng)) model = this.ligandModels.get (id + suffix);
var isError = false;
if (model == null) {
var s;
if (isLigand) {
fname = this.setLoadFormat ("#" + id, '#', false);
if (fname.length == 0) return null;
this.scriptEcho ("fetching " + fname);
s = this.getFileAsString3 (fname, false, null);
} else {
s = this.getFileAsString3 (prefix, false, null);
var pt = (terminator == null ? -1 : s.indexOf (terminator));
if (pt >= 0) s = s.substring (0, pt);
}isError = (s.indexOf ("java.") == 0);
model = s;
if (!isError) this.ligandModels.put (id + suffix, model);
}if (!isLigand) return model;
if (!isError && Clazz_instanceOf (model, String)) {
data = model;
if (data.length != 0) {
var htParams =  new java.util.Hashtable ();
htParams.put ("modelOnly", Boolean.TRUE);
model = this.getModelAdapter ().getAtomSetCollectionReader ("ligand", null, JU.Rdr.getBR (data), htParams);
isError = (Clazz_instanceOf (model, String));
if (!isError) {
model = this.getModelAdapter ().getAtomSetCollection (model);
isError = (Clazz_instanceOf (model, String));
if (fname != null && !isError) this.scriptEcho (this.getModelAdapter ().getAtomSetCollectionAuxiliaryInfo (model).get ("modelLoadNote"));
}}}if (isError) {
this.scriptEcho (model.toString ());
this.ligandModels.put (id, Boolean.FALSE);
return null;
}return model;
}, "~S,~S,~S,~S");
Clazz_defineMethod (c$, "openFileFull", 
 function (fileName, isAppend, htParams, loadScript) {
if (fileName == null) return null;
if (fileName.indexOf ("[]") >= 0) {
return null;
}var atomSetCollection;
var msg = "openFile(" + fileName + ")";
JU.Logger.startTimer (msg);
htParams = this.setLoadParameters (htParams, isAppend);
var isLoadVariable = fileName.startsWith ("@");
var haveFileData = (htParams.containsKey ("fileData"));
if (fileName.indexOf ('$') == 0) htParams.put ("smilesString", fileName.substring (1));
var isString = (fileName.equalsIgnoreCase ("string") || fileName.equals ("Jmol Model Kit"));
var strModel = null;
if (haveFileData) {
strModel = htParams.get ("fileData");
if (htParams.containsKey ("isData")) {
return this.loadInlineScript (strModel, '\0', isAppend, htParams);
}} else if (isString) {
strModel = this.ms.getInlineData (-1);
if (strModel == null) if (this.g.modelKitMode) strModel = "5\n\nC 0 0 0\nH .63 .63 .63\nH -.63 -.63 .63\nH -.63 .63 -.63\nH .63 -.63 -.63";
 else return "cannot find string data";
if (loadScript != null) htParams.put ("loadScript", loadScript =  new JU.SB ().append (JU.PT.rep (loadScript.toString (), "$FILENAME$", "data \"model inline\"\n" + strModel + "end \"model inline\"")));
}if (strModel != null) {
if (!isAppend) this.zap (true, false, false);
if (!isLoadVariable && (!haveFileData || isString)) this.getStateCreator ().getInlineData (loadScript, strModel, isAppend, this.g.defaultLoadFilter);
atomSetCollection = this.fm.createAtomSetCollectionFromString (strModel, htParams, isAppend);
} else {
atomSetCollection = this.fm.createAtomSetCollectionFromFile (fileName, htParams, isAppend);
}JU.Logger.checkTimer (msg, false);
return atomSetCollection;
}, "~S,~B,java.util.Map,JU.SB");
Clazz_overrideMethod (c$, "openStringInline", 
function (strModel) {
var ret = this.openStringInlineParamsAppend (strModel, null, false);
this.refresh (1, "openStringInline");
return ret;
}, "~S");
Clazz_defineMethod (c$, "loadInline", 
function (strModel) {
return this.loadInlineScriptRepaint (strModel, this.g.inlineNewlineChar, false);
}, "~S");
Clazz_defineMethod (c$, "loadInline", 
function (strModel, newLine) {
return this.loadInlineScriptRepaint (strModel, newLine, false);
}, "~S,~S");
Clazz_overrideMethod (c$, "loadInlineAppend", 
function (strModel, isAppend) {
return this.loadInlineScriptRepaint (strModel, '\0', isAppend);
}, "~S,~B");
Clazz_defineMethod (c$, "loadInlineScriptRepaint", 
 function (strModel, newLine, isAppend) {
var ret = this.loadInlineScript (strModel, newLine, isAppend, null);
this.refresh (1, "loadInlineScript");
return ret;
}, "~S,~S,~B");
Clazz_defineMethod (c$, "loadInline", 
function (arrayModels) {
return this.loadInline (arrayModels, false);
}, "~A");
Clazz_defineMethod (c$, "loadInline", 
function (arrayModels, isAppend) {
if (arrayModels == null || arrayModels.length == 0) return null;
var ret = this.openStringsInlineParamsAppend (arrayModels, null, isAppend);
this.refresh (1, "loadInline String[]");
return ret;
}, "~A,~B");
Clazz_defineMethod (c$, "loadInline", 
function (arrayData, isAppend) {
if (arrayData == null || arrayData.size () == 0) return null;
if (!isAppend) this.zap (true, false, false);
var list =  new JU.Lst ();
for (var i = 0; i < arrayData.size (); i++) list.addLast (arrayData.get (i));

var atomSetCollection = this.fm.createAtomSeCollectionFromArrayData (list, this.setLoadParameters (null, isAppend), isAppend);
var ret = this.createModelSetAndReturnError (atomSetCollection, isAppend, null, null);
this.refresh (1, "loadInline");
return ret;
}, "java.util.List,~B");
Clazz_defineMethod (c$, "loadInlineScript", 
 function (strModel, newLine, isAppend, htParams) {
if (strModel == null || strModel.length == 0) return null;
strModel = JV.Viewer.fixInlineString (strModel, newLine);
if (newLine.charCodeAt (0) != 0) JU.Logger.info ("loading model inline, " + strModel.length + " bytes, with newLine character " + (newLine).charCodeAt (0) + " isAppend=" + isAppend);
if (JU.Logger.debugging) JU.Logger.debug (strModel);
var datasep = this.getDataSeparator ();
var i;
if (datasep != null && datasep !== "" && (i = strModel.indexOf (datasep)) >= 0 && strModel.indexOf ("# Jmol state") < 0) {
var n = 2;
while ((i = strModel.indexOf (datasep, i + 1)) >= 0) n++;

var strModels =  new Array (n);
var pt = 0;
var pt0 = 0;
for (i = 0; i < n; i++) {
pt = strModel.indexOf (datasep, pt0);
if (pt < 0) pt = strModel.length;
strModels[i] = strModel.substring (pt0, pt);
pt0 = pt + datasep.length;
}
return this.openStringsInlineParamsAppend (strModels, htParams, isAppend);
}return this.openStringInlineParamsAppend (strModel, htParams, isAppend);
}, "~S,~S,~B,java.util.Map");
c$.fixInlineString = Clazz_defineMethod (c$, "fixInlineString", 
function (strModel, newLine) {
var i;
if (strModel.indexOf ("\\/n") >= 0) {
strModel = JU.PT.rep (strModel, "\n", "");
strModel = JU.PT.rep (strModel, "\\/n", "\n");
newLine = String.fromCharCode ( 0);
}if (newLine.charCodeAt (0) != 0 && newLine != '\n') {
var repEmpty = (strModel.indexOf ('\n') >= 0);
var len = strModel.length;
for (i = 0; i < len && strModel.charAt (i) == ' '; ++i) {
}
if (i < len && strModel.charAt (i) == newLine) strModel = strModel.substring (i + 1);
if (repEmpty) strModel = JU.PT.rep (strModel, "" + newLine, "");
 else strModel = strModel.$replace (newLine, '\n');
}return strModel;
}, "~S,~S");
Clazz_defineMethod (c$, "openStringInlineParamsAppend", 
function (strModel, htParams, isAppend) {
var br = JU.Rdr.getBR (strModel);
var type = this.getModelAdapter ().getFileTypeName (br);
if (type == null) return "unknown file type";
if (type.equals ("spt")) {
return "cannot open script inline";
}htParams = this.setLoadParameters (htParams, isAppend);
var loadScript = htParams.get ("loadScript");
var isLoadCommand = htParams.containsKey ("isData");
if (loadScript == null) loadScript =  new JU.SB ();
if (!isAppend) this.zap (true, false, false);
if (!isLoadCommand) this.getStateCreator ().getInlineData (loadScript, strModel, isAppend, this.g.defaultLoadFilter);
var atomSetCollection = this.fm.createAtomSetCollectionFromString (strModel, htParams, isAppend);
return this.createModelSetAndReturnError (atomSetCollection, isAppend, loadScript, null);
}, "~S,java.util.Map,~B");
Clazz_defineMethod (c$, "openStringsInlineParamsAppend", 
 function (arrayModels, htParams, isAppend) {
var loadScript =  new JU.SB ();
if (!isAppend) this.zap (true, false, false);
var atomSetCollection = this.fm.createAtomSeCollectionFromStrings (arrayModels, loadScript, this.setLoadParameters (htParams, isAppend), isAppend);
return this.createModelSetAndReturnError (atomSetCollection, isAppend, loadScript, null);
}, "~A,java.util.Map,~B");
Clazz_defineMethod (c$, "getInlineChar", 
function () {
return this.g.inlineNewlineChar;
});
Clazz_defineMethod (c$, "getDataSeparator", 
function () {
return this.g.getParameter ("dataseparator", true);
});
Clazz_defineMethod (c$, "createModelSetAndReturnError", 
 function (atomSetCollection, isAppend, loadScript, htParams) {
var fullPathName = this.fm.getFullPathName (false);
var fileName = this.fm.getFileName ();
var errMsg;
if (loadScript == null) {
this.setBooleanProperty ("preserveState", false);
loadScript =  new JU.SB ().append ("load \"???\"");
}if (Clazz_instanceOf (atomSetCollection, String)) {
errMsg = atomSetCollection;
this.setFileLoadStatus (J.c.FIL.NOT_LOADED, fullPathName, null, null, errMsg, null);
if (this.displayLoadErrors && !isAppend && !errMsg.equals ("#CANCELED#") && !errMsg.startsWith (JV.JC.READER_NOT_FOUND)) this.zapMsg (errMsg);
return errMsg;
}if (isAppend) this.clearAtomSets ();
 else if (this.g.modelKitMode && !fileName.equals ("Jmol Model Kit")) this.setModelKitMode (false);
this.setFileLoadStatus (J.c.FIL.CREATING_MODELSET, fullPathName, fileName, null, null, null);
this.pushHoldRepaintWhy ("createModelSet");
this.setErrorMessage (null, null);
try {
var bsNew =  new JU.BS ();
this.mm.createModelSet (fullPathName, fileName, loadScript, atomSetCollection, bsNew, isAppend);
if (bsNew.cardinality () > 0) {
var jmolScript = this.ms.getInfoM ("jmolscript");
if (this.ms.getMSInfoB ("doMinimize")) try {
this.minimize (htParams.get ("eval"), 2147483647, 0, bsNew, null, 0, true, true, true, true);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
 else this.addHydrogens (bsNew, false, true);
if (jmolScript != null) this.ms.msInfo.put ("jmolscript", jmolScript);
}this.initializeModel (isAppend);
} catch (er) {
if (Clazz_exceptionOf (er, Error)) {
this.handleError (er, true);
errMsg = this.getShapeErrorState ();
errMsg = ("ERROR creating model: " + er + (errMsg.length == 0 ? "" : "|" + errMsg));
this.zapMsg (errMsg);
this.setErrorMessage (errMsg, null);
} else {
throw er;
}
}
this.popHoldRepaint ("createModelSet \u0001## REPAINT_IGNORE ##");
errMsg = this.getErrorMessage ();
this.setFileLoadStatus (J.c.FIL.CREATED, fullPathName, fileName, this.ms.modelSetName, errMsg, htParams == null ? null : htParams.get ("async"));
if (isAppend) {
this.selectAll ();
this.setTainted (true);
this.axesAreTainted = true;
}atomSetCollection = null;
System.gc ();
return errMsg;
}, "~O,~B,JU.SB,java.util.Map");
Clazz_defineMethod (c$, "loadAtomDataAndReturnError", 
 function (atomSetCollection, tokType) {
if (Clazz_instanceOf (atomSetCollection, String)) return atomSetCollection;
this.setErrorMessage (null, null);
try {
var script = this.mm.createAtomDataSet (atomSetCollection, tokType);
switch (tokType) {
case 1146095626:
if (script != null) this.runScript (script);
break;
case 4166:
this.setStatusFrameChanged (true, true);
break;
case 1649412120:
this.shm.deleteVdwDependentShapes (null);
break;
}
} catch (er) {
if (Clazz_exceptionOf (er, Error)) {
this.handleError (er, true);
var errMsg = this.getShapeErrorState ();
errMsg = ("ERROR adding atom data: " + er + (errMsg.length == 0 ? "" : "|" + errMsg));
this.zapMsg (errMsg);
this.setErrorMessage (errMsg, null);
this.setParallel (false);
} else {
throw er;
}
}
return this.getErrorMessage ();
}, "~O,~N");
Clazz_defineMethod (c$, "getCurrentFileAsString", 
function (state) {
var filename = this.fm.getFullPathName (false);
if (filename.equals ("string") || filename.equals ("Jmol Model Kit")) return this.ms.getInlineData (this.am.cmi);
if (filename.indexOf ("[]") >= 0) return filename;
if (filename === "JSNode") return "<DOM NODE>";
return this.getFileAsString4 (filename, -1, true, false, false, state);
}, "~S");
Clazz_defineMethod (c$, "getFullPathNameOrError", 
function (filename) {
var data =  new Array (2);
this.fm.getFullPathNameOrError (filename, false, data);
return data;
}, "~S");
Clazz_defineMethod (c$, "getFileAsString3", 
function (name, checkProtected, state) {
return this.getFileAsString4 (name, -1, false, false, checkProtected, state);
}, "~S,~B,~S");
Clazz_defineMethod (c$, "getFileAsString4", 
function (name, nBytesMax, doSpecialLoad, allowBinary, checkProtected, state) {
if (name == null) return this.getCurrentFileAsString (state);
var data =  new Array (2);
data[0] = name;
this.fm.getFileDataAsString (data, nBytesMax, doSpecialLoad, allowBinary, checkProtected);
return data[1];
}, "~S,~N,~B,~B,~B,~S");
Clazz_defineMethod (c$, "autoCalculate", 
function (tokProperty) {
switch (tokProperty) {
case 1112539151:
this.ms.getSurfaceDistanceMax ();
break;
case 1112539150:
this.ms.calculateStraightness ();
break;
}
}, "~N");
Clazz_defineMethod (c$, "calculateStraightness", 
function () {
this.ms.haveStraightness = false;
this.ms.calculateStraightness ();
});
Clazz_defineMethod (c$, "calculateSurface", 
function (bsSelected, envelopeRadius) {
if (bsSelected == null) bsSelected = this.bsA ();
if (envelopeRadius == 3.4028235E38 || envelopeRadius == -1) this.ms.addStateScript ("calculate surfaceDistance " + (envelopeRadius == 3.4028235E38 ? "FROM" : "WITHIN"), null, bsSelected, null, "", false, true);
return this.ms.calculateSurface (bsSelected, envelopeRadius);
}, "JU.BS,~N");
Clazz_defineMethod (c$, "getStructureList", 
function () {
return this.g.getStructureList ();
});
Clazz_defineMethod (c$, "setStructureList", 
function (list, type) {
this.g.setStructureList (list, type);
this.ms.setStructureList (this.getStructureList ());
}, "~A,J.c.STR");
Clazz_defineMethod (c$, "calculateStructures", 
function (bsAtoms, asDSSP, setStructure) {
if (bsAtoms == null) bsAtoms = this.bsA ();
return this.ms.calculateStructures (bsAtoms, asDSSP, !this.am.animationOn, this.g.dsspCalcHydrogen, setStructure);
}, "JU.BS,~B,~B");
Clazz_defineMethod (c$, "getAnnotationParser", 
function () {
return (this.annotationParser == null ? (this.annotationParser = J.api.Interface.getOption ("dssx.AnnotationParser", this, "script")) : this.annotationParser);
});
Clazz_overrideMethod (c$, "getSelectedAtomIterator", 
function (bsSelected, isGreaterOnly, modelZeroBased, isMultiModel) {
return this.ms.getSelectedAtomIterator (bsSelected, isGreaterOnly, modelZeroBased, false, isMultiModel);
}, "JU.BS,~B,~B,~B");
Clazz_overrideMethod (c$, "setIteratorForAtom", 
function (iterator, atomIndex, distance) {
this.ms.setIteratorForAtom (iterator, -1, atomIndex, distance, null);
}, "J.api.AtomIndexIterator,~N,~N");
Clazz_overrideMethod (c$, "setIteratorForPoint", 
function (iterator, modelIndex, pt, distance) {
this.ms.setIteratorForPoint (iterator, modelIndex, pt, distance);
}, "J.api.AtomIndexIterator,~N,JU.T3,~N");
Clazz_overrideMethod (c$, "fillAtomData", 
function (atomData, mode) {
atomData.programInfo = "Jmol Version " + JV.Viewer.getJmolVersion ();
atomData.fileName = this.fm.getFileName ();
this.ms.fillAtomData (atomData, mode);
}, "J.atomdata.AtomData,~N");
Clazz_defineMethod (c$, "addStateScript", 
function (script, addFrameNumber, postDefinitions) {
return this.ms.addStateScript (script, null, null, null, null, addFrameNumber, postDefinitions);
}, "~S,~B,~B");
Clazz_defineMethod (c$, "getMinimizer", 
function (createNew) {
return (this.minimizer == null && createNew ? (this.minimizer = J.api.Interface.getInterface ("JM.Minimizer", this, "script")).setProperty ("vwr", this) : this.minimizer);
}, "~B");
Clazz_defineMethod (c$, "getSmilesMatcher", 
function () {
return (this.smilesMatcher == null ? (this.smilesMatcher = J.api.Interface.getInterface ("JS.SmilesMatcher", this, "script")) : this.smilesMatcher);
});
Clazz_defineMethod (c$, "clearModelDependentObjects", 
function () {
this.setFrameOffsets (null);
this.stopMinimization ();
this.minimizer = null;
this.smilesMatcher = null;
});
Clazz_defineMethod (c$, "zap", 
function (notify, resetUndo, zapModelKit) {
this.clearThreads ();
if (this.mm.modelSet == null) {
this.mm.zap ();
} else {
this.ligandModelSet = null;
this.clearModelDependentObjects ();
this.fm.clear ();
this.clearRepaintManager (-1);
this.am.clear ();
this.tm.clear ();
this.slm.clear ();
this.clearAllMeasurements ();
this.clearMinimization ();
this.gdata.clear ();
this.mm.zap ();
if (this.scm != null) this.scm.clear (false);
if (this.nmrCalculation != null) this.getNMRCalculation ().setChemicalShiftReference (null, 0);
if (this.haveDisplay) {
this.mouse.clear ();
this.clearTimeouts ();
this.acm.clear ();
}this.stm.clear (this.g);
this.tempArray.clear ();
this.chainMap.clear ();
this.chainList.clear ();
this.definedAtomSets.clear ();
this.lastData = null;
if (this.dm != null) this.dm.clear ();
this.setBooleanProperty ("legacyjavafloat", false);
if (resetUndo) {
if (zapModelKit && this.g.modelKitMode) {
this.openStringInlineParamsAppend ("5\n\nC 0 0 0\nH .63 .63 .63\nH -.63 -.63 .63\nH -.63 .63 -.63\nH .63 -.63 -.63", null, true);
this.setRotationRadius (5.0, true);
this.setStringProperty ("picking", "assignAtom_C");
this.setStringProperty ("picking", "assignBond_p");
}this.undoClear ();
}System.gc ();
}this.initializeModel (false);
if (notify) {
this.setFileLoadStatus (J.c.FIL.ZAPPED, null, (resetUndo ? "resetUndo" : this.getZapName ()), null, null, null);
}if (JU.Logger.debugging) JU.Logger.checkMemory ();
}, "~B,~B,~B");
Clazz_defineMethod (c$, "zapMsg", 
 function (msg) {
this.zap (true, true, false);
this.echoMessage (msg);
}, "~S");
Clazz_defineMethod (c$, "echoMessage", 
function (msg) {
var iShape = 31;
this.shm.loadShape (iShape);
this.setShapeProperty (iShape, "font", this.getFont3D ("SansSerif", "Plain", 9));
this.setShapeProperty (iShape, "target", "error");
this.setShapeProperty (iShape, "text", msg);
}, "~S");
Clazz_defineMethod (c$, "initializeModel", 
 function (isAppend) {
this.clearThreads ();
if (isAppend) {
this.am.initializePointers (1);
return;
}this.reset (true);
this.selectAll ();
this.rotatePrev1 = this.rotateBondIndex = -1;
this.movingSelected = false;
this.slm.noneSelected = Boolean.FALSE;
this.hoverEnabled = true;
this.tm.setCenter ();
this.am.initializePointers (1);
if (!this.ms.getMSInfoB ("isPyMOL")) {
this.clearAtomSets ();
this.setCurrentModelIndex (0);
}this.setBackgroundModelIndex (-1);
this.setFrankOn (this.getShowFrank ());
this.startHoverWatcher (true);
this.setTainted (true);
this.finalizeTransformParameters ();
}, "~B");
Clazz_defineMethod (c$, "startHoverWatcher", 
function (tf) {
if (tf && this.inMotion || !this.haveDisplay || tf && (!this.hoverEnabled || this.am.animationOn)) return;
this.acm.startHoverWatcher (tf);
}, "~B");
Clazz_overrideMethod (c$, "getModelSetPathName", 
function () {
return this.mm.modelSetPathName;
});
Clazz_overrideMethod (c$, "getModelSetFileName", 
function () {
return (this.mm.fileName == null ? this.getZapName () : this.mm.fileName);
});
Clazz_defineMethod (c$, "getUnitCellInfoText", 
function () {
var c = this.getCurrentUnitCell ();
return (c == null ? "not applicable" : c.getUnitCellInfo ());
});
Clazz_defineMethod (c$, "getUnitCellInfo", 
function (infoType) {
var symmetry = this.getCurrentUnitCell ();
return (symmetry == null ? NaN : symmetry.getUnitCellInfoType (infoType));
}, "~N");
Clazz_defineMethod (c$, "getV0abc", 
function (def) {
var uc = this.getCurrentUnitCell ();
return (uc == null ? null : uc.getV0abc (def));
}, "~O");
Clazz_defineMethod (c$, "getPolymerPointsAndVectors", 
function (bs, vList) {
this.ms.getPolymerPointsAndVectors (bs, vList, this.g.traceAlpha, this.g.sheetSmoothing);
}, "JU.BS,JU.Lst");
Clazz_defineMethod (c$, "getHybridizationAndAxes", 
function (atomIndex, z, x, lcaoType) {
return this.ms.getHybridizationAndAxes (atomIndex, 0, z, x, lcaoType, true, true);
}, "~N,JU.V3,JU.V3,~S");
Clazz_defineMethod (c$, "getAllAtoms", 
function () {
return this.getModelUndeletedAtomsBitSet (-1);
});
Clazz_defineMethod (c$, "getModelUndeletedAtomsBitSet", 
function (modelIndex) {
return this.slm.excludeAtoms (this.ms.getModelAtomBitSetIncludingDeleted (modelIndex, true), false);
}, "~N");
Clazz_defineMethod (c$, "getModelUndeletedAtomsBitSetBs", 
function (bsModels) {
return this.slm.excludeAtoms (this.ms.getModelAtomBitSetIncludingDeletedBs (bsModels), false);
}, "JU.BS");
Clazz_overrideMethod (c$, "getBoundBoxCenter", 
function () {
return this.ms.getBoundBoxCenter (this.am.cmi);
});
Clazz_defineMethod (c$, "calcBoundBoxDimensions", 
function (bs, scale) {
this.ms.calcBoundBoxDimensions (bs, scale);
this.axesAreTainted = true;
}, "JU.BS,~N");
Clazz_overrideMethod (c$, "getBoundBoxCornerVector", 
function () {
return this.ms.getBoundBoxCornerVector ();
});
Clazz_defineMethod (c$, "getBoundBoxCenterX", 
function () {
return Clazz_doubleToInt (this.dimScreen.width / 2);
});
Clazz_defineMethod (c$, "getBoundBoxCenterY", 
function () {
return Clazz_doubleToInt (this.dimScreen.height / 2);
});
Clazz_overrideMethod (c$, "getModelSetProperties", 
function () {
return this.ms.modelSetProperties;
});
Clazz_overrideMethod (c$, "getModelProperties", 
function (modelIndex) {
return this.ms.am[modelIndex].properties;
}, "~N");
Clazz_overrideMethod (c$, "getModelSetAuxiliaryInfo", 
function () {
return this.ms.msInfo;
});
Clazz_overrideMethod (c$, "getModelNumber", 
function (modelIndex) {
return (modelIndex < 0 ? modelIndex : this.ms.getModelNumber (modelIndex));
}, "~N");
Clazz_defineMethod (c$, "getModelFileNumber", 
function (modelIndex) {
return (modelIndex < 0 ? 0 : this.ms.modelFileNumbers[modelIndex]);
}, "~N");
Clazz_overrideMethod (c$, "getModelNumberDotted", 
function (modelIndex) {
return modelIndex < 0 ? "0" : this.ms.getModelNumberDotted (modelIndex);
}, "~N");
Clazz_overrideMethod (c$, "getModelName", 
function (modelIndex) {
return this.ms.getModelName (modelIndex);
}, "~N");
Clazz_defineMethod (c$, "modelHasVibrationVectors", 
function (modelIndex) {
return (this.ms.getLastVibrationVector (modelIndex, 4166) >= 0);
}, "~N");
Clazz_defineMethod (c$, "getBondsForSelectedAtoms", 
function (bsAtoms) {
return this.ms.getBondsForSelectedAtoms (bsAtoms, this.g.bondModeOr || JU.BSUtil.cardinalityOf (bsAtoms) == 1);
}, "JU.BS");
Clazz_defineMethod (c$, "frankClicked", 
function (x, y) {
return !this.g.disablePopupMenu && this.getShowFrank () && this.shm.checkFrankclicked (x, y);
}, "~N,~N");
Clazz_defineMethod (c$, "frankClickedModelKit", 
function (x, y) {
return !this.g.disablePopupMenu && this.g.modelKitMode && x >= 0 && y >= 0 && x < 40 && y < 80;
}, "~N,~N");
Clazz_overrideMethod (c$, "findNearestAtomIndex", 
function (x, y) {
return this.findNearestAtomIndexMovable (x, y, false);
}, "~N,~N");
Clazz_defineMethod (c$, "findNearestAtomIndexMovable", 
function (x, y, mustBeMovable) {
return (!this.g.atomPicking ? -1 : this.ms.findNearestAtomIndex (x, y, mustBeMovable ? this.slm.getMotionFixedAtoms () : null, this.g.minPixelSelRadius));
}, "~N,~N,~B");
Clazz_defineMethod (c$, "toCartesian", 
function (pt, ignoreOffset) {
var unitCell = this.getCurrentUnitCell ();
if (unitCell != null) {
unitCell.toCartesian (pt, ignoreOffset);
if (!this.g.legacyJavaFloat) JU.PT.fixPtFloats (pt, 10000.0);
}}, "JU.T3,~B");
Clazz_defineMethod (c$, "toFractional", 
function (pt, asAbsolute) {
var unitCell = this.getCurrentUnitCell ();
if (unitCell != null) {
unitCell.toFractional (pt, asAbsolute);
if (!this.g.legacyJavaFloat) JU.PT.fixPtFloats (pt, 100000.0);
}}, "JU.T3,~B");
Clazz_defineMethod (c$, "toUnitCell", 
function (pt, offset) {
var unitCell = this.getCurrentUnitCell ();
if (unitCell != null) unitCell.toUnitCell (pt, offset);
}, "JU.P3,JU.P3");
Clazz_defineMethod (c$, "setCurrentCage", 
function (isosurfaceId) {
var data = [isosurfaceId, null];
this.shm.getShapePropertyData (24, "unitCell", data);
this.ms.setModelCage (this.am.cmi, data[1]);
}, "~S");
Clazz_defineMethod (c$, "addUnitCellOffset", 
function (pt) {
var unitCell = this.getCurrentUnitCell ();
if (unitCell == null) return;
pt.add (unitCell.getCartesianOffset ());
}, "JU.P3");
Clazz_defineMethod (c$, "setAtomData", 
function (type, name, coordinateData, isDefault) {
this.ms.setAtomData (type, name, coordinateData, isDefault);
if (type == 2) this.checkCoordinatesChanged ();
this.refreshMeasures (true);
}, "~N,~S,~S,~B");
Clazz_overrideMethod (c$, "setCenterSelected", 
function () {
this.setCenterBitSet (this.bsA (), true);
});
Clazz_defineMethod (c$, "setApplySymmetryToBonds", 
function (TF) {
this.g.applySymmetryToBonds = TF;
}, "~B");
Clazz_overrideMethod (c$, "setBondTolerance", 
function (bondTolerance) {
this.g.setF ("bondTolerance", bondTolerance);
this.g.bondTolerance = bondTolerance;
}, "~N");
Clazz_overrideMethod (c$, "setMinBondDistance", 
function (minBondDistance) {
this.g.setF ("minBondDistance", minBondDistance);
this.g.minBondDistance = minBondDistance;
}, "~N");
Clazz_defineMethod (c$, "getAtomsNearPt", 
function (distance, coord) {
var bs =  new JU.BS ();
this.ms.getAtomsWithin (distance, coord, bs, -1);
return bs;
}, "~N,JU.P3");
Clazz_defineMethod (c$, "getBranchBitSet", 
function (atomIndex, atomIndexNot, allowCyclic) {
if (atomIndex < 0 || atomIndex >= this.ms.ac) return  new JU.BS ();
return JU.JmolMolecule.getBranchBitSet (this.ms.at, atomIndex, this.getModelUndeletedAtomsBitSet (this.ms.at[atomIndex].mi), null, atomIndexNot, allowCyclic, true);
}, "~N,~N,~B");
Clazz_defineMethod (c$, "getAtomIndexFromAtomNumber", 
function (atomNumber) {
return this.ms.getAtomIndexFromAtomNumber (atomNumber, this.getVisibleFramesBitSet ());
}, "~N");
Clazz_overrideMethod (c$, "getElementsPresentBitSet", 
function (modelIndex) {
return this.ms.getElementsPresentBitSet (modelIndex);
}, "~N");
Clazz_defineMethod (c$, "getFileHeader", 
function () {
return this.ms.getFileHeader (this.am.cmi);
});
Clazz_defineMethod (c$, "getFileData", 
function () {
return this.ms.getFileData (this.am.cmi);
});
Clazz_defineMethod (c$, "getCifData", 
function (modelIndex) {
var data = this.getFileAsString3 (this.ms.getModelFileName (modelIndex), false, null);
return (data == null ? null : JU.Rdr.readCifData (J.api.Interface.getInterface ("JU.CifDataParser", this, "script"), JU.Rdr.getBR (data)));
}, "~N");
Clazz_defineMethod (c$, "getStateCreator", 
function () {
if (this.jsc == null) (this.jsc = J.api.Interface.getInterface ("JV.StateCreator", this, "script")).setViewer (this);
return this.jsc;
});
Clazz_defineMethod (c$, "getWrappedStateScript", 
function () {
return this.getOutputManager ().getWrappedState (null, null, null, null);
});
Clazz_overrideMethod (c$, "getStateInfo", 
function () {
return this.getStateInfo3 (null, 0, 0);
});
Clazz_defineMethod (c$, "getStateInfo3", 
function (type, width, height) {
return (this.g.preserveState ? this.getStateCreator ().getStateScript (type, width, height) : "");
}, "~S,~N,~N");
Clazz_defineMethod (c$, "getStructureState", 
function () {
return this.getStateCreator ().getModelState (null, false, true);
});
Clazz_defineMethod (c$, "getProteinStructureState", 
function () {
return this.ms.getProteinStructureState (this.bsA (), false, false, 3);
});
Clazz_defineMethod (c$, "getCoordinateState", 
function (bsSelected) {
return this.getStateCreator ().getAtomicPropertyState (2, bsSelected);
}, "JU.BS");
Clazz_defineMethod (c$, "setCurrentColorRange", 
function (label) {
var data = this.getDataFloat (label);
var bs = (data == null ? null : (this.getDataManager ().getData (label))[2]);
if (bs != null && this.g.rangeSelected) bs.and (this.bsA ());
this.cm.setPropertyColorRangeData (data, bs);
}, "~S");
Clazz_defineMethod (c$, "setData", 
function (type, data, arrayCount, matchField, matchFieldColumnCount, field, fieldColumnCount) {
this.getDataManager ().setData (type, this.lastData = data, arrayCount, this.ms.ac, matchField, matchFieldColumnCount, field, fieldColumnCount);
}, "~S,~A,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "getData", 
function (type) {
return (type == null ? this.lastData : this.getDataManager ().getData (type));
}, "~S");
Clazz_defineMethod (c$, "getDataFloat", 
function (label) {
return this.getDataManager ().getDataFloatA (label);
}, "~S");
Clazz_defineMethod (c$, "getDataFloat2D", 
function (label) {
return this.getDataManager ().getDataFloat2D (label);
}, "~S");
Clazz_defineMethod (c$, "getDataFloat3D", 
function (label) {
return this.getDataManager ().getDataFloat3D (label);
}, "~S");
Clazz_defineMethod (c$, "getDataFloatAt", 
function (label, atomIndex) {
return this.getDataManager ().getDataFloat (label, atomIndex);
}, "~S,~N");
Clazz_defineMethod (c$, "autoHbond", 
function (bsFrom, bsTo, onlyIfHaveCalculated) {
if (bsFrom == null) bsFrom = bsTo = this.bsA ();
return this.ms.autoHbond (bsFrom, bsTo, onlyIfHaveCalculated);
}, "JU.BS,JU.BS,~B");
Clazz_defineMethod (c$, "getCurrentUnitCell", 
function () {
if (this.am.cai >= 0) return this.ms.getUnitCellForAtom (this.am.cai);
var m = this.am.cmi;
if (m >= 0) return this.ms.getUnitCell (m);
var models = this.getVisibleFramesBitSet ();
var ucLast = null;
for (var i = models.nextSetBit (0); i >= 0; i = models.nextSetBit (i + 1)) {
var uc = this.ms.getUnitCell (i);
if (uc == null) continue;
if (ucLast == null) {
ucLast = uc;
continue;
}if (!ucLast.unitCellEquals (uc)) return null;
}
return ucLast;
});
Clazz_defineMethod (c$, "getDefaultMeasurementLabel", 
function (nPoints) {
switch (nPoints) {
case 2:
return this.g.defaultDistanceLabel;
case 3:
return this.g.defaultAngleLabel;
default:
return this.g.defaultTorsionLabel;
}
}, "~N");
Clazz_overrideMethod (c$, "getMeasurementCount", 
function () {
var count = this.getShapePropertyAsInt (6, "count");
return count <= 0 ? 0 : count;
});
Clazz_overrideMethod (c$, "getMeasurementStringValue", 
function (i) {
return "" + this.shm.getShapePropertyIndex (6, "stringValue", i);
}, "~N");
Clazz_defineMethod (c$, "getMeasurementInfoAsString", 
function () {
return this.getShapeProperty (6, "infostring");
});
Clazz_overrideMethod (c$, "getMeasurementCountPlusIndices", 
function (i) {
return this.shm.getShapePropertyIndex (6, "countPlusIndices", i);
}, "~N");
Clazz_defineMethod (c$, "setPendingMeasurement", 
function (mp) {
this.shm.loadShape (6);
this.setShapeProperty (6, "pending", mp);
}, "JM.MeasurementPending");
Clazz_defineMethod (c$, "getPendingMeasurement", 
function () {
return this.getShapeProperty (6, "pending");
});
Clazz_defineMethod (c$, "clearAllMeasurements", 
function () {
this.setShapeProperty (6, "clear", null);
});
Clazz_overrideMethod (c$, "clearMeasurements", 
function () {
this.evalString ("measures delete");
});
Clazz_defineMethod (c$, "setAnimation", 
function (tok) {
switch (tok) {
case 1073742098:
this.am.reverseAnimation ();
case 1073742096:
case 4143:
if (!this.am.animationOn) this.am.resumeAnimation ();
return;
case 20487:
if (this.am.animationOn && !this.am.animationPaused) this.am.pauseAnimation ();
return;
case 1073742037:
this.am.setAnimationNext ();
return;
case 1073742108:
this.am.setAnimationPrevious ();
return;
case 1073741942:
case 1073742125:
this.am.rewindAnimation ();
return;
case 1073741993:
this.am.setAnimationLast ();
return;
}
}, "~N");
Clazz_overrideMethod (c$, "setAnimationFps", 
function (fps) {
this.am.setAnimationFps (fps);
}, "~N");
Clazz_defineMethod (c$, "setAnimationMode", 
 function (mode) {
if (mode.equalsIgnoreCase ("once")) {
this.am.setAnimationReplayMode (1073742070, 0, 0);
} else if (mode.equalsIgnoreCase ("loop")) {
this.am.setAnimationReplayMode (528410, 1, 1);
} else if (mode.startsWith ("pal")) {
this.am.setAnimationReplayMode (1073742082, 1, 1);
}}, "~S");
Clazz_defineMethod (c$, "setAnimationOn", 
function (animationOn) {
var wasAnimating = this.am.animationOn;
if (animationOn == wasAnimating) return;
this.am.setAnimationOn (animationOn);
}, "~B");
Clazz_defineMethod (c$, "setAnimationRange", 
function (modelIndex1, modelIndex2) {
this.am.setAnimationRange (modelIndex1, modelIndex2);
}, "~N,~N");
Clazz_overrideMethod (c$, "getVisibleFramesBitSet", 
function () {
return this.ms.selectDisplayedTrajectories (JU.BSUtil.copy (this.am.bsVisibleModels));
});
Clazz_defineMethod (c$, "defineAtomSets", 
function (info) {
this.definedAtomSets.putAll (info);
}, "java.util.Map");
Clazz_defineMethod (c$, "setAnimDisplay", 
function (bs) {
this.am.setDisplay (bs);
if (!this.am.animationOn) this.am.morph (this.am.currentMorphModel + 1);
}, "JU.BS");
Clazz_defineMethod (c$, "setCurrentModelIndex", 
function (modelIndex) {
if (modelIndex == -2147483648) {
this.prevFrame = -2147483648;
this.setCurrentModelIndexClear (this.am.cmi, true);
return;
}this.am.setModel (modelIndex, true);
}, "~N");
Clazz_defineMethod (c$, "getTrajectoryState", 
function () {
return this.getStateCreator ().getTrajectoryState ();
});
Clazz_defineMethod (c$, "setFrameOffsets", 
function (bsAtoms) {
this.frameOffsets = this.ms.getFrameOffsets (this.bsFrameOffsets = bsAtoms);
}, "JU.BS");
Clazz_defineMethod (c$, "setCurrentModelIndexClear", 
function (modelIndex, clearBackground) {
this.am.setModel (modelIndex, clearBackground);
}, "~N,~B");
Clazz_defineMethod (c$, "haveFileSet", 
function () {
return (this.ms.mc > 1 && this.getModelNumber (2147483647) > 2000000);
});
Clazz_defineMethod (c$, "setBackgroundModelIndex", 
function (modelIndex) {
this.am.setBackgroundModelIndex (modelIndex);
this.g.setO ("backgroundModel", this.ms.getModelNumberDotted (modelIndex));
}, "~N");
Clazz_defineMethod (c$, "setFrameVariables", 
function () {
this.g.setO ("animationMode", JS.T.nameOf (this.am.animationReplayMode));
this.g.setI ("animationFps", this.am.animationFps);
this.g.setO ("_firstFrame", this.am.getModelSpecial (-1));
this.g.setO ("_lastFrame", this.am.getModelSpecial (1));
this.g.setF ("_animTimeSec", this.am.getAnimRunTimeSeconds ());
this.g.setB ("_animMovie", this.am.isMovie);
});
Clazz_defineMethod (c$, "getInMotion", 
function (includeAnim) {
return (this.inMotion || includeAnim && this.am.animationOn);
}, "~B");
Clazz_overrideMethod (c$, "getMotionEventNumber", 
function () {
return this.motionEventNumber;
});
Clazz_overrideMethod (c$, "setInMotion", 
function (inMotion) {
if ( new Boolean (this.inMotion ^ inMotion).valueOf ()) {
this.inMotion = inMotion;
this.resizeImage (0, 0, false, false, true);
if (inMotion) {
this.startHoverWatcher (false);
++this.motionEventNumber;
} else {
this.startHoverWatcher (true);
this.refresh (3, "vwr setInMotion " + inMotion);
}}}, "~B");
Clazz_defineMethod (c$, "setRefreshing", 
 function (TF) {
this.refreshing = TF;
}, "~B");
Clazz_defineMethod (c$, "getRefreshing", 
function () {
return this.refreshing;
});
Clazz_overrideMethod (c$, "pushHoldRepaint", 
function () {
this.pushHoldRepaintWhy (null);
});
Clazz_defineMethod (c$, "pushHoldRepaintWhy", 
function (why) {
if (this.rm != null) this.rm.pushHoldRepaint (why);
}, "~S");
Clazz_overrideMethod (c$, "popHoldRepaint", 
function (why) {
if (this.rm != null) {
this.rm.popHoldRepaint (why.indexOf ("\u0001## REPAINT_IGNORE ##") < 0, why);
}}, "~S");
Clazz_overrideMethod (c$, "refresh", 
function (mode, strWhy) {
if (this.rm == null || !this.refreshing) return;
if (mode == 6 && this.getInMotion (true)) return;
if (this.isWebGL) {
if (mode == 1 || mode == 2 || mode == 7) {
this.tm.finalizeTransformParameters ();
{
if (!this.html5Applet) return;
this.html5Applet._refresh();
}}} else {
if (mode > 0 && mode != 7) this.rm.repaintIfReady ("refresh " + mode + " " + strWhy);
}if (mode != 7 && mode % 3 != 0 && this.sm.doSync ()) this.sm.setSync (mode == 2 ? strWhy : null);
}, "~N,~S");
Clazz_defineMethod (c$, "requestRepaintAndWait", 
function (why) {
if (!this.haveDisplay || this.rm == null) return;
this.rm.requestRepaintAndWait (why);
this.setSync ();
}, "~S");
Clazz_defineMethod (c$, "clearShapeRenderers", 
function () {
this.clearRepaintManager (-1);
});
Clazz_defineMethod (c$, "isRepaintPending", 
function () {
return (this.rm == null ? false : this.rm.isRepaintPending ());
});
Clazz_overrideMethod (c$, "notifyViewerRepaintDone", 
function () {
if (this.rm != null) this.rm.repaintDone ();
this.am.repaintDone ();
});
Clazz_defineMethod (c$, "areAxesTainted", 
function () {
var TF = this.axesAreTainted;
this.axesAreTainted = false;
return TF;
});
Clazz_defineMethod (c$, "setMaximumSize", 
 function (x) {
this.maximumSize = Math.max (x, 100);
}, "~N");
Clazz_overrideMethod (c$, "setScreenDimension", 
function (width, height) {
height = Math.min (height, this.maximumSize);
width = Math.min (width, this.maximumSize);
if (this.isStereoDouble ()) width = Clazz_doubleToInt ((width + 1) / 2);
if (this.dimScreen.width == width && this.dimScreen.height == height) return;
this.resizeImage (width, height, false, false, true);
}, "~N,~N");
Clazz_defineMethod (c$, "setStereo", 
function (isStereoSlave, gRight) {
this.isStereoSlave = isStereoSlave;
this.gRight = gRight;
}, "~B,~O");
Clazz_defineMethod (c$, "getImageFontScaling", 
function () {
return this.imageFontScaling;
});
Clazz_defineMethod (c$, "resizeImage", 
function (width, height, isImageWrite, isExport, isReset) {
if (!isImageWrite && this.creatingImage) return;
if (!isExport && !isImageWrite) this.setShapeProperty (5, "clearBoxes", null);
this.antialiased = (isReset ? this.g.antialiasDisplay && this.checkMotionRendering (603979786) : isImageWrite && !isExport ? this.g.antialiasImages : false);
this.imageFontScaling = (isReset || width <= 0 ? 1 : Clazz_doubleToInt ((this.g.zoomLarge == (height > width) ? height : width) / this.getScreenDim ())) * (this.antialiased ? 2 : 1);
if (width > 0) {
this.dimScreen.width = width;
this.dimScreen.height = height;
if (!isImageWrite) {
this.g.setI ("_width", width);
this.g.setI ("_height", height);
}} else {
width = (this.dimScreen.width == 0 ? this.dimScreen.width = 500 : this.dimScreen.width);
height = (this.dimScreen.height == 0 ? this.dimScreen.height = 500 : this.dimScreen.height);
}this.tm.setScreenParameters (width, height, isImageWrite || isReset ? this.g.zoomLarge : false, this.antialiased, false, false);
this.gdata.setWindowParameters (width, height, this.antialiased);
if (width > 0 && !isImageWrite) this.setStatusResized (width, height);
}, "~N,~N,~B,~B,~B");
Clazz_overrideMethod (c$, "getScreenWidth", 
function () {
return this.dimScreen.width;
});
Clazz_overrideMethod (c$, "getScreenHeight", 
function () {
return this.dimScreen.height;
});
Clazz_defineMethod (c$, "getScreenDim", 
function () {
return (this.g.zoomLarge == (this.dimScreen.height > this.dimScreen.width) ? this.dimScreen.height : this.dimScreen.width);
});
Clazz_overrideMethod (c$, "generateOutputForExport", 
function (params) {
return (this.noGraphicsAllowed || this.rm == null ? null : this.getOutputManager ().getOutputFromExport (params));
}, "java.util.Map");
Clazz_defineMethod (c$, "clearRepaintManager", 
 function (iShape) {
if (this.rm != null) this.rm.clear (iShape);
}, "~N");
Clazz_defineMethod (c$, "renderScreenImageStereo", 
function (gLeft, checkStereoSlave, width, height) {
if (this.updateWindow (width, height)) {
if (!checkStereoSlave || this.gRight == null) {
this.getScreenImageBuffer (gLeft, false);
} else {
this.render1 (this.gRight, this.getImage (true, false), 0, 0);
this.render1 (gLeft, this.getImage (false, false), 0, 0);
}}if (this.captureParams != null && Boolean.FALSE !== this.captureParams.get ("captureEnabled")) {
var t = (this.captureParams.get ("endTime")).longValue ();
if (t > 0 && System.currentTimeMillis () + 50 > t) this.captureParams.put ("captureMode", "end");
this.processWriteOrCapture (this.captureParams);
}this.notifyViewerRepaintDone ();
}, "~O,~B,~N,~N");
Clazz_defineMethod (c$, "updateJS", 
function () {
if (this.isWebGL) {
if (this.jsParams == null) {
this.jsParams =  new java.util.Hashtable ();
this.jsParams.put ("type", "JS");
}if (this.updateWindow (0, 0)) this.render ();
this.notifyViewerRepaintDone ();
} else {
if (this.isStereoSlave) return;
this.renderScreenImageStereo (this.apiPlatform.getGraphics (null), true, 0, 0);
}});
Clazz_defineMethod (c$, "updateJSView", 
 function (imodel, iatom) {
var applet = this.html5Applet;
{
applet && applet._viewSet != null && applet._atomPickedCallback(imodel, iatom);
}}, "~N,~N");
Clazz_defineMethod (c$, "updateWindow", 
 function (width, height) {
if (!this.refreshing || this.creatingImage) return false;
if (this.isTainted || this.tm.slabEnabled) this.setModelVisibility ();
this.isTainted = false;
if (this.rm != null) {
if (width != 0) this.setScreenDimension (width, height);
}return true;
}, "~N,~N");
Clazz_defineMethod (c$, "renderScreenImage", 
function (g, width, height) {
this.renderScreenImageStereo (g, false, width, height);
}, "~O,~N,~N");
Clazz_defineMethod (c$, "getImage", 
 function (isDouble, isImageWrite) {
if (this.isWebGL) return null;
var image = null;
try {
this.beginRendering (isDouble, isImageWrite);
this.render ();
this.gdata.endRendering ();
image = this.gdata.getScreenImage (isImageWrite);
} catch (e$$) {
if (Clazz_exceptionOf (e$$, Error)) {
var er = e$$;
{
this.gdata.getScreenImage (isImageWrite);
this.handleError (er, false);
this.setErrorMessage ("Error during rendering: " + er, null);
}
} else if (Clazz_exceptionOf (e$$, Exception)) {
var e = e$$;
{
System.out.println ("render error");
}
} else {
throw e$$;
}
}
return image;
}, "~B,~B");
Clazz_defineMethod (c$, "beginRendering", 
 function (isDouble, isImageWrite) {
this.gdata.beginRendering (this.tm.getStereoRotationMatrix (isDouble), this.g.translucent, isImageWrite, !this.checkMotionRendering (603979967));
}, "~B,~B");
Clazz_defineMethod (c$, "render", 
 function () {
if (this.mm.modelSet == null || !this.mustRender || !this.refreshing && !this.creatingImage || this.rm == null) return;
var antialias2 = this.antialiased && this.g.antialiasTranslucent;
this.finalizeTransformParameters ();
var navMinMax = this.shm.finalizeAtoms (this.tm.bsSelectedAtoms, this.tm.ptOffset);
this.tm.bsSelectedAtoms = null;
if (this.isWebGL) {
this.rm.renderExport (this.gdata, this.ms, this.jsParams);
this.notifyViewerRepaintDone ();
return;
}this.rm.render (this.gdata, this.ms, true, navMinMax);
if (this.gdata.setPass2 (antialias2)) {
this.tm.setAntialias (antialias2);
this.rm.render (this.gdata, this.ms, false, null);
this.tm.setAntialias (this.antialiased);
}});
Clazz_defineMethod (c$, "render1", 
 function (graphic, img, x, y) {
if (graphic != null && img != null) {
this.apiPlatform.drawImage (graphic, img, x, y, this.dimScreen.width, this.dimScreen.height);
}this.gdata.releaseScreenImage ();
}, "~O,~O,~N,~N");
Clazz_overrideMethod (c$, "getScreenImageBuffer", 
function (graphic, isImageWrite) {
if (this.isWebGL) return null;
var mergeImages = (graphic == null && this.isStereoDouble ());
var imageBuffer;
if (this.tm.stereoMode.isBiColor ()) {
this.beginRendering (true, isImageWrite);
this.render ();
this.gdata.endRendering ();
this.gdata.snapshotAnaglyphChannelBytes ();
this.beginRendering (false, isImageWrite);
this.render ();
this.gdata.endRendering ();
this.gdata.applyAnaglygh (this.tm.stereoMode, this.tm.stereoColors);
imageBuffer = this.gdata.getScreenImage (isImageWrite);
} else {
imageBuffer = this.getImage (this.isStereoDouble (), isImageWrite);
}var imageBuffer2 = null;
if (mergeImages) {
imageBuffer2 = this.apiPlatform.newBufferedImage (imageBuffer, this.dimScreen.width << 1, this.dimScreen.height);
graphic = this.apiPlatform.getGraphics (imageBuffer2);
}if (graphic != null) {
if (this.isStereoDouble ()) {
this.render1 (graphic, imageBuffer, this.dimScreen.width, 0);
imageBuffer = this.getImage (false, false);
}this.render1 (graphic, imageBuffer, 0, 0);
}return (mergeImages ? imageBuffer2 : imageBuffer);
}, "~O,~B");
Clazz_overrideMethod (c$, "getImageAsBytes", 
function (type, width, height, quality, errMsg) {
return (this.isWebGL ? null : this.getOutputManager ().getImageAsBytes (type, width, height, quality, errMsg));
}, "~S,~N,~N,~N,~A");
Clazz_overrideMethod (c$, "releaseScreenImage", 
function () {
this.gdata.releaseScreenImage ();
});
Clazz_overrideMethod (c$, "evalFile", 
function (strFilename) {
return (this.allowScripting && this.getScriptManager () != null ? this.scm.evalFile (strFilename) : null);
}, "~S");
Clazz_defineMethod (c$, "getInsertedCommand", 
function () {
var s = this.insertedCommand;
this.insertedCommand = "";
if (JU.Logger.debugging && s !== "") JU.Logger.debug ("inserting: " + s);
return s;
});
Clazz_overrideMethod (c$, "script", 
function (strScript) {
return this.evalStringQuietSync (strScript, false, true);
}, "~S");
Clazz_overrideMethod (c$, "evalString", 
function (strScript) {
return this.evalStringQuietSync (strScript, false, true);
}, "~S");
Clazz_overrideMethod (c$, "evalStringQuiet", 
function (strScript) {
return this.evalStringQuietSync (strScript, true, true);
}, "~S");
Clazz_defineMethod (c$, "evalStringQuietSync", 
function (strScript, isQuiet, allowSyncScript) {
return (this.getScriptManager () == null ? null : this.scm.evalStringQuietSync (strScript, isQuiet, allowSyncScript));
}, "~S,~B,~B");
Clazz_defineMethod (c$, "clearScriptQueue", 
function () {
if (this.scm != null) this.scm.clearQueue ();
});
Clazz_defineMethod (c$, "setScriptQueue", 
 function (TF) {
this.g.useScriptQueue = TF;
if (!TF) this.clearScriptQueue ();
}, "~B");
Clazz_overrideMethod (c$, "checkHalt", 
function (str, isInsert) {
return (this.scm != null && this.scm.checkHalt (str, isInsert));
}, "~S,~B");
Clazz_overrideMethod (c$, "scriptWait", 
function (strScript) {
return this.evalWait ("JSON", strScript, "+scriptStarted,+scriptStatus,+scriptEcho,+scriptTerminated");
}, "~S");
Clazz_overrideMethod (c$, "scriptWaitStatus", 
function (strScript, statusList) {
return this.evalWait ("object", strScript, statusList);
}, "~S,~S");
Clazz_defineMethod (c$, "evalWait", 
 function (returnType, strScript, statusList) {
if (this.getScriptManager () == null) return null;
this.scm.waitForQueue ();
var doTranslateTemp = J.i18n.GT.setDoTranslate (false);
var ret = this.evalStringWaitStatusQueued (returnType, strScript, statusList, false, false);
J.i18n.GT.setDoTranslate (doTranslateTemp);
return ret;
}, "~S,~S,~S");
Clazz_defineMethod (c$, "evalStringWaitStatusQueued", 
function (returnType, strScript, statusList, isQuiet, isQueued) {
{
if (strScript.indexOf("JSCONSOLE") == 0) {
this.html5Applet._showInfo(strScript.indexOf("CLOSE")<0); if
(strScript.indexOf("CLEAR") >= 0) this.html5Applet._clearConsole();
return null; }
}return (this.getScriptManager () == null ? null : this.scm.evalStringWaitStatusQueued (returnType, strScript, statusList, isQuiet, isQueued));
}, "~S,~S,~S,~B,~B");
Clazz_defineMethod (c$, "exitJmol", 
function () {
if (this.isApplet && !this.isJNLP) return;
if (this.headlessImageParams != null) {
try {
if (this.headless) this.outputToFile (this.headlessImageParams);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}if (JU.Logger.debugging) JU.Logger.debug ("exitJmol -- exiting");
System.out.flush ();
System.exit (0);
});
Clazz_defineMethod (c$, "scriptCheckRet", 
 function (strScript, returnContext) {
if (this.getScriptManager () == null) return null;
return this.scm.scriptCheckRet (strScript, returnContext);
}, "~S,~B");
Clazz_overrideMethod (c$, "scriptCheck", 
function (strScript) {
if (this.getScriptManager () == null) return null;
return this.scriptCheckRet (strScript, false);
}, "~S");
Clazz_overrideMethod (c$, "isScriptExecuting", 
function () {
return (this.eval != null && this.eval.isExecuting ());
});
Clazz_overrideMethod (c$, "haltScriptExecution", 
function () {
if (this.eval != null) {
this.eval.haltExecution ();
this.eval.stopScriptThreads ();
}this.setStringPropertyTok ("pathForAllFiles", 545259571, "");
this.clearTimeouts ();
});
Clazz_defineMethod (c$, "pauseScriptExecution", 
function () {
if (this.eval != null) this.eval.pauseExecution (true);
});
Clazz_defineMethod (c$, "resolveDatabaseFormat", 
function (fileName) {
if (JV.Viewer.hasDatabasePrefix (fileName)) fileName = this.setLoadFormat (fileName, fileName.charAt (0), false);
return fileName;
}, "~S");
c$.isDatabaseCode = Clazz_defineMethod (c$, "isDatabaseCode", 
function (ch) {
return (ch == '*' || ch == '$' || ch == '=' || ch == ':');
}, "~S");
c$.hasDatabasePrefix = Clazz_defineMethod (c$, "hasDatabasePrefix", 
function (fileName) {
return (fileName.length != 0 && JV.Viewer.isDatabaseCode (fileName.charAt (0)));
}, "~S");
Clazz_defineMethod (c$, "setLoadFormat", 
function (name, type, withPrefix) {
var format;
var f = name.substring (1);
switch (type) {
case '=':
if (name.startsWith ("==")) {
f = f.substring (1);
type = '#';
} else if (f.indexOf ("/") > 0) {
try {
var pt = f.indexOf ("/");
var database = f.substring (0, pt);
f = this.g.resolveDataBase (database, f.substring (pt + 1));
return (f == null ? name : f);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return name;
} else {
throw e;
}
}
}case '#':
var s = (type == '=' ? this.g.loadFormat : this.g.loadLigandFormat);
if (f.indexOf (".") > 0 && s.indexOf ("%FILE.") >= 0) s = s.substring (0, s.indexOf ("%FILE") + 5);
return JU.PT.formatStringS (s, "FILE", f);
case '*':
var pt = name.lastIndexOf ("/");
if (name.startsWith ("*dom/")) {
f = name.substring (pt + 1);
format = (pt > 4 ? name.substring (5) : "mappings");
return JU.PT.rep (this.g.resolveDataBase ("map", f), "%TYPE", format);
} else if (name.startsWith ("*val/")) {
f = name.substring (pt + 1);
format = (pt > 4 ? name.substring (5) : "validation/outliers/all");
return JU.PT.rep (this.g.resolveDataBase ("map", f), "%TYPE", format);
} else if (name.startsWith ("*rna3d/")) {
f = name.substring (pt + 1);
format = (pt > 6 ? name.substring (6) : "loops");
return JU.PT.rep (this.g.resolveDataBase ("rna3d", f), "%TYPE", format);
} else if (name.startsWith ("*dssr/")) {
f = name.substring (pt + 1);
return this.g.resolveDataBase ("dssr", f);
}return this.g.resolveDataBase ("pdbe", f);
case ':':
format = this.g.pubChemFormat;
if (f.equals ("")) {
try {
f = "smiles:" + this.getSmiles (this.bsA ());
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
}var fl = f.toLowerCase ();
var fi = -2147483648;
try {
fi = Integer.parseInt (f);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
if (fi != -2147483648) {
f = "cid/" + fi;
} else {
if (fl.startsWith ("smiles:")) {
format += "?POST?smiles=" + f.substring (7);
f = "smiles";
} else if (f.startsWith ("cid:") || f.startsWith ("inchikey:") || f.startsWith ("cas:")) {
f = f.$replace (':', '/');
} else {
if (fl.startsWith ("name:")) f = f.substring (5);
f = "name/" + JU.PT.escapeUrl (f);
}}return JU.PT.formatStringS (format, "FILE", f);
case '$':
if (name.startsWith ("$$")) {
f = f.substring (1);
format = JU.PT.rep (this.g.smilesUrlFormat, "&get3d=True", "");
return JU.PT.formatStringS (format, "FILE", JU.PT.escapeUrl (f));
}if (name.equals ("$")) try {
f = this.getSmiles (this.bsA ());
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
case 'N':
case '2':
case 'I':
case 'K':
case 'S':
case 'T':
case '/':
f = JU.PT.escapeUrl (f);
switch (type) {
case 'N':
format = this.g.nihResolverFormat + "/names";
break;
case '2':
format = this.g.nihResolverFormat + "/image";
break;
case 'I':
format = this.g.nihResolverFormat + "/stdinchi";
break;
case 'K':
format = this.g.nihResolverFormat + "/inchikey";
break;
case 'S':
format = this.g.nihResolverFormat + "/stdinchikey";
break;
case 'T':
format = this.g.nihResolverFormat + "/stdinchi";
break;
case '/':
format = this.g.nihResolverFormat + "/";
break;
default:
format = this.g.smilesUrlFormat;
break;
}
return (withPrefix ? "MOL3D::" : "") + JU.PT.formatStringS (format, "FILE", f);
case '_':
var isDiff = f.startsWith ("=");
if (isDiff) f = f.substring (1);
var server = JV.FileManager.fixFileNameVariables (isDiff ? this.g.edsUrlFormatDiff : this.g.edsUrlFormat, f);
var strCutoff = (isDiff ? "" : JV.FileManager.fixFileNameVariables (this.g.edsUrlCutoff, f));
return [server, strCutoff, isDiff ? "diff" : null];
}
return f;
}, "~S,~S,~B");
Clazz_defineMethod (c$, "getStandardLabelFormat", 
function (type) {
switch (type) {
default:
case 0:
return "%[identify]";
case 1:
return this.g.defaultLabelXYZ;
case 2:
return this.g.defaultLabelPDB;
}
}, "~N");
Clazz_defineMethod (c$, "getAdditionalHydrogens", 
function (bsAtoms, doAll, justCarbon, vConnections) {
if (bsAtoms == null) bsAtoms = this.bsA ();
var nTotal =  Clazz_newIntArray (1, 0);
var pts = this.ms.calculateHydrogens (bsAtoms, nTotal, doAll, justCarbon, vConnections);
var points =  new Array (nTotal[0]);
for (var i = 0, pt = 0; i < pts.length; i++) if (pts[i] != null) for (var j = 0; j < pts[i].length; j++) points[pt++] = pts[i][j];


return points;
}, "JU.BS,~B,~B,JU.Lst");
Clazz_overrideMethod (c$, "setMarBond", 
function (marBond) {
this.g.bondRadiusMilliAngstroms = marBond;
this.g.setI ("bondRadiusMilliAngstroms", marBond);
this.setShapeSize (1, marBond * 2, JU.BSUtil.setAll (this.ms.ac));
}, "~N");
Clazz_defineMethod (c$, "setHoverLabel", 
function (strLabel) {
this.shm.loadShape (35);
this.setShapeProperty (35, "label", strLabel);
this.hoverEnabled = (strLabel != null);
if (!this.hoverEnabled && !this.sm.haveHoverCallback ()) this.startHoverWatcher (false);
}, "~S");
Clazz_defineMethod (c$, "hoverOn", 
function (atomIndex, isLabel) {
this.g.removeParam ("_objecthovered");
this.g.setI ("_atomhovered", atomIndex);
this.g.setUserVariable ("hovered", JS.SV.getVariable (JU.BSUtil.newAndSetBit (atomIndex)));
if (this.sm.haveHoverCallback ()) this.sm.setStatusAtomHovered (atomIndex, this.getAtomInfoXYZ (atomIndex, false));
if (!this.hoverEnabled) return;
if (this.g.modelKitMode) {
if (this.ms.isAtomAssignable (atomIndex)) this.highlight (JU.BSUtil.newAndSetBit (atomIndex));
this.refresh (3, "hover on atom");
return;
}if (this.eval != null && this.isScriptExecuting () || atomIndex == this.hoverAtomIndex || this.g.hoverDelayMs == 0) return;
if (!this.slm.isInSelectionSubset (atomIndex)) return;
this.shm.loadShape (35);
if (isLabel && this.ms.at[atomIndex].isVisible (512)) {
this.setShapeProperty (35, "specialLabel", J.i18n.GT._ ("Drag to move label"));
}this.setShapeProperty (35, "text", null);
this.setShapeProperty (35, "target", Integer.$valueOf (atomIndex));
this.hoverText = null;
this.hoverAtomIndex = atomIndex;
this.refresh (3, "hover on atom");
}, "~N,~B");
Clazz_defineMethod (c$, "hoverOnPt", 
function (x, y, text, id, pt) {
if (this.eval != null && this.isScriptExecuting ()) return;
if (id != null && pt != null) {
this.g.setO ("_objecthovered", id);
this.g.setI ("_atomhovered", -1);
this.g.setUserVariable ("hovered", JS.SV.getVariable (pt));
if (this.sm.haveHoverCallback ()) this.sm.setStatusObjectHovered (id, text, pt);
}if (!this.hoverEnabled) return;
this.shm.loadShape (35);
this.setShapeProperty (35, "xy", JU.P3i.new3 (x, y, 0));
this.setShapeProperty (35, "target", null);
this.setShapeProperty (35, "specialLabel", null);
this.setShapeProperty (35, "text", text);
this.hoverAtomIndex = -1;
this.hoverText = text;
this.refresh (3, "hover on point");
}, "~N,~N,~S,~S,JU.T3");
Clazz_defineMethod (c$, "hoverOff", 
function () {
try {
if (this.g.modelKitMode) this.highlight (null);
if (!this.hoverEnabled) return;
var isHover = (this.hoverText != null || this.hoverAtomIndex >= 0);
if (this.hoverAtomIndex >= 0) {
this.setShapeProperty (35, "target", null);
this.hoverAtomIndex = -1;
}if (this.hoverText != null) {
this.setShapeProperty (35, "text", null);
this.hoverText = null;
}this.setShapeProperty (35, "specialLabel", null);
if (isHover) this.refresh (3, "hover off");
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
});
Clazz_overrideMethod (c$, "setDebugScript", 
function (debugScript) {
this.g.debugScript = debugScript;
this.g.setB ("debugScript", debugScript);
if (this.eval != null) this.eval.setDebugging ();
}, "~B");
Clazz_defineMethod (c$, "clearClickCount", 
function () {
this.setTainted (true);
});
Clazz_defineMethod (c$, "setCursor", 
function (cursor) {
if (this.$isKiosk || this.currentCursor == cursor || this.multiTouch || !this.haveDisplay) return;
this.apiPlatform.setCursor (this.currentCursor = cursor, this.display);
}, "~N");
Clazz_defineMethod (c$, "setPickingMode", 
function (strMode, pickingMode) {
if (!this.haveDisplay) return;
this.showSelected = false;
var option = null;
if (strMode != null) {
var pt = strMode.indexOf ("_");
if (pt >= 0) {
option = strMode.substring (pt + 1);
strMode = strMode.substring (0, pt);
}pickingMode = JV.ActionManager.getPickingMode (strMode);
}if (pickingMode < 0) pickingMode = 1;
this.acm.setPickingMode (pickingMode);
this.g.setO ("picking", JV.ActionManager.getPickingModeName (this.acm.getAtomPickingMode ()));
if (option == null || option.length == 0) return;
option = Character.toUpperCase (option.charAt (0)) + (option.length == 1 ? "" : option.substring (1, 2));
switch (pickingMode) {
case 32:
this.setAtomPickingOption (option);
break;
case 33:
this.setBondPickingOption (option);
break;
default:
JU.Logger.error ("Bad picking mode: " + strMode + "_" + option);
}
}, "~S,~N");
Clazz_defineMethod (c$, "getPickingMode", 
function () {
return (this.haveDisplay ? this.acm.getAtomPickingMode () : 0);
});
Clazz_defineMethod (c$, "setPickingStyle", 
function (style, pickingStyle) {
if (!this.haveDisplay) return;
if (style != null) pickingStyle = JV.ActionManager.getPickingStyleIndex (style);
if (pickingStyle < 0) pickingStyle = 0;
this.acm.setPickingStyle (pickingStyle);
this.g.setO ("pickingStyle", JV.ActionManager.getPickingStyleName (this.acm.getPickingStyle ()));
}, "~S,~N");
Clazz_defineMethod (c$, "getDrawHover", 
function () {
return this.haveDisplay && this.g.drawHover;
});
Clazz_defineMethod (c$, "getAtomInfo", 
function (atomOrPointIndex) {
if (this.ptTemp == null) this.ptTemp =  new JU.P3 ();
return (atomOrPointIndex >= 0 ? this.ms.getAtomInfo (atomOrPointIndex, null, this.ptTemp) : this.shm.getShapePropertyIndex (6, "pointInfo", -atomOrPointIndex));
}, "~N");
Clazz_defineMethod (c$, "getAtomInfoXYZ", 
function (atomIndex, useChimeFormat) {
if (this.ptTemp == null) this.ptTemp =  new JU.P3 ();
return this.ms.at[atomIndex].getInfoXYZ (!this.g.legacyJavaFloat, useChimeFormat, this.ptTemp);
}, "~N,~B");
Clazz_defineMethod (c$, "setSync", 
 function () {
if (this.sm.doSync ()) this.sm.setSync (null);
});
Clazz_overrideMethod (c$, "setJmolCallbackListener", 
function (jmolCallbackListener) {
this.sm.setJmolCallbackListener (jmolCallbackListener);
}, "J.api.JmolCallbackListener");
Clazz_overrideMethod (c$, "setJmolStatusListener", 
function (jmolStatusListener) {
this.sm.setJmolStatusListener (jmolStatusListener, null);
}, "J.api.JmolStatusListener");
Clazz_defineMethod (c$, "getStatusChanged", 
function (statusNameList) {
return (statusNameList == null ? null : this.sm.getStatusChanged (statusNameList));
}, "~S");
Clazz_defineMethod (c$, "menuEnabled", 
function () {
return (!this.g.disablePopupMenu && this.getPopupMenu () != null);
});
Clazz_defineMethod (c$, "popupMenu", 
function (x, y, type) {
if (!this.haveDisplay || !this.refreshing || this.isPreviewOnly || this.g.disablePopupMenu) return;
switch (type) {
case 'j':
try {
this.getPopupMenu ();
this.jmolpopup.jpiShow (x, y);
} catch (e) {
JU.Logger.info (e.toString ());
this.g.disablePopupMenu = true;
}
break;
case 'a':
case 'b':
case 'm':
if (this.modelkitPopup == null && (this.modelkitPopup = this.apiPlatform.getMenuPopup (null, type)) == null) return;
this.modelkitPopup.jpiShow (x, y);
break;
}
}, "~N,~N,~S");
Clazz_defineMethod (c$, "getMenu", 
function (type) {
this.getPopupMenu ();
if (type.equals ("\0")) {
this.popupMenu (this.dimScreen.width - 120, 0, 'j');
return "OK";
}return (this.jmolpopup == null ? "" : this.jmolpopup.jpiGetMenuAsString ("Jmol version " + JV.Viewer.getJmolVersion () + "|_GET_MENU|" + type));
}, "~S");
Clazz_defineMethod (c$, "getPopupMenu", 
 function () {
if (this.g.disablePopupMenu) return null;
if (this.jmolpopup == null) {
this.jmolpopup = (this.allowScripting ? this.apiPlatform.getMenuPopup (this.menuStructure, 'j') : null);
if (this.jmolpopup == null && !this.async) {
this.g.disablePopupMenu = true;
return null;
}}return this.jmolpopup.jpiGetMenuAsObject ();
});
Clazz_overrideMethod (c$, "setMenu", 
function (fileOrText, isFile) {
if (isFile) JU.Logger.info ("Setting menu " + (fileOrText.length == 0 ? "to Jmol defaults" : "from file " + fileOrText));
if (fileOrText.length == 0) fileOrText = null;
 else if (isFile) fileOrText = this.getFileAsString3 (fileOrText, false, null);
this.getProperty ("DATA_API", "setMenu", fileOrText);
this.sm.setCallbackFunction ("menu", fileOrText);
}, "~S,~B");
Clazz_defineMethod (c$, "setStatusFrameChanged", 
function (isVib, doNotify) {
if (isVib) {
this.prevFrame = -2147483648;
}this.tm.setVibrationPeriod (NaN);
var firstIndex = this.am.firstFrameIndex;
var lastIndex = this.am.lastFrameIndex;
var isMovie = this.am.isMovie;
var modelIndex = this.am.cmi;
if (firstIndex == lastIndex && !isMovie) modelIndex = firstIndex;
var frameID = this.getModelFileNumber (modelIndex);
var currentFrame = this.am.cmi;
var fileNo = frameID;
var modelNo = frameID % 1000000;
var firstNo = (isMovie ? firstIndex : this.getModelFileNumber (firstIndex));
var lastNo = (isMovie ? lastIndex : this.getModelFileNumber (lastIndex));
var strModelNo;
if (isMovie) {
strModelNo = "" + (currentFrame + 1);
} else if (fileNo == 0) {
strModelNo = this.getModelNumberDotted (firstIndex);
if (firstIndex != lastIndex) strModelNo += " - " + this.getModelNumberDotted (lastIndex);
if (Clazz_doubleToInt (firstNo / 1000000) == Clazz_doubleToInt (lastNo / 1000000)) fileNo = firstNo;
} else {
strModelNo = this.getModelNumberDotted (modelIndex);
}if (fileNo != 0) fileNo = (fileNo < 1000000 ? 1 : Clazz_doubleToInt (fileNo / 1000000));
if (!isMovie) {
this.g.setI ("_currentFileNumber", fileNo);
this.g.setI ("_currentModelNumberInFile", modelNo);
}var currentMorphModel = this.am.currentMorphModel;
this.g.setI ("_currentFrame", currentFrame);
this.g.setI ("_morphCount", this.am.morphCount);
this.g.setF ("_currentMorphFrame", currentMorphModel);
this.g.setI ("_frameID", frameID);
this.g.setO ("_modelNumber", strModelNo);
this.g.setO ("_modelName", (modelIndex < 0 ? "" : this.getModelName (modelIndex)));
var title = (modelIndex < 0 ? "" : this.ms.getModelTitle (modelIndex));
this.g.setO ("_modelTitle", title == null ? "" : title);
this.g.setO ("_modelFile", (modelIndex < 0 ? "" : this.ms.getModelFileName (modelIndex)));
this.g.setO ("_modelType", (modelIndex < 0 ? "" : this.ms.getModelFileType (modelIndex)));
if (currentFrame == this.prevFrame && currentMorphModel == this.prevMorphModel) return;
this.prevFrame = currentFrame;
this.prevMorphModel = currentMorphModel;
var entryName;
if (isMovie) {
entryName = "" + (currentFrame + 1);
} else {
entryName = this.getModelName (currentFrame);
var script = "" + this.getModelNumberDotted (currentFrame);
if (!entryName.equals (script)) entryName = script + ": " + entryName;
if (entryName.length > 50) entryName = entryName.substring (0, 45) + "...";
}this.sm.setStatusFrameChanged (fileNo, modelNo, (this.am.animationDirection < 0 ? -firstNo : firstNo), (this.am.currentDirection < 0 ? -lastNo : lastNo), currentFrame, currentMorphModel, entryName);
if (this.doHaveJDX ()) this.getJSV ().setModel (modelIndex);
if (this.isJS) this.updateJSView (modelIndex, -1);
}, "~B,~B");
Clazz_defineMethod (c$, "doHaveJDX", 
 function () {
return (this.haveJDX || (this.haveJDX = this.getBooleanProperty ("_JSpecView".toLowerCase ())));
});
Clazz_defineMethod (c$, "getJSV", 
function () {
if (this.jsv == null) {
this.jsv = J.api.Interface.getOption ("jsv.JSpecView", this, "script");
this.jsv.setViewer (this);
}return this.jsv;
});
Clazz_defineMethod (c$, "getJDXBaseModelIndex", 
function (modelIndex) {
if (!this.doHaveJDX ()) return modelIndex;
return this.getJSV ().getBaseModelIndex (modelIndex);
}, "~N");
Clazz_defineMethod (c$, "getJspecViewProperties", 
function (myParam) {
var o = this.sm.getJspecViewProperties ("" + myParam);
if (o != null) this.haveJDX = true;
return o;
}, "~O");
Clazz_defineMethod (c$, "scriptEcho", 
function (strEcho) {
if (!JU.Logger.isActiveLevel (4)) return;
{
System.out.println(strEcho);
}this.sm.setScriptEcho (strEcho, this.isScriptQueued ());
if (this.listCommands && strEcho != null && strEcho.indexOf ("$[") == 0) JU.Logger.info (strEcho);
}, "~S");
Clazz_defineMethod (c$, "isScriptQueued", 
 function () {
return this.scm != null && this.scm.isScriptQueued ();
});
Clazz_defineMethod (c$, "notifyError", 
function (errType, errMsg, errMsgUntranslated) {
this.g.setO ("_errormessage", errMsgUntranslated);
this.sm.notifyError (errType, errMsg, errMsgUntranslated);
}, "~S,~S,~S");
Clazz_defineMethod (c$, "jsEval", 
function (strEval) {
return this.sm.jsEval (strEval);
}, "~S");
Clazz_defineMethod (c$, "setFileLoadStatus", 
 function (ptLoad, fullPathName, fileName, modelName, strError, isAsync) {
this.setErrorMessage (strError, null);
this.g.setI ("_loadPoint", ptLoad.getCode ());
var doCallback = (ptLoad !== J.c.FIL.CREATING_MODELSET);
if (doCallback) this.setStatusFrameChanged (false, false);
this.sm.setFileLoadStatus (fullPathName, fileName, modelName, strError, ptLoad.getCode (), doCallback, isAsync);
if (doCallback) {
if (this.doHaveJDX ()) this.getJSV ().setModel (this.am.cmi);
if (this.isJS) this.updateJSView (this.am.cmi, -2);
}}, "J.c.FIL,~S,~S,~S,~S,Boolean");
Clazz_defineMethod (c$, "getZapName", 
function () {
return (this.g.modelKitMode ? "Jmol Model Kit" : "zapped");
});
Clazz_defineMethod (c$, "setStatusMeasuring", 
function (status, intInfo, strMeasure, value) {
this.sm.setStatusMeasuring (status, intInfo, strMeasure, value);
}, "~S,~N,~S,~N");
Clazz_defineMethod (c$, "notifyMinimizationStatus", 
function () {
var step = this.getP ("_minimizationStep");
var ff = this.getP ("_minimizationForceField");
this.sm.notifyMinimizationStatus (this.getP ("_minimizationStatus"), Clazz_instanceOf (step, String) ? Integer.$valueOf (0) : step, this.getP ("_minimizationEnergy"), (step.toString ().equals ("0") ? Float.$valueOf (0) : this.getP ("_minimizationEnergyDiff")), ff);
});
Clazz_defineMethod (c$, "setStatusAtomPicked", 
function (atomIndex, info, map) {
if (info == null) {
info = this.g.pickLabel;
info = (info.length == 0 ? this.getAtomInfoXYZ (atomIndex, this.g.messageStyleChime) : this.ms.getAtomInfo (atomIndex, info, this.ptTemp));
}this.setPicked (atomIndex);
this.g.setO ("_pickinfo", info);
this.sm.setStatusAtomPicked (atomIndex, info, map);
if (atomIndex < 0) return;
var syncMode = this.sm.getSyncMode ();
if (syncMode == 1 && this.doHaveJDX ()) this.getJSV ().atomPicked (atomIndex);
if (this.isJS) this.updateJSView (this.ms.at[atomIndex].mi, atomIndex);
}, "~N,~S,java.util.Map");
Clazz_defineMethod (c$, "setStatusDragDropped", 
function (mode, x, y, fileName) {
if (mode == 0) {
this.g.setO ("_fileDropped", fileName);
this.g.setUserVariable ("doDrop", JS.SV.vT);
}var handled = this.sm.setStatusDragDropped (mode, x, y, fileName);
return (!handled || this.getP ("doDrop").toString ().equals ("true"));
}, "~N,~N,~N,~S");
Clazz_defineMethod (c$, "setStatusResized", 
function (width, height) {
this.sm.setStatusResized (width, height);
}, "~N,~N");
Clazz_defineMethod (c$, "scriptStatus", 
function (strStatus) {
this.setScriptStatus (strStatus, "", 0, null);
}, "~S");
Clazz_defineMethod (c$, "scriptStatusMsg", 
function (strStatus, statusMessage) {
this.setScriptStatus (strStatus, statusMessage, 0, null);
}, "~S,~S");
Clazz_defineMethod (c$, "setScriptStatus", 
function (strStatus, statusMessage, msWalltime, strErrorMessageUntranslated) {
this.sm.setScriptStatus (strStatus, statusMessage, msWalltime, strErrorMessageUntranslated);
}, "~S,~S,~N,~S");
Clazz_defineMethod (c$, "dialogAsk", 
function (type, fileName) {
{
return prompt(type, fileName);
}}, "~S,~S");
Clazz_overrideMethod (c$, "showUrl", 
function (urlString) {
if (urlString == null) return;
if (urlString.indexOf (":") < 0) {
var base = this.fm.getAppletDocumentBase ();
if (base === "") base = this.fm.getFullPathName (false);
if (base.indexOf ("/") >= 0) {
base = base.substring (0, base.lastIndexOf ("/") + 1);
} else if (base.indexOf ("\\") >= 0) {
base = base.substring (0, base.lastIndexOf ("\\") + 1);
}urlString = base + urlString;
}JU.Logger.info ("showUrl:" + urlString);
this.sm.showUrl (urlString);
}, "~S");
Clazz_defineMethod (c$, "setMeshCreator", 
function (meshCreator) {
this.shm.loadShape (24);
this.setShapeProperty (24, "meshCreator", meshCreator);
}, "~O");
Clazz_defineMethod (c$, "showConsole", 
function (showConsole) {
if (!this.haveDisplay) return;
try {
if (this.appConsole == null && showConsole) this.getProperty ("DATA_API", "getAppConsole", Boolean.TRUE);
this.appConsole.setVisible (true);
} catch (e) {
}
}, "~B");
Clazz_overrideMethod (c$, "getParameter", 
function (key) {
return this.getP (key);
}, "~S");
Clazz_defineMethod (c$, "getP", 
function (key) {
return this.g.getParameter (key, true);
}, "~S");
Clazz_defineMethod (c$, "getPOrNull", 
function (key) {
return this.g.getParameter (key, false);
}, "~S");
Clazz_defineMethod (c$, "unsetProperty", 
function (key) {
key = key.toLowerCase ();
if (key.equals ("all") || key.equals ("variables")) this.fm.setPathForAllFiles ("");
this.g.unsetUserVariable (key);
}, "~S");
Clazz_overrideMethod (c$, "notifyStatusReady", 
function (isReady) {
System.out.println ("Jmol applet " + this.fullName + (isReady ? " ready" : " destroyed"));
if (!isReady) this.dispose ();
this.sm.setStatusAppletReady (this.fullName, isReady);
}, "~B");
Clazz_overrideMethod (c$, "getBooleanProperty", 
function (key) {
key = key.toLowerCase ();
if (this.g.htBooleanParameterFlags.containsKey (key)) return this.g.htBooleanParameterFlags.get (key).booleanValue ();
if (key.endsWith ("p!")) {
if (this.acm == null) return false;
var s = this.acm.getPickingState ().toLowerCase ();
key = key.substring (0, key.length - 2) + ";";
return (s.indexOf (key) >= 0);
}if (key.equalsIgnoreCase ("executionPaused")) return (this.eval != null && this.eval.isPaused ());
if (key.equalsIgnoreCase ("executionStepping")) return (this.eval != null && this.eval.isStepping ());
if (key.equalsIgnoreCase ("haveBFactors")) return (this.ms.getBFactors () != null);
if (key.equalsIgnoreCase ("colorRasmol")) return this.cm.isDefaultColorRasmol;
if (key.equalsIgnoreCase ("frank")) return this.getShowFrank ();
if (key.equalsIgnoreCase ("spinOn")) return this.tm.spinOn;
if (key.equalsIgnoreCase ("isNavigating")) return this.tm.isNavigating ();
if (key.equalsIgnoreCase ("showSelections")) return this.ms.getSelectionHaloEnabled ();
if (this.g.htUserVariables.containsKey (key)) {
var t = this.g.getUserVariable (key);
if (t.tok == 1048589) return true;
if (t.tok == 1048588) return false;
}JU.Logger.error ("vwr.getBooleanProperty(" + key + ") - unrecognized");
return false;
}, "~S");
Clazz_overrideMethod (c$, "getInt", 
function (tok) {
switch (tok) {
case 553648132:
return this.am.animationFps;
case 553648143:
return this.g.dotDensity;
case 553648144:
return this.g.dotScale;
case 553648146:
return this.g.helixStep;
case 553648151:
return this.g.meshScale;
case 553648153:
return this.g.minPixelSelRadius;
case 553648154:
return this.g.percentVdwAtom;
case 553648157:
return this.g.pickingSpinRate;
case 553648166:
return this.g.ribbonAspectRatio;
case 536870922:
return this.g.scriptDelay;
case 553648170:
return this.g.smallMoleculeMaxAtoms;
case 553648184:
return this.g.strutSpacing;
}
JU.Logger.error ("viewer.getInt(" + JS.T.nameOf (tok) + ") - not listed");
return 0;
}, "~N");
Clazz_defineMethod (c$, "getDelayMaximumMs", 
function () {
return (this.haveDisplay ? this.g.delayMaximumMs : 1);
});
Clazz_defineMethod (c$, "getHermiteLevel", 
function () {
return (this.tm.spinOn ? 0 : this.g.hermiteLevel);
});
Clazz_defineMethod (c$, "getHoverDelay", 
function () {
return (this.g.modelKitMode ? 20 : this.g.hoverDelayMs);
});
Clazz_overrideMethod (c$, "getBoolean", 
function (tok) {
switch (tok) {
case 1074790662:
return this.ms.getMSInfoB ("isPDB");
case 603979780:
return this.g.allowGestures;
case 603979784:
return this.g.allowMultiTouch;
case 603979785:
return this.g.allowRotateSelected;
case 603979792:
return this.g.appendNew;
case 603979794:
return this.g.applySymmetryToBonds;
case 603979796:
return this.g.atomPicking;
case 603979798:
return this.g.autoBond;
case 603979800:
return this.g.autoFps;
case 603979806:
return this.g.axesOrientationRasmol;
case 603979811:
return this.g.backboneSteps;
case 603979812:
return this.g.bondModeOr;
case 603979816:
return this.g.cartoonBaseEdges;
case 603979817:
return this.g.cartoonFancy;
case 603979818:
return this.g.cartoonLadders;
case 603979819:
return this.g.cartoonRibose;
case 603979820:
return this.g.cartoonRockets;
case 603979823:
return this.g.chainCaseSensitive || this.chainList.size () > 0;
case 603979825:
return this.g.debugScript;
case 603979826:
return this.g.defaultStructureDSSP;
case 603979827:
return this.g.disablePopupMenu;
case 603979828:
return this.g.displayCellParameters;
case 603979830:
return this.g.dotSurface;
case 603979829:
return this.g.dotsSelectedOnly;
case 603979833:
return this.g.drawPicking;
case 603979844:
return this.g.fontCaching;
case 603979845:
return this.g.fontScaling;
case 603979846:
return this.g.forceAutoBond;
case 603979848:
return false;
case 603979850:
return this.g.greyscaleRendering;
case 603979852:
return this.g.hbondsBackbone;
case 603979853:
return this.g.hbondsRasmol;
case 603979854:
return this.g.hbondsSolid;
case 1613758470:
return this.g.rasmolHeteroSetting;
case 603979858:
return this.g.hideNameInPopup;
case 603979864:
return this.g.highResolutionFlag;
case 1613758476:
return this.g.rasmolHydrogenSetting;
case 603979869:
return this.g.isosurfaceKey;
case 603979871:
return this.g.justifyMeasurements;
case 603979873:
return this.g.legacyAutoBonding;
case 603979874:
return this.g.legacyHAddition;
case 603979875:
return this.g.legacyJavaFloat;
case 603979877:
return this.g.logGestures;
case 603979878:
return this.g.measureAllModels;
case 603979879:
return this.g.measurementLabels;
case 603979880:
return this.g.messageStyleChime;
case 603979883:
return this.g.modelKitMode;
case 603979887:
return this.g.navigationMode;
case 603979888:
return this.g.navigationPeriodic;
case 603979889:
return this.g.partialDots;
case 603979892:
return this.g.pdbSequential;
case 603979894:
return this.g.preserveState;
case 603979898:
return this.g.ribbonBorder;
case 603979900:
return this.g.rocketBarrels;
case 603979906:
return this.g.selectAllModels;
case 603979920:
return this.g.showHiddenSelectionHalos;
case 603979922:
return this.g.showHydrogens;
case 603979926:
return this.g.showMeasurements;
case 603979927:
return this.g.showModVecs;
case 603979928:
return this.g.showMultipleBonds;
case 603979934:
return this.g.showTiming;
case 603979937:
return this.g.showUnitCellDetails;
case 603979939:
return this.g.slabByAtom;
case 603979940:
return this.g.slabByMolecule;
case 603979944:
return this.g.smartAromatic;
case 1613758488:
return this.g.solventOn;
case 603979952:
return this.g.ssbondsBackbone;
case 603979955:
return this.g.strutsMultiple;
case 603979966:
return this.g.traceAlpha;
case 603979967:
return this.g.translucent;
case 603979968:
return this.g.twistedSheets;
case 603979972:
return this.g.vectorsCentered;
case 603979973:
return this.g.vectorSymmetry;
case 603979974:
return this.g.waitForMoveTo;
case 603979978:
return this.g.zeroBasedXyzRasmol;
}
JU.Logger.error ("viewer.getBoolean(" + JS.T.nameOf (tok) + ") - not listed");
return false;
}, "~N");
Clazz_defineMethod (c$, "allowEmbeddedScripts", 
function () {
return (this.g.allowEmbeddedScripts && !this.isPreviewOnly);
});
Clazz_defineMethod (c$, "getDragSelected", 
function () {
return (this.g.dragSelected && !this.g.modelKitMode);
});
Clazz_defineMethod (c$, "getBondPicking", 
function () {
return (this.g.bondPicking || this.g.modelKitMode);
});
Clazz_defineMethod (c$, "useMinimizationThread", 
function () {
return (this.g.useMinimizationThread && !this.autoExit);
});
Clazz_overrideMethod (c$, "getFloat", 
function (tok) {
switch (tok) {
case 1141899265:
return this.g.particleRadius;
case 570425346:
return this.g.axesScale;
case 570425348:
return this.g.bondTolerance;
case 570425354:
return this.g.defaultTranslucent;
case 570425352:
return this.g.defaultDrawArrowScale;
case 570425355:
return this.g.dipoleScale;
case 570425356:
return this.g.drawFontSize;
case 570425358:
return this.g.exportScale;
case 570425360:
return this.g.hbondsAngleMinimum;
case 570425361:
return this.g.hbondsDistanceMaximum;
case 570425363:
return this.g.loadAtomDataTolerance;
case 570425364:
return this.g.minBondDistance;
case 1276121113:
return this.g.modulationScale;
case 570425370:
return this.g.multipleBondSpacing;
case 570425369:
return this.g.multipleBondRadiusFactor;
case 570425374:
return this.g.navigationSpeed;
case 570425382:
return this.g.pointGroupDistanceTolerance;
case 570425384:
return this.g.pointGroupLinearTolerance;
case 570425388:
return this.tm.modelRadius;
case 570425392:
return this.g.sheetSmoothing;
case 570425394:
return this.g.solventProbeRadius;
case 570425403:
return this.g.starWidth;
case 570425406:
return this.g.strutDefaultRadius;
case 570425408:
return this.g.strutLengthMaximum;
case 1649410049:
return this.g.vectorScale;
case 570425412:
return this.g.vibrationPeriod;
}
JU.Logger.error ("viewer.getFloat(" + JS.T.nameOf (tok) + ") - not listed");
return 0;
}, "~N");
Clazz_overrideMethod (c$, "setStringProperty", 
function (key, value) {
if (value == null) return;
if (key.charAt (0) == '_') {
this.g.setO (key, value);
return;
}var tok = JS.T.getTokFromName (key);
switch (JS.T.getParamType (tok)) {
case 603979776:
this.setBooleanPropertyTok (key, tok, JS.SV.newV (4, value).asBoolean ());
break;
case 553648128:
this.setIntPropertyTok (key, tok, JS.SV.newV (4, value).asInt ());
break;
case 570425344:
this.setFloatPropertyTok (key, tok, JU.PT.parseFloat (value));
break;
default:
this.setStringPropertyTok (key, tok, value);
}
}, "~S,~S");
Clazz_defineMethod (c$, "setStringPropertyTok", 
 function (key, tok, value) {
switch (tok) {
case 545259556:
this.g.edsUrlCutoff = value;
break;
case 545259557:
this.g.edsUrlFormat = value;
break;
case 545259558:
this.g.edsUrlFormatDiff = value;
break;
case 545259521:
this.setAnimationMode (value);
return;
case 545259569:
this.g.nmrPredictFormat = value;
break;
case 545259548:
this.g.defaultDropScript = value;
break;
case 545259571:
value = this.fm.setPathForAllFiles (value);
break;
case 545259559:
this.setUnits (value, false);
return;
case 545259561:
this.g.forceField = value = ("UFF".equalsIgnoreCase (value) ? "UFF" : "MMFF");
this.minimizer = null;
break;
case 545259570:
this.g.nmrUrlFormat = value;
break;
case 545259568:
this.setUnits (value, true);
return;
case 545259566:
this.g.loadLigandFormat = value;
break;
case 545259543:
this.g.defaultLabelPDB = value;
break;
case 545259544:
this.g.defaultLabelXYZ = value;
break;
case 545259549:
this.g.defaultLoadFilter = value;
break;
case 545259567:
value = this.getOutputManager ().setLogFile (value);
if (value == null) return;
break;
case 545259560:
break;
case 545259524:
this.g.atomTypes = value;
break;
case 545259538:
break;
case 545259576:
this.g.pickLabel = value;
break;
case 545259580:
if (value.length == 2 && value.startsWith ("R")) this.g.quaternionFrame = value.substring (0, 2);
 else this.g.quaternionFrame = "" + (value.toLowerCase () + "p").charAt (0);
if (!JU.PT.isOneOf (this.g.quaternionFrame, "RC;RP;a;b;c;n;p;q;x;")) this.g.quaternionFrame = "p";
this.ms.haveStraightness = false;
break;
case 545259555:
this.setVdwStr (value);
return;
case 545259564:
 new J.i18n.GT (this, value);
var language = J.i18n.GT.getLanguage ();
this.modelkitPopup = null;
if (this.jmolpopup != null) {
this.jmolpopup.jpiDispose ();
this.jmolpopup = null;
this.getPopupMenu ();
}this.sm.setCallbackFunction ("language", language);
value = J.i18n.GT.getLanguage ();
break;
case 545259565:
this.g.loadFormat = value;
break;
case 545259534:
this.setObjectColor ("background", value);
return;
case 545259528:
this.setObjectColor ("axis1", value);
return;
case 545259530:
this.setObjectColor ("axis2", value);
return;
case 545259532:
this.setObjectColor ("axis3", value);
return;
case 545259536:
this.setObjectColor ("boundbox", value);
return;
case 545259586:
this.setObjectColor ("unitcell", value);
return;
case 545259578:
this.setPropertyColorScheme (value, false, false);
break;
case 545259563:
this.shm.loadShape (35);
this.setShapeProperty (35, "atomLabel", value);
break;
case 545259547:
this.g.defaultDistanceLabel = value;
break;
case 545259542:
this.g.defaultAngleLabel = value;
break;
case 545259554:
this.g.defaultTorsionLabel = value;
break;
case 545259550:
this.g.defaultLoadScript = value;
break;
case 545259522:
this.fm.setAppletProxy (value);
break;
case 545259546:
if (value == null) value = "";
value = value.$replace ('\\', '/');
this.g.defaultDirectory = value;
break;
case 545259562:
this.g.helpPath = value;
break;
case 545259552:
if (!value.equalsIgnoreCase ("RasMol") && !value.equalsIgnoreCase ("PyMOL")) value = "Jmol";
this.setDefaultsType (value);
break;
case 545259545:
this.setDefaultColors (value.equalsIgnoreCase ("rasmol"));
return;
case 545259572:
this.setPickingMode (value, 0);
return;
case 545259574:
this.setPickingStyle (value, 0);
return;
case 545259540:
break;
default:
if (key.toLowerCase ().endsWith ("callback")) {
this.sm.setCallbackFunction (key, (value.length == 0 || value.equalsIgnoreCase ("none") ? null : value));
break;
}if (!this.g.htNonbooleanParameterValues.containsKey (key.toLowerCase ())) {
this.g.setUserVariable (key, JS.SV.newV (4, value));
return;
}break;
}
this.g.setO (key, value);
}, "~S,~N,~S");
Clazz_overrideMethod (c$, "setFloatProperty", 
function (key, value) {
if (Float.isNaN (value)) return;
if (key.charAt (0) == '_') {
this.g.setF (key, value);
return;
}var tok = JS.T.getTokFromName (key);
switch (JS.T.getParamType (tok)) {
case 545259520:
this.setStringPropertyTok (key, tok, "" + value);
break;
case 603979776:
this.setBooleanPropertyTok (key, tok, value != 0);
break;
case 553648128:
this.setIntPropertyTok (key, tok, Clazz_floatToInt (value));
break;
default:
this.setFloatPropertyTok (key, tok, value);
}
}, "~S,~N");
Clazz_defineMethod (c$, "setFloatPropertyTok", 
 function (key, tok, value) {
switch (tok) {
case 570425366:
this.ms.setModulation (null, false, null, false);
this.g.modulationScale = value = Math.max (0.1, value);
this.ms.setModulation (null, true, null, false);
break;
case 570425381:
this.g.particleRadius = Math.abs (value);
break;
case 570425356:
this.g.drawFontSize = value;
break;
case 570425358:
this.g.exportScale = value;
break;
case 570425403:
this.g.starWidth = value;
break;
case 570425369:
this.g.multipleBondRadiusFactor = value;
break;
case 570425370:
this.g.multipleBondSpacing = value;
break;
case 570425393:
this.tm.setSlabRange (value);
break;
case 570425365:
this.g.minimizationCriterion = value;
break;
case 570425359:
if (this.haveDisplay) this.acm.setGestureSwipeFactor (value);
break;
case 570425367:
if (this.haveDisplay) this.acm.setMouseDragFactor (value);
break;
case 570425368:
if (this.haveDisplay) this.acm.setMouseWheelFactor (value);
break;
case 570425408:
this.g.strutLengthMaximum = value;
break;
case 570425406:
this.g.strutDefaultRadius = value;
break;
case 570425376:
this.setSpin ("X", Clazz_floatToInt (value));
break;
case 570425378:
this.setSpin ("Y", Clazz_floatToInt (value));
break;
case 570425380:
this.setSpin ("Z", Clazz_floatToInt (value));
break;
case 570425371:
if (Float.isNaN (value)) return;
this.setSpin ("FPS", Clazz_floatToInt (value));
break;
case 570425363:
this.g.loadAtomDataTolerance = value;
break;
case 570425360:
this.g.hbondsAngleMinimum = value;
break;
case 570425361:
this.g.hbondsDistanceMaximum = value;
break;
case 570425382:
this.g.pointGroupDistanceTolerance = value;
break;
case 570425384:
this.g.pointGroupLinearTolerance = value;
break;
case 570425357:
this.g.ellipsoidAxisDiameter = value;
break;
case 570425398:
this.setSpin ("x", Clazz_floatToInt (value));
break;
case 570425400:
this.setSpin ("y", Clazz_floatToInt (value));
break;
case 570425402:
this.setSpin ("z", Clazz_floatToInt (value));
break;
case 570425396:
this.setSpin ("fps", Clazz_floatToInt (value));
break;
case 570425352:
this.g.defaultDrawArrowScale = value;
break;
case 570425354:
this.g.defaultTranslucent = value;
break;
case 570425346:
this.setAxesScale (value);
break;
case 570425416:
this.tm.visualRangeAngstroms = value;
this.refresh (1, "set visualRange");
break;
case 570425372:
this.setNavigationDepthPercent (value);
break;
case 570425374:
this.g.navigationSpeed = value;
break;
case 570425373:
this.tm.setNavigationSlabOffsetPercent (value);
break;
case 570425350:
this.tm.setCameraDepthPercent (value, false);
this.refresh (1, "set cameraDepth");
return;
case 570425388:
this.setRotationRadius (value, true);
return;
case 570425362:
this.g.hoverDelayMs = Clazz_floatToInt (value * 1000);
break;
case 570425392:
this.g.sheetSmoothing = value;
break;
case 570425355:
value = JV.Viewer.checkFloatRange (value, -10, 10);
this.g.dipoleScale = value;
break;
case 570425404:
this.tm.setStereoDegrees (value);
break;
case 1649410049:
this.setVectorScale (value);
return;
case 570425412:
this.setVibrationPeriod (value);
return;
case 570425414:
this.setVibrationScale (value);
return;
case 570425348:
this.setBondTolerance (value);
return;
case 570425364:
this.setMinBondDistance (value);
return;
case 570425390:
this.tm.setScaleAngstromsPerInch (value);
break;
case 570425394:
value = JV.Viewer.checkFloatRange (value, 0, 10);
this.g.solventProbeRadius = value;
break;
default:
if (!this.g.htNonbooleanParameterValues.containsKey (key.toLowerCase ())) {
this.g.setUserVariable (key, JS.SV.newV (3, Float.$valueOf (value)));
return;
}}
this.g.setF (key, value);
}, "~S,~N,~N");
Clazz_overrideMethod (c$, "setIntProperty", 
function (key, value) {
if (value == -2147483648) return;
if (key.charAt (0) == '_') {
this.g.setI (key, value);
return;
}var tok = JS.T.getTokFromName (key);
switch (JS.T.getParamType (tok)) {
case 545259520:
this.setStringPropertyTok (key, tok, "" + value);
break;
case 603979776:
this.setBooleanPropertyTok (key, tok, value != 0);
break;
case 570425344:
this.setFloatPropertyTok (key, tok, value);
break;
default:
this.setIntPropertyTok (key, tok, value);
}
}, "~S,~N");
Clazz_defineMethod (c$, "setIntPropertyTok", 
 function (key, tok, value) {
switch (tok) {
case 553648138:
value = (value == 0 ? 0 : 1);
this.g.bondingVersion = JU.Elements.bondingVersion = value;
break;
case 553648137:
this.gdata.setCelPower (value);
break;
case 553648129:
this.gdata.setAmbientOcclusion (value);
break;
case 553648158:
this.g.platformSpeed = Math.min (Math.max (value, 0), 10);
break;
case 553648151:
this.g.meshScale = value;
break;
case 553648153:
this.g.minPixelSelRadius = value;
break;
case 553648149:
this.g.isosurfacePropertySmoothingPower = value;
break;
case 553648165:
this.g.repaintWaitMs = value;
break;
case 553648170:
this.g.smallMoleculeMaxAtoms = value;
break;
case 553648152:
this.g.minimizationSteps = value;
break;
case 553648184:
this.g.strutSpacing = value;
break;
case 553648156:
value = JV.Viewer.checkIntRange (value, 0, 1000);
this.gdata.setPhongExponent (value);
break;
case 553648146:
this.g.helixStep = value;
this.ms.haveStraightness = false;
break;
case 553648144:
this.g.dotScale = value;
break;
case 553648143:
this.g.dotDensity = value;
break;
case 553648140:
this.g.delayMaximumMs = value;
break;
case 553648150:
JU.Logger.setLogLevel (value);
JU.Logger.info ("logging level set to " + value);
this.g.setI ("logLevel", value);
if (this.eval != null) this.eval.setDebugging ();
return;
case 553648134:
this.setAxesMode (value == 2 ? 603979808 : value == 1 ? 603979804 : 603979810);
return;
case 553648178:
this.setStrandCount (0, value);
return;
case 553648182:
this.setStrandCount (12, value);
return;
case 553648180:
this.setStrandCount (13, value);
return;
case 553648155:
return;
case 536870922:
this.g.scriptDelay = value;
break;
case 553648176:
if (value < 0) value = JV.Viewer.checkIntRange (value, -10, -1);
 else value = JV.Viewer.checkIntRange (value, 0, 100);
this.gdata.setSpecularPower (value);
break;
case 553648172:
value = JV.Viewer.checkIntRange (-value, -10, -1);
this.gdata.setSpecularPower (value);
break;
case 553648136:
this.setMarBond (value);
return;
case 536870924:
this.setBooleanPropertyTok (key, tok, value == 1);
return;
case 553648174:
value = JV.Viewer.checkIntRange (value, 0, 100);
this.gdata.setSpecularPercent (value);
break;
case 553648142:
value = JV.Viewer.checkIntRange (value, 0, 100);
this.gdata.setDiffusePercent (value);
break;
case 553648130:
value = JV.Viewer.checkIntRange (value, 0, 100);
this.gdata.setAmbientPercent (value);
break;
case 553648186:
this.tm.zDepthToPercent (value);
break;
case 553648188:
this.tm.zSlabToPercent (value);
break;
case 554176526:
this.tm.depthToPercent (value);
break;
case 554176565:
this.tm.slabToPercent (value);
break;
case 553648190:
this.g.zShadePower = Math.max (value, 1);
break;
case 553648166:
this.g.ribbonAspectRatio = value;
break;
case 553648157:
this.g.pickingSpinRate = (value < 1 ? 1 : value);
break;
case 553648132:
this.setAnimationFps (value);
return;
case 553648154:
this.setPercentVdwAtom (value);
break;
case 553648147:
this.g.hermiteLevel = value;
break;
case 553648145:
case 553648148:
case 553648160:
case 553648159:
case 553648162:
case 553648164:
break;
default:
if (!this.g.htNonbooleanParameterValues.containsKey (key)) {
this.g.setUserVariable (key, JS.SV.newI (value));
return;
}}
this.g.setI (key, value);
}, "~S,~N,~N");
c$.checkIntRange = Clazz_defineMethod (c$, "checkIntRange", 
 function (value, min, max) {
return (value < min ? min : value > max ? max : value);
}, "~N,~N,~N");
c$.checkFloatRange = Clazz_defineMethod (c$, "checkFloatRange", 
 function (value, min, max) {
return (value < min ? min : value > max ? max : value);
}, "~N,~N,~N");
Clazz_overrideMethod (c$, "setBooleanProperty", 
function (key, value) {
if (key.charAt (0) == '_') {
this.g.setB (key, value);
return;
}var tok = JS.T.getTokFromName (key);
switch (JS.T.getParamType (tok)) {
case 545259520:
this.setStringPropertyTok (key, tok, "");
break;
case 553648128:
this.setIntPropertyTok (key, tok, value ? 1 : 0);
break;
case 570425344:
this.setFloatPropertyTok (key, tok, value ? 1 : 0);
break;
default:
this.setBooleanPropertyTok (key, tok, value);
}
}, "~S,~B");
Clazz_defineMethod (c$, "setBooleanPropertyTok", 
 function (key, tok, value) {
var doRepaint = true;
switch (tok) {
case 603979875:
this.g.legacyJavaFloat = value;
break;
case 603979927:
this.g.showModVecs = value;
break;
case 603979937:
this.g.showUnitCellDetails = value;
break;
case 603979848:
doRepaint = false;
break;
case 603979972:
this.g.vectorsCentered = value;
break;
case 603979811:
this.g.backboneSteps = value;
break;
case 603979819:
this.g.cartoonRibose = value;
if (value && this.getBoolean (603979816)) this.setBooleanPropertyTok ("cartoonBaseEdges", 603979816, false);
break;
case 603979837:
this.g.ellipsoidArrows = value;
break;
case 603979967:
this.g.translucent = value;
break;
case 603979818:
this.g.cartoonLadders = value;
break;
case 603979968:
var b = this.g.twistedSheets;
this.g.twistedSheets = value;
if (b != value) this.checkCoordinatesChanged ();
break;
case 603979822:
this.gdata.setCel (value);
break;
case 603979817:
this.g.cartoonFancy = value;
break;
case 603979934:
this.g.showTiming = value;
break;
case 603979973:
this.g.vectorSymmetry = value;
break;
case 603979869:
this.g.isosurfaceKey = value;
break;
case 603979889:
this.g.partialDots = value;
break;
case 603979873:
this.g.legacyAutoBonding = value;
break;
case 603979826:
this.g.defaultStructureDSSP = value;
break;
case 603979834:
this.g.dsspCalcHydrogen = value;
break;
case 603979782:
this.g.allowModelkit = value;
if (!value) this.setModelKitMode (false);
break;
case 603979883:
this.setModelKitMode (value);
break;
case 603979885:
this.g.multiProcessor = value && (JV.Viewer.nProcessors > 1);
break;
case 603979884:
this.g.monitorEnergy = value;
break;
case 603979853:
this.g.hbondsRasmol = value;
break;
case 603979881:
this.g.minimizationRefresh = value;
break;
case 603979882:
this.g.minimizationSilent = value;
break;
case 603979868:
if (value) {
this.$isKiosk = true;
this.g.disablePopupMenu = true;
if (this.display != null) this.apiPlatform.setTransparentCursor (this.display);
}break;
case 603979974:
this.g.waitForMoveTo = value;
break;
case 603979876:
this.g.logCommands = true;
break;
case 603979877:
this.g.logGestures = true;
break;
case 603979784:
this.g.allowMultiTouch = value;
break;
case 603979894:
this.g.preserveState = value;
this.ms.setPreserveState (value);
this.undoClear ();
break;
case 603979955:
this.g.strutsMultiple = value;
break;
case 603979842:
break;
case 603979939:
this.g.slabByAtom = value;
break;
case 603979940:
this.g.slabByMolecule = value;
break;
case 603979902:
this.g.saveProteinStructureState = value;
break;
case 603979780:
this.g.allowGestures = value;
break;
case 603979867:
this.g.imageState = value;
break;
case 603979970:
this.g.useMinimizationThread = value;
break;
case 603979781:
if (this.g.disablePopupMenu) value = false;
this.g.allowKeyStrokes = value;
break;
case 603979831:
this.g.dragSelected = value;
this.showSelected = false;
break;
case 603979924:
this.g.showKeyStrokes = value;
break;
case 603979844:
this.g.fontCaching = value;
break;
case 603979796:
this.g.atomPicking = value;
break;
case 603979814:
this.highlight (null);
this.g.bondPicking = value;
break;
case 603979906:
this.g.selectAllModels = value;
break;
case 603979880:
this.g.messageStyleChime = value;
break;
case 603979892:
this.g.pdbSequential = value;
break;
case 603979890:
this.g.pdbAddHydrogens = value;
break;
case 603979891:
this.g.pdbGetHeader = value;
break;
case 603979838:
this.g.ellipsoidAxes = value;
break;
case 603979836:
this.g.ellipsoidArcs = value;
break;
case 603979839:
this.g.ellipsoidBall = value;
break;
case 603979840:
this.g.ellipsoidDots = value;
break;
case 603979841:
this.g.ellipsoidFill = value;
break;
case 603979845:
this.g.fontScaling = value;
break;
case 603979956:
this.setSyncTarget (0, value);
break;
case 603979958:
this.setSyncTarget (1, value);
break;
case 603979976:
this.g.wireframeRotation = value;
break;
case 603979870:
this.g.isosurfacePropertySmoothing = value;
break;
case 603979833:
this.g.drawPicking = value;
break;
case 603979786:
case 603979790:
case 603979788:
this.setAntialias (tok, value);
break;
case 603979944:
this.g.smartAromatic = value;
break;
case 603979794:
this.setApplySymmetryToBonds (value);
break;
case 603979792:
this.g.appendNew = value;
break;
case 603979800:
this.g.autoFps = value;
break;
case 603979971:
JU.DF.setUseNumberLocalization (this.g.useNumberLocalization = value);
break;
case 603979918:
case 1611272202:
key = "showFrank";
this.setFrankOn (value);
break;
case 1613758488:
key = "solventProbe";
this.g.solventOn = value;
break;
case 603979948:
this.g.solventOn = value;
break;
case 603979785:
this.g.allowRotateSelected = value;
break;
case 603979783:
this.g.allowMoveAtoms = value;
this.g.allowRotateSelected = value;
this.g.dragSelected = value;
this.showSelected = false;
break;
case 536870922:
this.setIntPropertyTok ("showScript", tok, value ? 1 : 0);
return;
case 603979778:
this.g.allowEmbeddedScripts = value;
break;
case 603979888:
this.g.navigationPeriodic = value;
break;
case 603979984:
this.tm.setZShadeEnabled (value);
return;
case 603979832:
if (this.haveDisplay) this.g.drawHover = value;
break;
case 603979887:
this.setNavigationMode (value);
break;
case 603979886:
return;
case 603979860:
this.g.hideNavigationPoint = value;
break;
case 603979930:
this.g.showNavigationPointAlways = value;
break;
case 603979896:
this.setRefreshing (value);
break;
case 603979871:
this.g.justifyMeasurements = value;
break;
case 603979952:
this.g.ssbondsBackbone = value;
break;
case 603979852:
this.g.hbondsBackbone = value;
break;
case 603979854:
this.g.hbondsSolid = value;
break;
case 536870924:
this.gdata.setSpecular (value);
break;
case 603979942:
this.tm.setSlabEnabled (value);
return;
case 603979980:
this.tm.setZoomEnabled (value);
return;
case 603979864:
this.g.highResolutionFlag = value;
break;
case 603979966:
this.g.traceAlpha = value;
break;
case 603979983:
this.g.zoomLarge = value;
this.tm.setZoomHeight (this.g.zoomHeight, value);
break;
case 603979982:
this.g.zoomHeight = value;
this.tm.setZoomHeight (value, this.g.zoomLarge);
break;
case 603979872:
J.i18n.GT.setDoTranslate (value);
break;
case 603979862:
this.slm.setHideNotSelected (value);
break;
case 603979904:
this.setScriptQueue (value);
break;
case 603979830:
this.g.dotSurface = value;
break;
case 603979829:
this.g.dotsSelectedOnly = value;
break;
case 1611141171:
this.setSelectionHalos (value);
break;
case 603979910:
this.g.rasmolHydrogenSetting = value;
break;
case 603979908:
this.g.rasmolHeteroSetting = value;
break;
case 603979928:
this.g.showMultipleBonds = value;
break;
case 603979920:
this.g.showHiddenSelectionHalos = value;
break;
case 603979975:
this.tm.setWindowCentered (value);
break;
case 603979828:
this.g.displayCellParameters = value;
break;
case 603979960:
this.g.testFlag1 = value;
break;
case 603979962:
this.g.testFlag2 = value;
break;
case 603979964:
this.g.testFlag3 = value;
break;
case 603979965:
this.jmolTest ();
this.g.testFlag4 = value;
break;
case 603979898:
this.g.ribbonBorder = value;
break;
case 603979816:
this.g.cartoonBaseEdges = value;
if (value && this.getBoolean (603979819)) this.setBooleanPropertyTok ("cartoonRibose", 603979819, false);
break;
case 603979820:
this.g.cartoonRockets = value;
break;
case 603979900:
this.g.rocketBarrels = value;
break;
case 603979850:
this.gdata.setGreyscaleMode (this.g.greyscaleRendering = value);
break;
case 603979879:
this.g.measurementLabels = value;
break;
case 603979810:
case 603979804:
case 603979808:
this.setAxesMode (tok);
return;
case 603979806:
this.setAxesOrientationRasmol (value);
return;
case 603979824:
this.setStringPropertyTok ("defaultcolorscheme", 545259545, value ? "rasmol" : "jmol");
return;
case 603979825:
this.setDebugScript (value);
return;
case 603979893:
this.setPerspectiveDepth (value);
return;
case 603979798:
this.setAutoBond (value);
return;
case 603979914:
this.setShowAxes (value);
return;
case 603979916:
this.setShowBbcage (value);
return;
case 603979922:
this.setShowHydrogens (value);
return;
case 603979926:
this.setShowMeasurements (value);
return;
case 603979936:
this.setShowUnitCell (value);
return;
case 603979812:
doRepaint = false;
this.g.bondModeOr = value;
break;
case 603979978:
doRepaint = false;
this.g.zeroBasedXyzRasmol = value;
this.reset (true);
break;
case 603979895:
doRepaint = false;
this.g.rangeSelected = value;
break;
case 603979878:
doRepaint = false;
this.g.measureAllModels = value;
break;
case 603979954:
doRepaint = false;
this.sm.allowStatusReporting = value;
break;
case 603979823:
doRepaint = false;
this.g.chainCaseSensitive = value;
break;
case 603979858:
doRepaint = false;
this.g.hideNameInPopup = value;
break;
case 603979827:
doRepaint = false;
this.g.disablePopupMenu = value;
break;
case 603979846:
doRepaint = false;
this.g.forceAutoBond = value;
break;
default:
if (!this.g.htBooleanParameterFlags.containsKey (key.toLowerCase ())) {
this.g.setUserVariable (key, JS.SV.getBoolean (value));
return;
}}
this.g.setB (key, value);
if (doRepaint) this.setTainted (true);
}, "~S,~N,~B");
Clazz_defineMethod (c$, "setModelKitMode", 
 function (value) {
if (this.acm == null || !this.allowScripting) return;
if (value || this.g.modelKitMode) {
this.setPickingMode (null, value ? 33 : 1);
this.setPickingMode (null, value ? 32 : 1);
}var isChange = (this.g.modelKitMode != value);
this.g.modelKitMode = value;
this.highlight (null);
if (value) {
this.setNavigationMode (false);
this.selectAll ();
this.setAtomPickingOption ("C");
this.setBondPickingOption ("p");
if (!this.isApplet) this.popupMenu (0, 0, 'm');
if (isChange) this.sm.setCallbackFunction ("modelkit", "ON");
this.g.modelKitMode = true;
if (this.ms.ac == 0) this.zap (false, true, true);
} else {
this.acm.setPickingMode (-1);
this.setStringProperty ("pickingStyle", "toggle");
this.setBooleanProperty ("bondPicking", false);
if (isChange) this.sm.setCallbackFunction ("modelkit", "OFF");
}}, "~B");
Clazz_defineMethod (c$, "setSmilesString", 
function (s) {
if (s == null) this.g.removeParam ("_smilesString");
 else this.g.setO ("_smilesString", s);
}, "~S");
Clazz_defineMethod (c$, "removeUserVariable", 
function (key) {
this.g.removeUserVariable (key);
if (key.endsWith ("callback")) this.sm.setCallbackFunction (key, null);
}, "~S");
Clazz_defineMethod (c$, "jmolTest", 
 function () {
});
Clazz_defineMethod (c$, "showParameter", 
function (key, ifNotSet, nMax) {
var sv = "" + this.g.getParameterEscaped (key, nMax);
if (ifNotSet || sv.indexOf ("<not defined>") < 0) this.showString (key + " = " + sv, false);
}, "~S,~B,~N");
Clazz_defineMethod (c$, "showString", 
function (str, isPrint) {
if (!this.isJS && this.isScriptQueued () && (!this.isSilent || isPrint)) {
JU.Logger.warn (str);
}this.scriptEcho (str);
}, "~S,~B");
Clazz_defineMethod (c$, "getAllSettings", 
function (prefix) {
return this.getStateCreator ().getAllSettings (prefix);
}, "~S");
Clazz_defineMethod (c$, "getBindingInfo", 
function (qualifiers) {
return (this.haveDisplay ? this.acm.getBindingInfo (qualifiers) : "");
}, "~S");
Clazz_defineMethod (c$, "getIsosurfacePropertySmoothing", 
function (asPower) {
return (asPower ? this.g.isosurfacePropertySmoothingPower : this.g.isosurfacePropertySmoothing ? 1 : 0);
}, "~B");
Clazz_defineMethod (c$, "setNavigationDepthPercent", 
function (percent) {
this.tm.setNavigationDepthPercent (percent);
this.refresh (1, "set navigationDepth");
}, "~N");
Clazz_defineMethod (c$, "getShowNavigationPoint", 
function () {
if (!this.g.navigationMode) return false;
return (this.tm.isNavigating () && !this.g.hideNavigationPoint || this.g.showNavigationPointAlways || this.getInMotion (true));
});
Clazz_defineMethod (c$, "getCurrentSolventProbeRadius", 
function () {
return this.g.solventOn ? this.g.solventProbeRadius : 0;
});
Clazz_defineMethod (c$, "getTestFlag", 
function (i) {
switch (i) {
case 1:
return this.g.testFlag1;
case 2:
return this.g.testFlag2;
case 3:
return this.g.testFlag3;
case 4:
return this.g.testFlag4;
}
return false;
}, "~N");
Clazz_overrideMethod (c$, "setPerspectiveDepth", 
function (perspectiveDepth) {
this.tm.setPerspectiveDepth (perspectiveDepth);
}, "~B");
Clazz_overrideMethod (c$, "setAxesOrientationRasmol", 
function (TF) {
this.g.setB ("axesOrientationRasmol", TF);
this.g.axesOrientationRasmol = TF;
this.reset (true);
}, "~B");
Clazz_defineMethod (c$, "setAxesScale", 
function (scale) {
scale = JV.Viewer.checkFloatRange (scale, -100, 100);
this.g.axesScale = scale;
this.axesAreTainted = true;
}, "~N");
Clazz_defineMethod (c$, "getAxisPoints", 
function () {
this.shm.loadShape (34);
return (this.getObjectMad (1) == 0 || this.g.axesMode != 603979808 || (this.getShapeProperty (34, "axesTypeXY")).booleanValue () || this.getShapeProperty (34, "origin") != null ? null : this.getShapeProperty (34, "axisPoints"));
});
Clazz_defineMethod (c$, "setAxesMode", 
function (mode) {
this.g.axesMode = mode;
this.axesAreTainted = true;
switch (mode) {
case 603979808:
this.g.removeParam ("axesmolecular");
this.g.removeParam ("axeswindow");
this.g.setB ("axesUnitcell", true);
mode = 2;
break;
case 603979804:
this.g.removeParam ("axesunitcell");
this.g.removeParam ("axeswindow");
this.g.setB ("axesMolecular", true);
mode = 1;
break;
case 603979810:
this.g.removeParam ("axesunitcell");
this.g.removeParam ("axesmolecular");
this.g.setB ("axesWindow", true);
mode = 0;
}
this.g.setI ("axesMode", mode);
}, "~N");
Clazz_defineMethod (c$, "setSelectionHalos", 
function (TF) {
if (TF == this.ms.getSelectionHaloEnabled ()) return;
this.g.setB ("selectionHalos", TF);
this.shm.loadShape (8);
this.ms.setSelectionHaloEnabled (TF);
}, "~B");
Clazz_defineMethod (c$, "getSelectionHaloEnabled", 
function (isRenderer) {
var flag = this.ms.getSelectionHaloEnabled () || isRenderer && this.showSelected;
if (isRenderer) this.showSelected = false;
return flag;
}, "~B");
Clazz_defineMethod (c$, "setStrandCount", 
 function (type, value) {
value = JV.Viewer.checkIntRange (value, 0, 20);
switch (type) {
case 12:
this.g.strandCountForStrands = value;
break;
case 13:
this.g.strandCountForMeshRibbon = value;
break;
default:
this.g.strandCountForStrands = value;
this.g.strandCountForMeshRibbon = value;
break;
}
this.g.setI ("strandCount", value);
this.g.setI ("strandCountForStrands", this.g.strandCountForStrands);
this.g.setI ("strandCountForMeshRibbon", this.g.strandCountForMeshRibbon);
}, "~N,~N");
Clazz_defineMethod (c$, "getStrandCount", 
function (type) {
return (type == 12 ? this.g.strandCountForStrands : this.g.strandCountForMeshRibbon);
}, "~N");
Clazz_defineMethod (c$, "setNavigationMode", 
function (TF) {
this.g.navigationMode = TF;
this.tm.setNavigationMode (TF);
}, "~B");
Clazz_overrideMethod (c$, "setAutoBond", 
function (TF) {
this.g.setB ("autobond", TF);
this.g.autoBond = TF;
}, "~B");
Clazz_defineMethod (c$, "makeConnections", 
function (minDistance, maxDistance, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy) {
this.clearModelDependentObjects ();
this.clearMinimization ();
return this.ms.makeConnections (minDistance, maxDistance, order, connectOperation, bsA, bsB, bsBonds, isBonds, addGroup, energy);
}, "~N,~N,~N,~N,JU.BS,JU.BS,JU.BS,~B,~B,~N");
Clazz_overrideMethod (c$, "rebond", 
function () {
this.rebondState (false);
});
Clazz_defineMethod (c$, "rebondState", 
function (isStateScript) {
this.clearModelDependentObjects ();
this.ms.deleteAllBonds ();
var isLegacy = isStateScript && this.g.legacyAutoBonding;
this.ms.autoBondBs4 (null, null, null, null, this.getMadBond (), isLegacy);
this.addStateScript ((isLegacy ? "set legacyAutoBonding TRUE;connect;set legacyAutoBonding FALSE;" : "connect;"), false, true);
}, "~B");
Clazz_overrideMethod (c$, "setPercentVdwAtom", 
function (value) {
this.g.setI ("percentVdwAtom", value);
this.g.percentVdwAtom = value;
this.rd.value = value / 100;
this.rd.factorType = J.atomdata.RadiusData.EnumType.FACTOR;
this.rd.vdwType = J.c.VDW.AUTO;
this.shm.setShapeSizeBs (0, 0, this.rd, null);
}, "~N");
Clazz_overrideMethod (c$, "getMadBond", 
function () {
return (this.g.bondRadiusMilliAngstroms * 2);
});
Clazz_overrideMethod (c$, "setShowHydrogens", 
function (TF) {
this.g.setB ("showHydrogens", TF);
this.g.showHydrogens = TF;
}, "~B");
Clazz_defineMethod (c$, "setShowBbcage", 
function (value) {
this.setObjectMad (32, "boundbox", (value ? -4 : 0));
this.g.setB ("showBoundBox", value);
}, "~B");
Clazz_defineMethod (c$, "getShowBbcage", 
function () {
return this.getObjectMad (4) != 0;
});
Clazz_defineMethod (c$, "setShowUnitCell", 
function (value) {
this.setObjectMad (33, "unitcell", (value ? -2 : 0));
this.g.setB ("showUnitCell", value);
}, "~B");
Clazz_defineMethod (c$, "getShowUnitCell", 
function () {
return this.getObjectMad (5) != 0;
});
Clazz_defineMethod (c$, "setShowAxes", 
function (value) {
this.setObjectMad (34, "axes", (value ? -2 : 0));
this.g.setB ("showAxes", value);
}, "~B");
Clazz_defineMethod (c$, "getShowAxes", 
function () {
return this.getObjectMad (1) != 0;
});
Clazz_overrideMethod (c$, "setFrankOn", 
function (TF) {
if (this.isPreviewOnly) TF = false;
this.frankOn = TF;
this.setObjectMad (36, "frank", (TF ? 1 : 0));
}, "~B");
Clazz_defineMethod (c$, "getShowFrank", 
function () {
if (this.isPreviewOnly || this.isApplet && this.creatingImage) return false;
return (this.isSignedApplet && !this.isSignedAppletLocal && !this.isJS || this.frankOn);
});
Clazz_overrideMethod (c$, "setShowMeasurements", 
function (TF) {
this.g.setB ("showMeasurements", TF);
this.g.showMeasurements = TF;
}, "~B");
Clazz_defineMethod (c$, "setUnits", 
function (units, isDistance) {
this.g.setUnits (units);
if (isDistance) {
this.g.setUnits (units);
this.setShapeProperty (6, "reformatDistances", null);
} else {
}}, "~S,~B");
Clazz_overrideMethod (c$, "setRasmolDefaults", 
function () {
this.setDefaultsType ("RasMol");
});
Clazz_overrideMethod (c$, "setJmolDefaults", 
function () {
this.setDefaultsType ("Jmol");
});
Clazz_defineMethod (c$, "setDefaultsType", 
 function (type) {
if (type.equalsIgnoreCase ("RasMol")) {
this.stm.setRasMolDefaults ();
return;
}if (type.equalsIgnoreCase ("PyMOL")) {
this.stm.setPyMOLDefaults ();
return;
}this.stm.setJmolDefaults ();
this.setIntProperty ("bondingVersion", 0);
this.shm.setShapeSizeBs (0, 0, this.rd, this.getAllAtoms ());
}, "~S");
Clazz_defineMethod (c$, "setAntialias", 
 function (tok, TF) {
switch (tok) {
case 603979786:
this.g.antialiasDisplay = TF;
break;
case 603979790:
this.g.antialiasTranslucent = TF;
break;
case 603979788:
this.g.antialiasImages = TF;
return;
}
this.resizeImage (0, 0, false, false, true);
}, "~N,~B");
Clazz_defineMethod (c$, "allocTempPoints", 
function (size) {
return this.tempArray.allocTempPoints (size);
}, "~N");
Clazz_defineMethod (c$, "freeTempPoints", 
function (tempPoints) {
this.tempArray.freeTempPoints (tempPoints);
}, "~A");
Clazz_defineMethod (c$, "allocTempScreens", 
function (size) {
return this.tempArray.allocTempScreens (size);
}, "~N");
Clazz_defineMethod (c$, "freeTempScreens", 
function (tempScreens) {
this.tempArray.freeTempScreens (tempScreens);
}, "~A");
Clazz_defineMethod (c$, "allocTempEnum", 
function (size) {
return this.tempArray.allocTempEnum (size);
}, "~N");
Clazz_defineMethod (c$, "freeTempEnum", 
function (temp) {
this.tempArray.freeTempEnum (temp);
}, "~A");
Clazz_defineMethod (c$, "getFont3D", 
function (fontFace, fontStyle, fontSize) {
return this.gdata.getFont3DFSS (fontFace, fontStyle, fontSize);
}, "~S,~S,~N");
Clazz_defineMethod (c$, "getAtomGroupQuaternions", 
function (bsAtoms, nMax) {
return this.ms.getAtomGroupQuaternions (bsAtoms, nMax, this.getQuaternionFrame ());
}, "JU.BS,~N");
Clazz_defineMethod (c$, "setStereoMode", 
function (twoColors, stereoMode, degrees) {
this.setFloatProperty ("stereoDegrees", degrees);
this.setBooleanProperty ("greyscaleRendering", stereoMode.isBiColor ());
if (twoColors != null) this.tm.setStereoMode2 (twoColors);
 else this.tm.setStereoMode (stereoMode);
}, "~A,J.c.STER,~N");
Clazz_defineMethod (c$, "isStereoDouble", 
function () {
return this.tm.stereoMode === J.c.STER.DOUBLE;
});
Clazz_defineMethod (c$, "getChimeInfo", 
function (tok) {
return this.getPropertyManager ().getChimeInfo (tok, this.bsA ());
}, "~N");
Clazz_defineMethod (c$, "getModelFileInfo", 
function () {
return this.getPropertyManager ().getModelFileInfo (this.getVisibleFramesBitSet ());
});
Clazz_defineMethod (c$, "getModelFileInfoAll", 
function () {
return this.getPropertyManager ().getModelFileInfo (null);
});
Clazz_overrideMethod (c$, "getProperty", 
function (returnType, infoType, paramInfo) {
if (!"DATA_API".equals (returnType)) return this.getPropertyManager ().getProperty (returnType, infoType, paramInfo);
switch (("scriptCheck.........consoleText.........scriptEditor........scriptEditorState...getAppConsole.......getScriptEditor.....setMenu.............spaceGroupInfo......disablePopupMenu....defaultDirectory....getPopupMenu........shapeManager........").indexOf (infoType)) {
case 0:
return this.scriptCheckRet (paramInfo, true);
case 20:
return (this.appConsole == null ? "" : this.appConsole.getText ());
case 40:
this.showEditor (paramInfo);
return null;
case 60:
this.scriptEditorVisible = (paramInfo).booleanValue ();
return null;
case 80:
if (this.$isKiosk) {
this.appConsole = null;
} else if (Clazz_instanceOf (paramInfo, J.api.JmolAppConsoleInterface)) {
this.appConsole = paramInfo;
} else if (paramInfo != null && !(paramInfo).booleanValue ()) {
this.appConsole = null;
} else if (this.appConsole == null && paramInfo != null && (paramInfo).booleanValue ()) {
if (this.isJS) {
this.appConsole = J.api.Interface.getOption ("consolejs.AppletConsole", this, "script");
}{
}if (this.appConsole != null) this.appConsole.start (this);
}this.scriptEditor = (this.isJS || this.appConsole == null ? null : this.appConsole.getScriptEditor ());
return this.appConsole;
case 100:
if (this.appConsole == null && paramInfo != null && (paramInfo).booleanValue ()) {
this.getProperty ("DATA_API", "getAppConsole", Boolean.TRUE);
this.scriptEditor = (this.appConsole == null ? null : this.appConsole.getScriptEditor ());
}return this.scriptEditor;
case 120:
if (this.jmolpopup != null) this.jmolpopup.jpiDispose ();
this.jmolpopup = null;
return this.menuStructure = paramInfo;
case 140:
return this.ms.getSymTemp (true).getSpaceGroupInfo (this.ms, null);
case 160:
this.g.disablePopupMenu = true;
return null;
case 180:
return this.g.defaultDirectory;
case 200:
if (Clazz_instanceOf (paramInfo, String)) return this.getMenu (paramInfo);
return this.getPopupMenu ();
case 220:
return this.shm.getProperty (paramInfo);
}
JU.Logger.error ("ERROR in getProperty DATA_API: " + infoType);
return null;
}, "~S,~S,~O");
Clazz_defineMethod (c$, "showEditor", 
function (file_text) {
var scriptEditor = this.getProperty ("DATA_API", "getScriptEditor", Boolean.TRUE);
if (scriptEditor == null) return;
scriptEditor.show (file_text);
}, "~A");
Clazz_defineMethod (c$, "getPropertyManager", 
 function () {
if (this.pm == null) (this.pm = J.api.Interface.getInterface ("JV.PropertyManager", this, "prop")).setViewer (this);
return this.pm;
});
Clazz_defineMethod (c$, "getModelExtract", 
function (atomExpression, doTransform, isModelKit, type) {
return this.getPropertyManager ().getModelExtract (this.getAtomBitSet (atomExpression), doTransform, isModelKit, type);
}, "~O,~B,~B,~S");
Clazz_defineMethod (c$, "setTainted", 
function (TF) {
this.isTainted = this.axesAreTainted = (TF && (this.refreshing || this.creatingImage));
}, "~B");
Clazz_defineMethod (c$, "notifyMouseClicked", 
function (x, y, action, mode) {
var modifiers = JV.binding.Binding.getButtonMods (action);
var clickCount = JV.binding.Binding.getClickCount (action);
this.g.setI ("_mouseX", x);
this.g.setI ("_mouseY", this.dimScreen.height - y);
this.g.setI ("_mouseAction", action);
this.g.setI ("_mouseModifiers", modifiers);
this.g.setI ("_clickCount", clickCount);
return this.sm.setStatusClicked (x, this.dimScreen.height - y, action, clickCount, mode);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "checkObjectClicked", 
function (x, y, modifiers) {
return this.shm.checkObjectClicked (x, y, modifiers, this.getVisibleFramesBitSet (), this.g.drawPicking);
}, "~N,~N,~N");
Clazz_defineMethod (c$, "checkObjectHovered", 
function (x, y) {
return (x >= 0 && this.shm != null && this.shm.checkObjectHovered (x, y, this.getVisibleFramesBitSet (), this.getBondPicking ()));
}, "~N,~N");
Clazz_defineMethod (c$, "checkObjectDragged", 
function (prevX, prevY, x, y, action) {
var iShape = 0;
switch (this.getPickingMode ()) {
case 2:
iShape = 5;
break;
case 4:
iShape = 22;
break;
}
if (this.shm.checkObjectDragged (prevX, prevY, x, y, action, this.getVisibleFramesBitSet (), iShape)) {
this.refresh (1, "checkObjectDragged");
if (iShape == 22) this.scriptEcho (this.getShapeProperty (22, "command"));
}}, "~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "rotateAxisAngleAtCenter", 
function (eval, rotCenter, rotAxis, degreesPerSecond, endDegrees, isSpin, bsSelected) {
var isOK = this.tm.rotateAxisAngleAtCenter (eval, rotCenter, rotAxis, degreesPerSecond, endDegrees, isSpin, bsSelected);
if (isOK) this.setSync ();
return isOK;
}, "J.api.JmolScriptEvaluator,JU.P3,JU.V3,~N,~N,~B,JU.BS");
Clazz_defineMethod (c$, "rotateAboutPointsInternal", 
function (eval, point1, point2, degreesPerSecond, endDegrees, isSpin, bsSelected, translation, finalPoints, dihedralList, m4) {
if (this.headless) {
if (isSpin && endDegrees == 3.4028235E38) return false;
isSpin = false;
}var isOK = this.tm.rotateAboutPointsInternal (eval, point1, point2, degreesPerSecond, endDegrees, false, isSpin, bsSelected, false, translation, finalPoints, dihedralList, m4);
if (isOK) this.setSync ();
return isOK;
}, "J.api.JmolScriptEvaluator,JU.P3,JU.P3,~N,~N,~B,JU.BS,JU.V3,JU.Lst,~A,JU.M4");
Clazz_defineMethod (c$, "startSpinningAxis", 
function (pt1, pt2, isClockwise) {
if (this.tm.spinOn || this.tm.navOn) {
this.tm.setSpinOff ();
this.tm.setNavOn (false);
return;
}this.tm.rotateAboutPointsInternal (null, pt1, pt2, this.g.pickingSpinRate, 3.4028235E38, isClockwise, true, null, false, null, null, null, null);
}, "JU.T3,JU.T3,~B");
Clazz_defineMethod (c$, "getModelDipole", 
function () {
return this.ms.getModelDipole (this.am.cmi);
});
Clazz_defineMethod (c$, "calculateMolecularDipole", 
function (bsAtoms) {
return this.ms.calculateMolecularDipole (this.am.cmi, bsAtoms);
}, "JU.BS");
Clazz_defineMethod (c$, "setDefaultLattice", 
function (p) {
if (!Float.isNaN (p.x + p.y + p.z)) this.g.ptDefaultLattice.setT (p);
this.g.setO ("defaultLattice", JU.Escape.eP (p));
}, "JU.P3");
Clazz_defineMethod (c$, "getDefaultLattice", 
function () {
return this.g.ptDefaultLattice;
});
Clazz_defineMethod (c$, "getData", 
function (atomExpression, type) {
var exp = "";
if (type.equalsIgnoreCase ("MOL") || type.equalsIgnoreCase ("SDF") || type.equalsIgnoreCase ("V2000") || type.equalsIgnoreCase ("V3000") || type.equalsIgnoreCase ("XYZVIB") || type.equalsIgnoreCase ("CD") || type.equalsIgnoreCase ("JSON")) return this.getModelExtract (atomExpression, false, false, type);
if (type.toLowerCase ().indexOf ("property_") == 0) exp = "{selected}.label(\"%{" + type + "}\")";
 else if (type.equalsIgnoreCase ("CML")) return this.getModelCml (this.getAtomBitSet (atomExpression), 2147483647, true);
 else if (type.equalsIgnoreCase ("PDB")) exp = "{selected and not hetero}.label(\"ATOM  %5i %-4a%1A%3.3n %1c%4R%1E   %8.3x%8.3y%8.3z%6.2Q%6.2b          %2e  \").lines+{selected and hetero}.label(\"HETATM%5i %-4a%1A%3.3n %1c%4R%1E   %8.3x%8.3y%8.3z%6.2Q%6.2b          %2e  \").lines";
 else if (type.equalsIgnoreCase ("XYZRN")) exp = "\"\" + {selected}.size + \"\n\n\"+{selected}.label(\"%-2e %8.3x %8.3y %8.3z %4.2[vdw] 1 [%n]%r.%a#%i\").lines";
 else if (type.startsWith ("USER:")) exp = "{selected}.label(\"" + type.substring (5) + "\").lines";
 else exp = "\"\" + {selected}.size + \"\n\n\"+{selected}.label(\"%-2e %10.5x %10.5y %10.5z\").lines";
if (!atomExpression.equals ("selected")) exp = JU.PT.rep (exp, "selected", atomExpression);
return this.evaluateExpression (exp);
}, "~S,~S");
Clazz_defineMethod (c$, "getModelCml", 
function (bs, nAtomsMax, addBonds) {
return this.getPropertyManager ().getModelCml (bs, nAtomsMax, addBonds);
}, "JU.BS,~N,~B");
Clazz_defineMethod (c$, "getPdbAtomData", 
function (bs, sb) {
return this.getPropertyManager ().getPdbAtomData (bs == null ? this.bsA () : bs, sb);
}, "JU.BS,JU.OC");
Clazz_defineMethod (c$, "isJmolDataFrame", 
function () {
return this.ms.isJmolDataFrameForModel (this.am.cmi);
});
Clazz_defineMethod (c$, "setFrameTitle", 
function (modelIndex, title) {
this.ms.setFrameTitle (JU.BSUtil.newAndSetBit (modelIndex), title);
}, "~N,~S");
Clazz_defineMethod (c$, "setFrameTitleObj", 
function (title) {
this.shm.loadShape (31);
this.ms.setFrameTitle (this.getVisibleFramesBitSet (), title);
}, "~O");
Clazz_defineMethod (c$, "getFrameTitle", 
function () {
return this.ms.getFrameTitle (this.am.cmi);
});
Clazz_defineMethod (c$, "setAtomProperty", 
function (bs, tok, iValue, fValue, sValue, values, list) {
if (tok == 1649412120) this.shm.deleteVdwDependentShapes (bs);
this.clearMinimization ();
this.ms.setAtomProperty (bs, tok, iValue, fValue, sValue, values, list);
switch (tok) {
case 1112541185:
case 1112541186:
case 1112541187:
case 1112541188:
case 1112541189:
case 1112541190:
case 1112539153:
case 1112539154:
case 1112539155:
case 1087375365:
this.refreshMeasures (true);
}
}, "JU.BS,~N,~N,~N,~S,~A,~A");
Clazz_defineMethod (c$, "checkCoordinatesChanged", 
function () {
this.ms.recalculatePositionDependentQuantities (null, null);
this.refreshMeasures (true);
});
Clazz_defineMethod (c$, "setAtomCoords", 
function (bs, tokType, xyzValues) {
if (bs.cardinality () == 0) return;
this.ms.setAtomCoords (bs, tokType, xyzValues);
this.checkMinimization ();
this.sm.setStatusAtomMoved (bs);
}, "JU.BS,~N,~O");
Clazz_defineMethod (c$, "setAtomCoordsRelative", 
function (offset, bs) {
if (bs == null) bs = this.bsA ();
if (bs.cardinality () == 0) return;
this.ms.setAtomCoordsRelative (offset, bs);
this.checkMinimization ();
this.sm.setStatusAtomMoved (bs);
}, "JU.T3,JU.BS");
Clazz_defineMethod (c$, "invertAtomCoordPt", 
function (pt, bs) {
this.ms.invertSelected (pt, null, -1, null, bs);
this.checkMinimization ();
this.sm.setStatusAtomMoved (bs);
}, "JU.P3,JU.BS");
Clazz_defineMethod (c$, "invertAtomCoordPlane", 
function (plane, bs) {
this.ms.invertSelected (null, plane, -1, null, bs);
this.checkMinimization ();
this.sm.setStatusAtomMoved (bs);
}, "JU.P4,JU.BS");
Clazz_defineMethod (c$, "invertSelected", 
function (pt, plane, iAtom, invAtoms) {
var bs = this.bsA ();
if (bs.cardinality () == 0) return;
this.ms.invertSelected (pt, plane, iAtom, invAtoms, bs);
this.checkMinimization ();
this.sm.setStatusAtomMoved (bs);
}, "JU.P3,JU.P4,~N,JU.BS");
Clazz_defineMethod (c$, "moveAtoms", 
function (m4, mNew, rotation, translation, center, isInternal, bsAtoms, translationOnly) {
if (bsAtoms.cardinality () == 0) return;
this.ms.moveAtoms (m4, mNew, rotation, translation, bsAtoms, center, isInternal, translationOnly);
this.checkMinimization ();
this.sm.setStatusAtomMoved (bsAtoms);
}, "JU.M4,JU.M3,JU.M3,JU.V3,JU.P3,~B,JU.BS,~B");
Clazz_defineMethod (c$, "moveSelected", 
function (deltaX, deltaY, deltaZ, x, y, bsSelected, isTranslation, asAtoms) {
if (deltaZ == 0) return;
if (x == -2147483648) this.rotateBondIndex = -1;
if (this.isJmolDataFrame ()) return;
if (deltaX == -2147483648) {
this.showSelected = true;
this.shm.loadShape (8);
this.refresh (6, "moveSelected");
return;
}if (deltaX == 2147483647) {
if (!this.showSelected) return;
this.showSelected = false;
this.refresh (6, "moveSelected");
return;
}if (this.movingSelected) return;
this.movingSelected = true;
this.stopMinimization ();
if (this.rotateBondIndex >= 0 && x != -2147483648) {
this.actionRotateBond (deltaX, deltaY, x, y);
} else {
bsSelected = this.setMovableBitSet (bsSelected, !asAtoms);
if (bsSelected.cardinality () != 0) {
if (isTranslation) {
var ptCenter = this.ms.getAtomSetCenter (bsSelected);
this.tm.finalizeTransformParameters ();
var f = (this.g.antialiasDisplay ? 2 : 1);
var ptScreen = this.tm.transformPt (ptCenter);
var ptScreenNew;
if (deltaZ != -2147483648) ptScreenNew = JU.P3.new3 (ptScreen.x, ptScreen.y, ptScreen.z + deltaZ + 0.5);
 else ptScreenNew = JU.P3.new3 (ptScreen.x + deltaX * f + 0.5, ptScreen.y + deltaY * f + 0.5, ptScreen.z);
var ptNew =  new JU.P3 ();
this.tm.unTransformPoint (ptScreenNew, ptNew);
ptNew.sub (ptCenter);
this.setAtomCoordsRelative (ptNew, bsSelected);
} else {
this.tm.rotateXYBy (deltaX, deltaY, bsSelected);
}}}this.refresh (2, "");
this.movingSelected = false;
}, "~N,~N,~N,~N,~N,JU.BS,~B,~B");
Clazz_defineMethod (c$, "highlightBond", 
function (index, isHover) {
if (isHover && !this.hoverEnabled) return;
var bs = null;
if (index >= 0) {
var b = this.ms.bo[index];
var i = b.atom2.i;
if (!this.ms.isAtomAssignable (i)) return;
bs = JU.BSUtil.newAndSetBit (i);
bs.set (b.atom1.i);
}this.highlight (bs);
this.refresh (3, "highlightBond");
}, "~N,~B");
Clazz_defineMethod (c$, "highlight", 
function (bs) {
if (bs != null) this.shm.loadShape (8);
this.setShapeProperty (8, "highlight", bs);
}, "JU.BS");
Clazz_defineMethod (c$, "setRotateBondIndex", 
function (index) {
var haveBond = (this.rotateBondIndex >= 0);
if (!haveBond && index < 0) return;
this.rotatePrev1 = -1;
this.bsRotateBranch = null;
if (index == -2147483648) return;
this.rotateBondIndex = index;
this.highlightBond (index, false);
}, "~N");
Clazz_defineMethod (c$, "getRotateBondIndex", 
function () {
return this.rotateBondIndex;
});
Clazz_defineMethod (c$, "actionRotateBond", 
function (deltaX, deltaY, x, y) {
if (this.rotateBondIndex < 0) return;
var bsBranch = this.bsRotateBranch;
var atom1;
var atom2;
if (bsBranch == null) {
var b = this.ms.bo[this.rotateBondIndex];
atom1 = b.atom1;
atom2 = b.atom2;
this.undoMoveActionClear (atom1.i, 2, true);
var pt = JU.P3.new3 (x, y, Clazz_doubleToInt ((atom1.sZ + atom2.sZ) / 2));
this.tm.unTransformPoint (pt, pt);
if (atom2.getCovalentBondCount () == 1 || pt.distance (atom1) < pt.distance (atom2) && atom1.getCovalentBondCount () != 1) {
var a = atom1;
atom1 = atom2;
atom2 = a;
}if (JU.Measure.computeAngleABC (pt, atom1, atom2, true) > 90 || JU.Measure.computeAngleABC (pt, atom2, atom1, true) > 90) {
bsBranch = this.getBranchBitSet (atom2.i, atom1.i, true);
}if (bsBranch != null) for (var n = 0, i = atom1.bonds.length; --i >= 0; ) {
if (bsBranch.get (atom1.getBondedAtomIndex (i)) && ++n == 2) {
bsBranch = null;
break;
}}
if (bsBranch == null) {
bsBranch = this.ms.getMoleculeBitSetForAtom (atom1.i);
}this.bsRotateBranch = bsBranch;
this.rotatePrev1 = atom1.i;
this.rotatePrev2 = atom2.i;
} else {
atom1 = this.ms.at[this.rotatePrev1];
atom2 = this.ms.at[this.rotatePrev2];
}var v1 = JU.V3.new3 (atom2.sX - atom1.sX, atom2.sY - atom1.sY, 0);
var v2 = JU.V3.new3 (deltaX, deltaY, 0);
v1.cross (v1, v2);
var degrees = (v1.z > 0 ? 1 : -1) * v2.length ();
var bs = JU.BSUtil.copy (bsBranch);
bs.andNot (this.slm.getMotionFixedAtoms ());
this.rotateAboutPointsInternal (this.eval, atom1, atom2, 0, degrees, false, bs, null, null, null, null);
}, "~N,~N,~N,~N");
Clazz_defineMethod (c$, "refreshMeasures", 
function (andStopMinimization) {
this.setShapeProperty (6, "refresh", null);
if (andStopMinimization) this.stopMinimization ();
}, "~B");
Clazz_defineMethod (c$, "functionXY", 
function (functionName, nX, nY) {
var data = null;
if (functionName.indexOf ("file:") == 0) data = this.getFileAsString3 (functionName.substring (5), false, null);
 else if (functionName.indexOf ("data2d_") != 0) return this.sm.functionXY (functionName, nX, nY);
nX = Math.abs (nX);
nY = Math.abs (nY);
var fdata;
if (data == null) {
fdata = this.getDataFloat2D (functionName);
if (fdata != null) return fdata;
data = "";
}fdata =  Clazz_newFloatArray (nX, nY, 0);
var f =  Clazz_newFloatArray (nX * nY, 0);
JU.Parser.parseStringInfestedFloatArray (data, null, f);
for (var i = 0, n = 0; i < nX; i++) for (var j = 0; j < nY; j++) fdata[i][j] = f[n++];


return fdata;
}, "~S,~N,~N");
Clazz_defineMethod (c$, "functionXYZ", 
function (functionName, nX, nY, nZ) {
var data = null;
if (functionName.indexOf ("file:") == 0) data = this.getFileAsString3 (functionName.substring (5), false, null);
 else if (functionName.indexOf ("data3d_") != 0) return this.sm.functionXYZ (functionName, nX, nY, nZ);
nX = Math.abs (nX);
nY = Math.abs (nY);
nZ = Math.abs (nZ);
var xyzdata;
if (data == null) {
xyzdata = this.getDataFloat3D (functionName);
if (xyzdata != null) return xyzdata;
data = "";
}xyzdata =  Clazz_newFloatArray (nX, nY, nZ, 0);
var f =  Clazz_newFloatArray (nX * nY * nZ, 0);
JU.Parser.parseStringInfestedFloatArray (data, null, f);
for (var i = 0, n = 0; i < nX; i++) for (var j = 0; j < nY; j++) for (var k = 0; k < nZ; k++) xyzdata[i][j][k] = f[n++];



return xyzdata;
}, "~S,~N,~N,~N");
Clazz_overrideMethod (c$, "extractMolData", 
function (what) {
if (what == null) {
var i = this.am.cmi;
if (i < 0) return null;
what = this.getModelNumberDotted (i);
}return this.getModelExtract (what, true, false, "V2000");
}, "~S");
Clazz_defineMethod (c$, "getNMRPredict", 
function (openURL) {
var molFile = this.getModelExtract ("selected", true, false, "V2000");
var pt = molFile.indexOf ("\n");
molFile = "Jmol " + JV.Viewer.version_date + molFile.substring (pt);
if (openURL) {
if (this.isApplet) {
this.showUrl (this.g.nmrUrlFormat + molFile);
} else {
this.syncScript ("true", "*", 0);
this.syncScript ("H1Simulate:", ".", 0);
}return null;
}var url = this.g.nmrPredictFormat + molFile;
return this.getFileAsString3 (url, false, null);
}, "~B");
Clazz_defineMethod (c$, "getHelp", 
function (what) {
if (this.g.helpPath.indexOf ("?") < 0) {
if (what.length > 0 && what.indexOf ("?") != 0) what = "?search=" + JU.PT.rep (what, " ", "%20");
what += (what.length == 0 ? "?ver=" : "&ver=") + JV.JC.version;
} else {
what = "&" + what;
}this.showUrl (this.g.helpPath + what);
}, "~S");
Clazz_defineMethod (c$, "show2D", 
function (smiles) {
this.showUrl (this.setLoadFormat ("_" + smiles, '2', false));
}, "~S");
Clazz_defineMethod (c$, "getChemicalInfo", 
function (smiles, t) {
var info = null;
var type = '/';
switch ((t == null ? 1073742035 : t.tok)) {
case 1073741977:
type = 'I';
break;
case 1073741978:
type = 'K';
break;
case 1073742159:
type = 'T';
break;
case 1073742160:
type = 'S';
break;
case 1073742035:
type = 'N';
break;
default:
info = JS.SV.sValue (t);
}
var s = this.setLoadFormat ("_" + smiles, type, false);
if (type == '/') s += JU.PT.rep (info, " ", "%20");
return this.getFileAsString4 (s, -1, false, false, false, "file");
}, "~S,JS.T");
Clazz_defineMethod (c$, "addCommand", 
function (command) {
if (this.autoExit || !this.haveDisplay || !this.getPreserveState ()) return;
this.commandHistory.addCommand (JU.PT.replaceAllCharacters (command, "\r\n\t", " "));
}, "~S");
Clazz_defineMethod (c$, "removeCommand", 
function () {
return this.commandHistory.removeCommand ();
});
Clazz_overrideMethod (c$, "getSetHistory", 
function (howFarBack) {
return this.commandHistory.getSetHistory (howFarBack);
}, "~N");
Clazz_defineMethod (c$, "historyFind", 
function (cmd, dir) {
return this.commandHistory.find (cmd, dir);
}, "~S,~N");
Clazz_defineMethod (c$, "setHistory", 
function (fileName) {
this.commandHistory.getSetHistory (-2147483648);
this.commandHistory.addCommand (this.getFileAsString4 (fileName, -1, false, false, true, null));
}, "~S");
Clazz_defineMethod (c$, "getOutputChannel", 
function (localName, fullPath) {
return this.getOutputManager ().getOutputChannel (localName, fullPath);
}, "~S,~A");
Clazz_overrideMethod (c$, "writeTextFile", 
function (fileName, data) {
var params =  new java.util.Hashtable ();
params.put ("fileName", fileName);
params.put ("type", "txt");
params.put ("text", data);
this.outputToFile (params);
}, "~S,~S");
Clazz_overrideMethod (c$, "clipImageOrPasteText", 
function (text) {
if (!this.haveAccess (JV.Viewer.ACCESS.ALL)) return "no";
return this.getOutputManager ().clipImageOrPasteText (text);
}, "~S");
Clazz_overrideMethod (c$, "getClipboardText", 
function () {
if (!this.haveAccess (JV.Viewer.ACCESS.ALL)) return "no";
try {
return this.getOutputManager ().getClipboardText ();
} catch (er) {
if (Clazz_exceptionOf (er, Error)) {
return J.i18n.GT._ ("clipboard is not accessible -- use signed applet");
} else {
throw er;
}
}
});
Clazz_defineMethod (c$, "processWriteOrCapture", 
function (params) {
return this.getOutputManager ().processWriteOrCapture (params);
}, "java.util.Map");
Clazz_defineMethod (c$, "createZip", 
function (fileName, type, data) {
var params =  new java.util.Hashtable ();
params.put ("fileName", fileName);
params.put ("type", type);
params.put ("text", this.getStateInfo ());
if (Clazz_instanceOf (data, Array)) params.put ("scripts", data);
 else if (Clazz_instanceOf (data, JU.Lst)) params.put ("imageData", data);
return this.getOutputManager ().outputToFile (params);
}, "~S,~S,~O");
Clazz_overrideMethod (c$, "outputToFile", 
function (params) {
return this.getOutputManager ().outputToFile (params);
}, "java.util.Map");
Clazz_defineMethod (c$, "getOutputManager", 
 function () {
if (this.outputManager != null) return this.outputManager;
return (this.outputManager = J.api.Interface.getInterface ("JV.OutputManager" + (this.isJS ? "JS" : "Awt"), this, "file")).setViewer (this, this.privateKey);
});
Clazz_defineMethod (c$, "setSyncTarget", 
 function (mode, TF) {
switch (mode) {
case 0:
this.sm.syncingMouse = TF;
break;
case 1:
this.sm.syncingScripts = TF;
break;
case 2:
this.sm.syncSend (TF ? "GET_GRAPHICS" : "SET_GRAPHICS_OFF", "*", 0);
if (Float.isNaN (this.tm.stereoDegrees)) this.setFloatProperty ("stereoDegrees", -5);
if (TF) {
this.setBooleanProperty ("_syncMouse", false);
this.setBooleanProperty ("_syncScript", false);
}return;
}
if (!this.sm.syncingScripts && !this.sm.syncingMouse) this.setSync ();
}, "~N,~B");
Clazz_overrideMethod (c$, "syncScript", 
function (script, applet, port) {
this.getStateCreator ().syncScript (script, applet, port);
}, "~S,~S,~N");
Clazz_overrideMethod (c$, "getModelIndexFromId", 
function (id) {
return this.ms.getModelIndexFromId (id);
}, "~S");
Clazz_defineMethod (c$, "setSyncDriver", 
function (mode) {
this.sm.setSyncDriver (mode);
}, "~N");
Clazz_defineMethod (c$, "getPartialCharges", 
function () {
return this.ms.getPartialCharges ();
});
Clazz_defineMethod (c$, "setProteinType", 
function (type, bs) {
this.ms.setProteinType (bs == null ? this.bsA () : bs, type);
}, "J.c.STR,JU.BS");
Clazz_defineMethod (c$, "getVanderwaalsMar", 
function (i) {
return (this.defaultVdw === J.c.VDW.USER ? this.userVdwMars[i] : JU.Elements.getVanderwaalsMar (i, this.defaultVdw));
}, "~N");
Clazz_defineMethod (c$, "getVanderwaalsMarType", 
function (atomicAndIsotopeNumber, type) {
if (type == null) type = this.defaultVdw;
 else switch (type) {
case J.c.VDW.AUTO:
case J.c.VDW.AUTO_BABEL:
case J.c.VDW.AUTO_JMOL:
case J.c.VDW.AUTO_RASMOL:
if (this.defaultVdw !== J.c.VDW.AUTO) type = this.defaultVdw;
break;
default:
break;
}
if (type === J.c.VDW.USER && this.bsUserVdws == null) type = J.c.VDW.JMOL;
return (type === J.c.VDW.USER ? this.userVdwMars[atomicAndIsotopeNumber & 127] : JU.Elements.getVanderwaalsMar (atomicAndIsotopeNumber, type));
}, "~N,J.c.VDW");
Clazz_defineMethod (c$, "setVdwStr", 
function (name) {
var type = J.c.VDW.getVdwType (name);
if (type == null) type = J.c.VDW.AUTO;
switch (type) {
case J.c.VDW.JMOL:
case J.c.VDW.BABEL:
case J.c.VDW.RASMOL:
case J.c.VDW.AUTO:
case J.c.VDW.USER:
break;
default:
type = J.c.VDW.JMOL;
}
if (type !== this.defaultVdw && type === J.c.VDW.USER && this.bsUserVdws == null) this.setUserVdw (this.defaultVdw);
this.defaultVdw = type;
this.g.setO ("defaultVDW", type.getVdwLabel ());
}, "~S");
Clazz_defineMethod (c$, "setUserVdw", 
function (mode) {
this.userVdwMars =  Clazz_newIntArray (JU.Elements.elementNumberMax, 0);
this.userVdws =  Clazz_newFloatArray (JU.Elements.elementNumberMax, 0);
this.bsUserVdws =  new JU.BS ();
if (mode === J.c.VDW.USER) mode = J.c.VDW.JMOL;
for (var i = 1; i < JU.Elements.elementNumberMax; i++) {
this.userVdwMars[i] = JU.Elements.getVanderwaalsMar (i, mode);
this.userVdws[i] = this.userVdwMars[i] / 1000;
}
}, "J.c.VDW");
Clazz_defineMethod (c$, "getDefaultVdwNameOrData", 
function (mode, type, bs) {
switch (mode) {
case -2147483648:
return this.defaultVdw.getVdwLabel ();
case 2147483647:
if ((bs = this.bsUserVdws) == null) return "";
type = J.c.VDW.USER;
break;
}
if (type == null || type === J.c.VDW.AUTO) type = this.defaultVdw;
if (type === J.c.VDW.USER && this.bsUserVdws == null) this.setUserVdw (this.defaultVdw);
return this.getDataManager ().getDefaultVdwNameOrData (type, bs);
}, "~N,J.c.VDW,JU.BS");
Clazz_defineMethod (c$, "deleteAtoms", 
function (bsAtoms, fullModels) {
var atomIndex = (bsAtoms == null ? -1 : bsAtoms.nextSetBit (0));
if (atomIndex < 0) return 0;
this.clearModelDependentObjects ();
if (!fullModels) {
this.sm.modifySend (atomIndex, this.ms.at[atomIndex].mi, 4, "deleting atom " + this.ms.at[atomIndex].getAtomName ());
this.ms.deleteAtoms (bsAtoms);
var n = this.slm.deleteAtoms (bsAtoms);
this.setTainted (true);
this.sm.modifySend (atomIndex, this.ms.at[atomIndex].mi, -4, "OK");
return n;
}return this.deleteModels (this.ms.at[atomIndex].mi, bsAtoms);
}, "JU.BS,~B");
Clazz_defineMethod (c$, "deleteModels", 
function (modelIndex, bsAtoms) {
this.clearModelDependentObjects ();
this.sm.modifySend (-1, modelIndex, 5, "deleting model " + this.getModelNumberDotted (modelIndex));
this.setCurrentModelIndexClear (0, false);
this.am.setAnimationOn (false);
var bsD0 = JU.BSUtil.copy (this.slm.bsDeleted);
var bsModels = (bsAtoms == null ? JU.BSUtil.newAndSetBit (modelIndex) : this.ms.getModelBS (bsAtoms, false));
var bsDeleted = this.ms.deleteModels (bsModels);
this.slm.processDeletedModelAtoms (bsDeleted);
if (this.eval != null) this.eval.deleteAtomsInVariables (bsDeleted);
this.setAnimationRange (0, 0);
this.clearRepaintManager (-1);
this.am.clear ();
this.am.initializePointers (1);
this.setCurrentModelIndexClear (this.ms.mc > 1 ? -1 : 0, this.ms.mc > 1);
this.hoverAtomIndex = -1;
this.setFileLoadStatus (J.c.FIL.DELETED, null, null, null, null, null);
this.refreshMeasures (true);
if (bsD0 != null) bsDeleted.andNot (bsD0);
this.sm.modifySend (-1, modelIndex, -5, "OK");
return JU.BSUtil.cardinalityOf (bsDeleted);
}, "~N,JU.BS");
Clazz_defineMethod (c$, "deleteBonds", 
function (bsDeleted) {
var modelIndex = this.ms.bo[bsDeleted.nextSetBit (0)].atom1.mi;
this.sm.modifySend (-1, modelIndex, 2, "delete bonds " + JU.Escape.eBond (bsDeleted));
this.ms.deleteBonds (bsDeleted, false);
this.sm.modifySend (-1, modelIndex, -2, "OK");
}, "JU.BS");
Clazz_defineMethod (c$, "deleteModelAtoms", 
function (modelIndex, firstAtomIndex, nAtoms, bsModelAtoms) {
this.sm.modifySend (-1, modelIndex, 1, "delete atoms " + JU.Escape.eBS (bsModelAtoms));
JU.BSUtil.deleteBits (this.bsFrameOffsets, bsModelAtoms);
this.getDataManager ().deleteModelAtoms (firstAtomIndex, nAtoms, bsModelAtoms);
this.sm.modifySend (-1, modelIndex, -1, "OK");
}, "~N,~N,~N,JU.BS");
Clazz_defineMethod (c$, "getQuaternionFrame", 
function () {
return this.g.quaternionFrame.charAt (this.g.quaternionFrame.length == 2 ? 1 : 0);
});
Clazz_defineMethod (c$, "loadImageData", 
function (image, nameOrError, echoName, sc) {
if (image == null) this.scriptEcho (nameOrError);
if (echoName == null) {
this.setBackgroundImage ((image == null ? null : nameOrError), image);
} else {
this.shm.loadShape (31);
this.setShapeProperty (31, "text", nameOrError);
if (image != null) this.setShapeProperty (31, "image", image);
}if (this.isJS && sc != null) {
sc.mustResumeEval = true;
this.eval.resumeEval (sc);
}}, "~O,~S,~S,JS.ScriptContext");
Clazz_defineMethod (c$, "cd", 
function (dir) {
if (dir == null) {
dir = ".";
} else if (dir.length == 0) {
this.setStringProperty ("defaultDirectory", "");
dir = ".";
}dir = this.fm.getDefaultDirectory (dir + (dir.equals ("=") ? "" : dir.endsWith ("/") ? "X.spt" : "/X.spt"));
if (dir.length > 0) this.setStringProperty ("defaultDirectory", dir);
var path = this.fm.getFilePath (dir + "/", true, false);
if (path.startsWith ("file:/")) JV.FileManager.setLocalPath (this, dir, false);
return dir;
}, "~S");
Clazz_defineMethod (c$, "setErrorMessage", 
function (errMsg, errMsgUntranslated) {
this.errorMessageUntranslated = errMsgUntranslated;
if (errMsg != null) this.eval.stopScriptThreads ();
return (this.errorMessage = errMsg);
}, "~S,~S");
Clazz_overrideMethod (c$, "getErrorMessage", 
function () {
return this.errorMessage;
});
Clazz_overrideMethod (c$, "getErrorMessageUn", 
function () {
return this.errorMessageUntranslated == null ? this.errorMessage : this.errorMessageUntranslated;
});
Clazz_defineMethod (c$, "setShapeErrorState", 
function (shapeID, state) {
this.currentShapeID = shapeID;
this.currentShapeState = state;
}, "~N,~S");
Clazz_defineMethod (c$, "getShapeErrorState", 
function () {
if (this.currentShapeID < 0) return "";
this.shm.releaseShape (this.currentShapeID);
this.clearRepaintManager (this.currentShapeID);
return JV.JC.getShapeClassName (this.currentShapeID, false) + " " + this.currentShapeState;
});
Clazz_defineMethod (c$, "handleError", 
function (er, doClear) {
try {
if (doClear) this.zapMsg ("" + er);
this.undoClear ();
if (JU.Logger.getLogLevel () == 0) JU.Logger.setLogLevel (4);
this.setCursor (0);
this.setBooleanProperty ("refreshing", true);
this.fm.setPathForAllFiles ("");
JU.Logger.error ("vwr handling error condition: " + er + "  ");
if (!this.isJS) er.printStackTrace ();
this.notifyError ("Error", "doClear=" + doClear + "; " + er, "" + er);
} catch (e1) {
try {
JU.Logger.error ("Could not notify error " + er + ": due to " + e1);
} catch (er2) {
}
}
}, "Error,~B");
Clazz_defineMethod (c$, "getFunctions", 
function (isStatic) {
return (isStatic ? JV.Viewer.staticFunctions : this.localFunctions);
}, "~B");
Clazz_defineMethod (c$, "removeFunction", 
function (name) {
name = name.toLowerCase ();
var $function = this.getFunction (name);
if ($function == null) return;
JV.Viewer.staticFunctions.remove (name);
this.localFunctions.remove (name);
}, "~S");
Clazz_defineMethod (c$, "getFunction", 
function (name) {
if (name == null) return null;
var $function = (JV.Viewer.isStaticFunction (name) ? JV.Viewer.staticFunctions : this.localFunctions).get (name);
return ($function == null || $function.geTokens () == null ? null : $function);
}, "~S");
c$.isStaticFunction = Clazz_defineMethod (c$, "isStaticFunction", 
 function (name) {
return name.startsWith ("static_");
}, "~S");
Clazz_defineMethod (c$, "isFunction", 
function (name) {
return (JV.Viewer.isStaticFunction (name) ? JV.Viewer.staticFunctions : this.localFunctions).containsKey (name);
}, "~S");
Clazz_defineMethod (c$, "clearFunctions", 
function () {
JV.Viewer.staticFunctions.clear ();
this.localFunctions.clear ();
});
Clazz_defineMethod (c$, "addFunction", 
function ($function) {
var name = $function.getName ();
(JV.Viewer.isStaticFunction (name) ? JV.Viewer.staticFunctions : this.localFunctions).put (name, $function);
}, "J.api.JmolScriptFunction");
Clazz_defineMethod (c$, "getFunctionCalls", 
function (selectedFunction) {
return this.getStateCreator ().getFunctionCalls (selectedFunction);
}, "~S");
Clazz_defineMethod (c$, "warn", 
function (s) {
if (!this.isPrintOnly) JU.Logger.warn (s);
}, "~S");
Clazz_defineMethod (c$, "checkPrivateKey", 
function (privateKey) {
return privateKey == this.privateKey;
}, "~N");
Clazz_defineMethod (c$, "bindAction", 
function (desc, name) {
if (this.haveDisplay) this.acm.bind (desc, name);
}, "~S,~S");
Clazz_defineMethod (c$, "unBindAction", 
function (desc, name) {
if (this.haveDisplay) this.acm.unbindAction (desc, name);
}, "~S,~S");
Clazz_defineMethod (c$, "getPlaneIntersection", 
function (type, plane, scale, flags) {
return this.ms.getPlaneIntersection (type, plane, scale, flags, type == 1614417948 ? this.getCurrentUnitCell () : null);
}, "~N,JU.P4,~N,~N");
Clazz_defineMethod (c$, "calculateStruts", 
function (bs1, bs2) {
return this.ms.calculateStruts (bs1 == null ? this.bsA () : bs1, bs2 == null ? this.bsA () : bs2);
}, "JU.BS,JU.BS");
Clazz_defineMethod (c$, "getPreserveState", 
function () {
return (this.g.preserveState && this.scm != null);
});
Clazz_defineMethod (c$, "isKiosk", 
function () {
return this.$isKiosk;
});
Clazz_defineMethod (c$, "hasFocus", 
function () {
return (this.haveDisplay && (this.$isKiosk || this.apiPlatform.hasFocus (this.display)));
});
Clazz_defineMethod (c$, "setFocus", 
function () {
if (this.haveDisplay && !this.apiPlatform.hasFocus (this.display)) this.apiPlatform.requestFocusInWindow (this.display);
});
Clazz_defineMethod (c$, "stopMinimization", 
function () {
if (this.minimizer != null) {
this.minimizer.setProperty ("stop", null);
}});
Clazz_defineMethod (c$, "clearMinimization", 
function () {
if (this.minimizer != null) this.minimizer.setProperty ("clear", null);
});
Clazz_defineMethod (c$, "getMinimizationInfo", 
function () {
return (this.minimizer == null ? "" : this.minimizer.getProperty ("log", 0));
});
Clazz_defineMethod (c$, "checkMinimization", 
 function () {
this.refreshMeasures (true);
if (!this.g.monitorEnergy) return;
try {
this.minimize (null, 0, 0, this.getAllAtoms (), null, 0, false, false, true, false);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
} else {
throw e;
}
}
this.echoMessage (this.getP ("_minimizationForceField") + " Energy = " + this.getP ("_minimizationEnergy"));
});
Clazz_defineMethod (c$, "minimize", 
function (eval, steps, crit, bsSelected, bsFixed, rangeFixed, addHydrogen, isOnly, isSilent, isLoad2D) {
var ff = this.g.forceField;
var bsInFrame = this.getModelUndeletedAtomsBitSetBs (this.getVisibleFramesBitSet ());
if (bsSelected == null) bsSelected = this.getModelUndeletedAtomsBitSet (this.getVisibleFramesBitSet ().length () - 1);
 else bsSelected.and (bsInFrame);
if (rangeFixed <= 0) rangeFixed = 5.0;
var bsMotionFixed = JU.BSUtil.copy (bsFixed == null ? this.slm.getMotionFixedAtoms () : bsFixed);
var haveFixed = (bsMotionFixed.cardinality () > 0);
if (haveFixed) bsSelected.andNot (bsMotionFixed);
var bsNearby = (isOnly ?  new JU.BS () : this.ms.getAtomsWithinRadius (rangeFixed, bsSelected, true, null));
bsNearby.andNot (bsSelected);
if (haveFixed) {
bsMotionFixed.and (bsNearby);
} else {
bsMotionFixed = bsNearby;
}bsMotionFixed.and (bsInFrame);
if (addHydrogen) bsSelected.or (this.addHydrogens (bsSelected, isLoad2D, isSilent));
if (bsSelected.cardinality () > 200) {
JU.Logger.error ("Too many atoms for minimization (>200)");
return;
}try {
if (!isSilent) JU.Logger.info ("Minimizing " + bsSelected.cardinality () + " atoms");
this.getMinimizer (true).minimize (steps, crit, bsSelected, bsMotionFixed, haveFixed, isSilent, ff);
} catch (e$$) {
if (Clazz_exceptionOf (e$$, JV.JmolAsyncException)) {
var e = e$$;
{
eval.loadFileResourceAsync (e.getFileName ());
}
} else if (Clazz_exceptionOf (e$$, Exception)) {
var e = e$$;
{
JU.Logger.error ("Minimization error: " + e.toString ());
if (!this.isJS) e.printStackTrace ();
}
} else {
throw e$$;
}
}
}, "J.api.JmolScriptEvaluator,~N,~N,JU.BS,JU.BS,~N,~B,~B,~B,~B");
Clazz_defineMethod (c$, "setMotionFixedAtoms", 
function (bs) {
this.slm.setMotionFixedAtoms (bs);
}, "JU.BS");
Clazz_defineMethod (c$, "getMotionFixedAtoms", 
function () {
return this.slm.getMotionFixedAtoms ();
});
Clazz_defineMethod (c$, "getAtomicPropertyState", 
function (commands, type, bs, name, data) {
this.getStateCreator ().getAtomicPropertyStateBuffer (commands, type, bs, name, data);
}, "JU.SB,~N,JU.BS,~S,~A");
Clazz_defineMethod (c$, "getCenterAndPoints", 
function (atomSets, addCenter) {
return this.ms.getCenterAndPoints (atomSets, addCenter);
}, "JU.Lst,~B");
Clazz_defineMethod (c$, "writeFileData", 
function (fileName, type, modelIndex, parameters) {
return this.getOutputManager ().writeFileData (fileName, type, modelIndex, parameters);
}, "~S,~S,~N,~A");
Clazz_defineMethod (c$, "getPdbData", 
function (modelIndex, type, bsAtoms, parameters, oc, getStructure) {
return this.getPropertyManager ().getPdbData (modelIndex, type, bsAtoms == null ? this.bsA () : bsAtoms, parameters, oc, getStructure);
}, "~N,~S,JU.BS,~A,JU.OC,~B");
Clazz_defineMethod (c$, "getGroupsWithin", 
function (nResidues, bs) {
return this.ms.getGroupsWithin (nResidues, bs);
}, "~N,JU.BS");
Clazz_defineMethod (c$, "getExecutor", 
function () {
if (this.executor != null || JV.Viewer.nProcessors < 2) return this.executor;
try {
this.executor = (J.api.Interface.getInterface ("JS.ScriptParallelProcessor", null, null)).getExecutor ();
} catch (e$$) {
if (Clazz_exceptionOf (e$$, Exception)) {
var e = e$$;
{
this.executor = null;
}
} else if (Clazz_exceptionOf (e$$, Error)) {
var er = e$$;
{
this.executor = null;
}
} else {
throw e$$;
}
}
if (this.executor == null) JU.Logger.error ("parallel processing is not available");
return this.executor;
});
Clazz_defineMethod (c$, "setShapeSize", 
function (shapeID, mad, bsSelected) {
if (bsSelected == null) bsSelected = this.bsA ();
this.shm.setShapeSizeBs (shapeID, mad, null, bsSelected);
}, "~N,~N,JU.BS");
Clazz_defineMethod (c$, "setShapeProperty", 
function (shapeID, propertyName, value) {
if (shapeID < 0) return;
this.shm.setShapePropertyBs (shapeID, propertyName, value, null);
}, "~N,~S,~O");
Clazz_defineMethod (c$, "getShapeProperty", 
function (shapeType, propertyName) {
return this.shm.getShapePropertyIndex (shapeType, propertyName, -2147483648);
}, "~N,~S");
Clazz_defineMethod (c$, "getShapePropertyAsInt", 
 function (shapeID, propertyName) {
var value = this.getShapeProperty (shapeID, propertyName);
return value == null || !(Clazz_instanceOf (value, Integer)) ? -2147483648 : (value).intValue ();
}, "~N,~S");
Clazz_defineMethod (c$, "setModelVisibility", 
function () {
if (this.shm == null) return;
this.shm.setModelVisibility ();
});
Clazz_defineMethod (c$, "resetShapes", 
function (andCreateNew) {
this.shm.resetShapes ();
if (andCreateNew) {
this.shm.loadDefaultShapes (this.ms);
this.clearRepaintManager (-1);
}}, "~B");
Clazz_defineMethod (c$, "setParallel", 
function (TF) {
return (this.$isParallel = this.g.multiProcessor && TF);
}, "~B");
Clazz_defineMethod (c$, "isParallel", 
function () {
return this.g.multiProcessor && this.$isParallel;
});
Clazz_defineMethod (c$, "setAtomPickingOption", 
 function (option) {
if (this.haveDisplay) this.acm.setAtomPickingOption (option);
}, "~S");
Clazz_defineMethod (c$, "setBondPickingOption", 
 function (option) {
if (this.haveDisplay) this.acm.setBondPickingOption (option);
}, "~S");
Clazz_defineMethod (c$, "undoClear", 
function () {
this.actionStates.clear ();
this.actionStatesRedo.clear ();
});
Clazz_defineMethod (c$, "undoMoveAction", 
function (action, n) {
this.getStateCreator ().undoMoveAction (action, n);
}, "~N,~N");
Clazz_defineMethod (c$, "undoMoveActionClear", 
function (taintedAtom, type, clearRedo) {
if (!this.g.preserveState) return;
this.getStateCreator ().undoMoveActionClear (taintedAtom, type, clearRedo);
}, "~N,~N,~B");
Clazz_defineMethod (c$, "moveAtomWithHydrogens", 
function (atomIndex, deltaX, deltaY, deltaZ, bsAtoms) {
this.stopMinimization ();
if (bsAtoms == null) {
var atom = this.ms.at[atomIndex];
bsAtoms = JU.BSUtil.newAndSetBit (atomIndex);
var bonds = atom.bonds;
if (bonds != null) for (var i = 0; i < bonds.length; i++) {
var atom2 = bonds[i].getOtherAtom (atom);
if (atom2.getElementNumber () == 1) bsAtoms.set (atom2.i);
}
}this.moveSelected (deltaX, deltaY, deltaZ, -2147483648, -2147483648, bsAtoms, true, true);
}, "~N,~N,~N,~N,JU.BS");
Clazz_defineMethod (c$, "isModelPDB", 
function (i) {
return this.ms.am[i].isBioModel;
}, "~N");
Clazz_overrideMethod (c$, "deleteMeasurement", 
function (i) {
this.setShapeProperty (6, "delete", Integer.$valueOf (i));
}, "~N");
Clazz_overrideMethod (c$, "getSmiles", 
function (bs) {
return this.getSmilesOpt (bs, -1, -1, false, false, false, false, false);
}, "JU.BS");
Clazz_defineMethod (c$, "getSmilesOpt", 
function (bsSelected, index1, index2, explicitH, isBioSmiles, bioAllowUnmatchedRings, bioAddCrossLinks, bioAddComment) {
var atoms = this.ms.at;
if (bsSelected == null) {
if (index1 < 0 || index2 < 0) {
bsSelected = this.bsA ();
} else {
if (isBioSmiles) {
if (index1 > index2) {
var i = index1;
index1 = index2;
index2 = i;
}index1 = atoms[index1].group.firstAtomIndex;
index2 = atoms[index2].group.lastAtomIndex;
}bsSelected =  new JU.BS ();
bsSelected.setBits (index1, index2 + 1);
}}var bioComment = (bioAddComment ? JV.Viewer.getJmolVersion () + " " + this.getModelName (this.am.cmi) : null);
return this.getSmilesMatcher ().getSmiles (atoms, this.ms.ac, bsSelected, isBioSmiles, bioAllowUnmatchedRings, bioAddCrossLinks, bioComment, explicitH);
}, "JU.BS,~N,~N,~B,~B,~B,~B,~B");
Clazz_defineMethod (c$, "prompt", 
function (label, data, list, asButtons) {
return (this.$isKiosk ? "null" : this.apiPlatform.prompt (label, data, list, asButtons));
}, "~S,~S,~A,~B");
Clazz_defineMethod (c$, "initializeExporter", 
function (params) {
var isJS = params.get ("type").equals ("JS");
if (isJS) {
if (this.jsExporter3D != null) {
this.jsExporter3D.initializeOutput (this, this.privateKey, params);
return this.jsExporter3D;
}} else {
var fileName = params.get ("fileName");
var fullPath = params.get ("fullPath");
var out = this.getOutputChannel (fileName, fullPath);
if (out == null) return null;
params.put ("outputChannel", out);
}var export3D = J.api.Interface.getOption ("export.Export3D", this, "export");
if (export3D == null) return null;
var exporter = export3D.initializeExporter (this, this.privateKey, this.gdata, params);
if (isJS && exporter != null) this.jsExporter3D = export3D;
return (exporter == null ? null : export3D);
}, "java.util.Map");
Clazz_defineMethod (c$, "getMouseEnabled", 
function () {
return this.refreshing && !this.creatingImage;
});
Clazz_overrideMethod (c$, "calcAtomsMinMax", 
function (bs, boxInfo) {
this.ms.calcAtomsMinMax (bs, boxInfo);
}, "JU.BS,JU.BoxInfo");
Clazz_defineMethod (c$, "getObjectMap", 
function (map, c) {
switch (c) {
case '{':
if (this.getScriptManager () != null) {
var m = map;
var sets = this.eval.getDefinedAtomSets ();
if (sets != null) m.putAll (sets);
JS.T.getTokensType (m, 3145728);
}return;
case '$':
case '0':
this.shm.getObjectMap (map, c == '$');
return;
}
}, "java.util.Map,~S");
Clazz_defineMethod (c$, "setPicked", 
function (atomIndex) {
var pickedSet = null;
var pickedList = null;
if (atomIndex >= 0) {
this.g.setI ("_atompicked", atomIndex);
pickedSet = this.g.getParam ("picked", true);
pickedList = this.g.getParam ("pickedList", true);
}if (pickedSet == null || pickedSet.tok != 10) {
pickedSet = JS.SV.newV (10,  new JU.BS ());
pickedList = JS.SV.getVariableList ( new JU.Lst ());
this.g.setUserVariable ("picked", pickedSet);
this.g.setUserVariable ("pickedList", pickedList);
}if (atomIndex < 0) return;
JS.SV.getBitSet (pickedSet, false).set (atomIndex);
var p = pickedList.pushPop (null, null);
if (p.tok == 10) pickedList.pushPop (p, null);
if (p.tok != 10 || !(p.value).get (atomIndex)) pickedList.pushPop (JS.SV.newV (10, JU.BSUtil.newAndSetBit (atomIndex)), null);
}, "~N");
Clazz_overrideMethod (c$, "runScript", 
function (script) {
var outputBuffer =  new JU.SB ();
try {
if (this.getScriptManager () == null) return null;
this.eval.runScriptBuffer (script, outputBuffer);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return this.eval.getErrorMessage ();
} else {
throw e;
}
}
return outputBuffer.toString ();
}, "~S");
Clazz_defineMethod (c$, "setFrameDelayMs", 
function (millis) {
this.ms.setFrameDelayMs (millis, this.getVisibleFramesBitSet ());
}, "~N");
Clazz_defineMethod (c$, "getBaseModelBitSet", 
function () {
return this.ms.getModelAtomBitSetIncludingDeleted (this.getJDXBaseModelIndex (this.am.cmi), true);
});
Clazz_defineMethod (c$, "clearTimeouts", 
function () {
if (this.timeouts != null) J.thread.TimeoutThread.clear (this.timeouts);
});
Clazz_defineMethod (c$, "setTimeout", 
function (name, mSec, script) {
if (!this.haveDisplay || this.headless || this.autoExit) return;
if (name == null) {
this.clearTimeouts ();
return;
}if (this.timeouts == null) {
this.timeouts =  new java.util.Hashtable ();
}J.thread.TimeoutThread.setTimeout (this, this.timeouts, name, mSec, script);
}, "~S,~N,~S");
Clazz_defineMethod (c$, "triggerTimeout", 
function (name) {
if (!this.haveDisplay || this.timeouts == null) return;
J.thread.TimeoutThread.trigger (this.timeouts, name);
}, "~S");
Clazz_defineMethod (c$, "clearTimeout", 
function (name) {
this.setTimeout (name, 0, null);
}, "~S");
Clazz_defineMethod (c$, "showTimeout", 
function (name) {
return (this.haveDisplay ? J.thread.TimeoutThread.showTimeout (this.timeouts, name) : "");
}, "~S");
Clazz_defineMethod (c$, "calculatePartialCharges", 
function (bsSelected) {
if (bsSelected == null || bsSelected.cardinality () == 0) bsSelected = this.getModelUndeletedAtomsBitSetBs (this.getVisibleFramesBitSet ());
this.getMinimizer (true).calculatePartialCharges (this.ms.bo, this.ms.bondCount, this.ms.at, bsSelected);
}, "JU.BS");
Clazz_defineMethod (c$, "setCurrentModelID", 
function (id) {
var modelIndex = this.am.cmi;
if (modelIndex >= 0) this.ms.setInfo (modelIndex, "modelID", id);
}, "~S");
Clazz_defineMethod (c$, "cacheClear", 
function () {
this.fm.cacheClear ();
this.ligandModelSet = null;
this.ligandModels = null;
this.ms.clearCache ();
});
Clazz_defineMethod (c$, "cachePut", 
function (key, data) {
JU.Logger.info ("Viewer cachePut " + key);
this.fm.cachePut (key, data);
}, "~S,~O");
Clazz_defineMethod (c$, "cacheFileByName", 
function (fileName, isAdd) {
if (fileName == null) {
this.cacheClear ();
return -1;
}return this.fm.cacheFileByNameAdd (fileName, isAdd);
}, "~S,~B");
Clazz_defineMethod (c$, "clearThreads", 
function () {
if (this.eval != null) this.eval.stopScriptThreads ();
this.stopMinimization ();
this.tm.clearThreads ();
this.setAnimationOn (false);
});
Clazz_defineMethod (c$, "getEvalContextAndHoldQueue", 
function (eval) {
if (eval == null || !this.isJS && !this.testAsync) return null;
eval.pushContextDown ("getEvalContextAndHoldQueue");
var sc = eval.getThisContext ();
sc.setMustResume ();
sc.isJSThread = true;
this.queueOnHold = true;
return sc;
}, "J.api.JmolScriptEvaluator");
Clazz_overrideMethod (c$, "resizeInnerPanel", 
function (width, height) {
if (this.autoExit || !this.haveDisplay) {
this.setScreenDimension (width, height);
return this.dimScreen;
}return this.sm.resizeInnerPanel (width, height);
}, "~N,~N");
Clazz_defineMethod (c$, "getFontLineShapeState", 
function (s, myType, tickInfos) {
return this.getStateCreator ().getFontLineShapeState (s, myType, tickInfos);
}, "~S,~S,~A");
Clazz_defineMethod (c$, "getShapeSetState", 
function (atomShape, shape, monomerCount, monomers, bsSizeDefault, temp, temp2) {
this.getStateCreator ().getShapeSetState (atomShape, shape, monomerCount, monomers, bsSizeDefault, temp, temp2);
}, "J.shape.AtomShape,J.shape.Shape,~N,~A,JU.BS,java.util.Map,java.util.Map");
Clazz_defineMethod (c$, "getMeasurementState", 
function (measures, mList, measurementCount, font3d, ti) {
return this.getStateCreator ().getMeasurementState (measures, mList, measurementCount, font3d, ti);
}, "J.shape.Measures,JU.Lst,~N,javajs.awt.Font,JM.TickInfo");
Clazz_defineMethod (c$, "getBondState", 
function (shape, bsOrderSet, reportAll) {
return this.getStateCreator ().getBondState (shape, bsOrderSet, reportAll);
}, "J.shape.Shape,JU.BS,~B");
Clazz_defineMethod (c$, "getAtomShapeSetState", 
function (shape, shapes) {
return this.getStateCreator ().getAtomShapeSetState (shape, shapes);
}, "J.shape.Shape,~A");
Clazz_defineMethod (c$, "getShapeState", 
function (shape) {
return this.getStateCreator ().getShapeState (shape);
}, "J.shape.Shape");
Clazz_defineMethod (c$, "getAtomShapeState", 
function (shape) {
return this.getStateCreator ().getAtomShapeState (shape);
}, "J.shape.AtomShape");
Clazz_defineMethod (c$, "getDefaultPropertyParam", 
function (propertyID) {
return this.getPropertyManager ().getDefaultPropertyParam (propertyID);
}, "~N");
Clazz_defineMethod (c$, "getPropertyNumber", 
function (name) {
return this.getPropertyManager ().getPropertyNumber (name);
}, "~S");
Clazz_defineMethod (c$, "checkPropertyParameter", 
function (name) {
return this.getPropertyManager ().checkPropertyParameter (name);
}, "~S");
Clazz_defineMethod (c$, "extractProperty", 
function (property, args, pt) {
return this.getPropertyManager ().extractProperty (property, args, pt, null, false);
}, "~O,~O,~N");
Clazz_defineMethod (c$, "addHydrogens", 
function (bsAtoms, is2DLoad, isSilent) {
var doAll = (bsAtoms == null);
if (bsAtoms == null) bsAtoms = this.getModelUndeletedAtomsBitSet (this.getVisibleFramesBitSet ().length () - 1);
var bsB =  new JU.BS ();
if (bsAtoms.cardinality () == 0) return bsB;
var modelIndex = this.ms.at[bsAtoms.nextSetBit (0)].mi;
if (modelIndex != this.ms.mc - 1) return bsB;
var vConnections =  new JU.Lst ();
var pts = this.getAdditionalHydrogens (bsAtoms, doAll, false, vConnections);
var wasAppendNew = false;
wasAppendNew = this.g.appendNew;
if (pts.length > 0) {
this.clearModelDependentObjects ();
try {
bsB = (is2DLoad ? this.ms.addHydrogens (vConnections, pts) : this.addHydrogensInline (bsAtoms, vConnections, pts));
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
System.out.println (e.toString ());
} else {
throw e;
}
}
if (wasAppendNew) this.g.appendNew = true;
}if (!isSilent) this.scriptStatus (J.i18n.GT.i (J.i18n.GT._ ("{0} hydrogens added"), pts.length));
return bsB;
}, "JU.BS,~B,~B");
Clazz_defineMethod (c$, "addHydrogensInline", 
function (bsAtoms, vConnections, pts) {
if (this.getScriptManager () == null) return null;
return this.scm.addHydrogensInline (bsAtoms, vConnections, pts);
}, "JU.BS,JU.Lst,~A");
Clazz_overrideMethod (c$, "evalFunctionFloat", 
function (func, params, values) {
return (this.getScriptManager () == null ? 0 : this.eval.evalFunctionFloat (func, params, values));
}, "~O,~O,~A");
Clazz_defineMethod (c$, "evalParallel", 
function (context, shapeManager) {
this.displayLoadErrors = false;
var isOK = this.getScriptManager () != null && this.eval.evalParallel (context, (shapeManager == null ? this.shm : shapeManager));
this.displayLoadErrors = true;
return isOK;
}, "JS.ScriptContext,JV.ShapeManager");
Clazz_overrideMethod (c$, "evaluateExpression", 
function (stringOrTokens) {
return (this.getScriptManager () == null ? null : this.eval.evaluateExpression (stringOrTokens, false, false));
}, "~O");
Clazz_defineMethod (c$, "evaluateExpressionAsVariable", 
function (stringOrTokens) {
return (this.getScriptManager () == null ? null : this.eval.evaluateExpression (stringOrTokens, true, false));
}, "~O");
Clazz_defineMethod (c$, "getAtomBitSet", 
function (atomExpression) {
if (Clazz_instanceOf (atomExpression, JU.BS)) return this.slm.excludeAtoms (atomExpression, false);
this.getScriptManager ();
return this.getAtomBitSetEval (this.eval, atomExpression);
}, "~O");
Clazz_defineMethod (c$, "getAtomBitSetVector", 
function (atomExpression) {
return (this.getScriptManager () == null ? null : this.eval.getAtomBitSetVector (this.ms.ac, atomExpression));
}, "~O");
Clazz_defineMethod (c$, "getContextVariables", 
function () {
return (this.getScriptManager () == null ? null : this.eval.getContextVariables ());
});
Clazz_defineMethod (c$, "getScriptContext", 
function (why) {
return (this.getScriptManager () == null ? null : this.eval.getScriptContext (why));
}, "~S");
Clazz_defineMethod (c$, "getAtomDefs", 
function (names) {
var sb =  new JU.SB ();
for (var e, $e = names.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
if (Clazz_instanceOf (e.getValue (), JU.BS)) sb.append ("{" + e.getKey () + "} <" + (e.getValue ()).cardinality () + " atoms>\n");
}
return sb.append ("\n").toString ();
}, "java.util.Map");
Clazz_defineMethod (c$, "setCGO", 
function (info) {
this.shm.loadShape (23);
this.shm.setShapePropertyBs (23, "setCGO", info, null);
}, "JU.Lst");
Clazz_defineMethod (c$, "setModelSet", 
function (modelSet) {
this.ms = this.mm.modelSet = modelSet;
}, "JM.ModelSet");
Clazz_defineMethod (c$, "setObjectProp", 
function (id, tokCommand) {
this.getScriptManager ();
if (id == null) id = "*";
return (this.eval == null ? null : this.eval.setObjectPropSafe (id, tokCommand));
}, "~S,~N");
Clazz_defineMethod (c$, "setDihedrals", 
function (dihedralList, bsBranches, rate) {
if (bsBranches == null) bsBranches = this.ms.getBsBranches (dihedralList);
this.ms.setDihedrals (dihedralList, bsBranches, rate);
}, "~A,~A,~N");
Clazz_defineMethod (c$, "getChainID", 
function (id, isAssign) {
var iboxed = this.chainMap.get (id);
if (iboxed != null) return iboxed.intValue ();
var i = id.charCodeAt (0);
if (id.length > 1) {
i = 300 + this.chainList.size ();
} else if (isAssign && 97 <= i && i <= 122) {
i += 159;
}if (i >= 256) {
this.chainList.addLast (id);
}iboxed = Integer.$valueOf (i);
this.chainMap.put (iboxed, id);
this.chainMap.put (id, iboxed);
return i;
}, "~S,~B");
Clazz_defineMethod (c$, "getChainIDStr", 
function (id) {
return this.chainMap.get (Integer.$valueOf (id));
}, "~N");
Clazz_defineMethod (c$, "getScriptQueueInfo", 
function () {
return (this.scm != null && this.scm.isQueueProcessing () ? Boolean.TRUE : Boolean.FALSE);
});
Clazz_defineMethod (c$, "getNMRCalculation", 
function () {
return (this.nmrCalculation == null ? (this.nmrCalculation = J.api.Interface.getOption ("quantum.NMRCalculation", this, "script")).setViewer (this) : this.nmrCalculation);
});
Clazz_defineMethod (c$, "getDistanceUnits", 
function (s) {
if (s == null) s = this.getDefaultMeasurementLabel (2);
var pt = s.indexOf ("//");
return (pt < 0 ? this.g.measureDistanceUnits : s.substring (pt + 2));
}, "~S");
Clazz_defineMethod (c$, "calculateFormalCharges", 
function (bs) {
return this.ms.fixFormalCharges (bs == null ? this.bsA () : bs);
}, "JU.BS");
Clazz_defineMethod (c$, "cachePngFiles", 
function () {
return (!this.getTestFlag (1));
});
Clazz_defineMethod (c$, "setModulation", 
function (bs, isOn, t1, isQ) {
if (isQ) this.g.setO ("_modt", JU.Escape.eP (t1));
this.ms.setModulation (bs == null ? this.getAllAtoms () : bs, isOn, t1, isQ);
this.refreshMeasures (true);
}, "JU.BS,~B,JU.P3,~B");
Clazz_defineMethod (c$, "checkInMotion", 
function (state) {
switch (state) {
case 0:
this.setTimeout ("_SET_IN_MOTION_", 0, null);
break;
case 1:
if (!this.inMotion) this.setTimeout ("_SET_IN_MOTION_", this.g.hoverDelayMs * 2, "!setInMotion");
break;
case 2:
this.setInMotion (true);
this.refresh (3, "timeoutThread set in motion");
break;
}
}, "~N");
Clazz_defineMethod (c$, "checkMotionRendering", 
function (tok) {
if (!this.getInMotion (true) && !this.tm.spinOn && !this.tm.vibrationOn && !this.am.animationOn) return true;
if (this.g.wireframeRotation) return false;
var n = 0;
switch (tok) {
case 1678770178:
case 1141899265:
n = 2;
break;
case 1113198596:
n = 3;
break;
case 1113198597:
n = 4;
break;
case 1113200642:
n = 5;
break;
case 1073742018:
n = 6;
break;
case 603979967:
n = 7;
break;
case 603979786:
n = 8;
break;
}
return this.g.platformSpeed >= n;
}, "~N");
Clazz_defineMethod (c$, "openExportChannel", 
function (privateKey, fileName, asWriter) {
return this.getOutputManager ().openOutputChannel (privateKey, fileName, asWriter, false);
}, "~N,~S,~B");
Clazz_overrideMethod (c$, "log", 
function (data) {
if (data != null) this.getOutputManager ().logToFile (data);
}, "~S");
Clazz_defineMethod (c$, "getLogFileName", 
function () {
return (this.logFileName == null ? "" : this.logFileName);
});
Clazz_defineMethod (c$, "getCommands", 
function (htDefine, htMore, select) {
return this.getStateCreator ().getCommands (htDefine, htMore, select);
}, "java.util.Map,java.util.Map,~S");
Clazz_defineMethod (c$, "allowCapture", 
function () {
return !this.isApplet || this.isSignedApplet;
});
Clazz_defineMethod (c$, "compileExpr", 
function (expr) {
var o = (this.getScriptManager () == null ? null : this.eval.evaluateExpression (expr, false, true));
return (Clazz_instanceOf (o, Array) ? o : [JS.T.o (4, expr)]);
}, "~S");
Clazz_defineMethod (c$, "checkSelect", 
function (h, value) {
return this.getScriptManager () != null && this.eval.checkSelect (h, value);
}, "java.util.Map,~A");
Clazz_defineMethod (c$, "getAnnotationInfo", 
function (d, match, type) {
return this.getAnnotationParser ().getAnnotationInfo (this, d, match, type, this.am.cmi);
}, "JS.SV,~S,~N");
Clazz_defineMethod (c$, "getAtomValidation", 
function (type, atom) {
return this.getAnnotationParser ().getAtomValidation (this, type, atom);
}, "~S,JM.Atom");
Clazz_defineMethod (c$, "getJzt", 
function () {
return (this.jzt == null ? this.jzt = J.api.Interface.getInterface ("JU.ZipTools", this, "zip") : this.jzt);
});
Clazz_defineMethod (c$, "dragMinimizeAtom", 
function (iAtom) {
this.stopMinimization ();
var bs = (this.getMotionFixedAtoms ().cardinality () == 0 ? this.ms.getAtoms ((this.ms.isAtomPDB (iAtom) ? 1087373318 : 1095761936), JU.BSUtil.newAndSetBit (iAtom)) : JU.BSUtil.setAll (this.ms.ac));
try {
this.minimize (null, 2147483647, 0, bs, null, 0, false, false, false, false);
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
if (!this.async) return;
{
var me = this;
setTimeout(function() {me.dragMinimizeAtom(iAtom)}, 100);
}} else {
throw e;
}
}
}, "~N");
Clazz_defineMethod (c$, "getJBR", 
function () {
return (this.jbr == null ? this.jbr = (J.api.Interface.getInterface ("JM.Resolver", this, "file")).setViewer (this) : this.jbr);
});
Clazz_defineMethod (c$, "checkMenuUpdate", 
function () {
if (this.jmolpopup != null) this.jmolpopup.jpiUpdateComputedMenus ();
});
Clazz_pu$h(self.c$);
c$ = Clazz_declareType (JV.Viewer, "ACCESS", Enum);
Clazz_defineEnumConstant (c$, "NONE", 0, []);
Clazz_defineEnumConstant (c$, "READSPT", 1, []);
Clazz_defineEnumConstant (c$, "ALL", 2, []);
c$ = Clazz_p0p ();
{
{
self.Jmol && Jmol.extend && Jmol.extend("vwr", JV.Viewer.prototype);
}}Clazz_defineStatics (c$,
"appletDocumentBase", "",
"appletCodeBase", "",
"appletIdiomaBase", null,
"jsDocumentBase", "");
c$.strJavaVendor = c$.prototype.strJavaVendor = "Java: " + System.getProperty ("java.vendor", "j2s");
c$.strOSName = c$.prototype.strOSName = System.getProperty ("os.name", "");
c$.strJavaVersion = c$.prototype.strJavaVersion = "Java " + System.getProperty ("java.version", "");
Clazz_defineStatics (c$,
"version_date", null,
"SYNC_GRAPHICS_MESSAGE", "GET_GRAPHICS",
"SYNC_NO_GRAPHICS_MESSAGE", "SET_GRAPHICS_OFF");
c$.staticFunctions = c$.prototype.staticFunctions =  new java.util.Hashtable ();
Clazz_defineStatics (c$,
"nProcessors", 1);
{
{
}}});

})();

Clazz._coreLoaded = true;



})(Clazz
,Clazz.newLongArray
,Clazz.doubleToByte
,Clazz.doubleToInt
,Clazz.doubleToLong
,Clazz.declarePackage
,Clazz.instanceOf
,Clazz.load
,Clazz.instantialize
,Clazz.decorateAsClass
,Clazz.floatToInt
,Clazz.floatToLong
,Clazz.makeConstructor
,Clazz.defineEnumConstant
,Clazz.exceptionOf
,Clazz.newIntArray
,Clazz.defineStatics
,Clazz.newFloatArray
,Clazz.declareType
,Clazz.prepareFields
,Clazz.superConstructor
,Clazz.newByteArray
,Clazz.declareInterface
,Clazz.p0p
,Clazz.pu$h
,Clazz.newShortArray
,Clazz.innerTypeInstance
,Clazz.isClassDefined
,Clazz.prepareCallback
,Clazz.newArray
,Clazz.castNullAs
,Clazz.floatToShort
,Clazz.superCall
,Clazz.decorateAsType
,Clazz.newBooleanArray
,Clazz.newCharArray
,Clazz.implementOf
,Clazz.newDoubleArray
,Clazz.overrideConstructor
,Clazz.clone
,Clazz.doubleToShort
,Clazz.getInheritedLevel
,Clazz.getParamsType
,Clazz.isAF
,Clazz.isAI
,Clazz.isAS
,Clazz.isASS
,Clazz.isAP
,Clazz.isAFloat
,Clazz.isAII
,Clazz.isAFF
,Clazz.isAFFF
,Clazz.tryToSearchAndExecute
,Clazz.getStackTrace
,Clazz.inheritArgs
,Clazz.alert
,Clazz.defineMethod
,Clazz.overrideMethod
,Clazz.declareAnonymous
//,Clazz.checkPrivateMethod
,Clazz.cloneFinals
);
